microsoft / OpenCLOn12

The OpenCL-on-D3D12 mapping layer
MIT License
104 stars 13 forks source link

Consider exposing WARP as CL_DEVICE_TYPE_CPU #19

Closed MathiasMagnus closed 1 year ago

MathiasMagnus commented 3 years ago

I have already noted to @jenatali that exposing WARP as CL_DEVICE_TYPE_GPU is counterintuitive, I even tried running a poll on Twitter to see if I'm the only one thinking like it, but my Twitter penetration seems to have betrayed me. (That one vote out of 82 views did 100% agree with me though.) If slightly more votes would be useful, I could run it by the work-group and/or another poll posted by the OpenCLAPI Twitter user.

I understand that it's exposed as a GPU because "WARP for all intents and purposes behaves as a GPU", however OpenCL developers have explicit queries to find where work enqueued to a device executes and expect the ground truth.

(ps.: can't wait for OpenCLOn12 to land 3.0 support (SPIR-V support specifically). Keep up the good work!)

jenatali commented 3 years ago

Hm, I think I agree with you here.

I'll probably add an environment variable to force one way or the other, with CPU as the default, as we like to use WARP as an isolation test to see if issues are caused by graphics drivers, and I wouldn't be surprised if some CL applications will only use GPUs.

I also agree with MCDM being ACCELERATOR, but if we're using DXGI instead of DXCore there's no way to distinguish between the two without initialization a D3D12 device, which would really slow down platform initialization, so I'll probably only make that change if we're using DXCore (which we should be on modern versions of Windows).

BlohoJo commented 4 months ago

I am a user who needs OpenCLon12 to expose WARP as a GPU device. It always crashed for me in version 22.0 and below . It is now working in version 23.0 and above, but I still can't use it because it was changed to a CPU device! :(

jenatali implied that it could be selected with an environment variable, but I'm not sure if this was done or not, or what the environment variable would be or how to set it.

Please consider allowing users to select how OpenCLon12 exposes WARP to the system: as either CPU, or GPU.