Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions tests/hlsl-intrinsic/atomic/atomic-intrinsics-64bit.slang
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=CHK):-slang -compute -dx12 -profile cs_6_6 -shaderobj -output-using-type
//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=CHK):-slang -compute -cuda -profile cs_6_6 -shaderobj -output-using-type
//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=BUF):-slang -compute -dx12 -profile cs_6_6 -shaderobj -output-using-type
//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=BUF):-slang -compute -cuda -profile cs_6_6 -shaderobj -output-using-type

// This is to support 64-bit `Interlocked*` functions defined for HLSL SM6.6
// https://microsoft.github.io/DirectX-Specs/d3d/HLSL_SM_6_6_Int64_and_Float_Atomics.html
Expand Down Expand Up @@ -334,10 +334,9 @@ void computeMain(uint groupIndex : SV_GroupIndex, int3 dispatchThreadID: SV_Disp
&& (fBuf.Load<float>(idx * 8) == float(1))
;

// BUF: 1
// BUF-NEXT: 1
// BUF-NEXT: 1
// BUF-NEXT: 1
outputBuffer[idx] = int(result);
}

// CHK: 1
// CHK-NEXT: 1
// CHK-NEXT: 1
// CHK-NEXT: 1
28 changes: 10 additions & 18 deletions tests/hlsl-intrinsic/atomic/atomic-intrinsics.slang
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
//DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-cpu -compute -shaderobj -output-using-type
//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=DX12):-slang -compute -dx12 -profile cs_6_0 -shaderobj -output-using-type -xslang -DDX12
//TEST(compute, vulkan):COMPARE_COMPUTE_EX(filecheck-buffer=VK):-vk -emit-spirv-directly -compute -shaderobj -output-using-type -render-feature hardware-device -xslang -DVK
//TEST(compute, vulkan):COMPARE_COMPUTE_EX(filecheck-buffer=VK):-vk -emit-spirv-via-glsl -compute -shaderobj -output-using-type -render-feature hardware-device -xslang -DVK -xslang -minimum-slang-optimization
//TEST(compute, vulkan):COMPARE_COMPUTE_EX(filecheck-buffer=VK):-vk -emit-spirv-via-glsl -compute -shaderobj -output-using-type -render-feature hardware-device -xslang -DVK
//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=CUDA):-cuda -compute -shaderobj -output-using-type
//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=BUF):-slang -compute -dx12 -profile cs_6_0 -shaderobj -output-using-type -xslang -DDX12
//TEST(compute, vulkan):COMPARE_COMPUTE_EX(filecheck-buffer=BUF):-vk -emit-spirv-directly -compute -shaderobj -output-using-type -render-feature hardware-device -xslang -DVK
//TEST(compute, vulkan):COMPARE_COMPUTE_EX(filecheck-buffer=BUF):-vk -emit-spirv-via-glsl -compute -shaderobj -output-using-type -render-feature hardware-device -xslang -DVK -xslang -minimum-slang-optimization
//TEST(compute, vulkan):COMPARE_COMPUTE_EX(filecheck-buffer=BUF):-vk -emit-spirv-via-glsl -compute -shaderobj -output-using-type -render-feature hardware-device -xslang -DVK
//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=BUF):-cuda -compute -shaderobj -output-using-type
//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=BUF):-metal -compute -shaderobj -output-using-type


//TEST_INPUT:ubuffer(data=[0 1 2 3], stride=4):name=uintBuffer
Expand Down Expand Up @@ -269,18 +270,9 @@ void computeMain(uint groupIndex : SV_GroupIndex, int3 dispatchThreadID: SV_Disp
val += intBuffer[idx];
val += origi;

// BUF: 184
// BUF-NEXT: 207
// BUF-NEXT: 230
// BUF-NEXT: 253
outputBuffer[idx] = val;
}

// DX12: 184
// DX12: 207
// DX12: 230
// DX12: 253
// VK: 184
// VK: 207
// VK: 230
// VK: 253
// CUDA: 184
// CUDA: 207
// CUDA: 230
// CUDA: 253
12 changes: 8 additions & 4 deletions tests/metal/8bit-vector-types.slang
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
//TEST:SIMPLE(filecheck=CHECK): -target metal -stage compute -entry computeMain
//TEST:SIMPLE(filecheck=MTL): -target metal -stage compute -entry computeMain
//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=BUF):-metal -compute -output-using-type
//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=BUF):-vk -compute -output-using-type

//TEST_INPUT:ubuffer(data=[0], stride=4, counter=1):out,name=outputBuffer
RWStructuredBuffer<uint> outputBuffer;

uint8_t2 createUChar2()
Expand All @@ -15,10 +18,11 @@ int8_t2 createChar2()
[numthreads(1, 1, 1)]
void computeMain()
{
// CHECK: uchar2
// CHECK: char2
// MTL: uchar2
// MTL: char2
uint8_t2 u8v2 = createUChar2();
int8_t2 i8v2 = createChar2();

// BUF: {{^}}4{{$}}
outputBuffer[0] = u8v2.x + i8v2.x;
}
}
29 changes: 15 additions & 14 deletions tests/metal/atomic-byteaddressbuffer.slang
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=CHK):-slang -compute -dx12 -profile cs_6_0 -shaderobj -output-using-type
//TEST(compute, vulkan):COMPARE_COMPUTE_EX(filecheck-buffer=CHK):-vk -compute -shaderobj -output-using-type
//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=CHK):-cuda -compute -shaderobj -output-using-type
//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=BUF):-slang -compute -dx12 -profile cs_6_0 -shaderobj -output-using-type
//TEST(compute, vulkan):COMPARE_COMPUTE_EX(filecheck-buffer=BUF):-vk -compute -shaderobj -output-using-type
//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=BUF):-cuda -compute -shaderobj -output-using-type
//TEST:SIMPLE(filecheck=LIB):-target metallib -entry computeMain -stage compute -DMETAL
//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=BUF):-metal -compute -shaderobj -output-using-type

//TEST_INPUT:ubuffer(data=[0 0 0 0 0]):name=uintBuffer
RWByteAddressBuffer uintBuffer;
Expand All @@ -16,42 +17,42 @@ void computeMain()
int oldValue;
//LIB: call {{.*}}.atomic.global.add.u.i32
uintBuffer.InterlockedAdd(0, 1, oldValue);
// CHK: 1
// BUF: 1
outputBuffer[0] = oldValue;

uintBuffer.InterlockedAdd(0, 1, oldValue);
// CHK: 2
// BUF: 2
outputBuffer[1] = (int)oldValue;

uintBuffer.InterlockedCompareExchange(0, 3, 4, oldValue);
// CHK: 3
// BUF: 3
outputBuffer[2] = (int)oldValue;

uintBuffer.InterlockedOr(0, 3, oldValue);
// CHK: 4
// BUF: 4
outputBuffer[3] = oldValue; // 4

uintBuffer.InterlockedExchange(0, 4, oldValue);
// CHK: 7
// BUF: 7
outputBuffer[4] = oldValue; // 7

uintBuffer.InterlockedMin(0, 3, oldValue);
// CHK: 4
// BUF: 4
outputBuffer[5] = oldValue; // 4

uintBuffer.InterlockedMax(0, 4, oldValue);
// CHK: 3
// BUF: 3
outputBuffer[6] = oldValue; // 3

uintBuffer.InterlockedAnd(0, 7, oldValue);
// CHK: 4
// BUF: 4
outputBuffer[7] = oldValue; // 4

uintBuffer.InterlockedXor(0, 7, oldValue);
// CHK: 4
// BUF: 4
outputBuffer[8] = oldValue; // 4

// CHK: 3
// BUF: 3
outputBuffer[9] = uintBuffer.Load(0);

}
}
14 changes: 7 additions & 7 deletions tests/metal/atomic-intrinsics.slang
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
//TEST:SIMPLE(filecheck=MTL):-target metal -entry computeMain -stage compute -DMETAL
//TEST:SIMPLE(filecheck=LIB):-target metallib -entry computeMain -stage compute -DMETAL
//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=CHK):-slang -compute -dx12 -profile cs_6_0 -shaderobj -output-using-type
//TEST(compute, vulkan):COMPARE_COMPUTE_EX(filecheck-buffer=CHK):-vk -compute -shaderobj -output-using-type
//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=BUF):-slang -compute -dx12 -profile cs_6_0 -shaderobj -output-using-type
//TEST(compute, vulkan):COMPARE_COMPUTE_EX(filecheck-buffer=BUF):-vk -compute -shaderobj -output-using-type
//TEST(compute, metal):COMPARE_COMPUTE_EX(filecheck-buffer=BUF):-metal -compute -shaderobj -output-using-type

//DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-cpu -compute -shaderobj -output-using-type
//DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-cuda -compute -shaderobj -output-using-type
Expand Down Expand Up @@ -343,10 +344,9 @@ void computeMain(uint groupIndex : SV_GroupIndex)
val += intBuffer[idx];
val += origi;

// BUF: 184
// BUF-NEXT: 207
// BUF-NEXT: 230
// BUF-NEXT: 253
outputBuffer[idx] = val;
}

// CHK: 184
// CHK: 207
// CHK: 230
// CHK: 253
4 changes: 4 additions & 0 deletions tests/metal/atomic-texture-buffer.slang
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
//TEST:SIMPLE(filecheck=METAL_FLOAT): -target metal -stage compute -entry computeMain -DFLOAT
//TEST:SIMPLE(filecheck=METALLIB): -target metallib -stage compute -entry computeMain

// Test framework does not support RWBuffer
// TODO: github issue #8456


// METAL_FLOAT: floating point atomic operation

//METALLIB: @computeMain
Expand Down
Loading