-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SPIR-V Instruction reordering resulting in false-positive read-write data race? #210
Comments
I was able to simplify the kernel a bit more, and I think I could narrow down the problem a bit further.
executed using
produces the following SPIR-V code:
The data-race is caused by lines 5 and 7 in the OpenCL kernel and lines 26 and 28 in the SPIR-V kernel. Do you see any way to adapt Oclgrind to honor cases like this? |
Thanks for reporting this. It certainly seems like LLVM is transforming a program which has no data races into one that does, which is unfortunate. Tracking loads to see if they are used in any significant way would likely be a large amount of effort to add to the data race detection plugin. We might be able to figure out which LLVM pass is causing this to happen and disable it. In the meantime, you can work around this by changing the optimization level. For the example you provided, using |
Many thanks for the suggestion using |
First of all, many thanks for your work on Oclgrind! It has been an invaluable tool for developing OpenCL and also CUDA kernels.
I am facing weird behavior in the following (simplified) kernel, that simply copies some values around:
executed with
oclgrind-kernel
using this simfile:I get multiple read-write data races:
However, just by looking at the kernel, I don't think there should be any data races, since all array accesses are wrapped in an
if
on the local id. Also, changing one of the following things makes the data-race warnings disappear:i_1
loop (even though it does a single iteration only and is not even used in the kernel)if
sbarrier(CLK_LOCAL_MEM_FENCE);
after the firstif
This is weird, since those changes are syntactical only, and should not change the semantics of the program.
Any help would be greatly appreciated. Many thanks in advance!
The text was updated successfully, but these errors were encountered: