-
Notifications
You must be signed in to change notification settings - Fork 199
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
basic: workaround MSVC compiler bug with post-increment operator #1939
Conversation
Disabling optimizations is not what |
Discussed in the April 16th teleconference. We’d prefer not to use “volatile” to work around this issue. Qualcomm will include more information about the failing case, e.g. which compiler is exhibiting the problem. |
This is with Visual Studio compiler VS 2022 It is probably a compiler bug. It also reproduces pretty consistently in a unit test that just calls that function from main like below:
Disabling optimizations via pragma just for that function does not help. We have precedence for using volatile to prevent optimizations (including the commented instance here https://github.com/KhronosGroup/OpenCL-CTS/blob/main/test_conformance/basic/test_local_kernel_scope.cpp#L114) but if we would prefer to, switching the variable to post-increment seems to help. Would that be acceptable?
This is breaking conformance for us, so would like to merge some manner of fix for it. |
Thanks for the detail. If it fixes your issue, switching to post-increment would be fine with me. Otherwise, I suppose you can add something like this to the test's CMakeLists.txt:
|
2401a40
to
96ef7ab
Compare
Merging as discussed in the May 21st teleconference. |
Prevent the compiler from optimizing away initialization loops