mirror of
https://github.com/KhronosGroup/SPIRV-Tools
synced 2025-01-13 09:50:06 +00:00
OpAtomicLoad, OpAtomicStore, OpAtomicExchange can operate on int or float value. Except for Vulkan environment that only operates on int value. (#2385)
To fix: #2128. Already implemented. This PR adds witness tests.
This commit is contained in:
parent
80496f42a5
commit
bf23ed887c
@ -225,7 +225,7 @@ TEST_F(ValidateAtomics, AtomicLoadKernelSuccess) {
|
|||||||
ASSERT_EQ(SPV_SUCCESS, ValidateInstructions());
|
ASSERT_EQ(SPV_SUCCESS, ValidateInstructions());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ValidateAtomics, AtomicLoadVulkanSuccess) {
|
TEST_F(ValidateAtomics, AtomicLoadInt32VulkanSuccess) {
|
||||||
const std::string body = R"(
|
const std::string body = R"(
|
||||||
%val1 = OpAtomicLoad %u32 %u32_var %device %relaxed
|
%val1 = OpAtomicLoad %u32 %u32_var %device %relaxed
|
||||||
%val2 = OpAtomicLoad %u32 %u32_var %workgroup %acquire
|
%val2 = OpAtomicLoad %u32 %u32_var %workgroup %acquire
|
||||||
@ -235,6 +235,41 @@ TEST_F(ValidateAtomics, AtomicLoadVulkanSuccess) {
|
|||||||
ASSERT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_0));
|
ASSERT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_F(ValidateAtomics, AtomicLoadFloatVulkan) {
|
||||||
|
const std::string body = R"(
|
||||||
|
%val1 = OpAtomicLoad %f32 %f32_var %device %relaxed
|
||||||
|
%val2 = OpAtomicLoad %f32 %f32_var %workgroup %acquire
|
||||||
|
)";
|
||||||
|
|
||||||
|
CompileSuccessfully(GenerateShaderCode(body), SPV_ENV_VULKAN_1_0);
|
||||||
|
ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_0));
|
||||||
|
EXPECT_THAT(getDiagnosticString(),
|
||||||
|
HasSubstr("expected Result Type to be int scalar type"));
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(ValidateAtomics, AtomicLoadInt64WithCapabilityVulkanSuccess) {
|
||||||
|
const std::string body = R"(
|
||||||
|
%val1 = OpAtomicLoad %u64 %u64_var %device %relaxed
|
||||||
|
%val2 = OpAtomicLoad %u64 %u64_var %workgroup %acquire
|
||||||
|
)";
|
||||||
|
|
||||||
|
CompileSuccessfully(GenerateShaderCode(body, "OpCapability Int64Atomics\n"),
|
||||||
|
SPV_ENV_VULKAN_1_0);
|
||||||
|
ASSERT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_0));
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(ValidateAtomics, AtomicLoadInt64WithoutCapabilityVulkan) {
|
||||||
|
const std::string body = R"(
|
||||||
|
%val1 = OpAtomicLoad %u64 %u64_var %device %relaxed
|
||||||
|
%val2 = OpAtomicLoad %u64 %u64_var %workgroup %acquire
|
||||||
|
)";
|
||||||
|
|
||||||
|
CompileSuccessfully(GenerateShaderCode(body), SPV_ENV_VULKAN_1_0);
|
||||||
|
ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_0));
|
||||||
|
EXPECT_THAT(getDiagnosticString(),
|
||||||
|
HasSubstr("64-bit atomics require the Int64Atomics capability"));
|
||||||
|
}
|
||||||
|
|
||||||
TEST_F(ValidateAtomics, AtomicStoreOpenCLFunctionPointerStorageTypeSuccess) {
|
TEST_F(ValidateAtomics, AtomicStoreOpenCLFunctionPointerStorageTypeSuccess) {
|
||||||
const std::string body = R"(
|
const std::string body = R"(
|
||||||
%f32_var_function = OpVariable %f32_ptr_function Function
|
%f32_var_function = OpVariable %f32_ptr_function Function
|
||||||
|
Loading…
Reference in New Issue
Block a user