-
Notifications
You must be signed in to change notification settings - Fork 121
Open
Labels
Description
Describe the bug
In macOS
, I noticed that the TestAtomics
unit-tests have one test failing. The error is related to the cl2Metal
conversion which implies that the Metal clang implementation probably does not support the long type for atom_add
.
This issue seems to be OS-specific. Hence, I am opening it in order to document it and provide a patch as workaround.
How To Reproduce
Build TornadoVM with OpenCL backend on macOS:
./bin/tornadovm-installer --jdk jdk21 --backend opencl
Then run:
tornado-test -V uk.ac.manchester.tornado.unittests.atomics.TestAtomics#testAtomic18_parallel_api_LongArray
WARNING: Using incubator modules: jdk.incubator.vector
UNSUPPORTED (log once): buildComputeProgram: cl2Metal failed
[ERROR] TornadoVM JIT Compiler - OpenCL Build Error Log:
program_source:21:13: error: call to 'atom_add' is ambiguous
l_8 = atom_add((volatile __global long *) ul_7, 1L);
^~~~~~~~
/System/Library/PrivateFrameworks/GPUCompiler.framework/Versions/32023/Libraries/lib/clang/32023.406/include/opencl-c.h:13111:12: note: candidate function
int __ovld atom_add(volatile __global int *p, int val);
^
/System/Library/PrivateFrameworks/GPUCompiler.framework/Versions/32023/Libraries/lib/clang/32023.406/include/opencl-c.h:13112:13: note: candidate function
uint __ovld atom_add(volatile __global uint *p, uint val);
Expected behavior
It seems that the Metal-based OpenCL implementation of the atom_add
may not support long types.
If I change at the code gen the casted type to be int
instead of long
, it works:
l_8 = atom_add((volatile __global int *) ul_7, 1L);
See the patch: ISSUE_637.patch
Computing system setup (please complete the following information):
- OS: macOS 15.3.2
- OpenCL and Driver versions: n/a
- TornadoVM commit id:
4d8be35
- TornadoVM version:
1.0.11-dev
- branch:
develop