3 ms·
The Open CL 1.2 barrier() function is threadgroup scope, same as threadgroup_barrier on Metal. OpenCL 2.0 introduced a proper barrier function (work_group_barri
by raphlinus 5y ago
The Open CL 1.2 barrier() function is threadgroup scope, same as threadgroup_barrier on Metal. OpenCL 2.0 introduced a proper barrier function (work_group_barrier), which takes a memory scope parameter, which can be memory_scope_device (all this is pretty similar to the Vulkan memory model, and at least some of the same people worked on both). I know of no way to reliably support those semantics on Metal.
Claiming OpenCL bitcode is "forward compatible" is a pretty strong claim considering that OpenCL has been deprecated for over 3 years, and the main thing you get when searching OpenCL docs on the Apple site is an exhortation to migrate to Metal. To the extent there's a forward compatibility guarantee for AIR, I'm sure it only applies to output generated by official Apple tools, and I'm pretty sure by now there's no way to get those to output a device-scope barrier.
- my123 5y ago> The Open CL 1.2 barrier() function is threadgroup scope, same as threadgroup_barrier on Metal Interestingly, the Apple driver seems to have that screwed up, with giving much stronger semantics than necessary... #define _AIR_MEM_SCOPE_WORK_GROUP 0x2 in the OpenCL header And for metal_types.h... #define _AIR_MEM_SCOPE_WORK_GROUP 0x1 #define _AIR_MEM_SCOPE_DEVICE 0x2 Which made me have even more questions, that's why I couldn't give a straight answer earlier. > OpenCL has been deprecated for over 3 years The OpenCL implementation using AIR is new, for Apple Silicon.