Skip to content

Conversation

@spencer-lunarg
Copy link
Contributor

Another check for #9626

image

@spencer-lunarg spencer-lunarg requested a review from a team as a code owner December 24, 2025 14:46
@ci-tester-lunarg
Copy link
Collaborator

CI Vulkan-ValidationLayers build queued with queue ID 608789.

@ci-tester-lunarg
Copy link
Collaborator

CI Vulkan-ValidationLayers build # 22003 running.

@ci-tester-lunarg
Copy link
Collaborator

CI Vulkan-ValidationLayers build # 22003 failed.

@ci-tester-lunarg
Copy link
Collaborator

CI Vulkan-ValidationLayers build queued with queue ID 609020.

@ci-tester-lunarg
Copy link
Collaborator

CI Vulkan-ValidationLayers build # 22005 running.

@ci-tester-lunarg
Copy link
Collaborator

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));
Copy link
Contributor

@arno-lunarg arno-lunarg Dec 29, 2025

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

Copy link
Contributor

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.

Copy link
Contributor

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");
}
Copy link
Contributor

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants