-
Notifications
You must be signed in to change notification settings - Fork 457
gpuav: Add Pow to Sanitizer #11345
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
base: main
Are you sure you want to change the base?
gpuav: Add Pow to Sanitizer #11345
Conversation
|
CI Vulkan-ValidationLayers build queued with queue ID 608789. |
|
CI Vulkan-ValidationLayers build # 22003 running. |
|
CI Vulkan-ValidationLayers build # 22003 failed. |
|
CI Vulkan-ValidationLayers build queued with queue ID 609020. |
|
CI Vulkan-ValidationLayers build # 22005 running. |
|
CI Vulkan-ValidationLayers build # 22005 passed. |
| // Casting produces artifacts in float value, need to memcpy | ||
| float x_value = 0.0f; | ||
| float y_value = 0.0f; | ||
| memcpy(&x_value, &error_record[kInstLogErrorParameterOffset_1], sizeof(float)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How do you cast so that it does not work?
x_value = *(float*)(error_record + kInstLogErrorParameterOffset_1); should work
In practice this code seems fine, it gets optimised (https://godbolt.org/z/7rde8v97G) but still
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
my 5c, since i worked a lot for memcpy cast, in case that’s the topic of discussion. it’s totally fine with all compilers, works as intrinsics for small types (does not generate code). It’s better than reinterpret cast - the latter violates aliasing rules. But if we start using c++ 20, then std::bit_cast is the way to go.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
basically without bit_cast I dont know if it is possible to write c++ that does not violate strict type aliasing rules when converting int to float.
| )glsl"; | ||
|
|
||
| SimpleZeroComputeTest(cs_source, SPV_SOURCE_GLSL, "SPIRV-Sanitizer-Pow"); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what about some slang tests?
Another check for #9626