Closed BlohoJo closed 9 months ago
This looks like a LuxMark bug, but given that, I'll probably want to work around it.
The relevant code in LuxMark is https://github.com/LuxCoreRender/LuxCore/blob/a061ca97e1aa91de5da451baae940cd7f485cbf3/src/luxrays/devices/ocldevice.cpp#L53. They switch
on the cl_device_type
retrieved from clGetDeviceInfo
for CL_DEVICE_TYPE
, but the spec for CL says:
Please see the Device Types table for supported device types and device type combinations.
Emphasis on "combinations." Per the link in the spec:
Some devices may be more than one type. For example, a CL_DEVICE_TYPE_CPU device may also be a CL_DEVICE_TYPE_GPU device, or a CL_DEVICE_TYPE_ACCELERATOR device may also be some other, more descriptive device type. CL_DEVICE_TYPE_CUSTOM devices must not be combined with any other device types.
One device in the platform should be a CL_DEVICE_TYPE_DEFAULT device. The default device should also be a more specific device type, such as CL_DEVICE_TYPE_CPU or CL_DEVICE_TYPE_GPU.
The change that likely caused issues is https://github.com/microsoft/OpenCLOn12/commit/e1e0cba8b7ba8c146842064e3f77488ffec772a7, adding in CL_DEVICE_TYPE_DEFAULT
into the first device in the list based on that spec language above.
FYI @bashbaug (just as someone who works on the CL spec and related tests) that it seems nothing is verifying this spec wording (which I guess makes sense since it only says "should") otherwise apps in the ecosystem wouldn't be taking that kind of dependency...
And yes, while I'm in this area I'll probably add an environment variable or something so that WARP can be reported as a GPU device again (FYI @MathiasMagnus)
Oh, thank you so much! :satisfied: :smiley:
There's some background discussion describing why the current spec text is phrased the way that it is in this issue here: https://github.com/KhronosGroup/OpenCL-Docs/issues/224
In short, there is a lot of code in the wild like that checks for specific CL_DEVICE_TYPE values, like that linked above, so we need to be careful not to mandate a behavior that will cause lots of shipping applications to break.
Thanks for that link, that's exactly what I was looking for. I'll chime in on that issue with my opinion.
Fixed by 989a95f42b86c80f2c30f7ba59ee4c306668b9ab (addressing the "unknown" device type) and 3486370d8b1821d39e057aed29aec359f1954d8e (adding an environment variable that can force WARP to enumerate as a GPU)
Hi!
I use MESA with OpenCLon12 / DirectX WARP.
I need it to expose DirectX WARP as a GPU device so that I can use it with some applications that only allow OpenCL GPU devices.
For some years, I was never able to get it to work... it just crashed. See here: https://github.com/pal1000/mesa-dist-win/issues/88
It started working with MESA version 23.0.0. However, due to this posted issue, OpenCLon12 was changed to expose DirectX WARP as a CPU device. So it now works, but I still can't use it! :(
In the above issue, the developer implies that they will implement an environment variable so that the user can select how OpenCLon12 exposes DirectX WARP (CPU or GPU). But I can't find any info about if this environment variable even exists, or what it is and how to set it if it does exist.
If there's currently no way to select CPU or GPU for OpenCLon12/DirectX WARP, please consider implementing one.
(By the way, the current version of MESA - 24.0.0 - exposes WARP as an unknown device. I'm not sure if this is a problem with
openclon12.dll
orclon12compiler.dll
. This means that it will not work with any application that expects to see an OpenCL CPU and/or an OpenCL GPU device type.)