Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit fa1dd94

Browse files
committedJan 17, 2025
Add tests for GLSL atomics destination validation
Attempting to use the GLSL atomic functions on destinations that are neither groupshared nor from a device buffer should fail with the following error: error 41403: cannot perform atomic operation because destination is neither groupshared nor from a device buffer.
1 parent ca15868 commit fa1dd94

8 files changed

+104
-0
lines changed
 
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
//DIAGNOSTIC_TEST:SIMPLE(filecheck=CHECK): -allow-glsl -stage compute -entry computeMain -target glsl -DTARGET_GLSL
2+
//DIAGNOSTIC_TEST:SIMPLE(filecheck=CHECK): -allow-glsl -stage compute -entry computeMain -target spirv -emit-spirv-directly -DTARGET_SPIRV
3+
#version 430
4+
5+
// CHECK: error 41403
6+
7+
uint notShared;
8+
9+
void computeMain()
10+
{
11+
// error 41403: cannot perform atomic operation because destination is neither groupshared nor from a device buffer.
12+
atomicAdd(notShared, 1u);
13+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
//DIAGNOSTIC_TEST:SIMPLE(filecheck=CHECK): -allow-glsl -stage compute -entry computeMain -target glsl -DTARGET_GLSL
2+
//DIAGNOSTIC_TEST:SIMPLE(filecheck=CHECK): -allow-glsl -stage compute -entry computeMain -target spirv -emit-spirv-directly -DTARGET_SPIRV
3+
#version 430
4+
5+
// CHECK: error 41403
6+
7+
uint notShared;
8+
9+
void computeMain()
10+
{
11+
// error 41403: cannot perform atomic operation because destination is neither groupshared nor from a device buffer.
12+
atomicAnd(notShared, 1u);
13+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
//DIAGNOSTIC_TEST:SIMPLE(filecheck=CHECK): -allow-glsl -stage compute -entry computeMain -target glsl -DTARGET_GLSL
2+
//DIAGNOSTIC_TEST:SIMPLE(filecheck=CHECK): -allow-glsl -stage compute -entry computeMain -target spirv -emit-spirv-directly -DTARGET_SPIRV
3+
#version 430
4+
5+
// CHECK: error 41403
6+
7+
uint notShared;
8+
9+
void computeMain()
10+
{
11+
// error 41403: cannot perform atomic operation because destination is neither groupshared nor from a device buffer.
12+
atomicCompSwap(notShared, 1u, 2u);
13+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
//DIAGNOSTIC_TEST:SIMPLE(filecheck=CHECK): -allow-glsl -stage compute -entry computeMain -target glsl -DTARGET_GLSL
2+
//DIAGNOSTIC_TEST:SIMPLE(filecheck=CHECK): -allow-glsl -stage compute -entry computeMain -target spirv -emit-spirv-directly -DTARGET_SPIRV
3+
#version 430
4+
5+
// CHECK: error 41403
6+
7+
uint notShared;
8+
9+
void computeMain()
10+
{
11+
// error 41403: cannot perform atomic operation because destination is neither groupshared nor from a device buffer.
12+
atomicExchange(notShared, 1u);
13+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
//DIAGNOSTIC_TEST:SIMPLE(filecheck=CHECK): -allow-glsl -stage compute -entry computeMain -target glsl -DTARGET_GLSL
2+
//DIAGNOSTIC_TEST:SIMPLE(filecheck=CHECK): -allow-glsl -stage compute -entry computeMain -target spirv -emit-spirv-directly -DTARGET_SPIRV
3+
#version 430
4+
5+
// CHECK: error 41403
6+
7+
uint notShared;
8+
9+
void computeMain()
10+
{
11+
// error 41403: cannot perform atomic operation because destination is neither groupshared nor from a device buffer.
12+
atomicMax(notShared, 1u);
13+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
//DIAGNOSTIC_TEST:SIMPLE(filecheck=CHECK): -allow-glsl -stage compute -entry computeMain -target glsl -DTARGET_GLSL
2+
//DIAGNOSTIC_TEST:SIMPLE(filecheck=CHECK): -allow-glsl -stage compute -entry computeMain -target spirv -emit-spirv-directly -DTARGET_SPIRV
3+
#version 430
4+
5+
// CHECK: error 41403
6+
7+
uint notShared;
8+
9+
void computeMain()
10+
{
11+
// error 41403: cannot perform atomic operation because destination is neither groupshared nor from a device buffer.
12+
atomicMin(notShared, 1u);
13+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
//DIAGNOSTIC_TEST:SIMPLE(filecheck=CHECK): -allow-glsl -stage compute -entry computeMain -target glsl -DTARGET_GLSL
2+
//DIAGNOSTIC_TEST:SIMPLE(filecheck=CHECK): -allow-glsl -stage compute -entry computeMain -target spirv -emit-spirv-directly -DTARGET_SPIRV
3+
#version 430
4+
5+
// CHECK: error 41403
6+
7+
uint notShared;
8+
9+
void computeMain()
10+
{
11+
// error 41403: cannot perform atomic operation because destination is neither groupshared nor from a device buffer.
12+
atomicOr(notShared, 1u);
13+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
//DIAGNOSTIC_TEST:SIMPLE(filecheck=CHECK): -allow-glsl -stage compute -entry computeMain -target glsl -DTARGET_GLSL
2+
//DIAGNOSTIC_TEST:SIMPLE(filecheck=CHECK): -allow-glsl -stage compute -entry computeMain -target spirv -emit-spirv-directly -DTARGET_SPIRV
3+
#version 430
4+
5+
// CHECK: error 41403
6+
7+
uint notShared;
8+
9+
void computeMain()
10+
{
11+
// error 41403: cannot perform atomic operation because destination is neither groupshared nor from a device buffer.
12+
atomicXor(notShared, 1u);
13+
}

0 commit comments

Comments
 (0)
Please sign in to comment.