From b4a1d618b8d850a579af2840db2df6bee312172c Mon Sep 17 00:00:00 2001 From: Jay Kwak <82421531+jkwak-work@users.noreply.github.com> Date: Wed, 2 Apr 2025 13:06:45 -0700 Subject: Enable coopvec tests with dxc backend (#6726) This PR enables existing CoopVec tests with DX12 backend. In order to use the CoopVec feature with DX12 backend, we have to use an option, "-dx12-experimental", because the current implementation of CoopVec feature in dxcompiler.dll requires "experimental feature". Note that when the "experimental feature" is enabled, slang-test becomes less stable. For that reason, we should use the option "-dx12-experimental" only when it is needed. All tests for GLSL are deleted because CoopVec support for GLSL in Slang is deprecated and no longer supported. Some of CoopVec tests are still disabled for DX12 backend because: DXC doesn't support 8bit integer types and Some of CoopVec features are not implemented in DXC backend. --- tests/cooperative-vector/CoopVec/add.slang | 30 --------- tests/cooperative-vector/CoopVec/array.slang | 25 -------- tests/cooperative-vector/CoopVec/atan.slang | 26 -------- tests/cooperative-vector/CoopVec/clamp.slang | 28 --------- tests/cooperative-vector/CoopVec/comparison.slang | 32 ---------- tests/cooperative-vector/CoopVec/conversion.slang | 28 --------- tests/cooperative-vector/CoopVec/copyFrom.slang | 22 ------- tests/cooperative-vector/CoopVec/div.slang | 30 --------- tests/cooperative-vector/CoopVec/exp.slang | 27 -------- tests/cooperative-vector/CoopVec/fill.slang | 21 ------- tests/cooperative-vector/CoopVec/fma.slang | 34 ---------- tests/cooperative-vector/CoopVec/inout.slang | 23 ------- .../CoopVec/load-store-arbitrary-array-vec.slang | 35 ----------- .../CoopVec/load-store-arbitrary-array.slang | 35 ----------- .../CoopVec/load-store-groupshared.slang | 27 -------- .../CoopVec/load-store-rwbyteaddressbuffer.slang | 22 ------- .../CoopVec/load-store-rwstructuredbuffer.slang | 30 --------- tests/cooperative-vector/CoopVec/log.slang | 26 -------- .../CoopVec/matrix-mul-bias-mut.slang | 48 -------------- .../CoopVec/matrix-mul-bias-packed-mut.slang | 47 -------------- .../CoopVec/matrix-mul-bias-packed.slang | 46 -------------- .../CoopVec/matrix-mul-bias-rw-packed.slang | 48 -------------- .../CoopVec/matrix-mul-bias-rw.slang | 47 -------------- .../matrix-mul-bias-rwbyteaddress-packed.slang | 49 --------------- .../matrix-mul-bias-structuredbuffer-packed.slang | 47 -------------- .../CoopVec/matrix-mul-bias.slang | 47 -------------- .../CoopVec/matrix-mul-byteaddress.slang | 40 ------------ .../CoopVec/matrix-mul-mut.slang | 41 ------------ .../CoopVec/matrix-mul-packed-mut.slang | 40 ------------ .../CoopVec/matrix-mul-packed.slang | 39 ------------ .../CoopVec/matrix-mul-rw-packed.slang | 41 ------------ .../cooperative-vector/CoopVec/matrix-mul-rw.slang | 40 ------------ .../CoopVec/matrix-mul-rwbyteaddress-packed.slang | 41 ------------ .../matrix-mul-structuredbuffer-packed.slang | 42 ------------- tests/cooperative-vector/CoopVec/matrix-mul.slang | 40 ------------ tests/cooperative-vector/CoopVec/max.slang | 30 --------- tests/cooperative-vector/CoopVec/min.slang | 30 --------- tests/cooperative-vector/CoopVec/mod.slang | 46 -------------- tests/cooperative-vector/CoopVec/mul.slang | 30 --------- tests/cooperative-vector/CoopVec/out.slang | 24 ------- .../CoopVec/outer-product-structuredbuffer.slang | 69 -------------------- .../cooperative-vector/CoopVec/outer-product.slang | 73 ---------------------- tests/cooperative-vector/CoopVec/parameter.slang | 22 ------- .../reduce-sum-accumulate-structuredbuffer.slang | 41 ------------ .../CoopVec/reduce-sum-accumulate.slang | 41 ------------ tests/cooperative-vector/CoopVec/return.slang | 23 ------- tests/cooperative-vector/CoopVec/scalar-mul.slang | 25 -------- tests/cooperative-vector/CoopVec/simple.slang | 24 ------- tests/cooperative-vector/CoopVec/step.slang | 30 --------- tests/cooperative-vector/CoopVec/struct.slang | 31 --------- tests/cooperative-vector/CoopVec/sub.slang | 30 --------- .../CoopVec/subscript-in-func.slang | 26 -------- tests/cooperative-vector/CoopVec/subscript.slang | 25 -------- tests/cooperative-vector/CoopVec/tanh.slang | 28 --------- tests/cooperative-vector/CoopVec/unary.slang | 25 -------- .../CoopVec/variadic-init-bad-length.slang | 14 ----- .../CoopVec/variadic-init-cast.slang | 20 ------ .../cooperative-vector/CoopVec/variadic-init.slang | 20 ------ tests/cooperative-vector/add.slang | 30 +++++++++ tests/cooperative-vector/array.slang | 25 ++++++++ tests/cooperative-vector/atan.slang | 26 ++++++++ tests/cooperative-vector/clamp.slang | 28 +++++++++ tests/cooperative-vector/comparison.slang | 32 ++++++++++ tests/cooperative-vector/conversion.slang | 28 +++++++++ tests/cooperative-vector/copyFrom.slang | 22 +++++++ tests/cooperative-vector/div.slang | 30 +++++++++ tests/cooperative-vector/exp.slang | 27 ++++++++ tests/cooperative-vector/fill.slang | 21 +++++++ tests/cooperative-vector/fma.slang | 34 ++++++++++ tests/cooperative-vector/glsl/cast.slang | 30 --------- tests/cooperative-vector/glsl/cast.slang.glsl | 23 ------- .../glsl/groupshared-sized.slang | 37 ----------- .../glsl/groupshared-sized.slang.glsl | 38 ----------- tests/cooperative-vector/glsl/load-store.slang | 13 ---- .../cooperative-vector/glsl/load-store.slang.glsl | 20 ------ tests/cooperative-vector/glsl/only-arith.slang | 18 ------ .../cooperative-vector/glsl/only-arith.slang.glsl | 16 ----- .../glsl/outer-product-accumulate.slang | 19 ------ .../glsl/outer-product-accumulate.slang.glsl | 17 ----- tests/cooperative-vector/glsl/simple.slang | 35 ----------- tests/cooperative-vector/glsl/simple.slang.glsl | 20 ------ tests/cooperative-vector/inout.slang | 23 +++++++ .../load-store-arbitrary-array-vec.slang | 35 +++++++++++ .../load-store-arbitrary-array.slang | 35 +++++++++++ .../load-store-groupshared.slang | 27 ++++++++ .../load-store-rwbyteaddressbuffer.slang | 22 +++++++ .../load-store-rwstructuredbuffer.slang | 30 +++++++++ tests/cooperative-vector/log.slang | 26 ++++++++ tests/cooperative-vector/matrix-mul-bias-mut.slang | 48 ++++++++++++++ .../matrix-mul-bias-packed-mut.slang | 47 ++++++++++++++ .../matrix-mul-bias-packed.slang | 46 ++++++++++++++ .../matrix-mul-bias-rw-packed.slang | 48 ++++++++++++++ tests/cooperative-vector/matrix-mul-bias-rw.slang | 47 ++++++++++++++ .../matrix-mul-bias-rwbyteaddress-packed.slang | 49 +++++++++++++++ .../matrix-mul-bias-structuredbuffer-packed.slang | 47 ++++++++++++++ tests/cooperative-vector/matrix-mul-bias.slang | 47 ++++++++++++++ .../matrix-mul-byteaddress.slang | 40 ++++++++++++ tests/cooperative-vector/matrix-mul-mut.slang | 41 ++++++++++++ .../cooperative-vector/matrix-mul-packed-mut.slang | 40 ++++++++++++ tests/cooperative-vector/matrix-mul-packed.slang | 39 ++++++++++++ .../cooperative-vector/matrix-mul-rw-packed.slang | 41 ++++++++++++ tests/cooperative-vector/matrix-mul-rw.slang | 40 ++++++++++++ .../matrix-mul-rwbyteaddress-packed.slang | 41 ++++++++++++ .../matrix-mul-structuredbuffer-packed.slang | 42 +++++++++++++ tests/cooperative-vector/matrix-mul.slang | 40 ++++++++++++ tests/cooperative-vector/max.slang | 30 +++++++++ tests/cooperative-vector/min.slang | 30 +++++++++ tests/cooperative-vector/mod.slang | 46 ++++++++++++++ tests/cooperative-vector/mul.slang | 30 +++++++++ tests/cooperative-vector/out.slang | 24 +++++++ .../outer-product-structuredbuffer.slang | 69 ++++++++++++++++++++ tests/cooperative-vector/outer-product.slang | 73 ++++++++++++++++++++++ tests/cooperative-vector/parameter.slang | 22 +++++++ .../reduce-sum-accumulate-structuredbuffer.slang | 41 ++++++++++++ .../cooperative-vector/reduce-sum-accumulate.slang | 41 ++++++++++++ tests/cooperative-vector/return.slang | 23 +++++++ tests/cooperative-vector/scalar-mul.slang | 25 ++++++++ tests/cooperative-vector/simple.slang | 24 +++++++ tests/cooperative-vector/step.slang | 30 +++++++++ tests/cooperative-vector/struct.slang | 31 +++++++++ tests/cooperative-vector/sub.slang | 30 +++++++++ tests/cooperative-vector/subscript-in-func.slang | 26 ++++++++ tests/cooperative-vector/subscript.slang | 25 ++++++++ tests/cooperative-vector/tanh.slang | 28 +++++++++ tests/cooperative-vector/unary.slang | 25 ++++++++ .../variadic-init-bad-length.slang | 14 +++++ tests/cooperative-vector/variadic-init-cast.slang | 20 ++++++ tests/cooperative-vector/variadic-init.slang | 20 ++++++ 128 files changed, 1971 insertions(+), 2257 deletions(-) delete mode 100644 tests/cooperative-vector/CoopVec/add.slang delete mode 100644 tests/cooperative-vector/CoopVec/array.slang delete mode 100644 tests/cooperative-vector/CoopVec/atan.slang delete mode 100644 tests/cooperative-vector/CoopVec/clamp.slang delete mode 100644 tests/cooperative-vector/CoopVec/comparison.slang delete mode 100644 tests/cooperative-vector/CoopVec/conversion.slang delete mode 100644 tests/cooperative-vector/CoopVec/copyFrom.slang delete mode 100644 tests/cooperative-vector/CoopVec/div.slang delete mode 100644 tests/cooperative-vector/CoopVec/exp.slang delete mode 100644 tests/cooperative-vector/CoopVec/fill.slang delete mode 100644 tests/cooperative-vector/CoopVec/fma.slang delete mode 100644 tests/cooperative-vector/CoopVec/inout.slang delete mode 100644 tests/cooperative-vector/CoopVec/load-store-arbitrary-array-vec.slang delete mode 100644 tests/cooperative-vector/CoopVec/load-store-arbitrary-array.slang delete mode 100644 tests/cooperative-vector/CoopVec/load-store-groupshared.slang delete mode 100644 tests/cooperative-vector/CoopVec/load-store-rwbyteaddressbuffer.slang delete mode 100644 tests/cooperative-vector/CoopVec/load-store-rwstructuredbuffer.slang delete mode 100644 tests/cooperative-vector/CoopVec/log.slang delete mode 100644 tests/cooperative-vector/CoopVec/matrix-mul-bias-mut.slang delete mode 100644 tests/cooperative-vector/CoopVec/matrix-mul-bias-packed-mut.slang delete mode 100644 tests/cooperative-vector/CoopVec/matrix-mul-bias-packed.slang delete mode 100644 tests/cooperative-vector/CoopVec/matrix-mul-bias-rw-packed.slang delete mode 100644 tests/cooperative-vector/CoopVec/matrix-mul-bias-rw.slang delete mode 100644 tests/cooperative-vector/CoopVec/matrix-mul-bias-rwbyteaddress-packed.slang delete mode 100644 tests/cooperative-vector/CoopVec/matrix-mul-bias-structuredbuffer-packed.slang delete mode 100644 tests/cooperative-vector/CoopVec/matrix-mul-bias.slang delete mode 100644 tests/cooperative-vector/CoopVec/matrix-mul-byteaddress.slang delete mode 100644 tests/cooperative-vector/CoopVec/matrix-mul-mut.slang delete mode 100644 tests/cooperative-vector/CoopVec/matrix-mul-packed-mut.slang delete mode 100644 tests/cooperative-vector/CoopVec/matrix-mul-packed.slang delete mode 100644 tests/cooperative-vector/CoopVec/matrix-mul-rw-packed.slang delete mode 100644 tests/cooperative-vector/CoopVec/matrix-mul-rw.slang delete mode 100644 tests/cooperative-vector/CoopVec/matrix-mul-rwbyteaddress-packed.slang delete mode 100644 tests/cooperative-vector/CoopVec/matrix-mul-structuredbuffer-packed.slang delete mode 100644 tests/cooperative-vector/CoopVec/matrix-mul.slang delete mode 100644 tests/cooperative-vector/CoopVec/max.slang delete mode 100644 tests/cooperative-vector/CoopVec/min.slang delete mode 100644 tests/cooperative-vector/CoopVec/mod.slang delete mode 100644 tests/cooperative-vector/CoopVec/mul.slang delete mode 100644 tests/cooperative-vector/CoopVec/out.slang delete mode 100644 tests/cooperative-vector/CoopVec/outer-product-structuredbuffer.slang delete mode 100644 tests/cooperative-vector/CoopVec/outer-product.slang delete mode 100644 tests/cooperative-vector/CoopVec/parameter.slang delete mode 100644 tests/cooperative-vector/CoopVec/reduce-sum-accumulate-structuredbuffer.slang delete mode 100644 tests/cooperative-vector/CoopVec/reduce-sum-accumulate.slang delete mode 100644 tests/cooperative-vector/CoopVec/return.slang delete mode 100644 tests/cooperative-vector/CoopVec/scalar-mul.slang delete mode 100644 tests/cooperative-vector/CoopVec/simple.slang delete mode 100644 tests/cooperative-vector/CoopVec/step.slang delete mode 100644 tests/cooperative-vector/CoopVec/struct.slang delete mode 100644 tests/cooperative-vector/CoopVec/sub.slang delete mode 100644 tests/cooperative-vector/CoopVec/subscript-in-func.slang delete mode 100644 tests/cooperative-vector/CoopVec/subscript.slang delete mode 100644 tests/cooperative-vector/CoopVec/tanh.slang delete mode 100644 tests/cooperative-vector/CoopVec/unary.slang delete mode 100644 tests/cooperative-vector/CoopVec/variadic-init-bad-length.slang delete mode 100644 tests/cooperative-vector/CoopVec/variadic-init-cast.slang delete mode 100644 tests/cooperative-vector/CoopVec/variadic-init.slang create mode 100644 tests/cooperative-vector/add.slang create mode 100644 tests/cooperative-vector/array.slang create mode 100644 tests/cooperative-vector/atan.slang create mode 100644 tests/cooperative-vector/clamp.slang create mode 100644 tests/cooperative-vector/comparison.slang create mode 100644 tests/cooperative-vector/conversion.slang create mode 100644 tests/cooperative-vector/copyFrom.slang create mode 100644 tests/cooperative-vector/div.slang create mode 100644 tests/cooperative-vector/exp.slang create mode 100644 tests/cooperative-vector/fill.slang create mode 100644 tests/cooperative-vector/fma.slang delete mode 100644 tests/cooperative-vector/glsl/cast.slang delete mode 100644 tests/cooperative-vector/glsl/cast.slang.glsl delete mode 100644 tests/cooperative-vector/glsl/groupshared-sized.slang delete mode 100644 tests/cooperative-vector/glsl/groupshared-sized.slang.glsl delete mode 100644 tests/cooperative-vector/glsl/load-store.slang delete mode 100644 tests/cooperative-vector/glsl/load-store.slang.glsl delete mode 100644 tests/cooperative-vector/glsl/only-arith.slang delete mode 100644 tests/cooperative-vector/glsl/only-arith.slang.glsl delete mode 100644 tests/cooperative-vector/glsl/outer-product-accumulate.slang delete mode 100644 tests/cooperative-vector/glsl/outer-product-accumulate.slang.glsl delete mode 100644 tests/cooperative-vector/glsl/simple.slang delete mode 100644 tests/cooperative-vector/glsl/simple.slang.glsl create mode 100644 tests/cooperative-vector/inout.slang create mode 100644 tests/cooperative-vector/load-store-arbitrary-array-vec.slang create mode 100644 tests/cooperative-vector/load-store-arbitrary-array.slang create mode 100644 tests/cooperative-vector/load-store-groupshared.slang create mode 100644 tests/cooperative-vector/load-store-rwbyteaddressbuffer.slang create mode 100644 tests/cooperative-vector/load-store-rwstructuredbuffer.slang create mode 100644 tests/cooperative-vector/log.slang create mode 100644 tests/cooperative-vector/matrix-mul-bias-mut.slang create mode 100644 tests/cooperative-vector/matrix-mul-bias-packed-mut.slang create mode 100644 tests/cooperative-vector/matrix-mul-bias-packed.slang create mode 100644 tests/cooperative-vector/matrix-mul-bias-rw-packed.slang create mode 100644 tests/cooperative-vector/matrix-mul-bias-rw.slang create mode 100644 tests/cooperative-vector/matrix-mul-bias-rwbyteaddress-packed.slang create mode 100644 tests/cooperative-vector/matrix-mul-bias-structuredbuffer-packed.slang create mode 100644 tests/cooperative-vector/matrix-mul-bias.slang create mode 100644 tests/cooperative-vector/matrix-mul-byteaddress.slang create mode 100644 tests/cooperative-vector/matrix-mul-mut.slang create mode 100644 tests/cooperative-vector/matrix-mul-packed-mut.slang create mode 100644 tests/cooperative-vector/matrix-mul-packed.slang create mode 100644 tests/cooperative-vector/matrix-mul-rw-packed.slang create mode 100644 tests/cooperative-vector/matrix-mul-rw.slang create mode 100644 tests/cooperative-vector/matrix-mul-rwbyteaddress-packed.slang create mode 100644 tests/cooperative-vector/matrix-mul-structuredbuffer-packed.slang create mode 100644 tests/cooperative-vector/matrix-mul.slang create mode 100644 tests/cooperative-vector/max.slang create mode 100644 tests/cooperative-vector/min.slang create mode 100644 tests/cooperative-vector/mod.slang create mode 100644 tests/cooperative-vector/mul.slang create mode 100644 tests/cooperative-vector/out.slang create mode 100644 tests/cooperative-vector/outer-product-structuredbuffer.slang create mode 100644 tests/cooperative-vector/outer-product.slang create mode 100644 tests/cooperative-vector/parameter.slang create mode 100644 tests/cooperative-vector/reduce-sum-accumulate-structuredbuffer.slang create mode 100644 tests/cooperative-vector/reduce-sum-accumulate.slang create mode 100644 tests/cooperative-vector/return.slang create mode 100644 tests/cooperative-vector/scalar-mul.slang create mode 100644 tests/cooperative-vector/simple.slang create mode 100644 tests/cooperative-vector/step.slang create mode 100644 tests/cooperative-vector/struct.slang create mode 100644 tests/cooperative-vector/sub.slang create mode 100644 tests/cooperative-vector/subscript-in-func.slang create mode 100644 tests/cooperative-vector/subscript.slang create mode 100644 tests/cooperative-vector/tanh.slang create mode 100644 tests/cooperative-vector/unary.slang create mode 100644 tests/cooperative-vector/variadic-init-bad-length.slang create mode 100644 tests/cooperative-vector/variadic-init-cast.slang create mode 100644 tests/cooperative-vector/variadic-init.slang (limited to 'tests') diff --git a/tests/cooperative-vector/CoopVec/add.slang b/tests/cooperative-vector/CoopVec/add.slang deleted file mode 100644 index e25cd5449..000000000 --- a/tests/cooperative-vector/CoopVec/add.slang +++ /dev/null @@ -1,30 +0,0 @@ -//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -xslang -skip-spirv-validation -//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. -//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type - -// CHECK: type: int32_t -// CHECK-NEXT: 1 -// CHECK-NEXT: 3 -// CHECK-NEXT: 5 -// CHECK-NEXT: 7 - -//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer -RWStructuredBuffer outputBuffer; - -//TEST_INPUT:ubuffer(data=[1 2 3 4], stride=4),name=input1 -ByteAddressBuffer input1; - -//TEST_INPUT:ubuffer(data=[0 1 2 3], stride=4),name=input2 -ByteAddressBuffer input2; - -[numthreads(1, 1, 1)] -void computeMain() -{ - CoopVec vec1 = coopVecLoad<4, int32_t>(input1); - CoopVec vec2 = coopVecLoad<4, int32_t>(input2); - - let result = vec1 + vec2; - - for(int i = 0; i < result.getCount(); ++i) - outputBuffer[i] = result[i]; -} diff --git a/tests/cooperative-vector/CoopVec/array.slang b/tests/cooperative-vector/CoopVec/array.slang deleted file mode 100644 index b63ff2f91..000000000 --- a/tests/cooperative-vector/CoopVec/array.slang +++ /dev/null @@ -1,25 +0,0 @@ -//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -xslang -skip-spirv-validation - -// CHECK: type: float -// CHECK-NEXT: 1.000000 -// CHECK-NEXT: 2.000000 -// CHECK-NEXT: 3.000000 -// CHECK-NEXT: 4.000000 -// CHECK-NEXT: 5.000000 -// CHECK-NEXT: 6.000000 -// CHECK-NEXT: 7.000000 -// CHECK-NEXT: 8.000000 - -//TEST_INPUT:ubuffer(data=[0 0 0 0 0 0 0 0], stride=4):out,name=outputBuffer -RWStructuredBuffer outputBuffer; - -[numthreads(1, 1, 1)] -void computeMain() -{ - CoopVec vecArray[2]; - vecArray[0] = CoopVec(1.0, 2.0, 3.0, 4.0); - vecArray[1] = CoopVec(5.0, 6.0, 7.0, 8.0); - - vecArray[0].store(outputBuffer, 0); - vecArray[1].store(outputBuffer, 16); -} diff --git a/tests/cooperative-vector/CoopVec/atan.slang b/tests/cooperative-vector/CoopVec/atan.slang deleted file mode 100644 index 37c0d7233..000000000 --- a/tests/cooperative-vector/CoopVec/atan.slang +++ /dev/null @@ -1,26 +0,0 @@ -//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -xslang -skip-spirv-validation -//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. -//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type - -// CHECK: type: float -// CHECK-NEXT: 0.785398 -// CHECK-NEXT: 1.107149 -// CHECK-NEXT: 1.249046 -// CHECK-NEXT: 1.325818 - -//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer -RWStructuredBuffer outputBuffer; - -//TEST_INPUT:ubuffer(data=[1.0 2.0 3.0 4.0], stride=4),name=input -ByteAddressBuffer input; - -[numthreads(1, 1, 1)] -void computeMain() -{ - CoopVec vec = coopVecLoad<4, float>(input); - - CoopVec result = atan(vec); - - for(int i = 0; i < result.getCount(); ++i) - outputBuffer[i] = result[i];; -} diff --git a/tests/cooperative-vector/CoopVec/clamp.slang b/tests/cooperative-vector/CoopVec/clamp.slang deleted file mode 100644 index 648223907..000000000 --- a/tests/cooperative-vector/CoopVec/clamp.slang +++ /dev/null @@ -1,28 +0,0 @@ -//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -xslang -skip-spirv-validation -//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. -//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type - -// CHECK: type: float -// CHECK-NEXT: 2.0 -// CHECK-NEXT: 2.0 -// CHECK-NEXT: 3.0 -// CHECK-NEXT: 4.0 - -//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer -RWStructuredBuffer outputBuffer; - -//TEST_INPUT:ubuffer(data=[1.0 2.0 3.0 5.0], stride=4),name=input -ByteAddressBuffer input; - -[numthreads(1, 1, 1)] -void computeMain() -{ - CoopVec vec = coopVecLoad<4, float>(input); - CoopVec minVal = CoopVec(2.0); - CoopVec maxVal = CoopVec(4.0); - - CoopVec result = clamp(vec, minVal, maxVal); - - for(int i = 0; i < result.getCount(); ++i) - outputBuffer[i] = result[i];; -} diff --git a/tests/cooperative-vector/CoopVec/comparison.slang b/tests/cooperative-vector/CoopVec/comparison.slang deleted file mode 100644 index 44f60c344..000000000 --- a/tests/cooperative-vector/CoopVec/comparison.slang +++ /dev/null @@ -1,32 +0,0 @@ -//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -xslang -skip-spirv-validation -//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. -//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type - -// CHECK: type: uint32_t -// CHECK-NEXT: 0 -// CHECK-NEXT: 1 -// CHECK-NEXT: 1 - -//TEST_INPUT:ubuffer(data=[1.0 2.0 3.0 4.0], stride=4),name=input1 -ByteAddressBuffer input1; - -//TEST_INPUT:ubuffer(data=[1.0 3.0 2.0 4.0], stride=4),name=input2 -ByteAddressBuffer input2; - -//TEST_INPUT:ubuffer(data=[0 0 0], stride=4):out,name=outputBuffer -RWStructuredBuffer outputBuffer; - -[numthreads(1, 1, 1)] -void computeMain() -{ - CoopVec vec1 = coopVecLoad<4, float>(input1); - CoopVec vec2 = coopVecLoad<4, float>(input2); - - uint32_t equals = vec1 == vec2 ? 1 : 0; - uint32_t lessThan = vec1 < vec2 ? 1 : 0; - uint32_t lessThanOrEquals = vec1 <= vec2 ? 1 : 0; - - outputBuffer[0] = equals; - outputBuffer[1] = lessThan; - outputBuffer[2] = lessThanOrEquals; -} diff --git a/tests/cooperative-vector/CoopVec/conversion.slang b/tests/cooperative-vector/CoopVec/conversion.slang deleted file mode 100644 index a9436b31e..000000000 --- a/tests/cooperative-vector/CoopVec/conversion.slang +++ /dev/null @@ -1,28 +0,0 @@ -//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -xslang -skip-spirv-validation -//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. -//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type - -// CHECK: type: float -// CHECK-NEXT: 2.000000 -// CHECK-NEXT: 4.000000 -// CHECK-NEXT: 6.000000 -// CHECK-NEXT: 8.000000 - -//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer -RWStructuredBuffer outputBuffer; - -//TEST_INPUT:ubuffer(data=[1 2 3 4], stride=4),name=input -ByteAddressBuffer input; - -[numthreads(1, 1, 1)] -void computeMain() -{ - let intVec = coopVecLoad<4, int>(input); - let floatVec = CoopVec(intVec); - let uintVec = CoopVec(intVec); - let floatVec2 = CoopVec(uintVec); - - let result = floatVec + floatVec2; - for(int i = 0; i < result.getCount(); ++i) - outputBuffer[i] = result[i]; -} diff --git a/tests/cooperative-vector/CoopVec/copyFrom.slang b/tests/cooperative-vector/CoopVec/copyFrom.slang deleted file mode 100644 index da6e77d1f..000000000 --- a/tests/cooperative-vector/CoopVec/copyFrom.slang +++ /dev/null @@ -1,22 +0,0 @@ -//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -emit-spirv-directly -//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. -//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type - -// CHECK: type: int32_t -// CHECK-NEXT: 1 -// CHECK-NEXT: 2 -// CHECK-NEXT: 3 -// CHECK-NEXT: 4 - -//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer -RWStructuredBuffer outputBuffer; - -[numthreads(1, 1, 1)] -void computeMain() -{ - let v = CoopVec(1,2,3,4); - var result : CoopVec; - result.copyFrom(v); - for(int i = 0; i < result.getCount(); ++i) - outputBuffer[i] = result[i];; -} diff --git a/tests/cooperative-vector/CoopVec/div.slang b/tests/cooperative-vector/CoopVec/div.slang deleted file mode 100644 index 43773c7bc..000000000 --- a/tests/cooperative-vector/CoopVec/div.slang +++ /dev/null @@ -1,30 +0,0 @@ -//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -xslang -skip-spirv-validation -//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. -//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type - -// CHECK: type: int32_t -// CHECK-NEXT: 2 -// CHECK-NEXT: 1 -// CHECK-NEXT: 1 -// CHECK-NEXT: 0 - -//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer -RWStructuredBuffer outputBuffer; - -//TEST_INPUT:ubuffer(data=[4 3 5 2], stride=4),name=input1 -ByteAddressBuffer input1; - -//TEST_INPUT:ubuffer(data=[2 3 4 5], stride=4),name=input2 -ByteAddressBuffer input2; - -[numthreads(1, 1, 1)] -void computeMain() -{ - CoopVec vec1 = coopVecLoad<4, int32_t>(input1); - CoopVec vec2 = coopVecLoad<4, int32_t>(input2); - - CoopVec result = vec1 / vec2; - - for(int i = 0; i < result.getCount(); ++i) - outputBuffer[i] = result[i];; -} diff --git a/tests/cooperative-vector/CoopVec/exp.slang b/tests/cooperative-vector/CoopVec/exp.slang deleted file mode 100644 index eda6e1c3e..000000000 --- a/tests/cooperative-vector/CoopVec/exp.slang +++ /dev/null @@ -1,27 +0,0 @@ -//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -xslang -skip-spirv-validation -//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. -//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type - -// CHECK: type: float -// CHECK-NEXT: 2.7182 -// CHECK-NEXT: 7.3890 -// CHECK-NEXT: 20.0855 -// CHECK-NEXT: 54.5981 - - -//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer -RWStructuredBuffer outputBuffer; - -//TEST_INPUT:ubuffer(data=[1.0 2.0 3.0 4.0], stride=4),name=input -ByteAddressBuffer input; - -[numthreads(1, 1, 1)] -void computeMain() -{ - CoopVec vec = coopVecLoad<4, float>(input); - - CoopVec result = exp(vec); - - for(int i = 0; i < result.getCount(); ++i) - outputBuffer[i] = result[i];; -} diff --git a/tests/cooperative-vector/CoopVec/fill.slang b/tests/cooperative-vector/CoopVec/fill.slang deleted file mode 100644 index 6cd37ba7d..000000000 --- a/tests/cooperative-vector/CoopVec/fill.slang +++ /dev/null @@ -1,21 +0,0 @@ -//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -emit-spirv-directly -//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. -//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type - -// CHECK: type: int32_t -// CHECK-NEXT: 10 -// CHECK-NEXT: 10 -// CHECK-NEXT: 10 -// CHECK-NEXT: 10 - -//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer -RWStructuredBuffer outputBuffer; - -[numthreads(1, 1, 1)] -void computeMain() -{ - var result : CoopVec; - result.fill(10); - for(int i = 0; i < result.getCount(); ++i) - outputBuffer[i] = result[i];; -} diff --git a/tests/cooperative-vector/CoopVec/fma.slang b/tests/cooperative-vector/CoopVec/fma.slang deleted file mode 100644 index 9a5c5311d..000000000 --- a/tests/cooperative-vector/CoopVec/fma.slang +++ /dev/null @@ -1,34 +0,0 @@ -//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -xslang -skip-spirv-validation -//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. -//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type - -// CHECK: type: float -// CHECK-NEXT: 5.000000 -// CHECK-NEXT: 10.000000 -// CHECK-NEXT: 17.000000 -// CHECK-NEXT: 26.000000 - -//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer -RWStructuredBuffer outputBuffer; - -//TEST_INPUT:ubuffer(data=[1.0 2.0 3.0 4.0], stride=4),name=input1 -ByteAddressBuffer input1; - -//TEST_INPUT:ubuffer(data=[2.0 3.0 4.0 5.0], stride=4),name=input2 -ByteAddressBuffer input2; - -//TEST_INPUT:ubuffer(data=[3.0 4.0 5.0 6.0], stride=4),name=input3 -ByteAddressBuffer input3; - -[numthreads(1, 1, 1)] -void computeMain() -{ - CoopVec vec1 = coopVecLoad<4, float>(input1); - CoopVec vec2 = coopVecLoad<4, float>(input2); - CoopVec vec3 = coopVecLoad<4, float>(input3); - - CoopVec result = fma(vec1, vec2, vec3); - - for(int i = 0; i < result.getCount(); ++i) - outputBuffer[i] = result[i];; -} diff --git a/tests/cooperative-vector/CoopVec/inout.slang b/tests/cooperative-vector/CoopVec/inout.slang deleted file mode 100644 index 8181a2019..000000000 --- a/tests/cooperative-vector/CoopVec/inout.slang +++ /dev/null @@ -1,23 +0,0 @@ -//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -xslang -skip-spirv-validation - -// CHECK: type: float -// CHECK-NEXT: 2.000000 -// CHECK-NEXT: 4.000000 -// CHECK-NEXT: 6.000000 -// CHECK-NEXT: 8.000000 - -//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer -RWStructuredBuffer outputBuffer; - -void doubleCoopVec(inout CoopVec vec) -{ - vec = vec * 2.0; -} - -[numthreads(1, 1, 1)] -void computeMain() -{ - var vec = CoopVec(1.0, 2.0, 3.0, 4.0); - doubleCoopVec(vec); - vec.store(outputBuffer, 0); -} diff --git a/tests/cooperative-vector/CoopVec/load-store-arbitrary-array-vec.slang b/tests/cooperative-vector/CoopVec/load-store-arbitrary-array-vec.slang deleted file mode 100644 index f577ae5f3..000000000 --- a/tests/cooperative-vector/CoopVec/load-store-arbitrary-array-vec.slang +++ /dev/null @@ -1,35 +0,0 @@ -//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -xslang -skip-spirv-validation - -// CHECK: 1 -// CHECK-NEXT: 2 -// CHECK-NEXT: 3 -// CHECK-NEXT: 4 -// CHECK-NEXT: 5 -// CHECK-NEXT: 6 -// CHECK-NEXT: 7 -// CHECK-NEXT: 8 -// CHECK-NEXT: 9 -// CHECK-NEXT: A -// CHECK-NEXT: B -// CHECK-NEXT: C -// CHECK-NEXT: D -// CHECK-NEXT: E -// CHECK-NEXT: F - -//TEST_INPUT:ubuffer(data=[1 2 3 4 5 6 7 8 9 10 11 12 13 14 15]):name=input -RWByteAddressBuffer input; - -//TEST_INPUT:ubuffer(data=[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]):out,name=outputBuffer -RWStructuredBuffer outputBuffer; - -groupshared float3[5] temp; - -[numthreads(1, 1, 1)] -void computeMain() -{ - let vec = coopVecLoad<15, uint32_t>(input); - vec.storeAny(temp); - let result = CoopVec.loadAny(temp); - for(int i = 0; i < result.getCount(); ++i) - outputBuffer[i] = result[i];; -} diff --git a/tests/cooperative-vector/CoopVec/load-store-arbitrary-array.slang b/tests/cooperative-vector/CoopVec/load-store-arbitrary-array.slang deleted file mode 100644 index d8353d1c1..000000000 --- a/tests/cooperative-vector/CoopVec/load-store-arbitrary-array.slang +++ /dev/null @@ -1,35 +0,0 @@ -//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -xslang -skip-spirv-validation - -// CHECK: 1 -// CHECK-NEXT: 2 -// CHECK-NEXT: 3 -// CHECK-NEXT: 4 -// CHECK-NEXT: 5 -// CHECK-NEXT: 6 -// CHECK-NEXT: 7 -// CHECK-NEXT: 8 -// CHECK-NEXT: 9 -// CHECK-NEXT: A -// CHECK-NEXT: B -// CHECK-NEXT: C -// CHECK-NEXT: D -// CHECK-NEXT: E -// CHECK-NEXT: F - -//TEST_INPUT:ubuffer(data=[1 2 3 4 5 6 7 8 9 10 11 12 13 14 15]):name=input -RWByteAddressBuffer input; - -//TEST_INPUT:ubuffer(data=[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]):out,name=outputBuffer -RWStructuredBuffer outputBuffer; - -groupshared float[15] temp; - -[numthreads(1, 1, 1)] -void computeMain() -{ - let vec = coopVecLoad<15, uint32_t>(input); - vec.storeAny(temp); - let result = CoopVec.loadAny(temp); - for(int i = 0; i < result.getCount(); ++i) - outputBuffer[i] = result[i]; -} diff --git a/tests/cooperative-vector/CoopVec/load-store-groupshared.slang b/tests/cooperative-vector/CoopVec/load-store-groupshared.slang deleted file mode 100644 index 331c12735..000000000 --- a/tests/cooperative-vector/CoopVec/load-store-groupshared.slang +++ /dev/null @@ -1,27 +0,0 @@ -//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -xslang -skip-spirv-validation -//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. -//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type - -// CHECK: 1 -// CHECK-NEXT: 2 -// CHECK-NEXT: 3 -// CHECK-NEXT: 4 -// CHECK-NEXT: 5 - -//TEST_INPUT:ubuffer(data=[1 2 3 4 5]):name=input -RWByteAddressBuffer input; - -//TEST_INPUT:ubuffer(data=[0 0 0 0 0]):out,name=outputBuffer -RWStructuredBuffer outputBuffer; - -groupshared uint32_t[5] temp; - -[numthreads(1, 1, 1)] -void computeMain() -{ - let vec = coopVecLoad<5, uint32_t>(input); - vec.store(temp); - let result = coopVecLoadGroupshared<5>(temp); - for(int i = 0; i < result.getCount(); ++i) - outputBuffer[i] = result[i];; -} diff --git a/tests/cooperative-vector/CoopVec/load-store-rwbyteaddressbuffer.slang b/tests/cooperative-vector/CoopVec/load-store-rwbyteaddressbuffer.slang deleted file mode 100644 index 88fed1cd6..000000000 --- a/tests/cooperative-vector/CoopVec/load-store-rwbyteaddressbuffer.slang +++ /dev/null @@ -1,22 +0,0 @@ -//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -xslang -skip-spirv-validation -//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. -//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu - -// CHECK: 1 -// CHECK-NEXT: 2 -// CHECK-NEXT: 3 -// CHECK-NEXT: 4 -// CHECK-NEXT: 5 - -//TEST_INPUT:ubuffer(data=[1 2 3 4 5]):name=input -RWByteAddressBuffer input; - -//TEST_INPUT:ubuffer(data=[0 0 0 0 0]):out,name=outputBuffer -RWByteAddressBuffer outputBuffer; - -[numthreads(1, 1, 1)] -void computeMain() -{ - let result = coopVecLoad<5, uint32_t>(input); - result.store(outputBuffer); -} diff --git a/tests/cooperative-vector/CoopVec/load-store-rwstructuredbuffer.slang b/tests/cooperative-vector/CoopVec/load-store-rwstructuredbuffer.slang deleted file mode 100644 index 4b143f5f8..000000000 --- a/tests/cooperative-vector/CoopVec/load-store-rwstructuredbuffer.slang +++ /dev/null @@ -1,30 +0,0 @@ -//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -xslang -skip-spirv-validation -//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type - -// HLSL doesn't support structured buffers for CoopVec -//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. - -// CHECK: type: int32_t -// CHECK-NEXT: 5 -// CHECK-NEXT: 6 -// CHECK-NEXT: 7 -// CHECK-NEXT: 8 -// CHECK-NEXT: 1 -// CHECK-NEXT: 2 -// CHECK-NEXT: 3 -// CHECK-NEXT: 4 - -//TEST_INPUT:ubuffer(data=[1 2 3 4 5 6 7 8], stride=4),name=buf -RWStructuredBuffer inputBuffer; - -//TEST_INPUT:ubuffer(data=[0 0 0 0 0 0 0 0], stride=4):out,name=outputBuffer -RWStructuredBuffer outputBuffer; - -[numthreads(1, 1, 1)] -void computeMain() -{ - let a = coopVecLoad<4>(inputBuffer, 0); - let b = coopVecLoad<4>(inputBuffer, 4*4); - b.store(outputBuffer, 0); - a.store(outputBuffer, 4*4); -} diff --git a/tests/cooperative-vector/CoopVec/log.slang b/tests/cooperative-vector/CoopVec/log.slang deleted file mode 100644 index c68696706..000000000 --- a/tests/cooperative-vector/CoopVec/log.slang +++ /dev/null @@ -1,26 +0,0 @@ -//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -xslang -skip-spirv-validation -//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. -//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type - -// CHECK: type: float -// CHECK-NEXT: 0.000000 -// CHECK-NEXT: 0.693147 -// CHECK-NEXT: 1.098612 -// CHECK-NEXT: 1.386294 - -//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer -RWStructuredBuffer outputBuffer; - -//TEST_INPUT:ubuffer(data=[1.0 2.0 3.0 4.0], stride=4),name=input -ByteAddressBuffer input; - -[numthreads(1, 1, 1)] -void computeMain() -{ - CoopVec vec = coopVecLoad<4, float>(input); - - CoopVec result = log(vec); - - for(int i = 0; i < result.getCount(); ++i) - outputBuffer[i] = result[i];; -} diff --git a/tests/cooperative-vector/CoopVec/matrix-mul-bias-mut.slang b/tests/cooperative-vector/CoopVec/matrix-mul-bias-mut.slang deleted file mode 100644 index 798162c8a..000000000 --- a/tests/cooperative-vector/CoopVec/matrix-mul-bias-mut.slang +++ /dev/null @@ -1,48 +0,0 @@ -//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -xslang -skip-spirv-validation -//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type - -// Disabled because HLSL doesn't support int8 -//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. - -// CHECK: type: int32_t -// CHECK-NEXT: 8035 -// CHECK-NEXT: 8076 -// CHECK-NEXT: 8117 -// CHECK-NEXT: 8158 - -//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer -RWStructuredBuffer outputBuffer; - -//TEST_INPUT:ubuffer(data=[67305985], stride=4),name=input -//[1 2 3 4] -ByteAddressBuffer input; - -//TEST_INPUT:ubuffer(data=[67305985 134678021 202050057 269422093], stride=4),name=matrix -//[1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16] -ByteAddressBuffer matrix; - -//TEST_INPUT:ubuffer(data=[5 6 7 8], stride=4),name=bias -ByteAddressBuffer bias; - -[numthreads(1, 1, 1)] -void computeMain() -{ - CoopVec vec = coopVecLoad<4, int8_t>(input); - var result = CoopVec(8000); - result.matMulAddAccum( - vec, - CoopVecComponentType::SignedInt8, - matrix, - 0, - CoopVecComponentType::SignedInt8, - bias, - 0, - CoopVecComponentType::SignedInt32, - CoopVecMatrixLayout::RowMajor, - false, - 4 - ); - - for(int i = 0; i < result.getCount(); ++i) - outputBuffer[i] = result[i];; -} diff --git a/tests/cooperative-vector/CoopVec/matrix-mul-bias-packed-mut.slang b/tests/cooperative-vector/CoopVec/matrix-mul-bias-packed-mut.slang deleted file mode 100644 index 307c4473c..000000000 --- a/tests/cooperative-vector/CoopVec/matrix-mul-bias-packed-mut.slang +++ /dev/null @@ -1,47 +0,0 @@ -//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -xslang -skip-spirv-validation -//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. -//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type - -// CHECK: type: int32_t -// CHECK-NEXT: 8035 -// CHECK-NEXT: 8076 -// CHECK-NEXT: 8117 -// CHECK-NEXT: 8158 - -//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer -RWStructuredBuffer outputBuffer; - -//TEST_INPUT:ubuffer(data=[67305985], stride=4),name=input -//[1 2 3 4] -ByteAddressBuffer input; - -//TEST_INPUT:ubuffer(data=[67305985 134678021 202050057 269422093], stride=4),name=matrix -//[1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16] -ByteAddressBuffer matrix; - -//TEST_INPUT:ubuffer(data=[5 6 7 8], stride=4),name=bias -ByteAddressBuffer bias; - -[numthreads(1, 1, 1)] -void computeMain() -{ - let vec = coopVecLoad<1, int32_t>(input); - var result = CoopVec(8000); - result.matMulAddAccumPacked( - vec, - CoopVecComponentType::SignedInt8Packed, - 4, - matrix, - 0, - CoopVecComponentType::SignedInt8, - bias, - 0, - CoopVecComponentType::SignedInt32, - CoopVecMatrixLayout::RowMajor, - false, - 4 - ); - - for(int i = 0; i < result.getCount(); ++i) - outputBuffer[i] = result[i];; -} diff --git a/tests/cooperative-vector/CoopVec/matrix-mul-bias-packed.slang b/tests/cooperative-vector/CoopVec/matrix-mul-bias-packed.slang deleted file mode 100644 index 200fa9163..000000000 --- a/tests/cooperative-vector/CoopVec/matrix-mul-bias-packed.slang +++ /dev/null @@ -1,46 +0,0 @@ -//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -xslang -skip-spirv-validation -//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. -//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type - -// CHECK: type: int32_t -// CHECK-NEXT: 35 -// CHECK-NEXT: 76 -// CHECK-NEXT: 117 -// CHECK-NEXT: 158 - -//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer -RWStructuredBuffer outputBuffer; - -//TEST_INPUT:ubuffer(data=[67305985], stride=4),name=input -//[1 2 3 4] -ByteAddressBuffer input; - -//TEST_INPUT:ubuffer(data=[67305985 134678021 202050057 269422093], stride=4),name=matrix -//[1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16] -ByteAddressBuffer matrix; - -//TEST_INPUT:ubuffer(data=[5 6 7 8], stride=4),name=bias -ByteAddressBuffer bias; - -[numthreads(1, 1, 1)] -void computeMain() -{ - let vec = coopVecLoad<1, int32_t>(input); - let result = coopVecMatMulAddPacked( - vec, - CoopVecComponentType::SignedInt8Packed, - 4, - matrix, - 0, - CoopVecComponentType::SignedInt8, - bias, - 0, - CoopVecComponentType::SignedInt32, - CoopVecMatrixLayout::RowMajor, - false, - 4 - ); - - for(int i = 0; i < result.getCount(); ++i) - outputBuffer[i] = result[i];; -} diff --git a/tests/cooperative-vector/CoopVec/matrix-mul-bias-rw-packed.slang b/tests/cooperative-vector/CoopVec/matrix-mul-bias-rw-packed.slang deleted file mode 100644 index 0cd3fa216..000000000 --- a/tests/cooperative-vector/CoopVec/matrix-mul-bias-rw-packed.slang +++ /dev/null @@ -1,48 +0,0 @@ -//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -xslang -skip-spirv-validation -//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type - -// Disabled because HLSL can't multiply from *RW*ByteAddressBuffers -//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. - -// CHECK: type: int32_t -// CHECK-NEXT: 35 -// CHECK-NEXT: 76 -// CHECK-NEXT: 117 -// CHECK-NEXT: 158 - -//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer -RWStructuredBuffer outputBuffer; - -//TEST_INPUT:ubuffer(data=[67305985], stride=4),name=input -//[1 2 3 4] -ByteAddressBuffer input; - -//TEST_INPUT:ubuffer(data=[67305985 134678021 202050057 269422093], stride=4),name=matrix -//[1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16] -RWByteAddressBuffer matrix; - -//TEST_INPUT:ubuffer(data=[5 6 7 8], stride=4),name=bias -RWByteAddressBuffer bias; - -[numthreads(1, 1, 1)] -void computeMain() -{ - let vec = coopVecLoad<1, int32_t>(input); - CoopVec result = coopVecMatMulAddPacked( - vec, - CoopVecComponentType::SignedInt8Packed, - 4, - matrix, - 0, - CoopVecComponentType::SignedInt8, - bias, - 0, - CoopVecComponentType::SignedInt32, - CoopVecMatrixLayout::RowMajor, - false, - 4 - ); - - for(int i = 0; i < result.getCount(); ++i) - outputBuffer[i] = result[i];; -} diff --git a/tests/cooperative-vector/CoopVec/matrix-mul-bias-rw.slang b/tests/cooperative-vector/CoopVec/matrix-mul-bias-rw.slang deleted file mode 100644 index e0b743259..000000000 --- a/tests/cooperative-vector/CoopVec/matrix-mul-bias-rw.slang +++ /dev/null @@ -1,47 +0,0 @@ -//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -xslang -skip-spirv-validation -//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type - -// Disabled because HLSL doesn't support int8 -//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. - -// CHECK: type: int32_t -// CHECK-NEXT: 35 -// CHECK-NEXT: 76 -// CHECK-NEXT: 117 -// CHECK-NEXT: 158 - -//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer -RWStructuredBuffer outputBuffer; - -//TEST_INPUT:ubuffer(data=[67305985], stride=4),name=input -//[1 2 3 4] -ByteAddressBuffer input; - -//TEST_INPUT:ubuffer(data=[67305985 134678021 202050057 269422093], stride=4),name=matrix -//[1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16] -RWByteAddressBuffer matrix; - -//TEST_INPUT:ubuffer(data=[5 6 7 8], stride=4),name=bias -RWByteAddressBuffer bias; - -[numthreads(1, 1, 1)] -void computeMain() -{ - CoopVec vec = coopVecLoad<4, int8_t>(input); - CoopVec result = coopVecMatMulAdd( - vec, - CoopVecComponentType::SignedInt8, - matrix, - 0, - CoopVecComponentType::SignedInt8, - bias, - 0, - CoopVecComponentType::SignedInt32, - CoopVecMatrixLayout::RowMajor, - false, - 4 - ); - - for(int i = 0; i < result.getCount(); ++i) - outputBuffer[i] = result[i];; -} diff --git a/tests/cooperative-vector/CoopVec/matrix-mul-bias-rwbyteaddress-packed.slang b/tests/cooperative-vector/CoopVec/matrix-mul-bias-rwbyteaddress-packed.slang deleted file mode 100644 index d365734c2..000000000 --- a/tests/cooperative-vector/CoopVec/matrix-mul-bias-rwbyteaddress-packed.slang +++ /dev/null @@ -1,49 +0,0 @@ -//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -xslang -skip-spirv-validation -//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type - -// Disabled because HLSL can't multiply from *RW*ByteAddressBuffers -//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. - -// CHECK: type: int32_t -// CHECK-NEXT: 35 -// CHECK-NEXT: 76 -// CHECK-NEXT: 117 -// CHECK-NEXT: 158 - -//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer -RWStructuredBuffer outputBuffer; - -//TEST_INPUT:ubuffer(data=[67305985], stride=4),name=input -//[1 2 3 4] -ByteAddressBuffer input; - -//TEST_INPUT:ubuffer(data=[67305985 134678021 202050057 269422093], stride=4),name=matrix -//[1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16] -RWByteAddressBuffer matrix; - -//TEST_INPUT:ubuffer(data=[5 6 7 8], stride=4),name=bias -RWByteAddressBuffer bias; - -[numthreads(1, 1, 1)] -void computeMain() -{ - let vec = coopVecLoad<1, int32_t>(input); - CoopVec result = coopVecMatMulAddPacked( - vec, - CoopVecComponentType::SignedInt8Packed, - 4, - matrix, - 0, - CoopVecComponentType::SignedInt8, - bias, - 0, - CoopVecComponentType::SignedInt32, - CoopVecMatrixLayout::RowMajor, - false, - 4 - ); - - for(int i = 0; i < result.getCount(); ++i) - outputBuffer[i] = result[i];; -} - diff --git a/tests/cooperative-vector/CoopVec/matrix-mul-bias-structuredbuffer-packed.slang b/tests/cooperative-vector/CoopVec/matrix-mul-bias-structuredbuffer-packed.slang deleted file mode 100644 index 7b2cf6ee2..000000000 --- a/tests/cooperative-vector/CoopVec/matrix-mul-bias-structuredbuffer-packed.slang +++ /dev/null @@ -1,47 +0,0 @@ -//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -xslang -skip-spirv-validation - -// These platforms don't support these operations from structured buffers -//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type -//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. - -// CHECK: type: int32_t -// CHECK-NEXT: 35 -// CHECK-NEXT: 76 -// CHECK-NEXT: 117 -// CHECK-NEXT: 158 - -//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer -RWStructuredBuffer outputBuffer; - -//TEST_INPUT:ubuffer(data=[67305985], stride=4),name=input -//[1 2 3 4] -StructuredBuffer input; - -//TEST_INPUT:ubuffer(data=[67305985 134678021 202050057 269422093], stride=4),name=matrix -//[1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16] -StructuredBuffer matrix; - -//TEST_INPUT:ubuffer(data=[5 6 7 8], stride=4),name=bias -StructuredBuffer bias; - -[numthreads(1, 1, 1)] -void computeMain() -{ - let vec = coopVecLoad<1>(input); - let result = coopVecMatMulAddPacked( - vec, - CoopVecComponentType::SignedInt8Packed, - 4, - matrix, - 0, - CoopVecComponentType::SignedInt8, - bias, - 0, - CoopVecComponentType::SignedInt32, - CoopVecMatrixLayout::RowMajor, - false, - 4 - ); - - result.store(outputBuffer); -} diff --git a/tests/cooperative-vector/CoopVec/matrix-mul-bias.slang b/tests/cooperative-vector/CoopVec/matrix-mul-bias.slang deleted file mode 100644 index c560af3c0..000000000 --- a/tests/cooperative-vector/CoopVec/matrix-mul-bias.slang +++ /dev/null @@ -1,47 +0,0 @@ -//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -xslang -skip-spirv-validation -//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type - -// Disabled because HLSL doesn't support int8 -//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. - -// CHECK: type: int32_t -// CHECK-NEXT: 35 -// CHECK-NEXT: 76 -// CHECK-NEXT: 117 -// CHECK-NEXT: 158 - -//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer -RWStructuredBuffer outputBuffer; - -//TEST_INPUT:ubuffer(data=[67305985], stride=4),name=input -//[1 2 3 4] -ByteAddressBuffer input; - -//TEST_INPUT:ubuffer(data=[67305985 134678021 202050057 269422093], stride=4),name=matrix -//[1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16] -ByteAddressBuffer matrix; - -//TEST_INPUT:ubuffer(data=[5 6 7 8], stride=4),name=bias -ByteAddressBuffer bias; - -[numthreads(1, 1, 1)] -void computeMain() -{ - CoopVec vec = coopVecLoad<4, int8_t>(input); - let result = coopVecMatMulAdd( - vec, - CoopVecComponentType::SignedInt8, - matrix, - 0, - CoopVecComponentType::SignedInt8, - bias, - 0, - CoopVecComponentType::SignedInt32, - CoopVecMatrixLayout::RowMajor, - false, - 4 - ); - - for(int i = 0; i < result.getCount(); ++i) - outputBuffer[i] = result[i];; -} diff --git a/tests/cooperative-vector/CoopVec/matrix-mul-byteaddress.slang b/tests/cooperative-vector/CoopVec/matrix-mul-byteaddress.slang deleted file mode 100644 index 4059f458c..000000000 --- a/tests/cooperative-vector/CoopVec/matrix-mul-byteaddress.slang +++ /dev/null @@ -1,40 +0,0 @@ -//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -xslang -skip-spirv-validation -//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type - -// Disabled because HLSL doesn't support int8 -//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. - -// CHECK: type: int32_t -// CHECK-NEXT: 30 -// CHECK-NEXT: 70 -// CHECK-NEXT: 110 -// CHECK-NEXT: 150 - -//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer -RWStructuredBuffer outputBuffer; -//TEST_INPUT:ubuffer(data=[67305985], stride=4),name=input -//[1 2 3 4] -ByteAddressBuffer input; - -//TEST_INPUT:ubuffer(data=[67305985 134678021 202050057 269422093], stride=4),name=matrix -//[1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16] -ByteAddressBuffer matrix; - -[numthreads(1, 1, 1)] -void computeMain() -{ - CoopVec vec = coopVecLoad<4, int8_t>(input); - let result = coopVecMatMul( - vec, - CoopVecComponentType::SignedInt8, - matrix, - 0, - CoopVecComponentType::SignedInt8, - CoopVecMatrixLayout::RowMajor, - false, - 4 - ); - - for(int i = 0; i < result.getCount(); ++i) - outputBuffer[i] = result[i];; -} diff --git a/tests/cooperative-vector/CoopVec/matrix-mul-mut.slang b/tests/cooperative-vector/CoopVec/matrix-mul-mut.slang deleted file mode 100644 index 5f7d63b95..000000000 --- a/tests/cooperative-vector/CoopVec/matrix-mul-mut.slang +++ /dev/null @@ -1,41 +0,0 @@ -//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -xslang -skip-spirv-validation -//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type - -// Disabled because HLSL doesn't support int8 -//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. - -// CHECK: type: int32_t -// CHECK-NEXT: 31 -// CHECK-NEXT: 71 -// CHECK-NEXT: 111 -// CHECK-NEXT: 151 - -//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer -RWStructuredBuffer outputBuffer; -//TEST_INPUT:ubuffer(data=[67305985], stride=4),name=input -//[1 2 3 4] -ByteAddressBuffer input; - -//TEST_INPUT:ubuffer(data=[67305985 134678021 202050057 269422093], stride=4),name=matrix -//[1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16] -ByteAddressBuffer matrix; - -[numthreads(1, 1, 1)] -void computeMain() -{ - let vec = coopVecLoad<4, int8_t>(input); - var result = CoopVec(1); - result.matMulAccum( - vec, - CoopVecComponentType::SignedInt8, - matrix, - 0, - CoopVecComponentType::SignedInt8, - CoopVecMatrixLayout::RowMajor, - false, - 4 - ); - - for(int i = 0; i < result.getCount(); ++i) - outputBuffer[i] = result[i];; -} diff --git a/tests/cooperative-vector/CoopVec/matrix-mul-packed-mut.slang b/tests/cooperative-vector/CoopVec/matrix-mul-packed-mut.slang deleted file mode 100644 index c71854467..000000000 --- a/tests/cooperative-vector/CoopVec/matrix-mul-packed-mut.slang +++ /dev/null @@ -1,40 +0,0 @@ -//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -xslang -skip-spirv-validation -//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type -//Test(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. - -// CHECK: type: int32_t -// CHECK-NEXT: 31 -// CHECK-NEXT: 71 -// CHECK-NEXT: 111 -// CHECK-NEXT: 151 - -//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer -RWStructuredBuffer outputBuffer; -//TEST_INPUT:ubuffer(data=[67305985], stride=4),name=input -//[1 2 3 4] -ByteAddressBuffer input; - -//TEST_INPUT:ubuffer(data=[67305985 134678021 202050057 269422093], stride=4),name=matrix -//[1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16] -ByteAddressBuffer matrix; - -[numthreads(1, 1, 1)] -void computeMain() -{ - let vec = coopVecLoad<1, int32_t>(input); - var result = CoopVec(1); - result.matMulAccumPacked( - vec, - CoopVecComponentType::SignedInt8Packed, - 4, - matrix, - 0, - CoopVecComponentType::SignedInt8, - CoopVecMatrixLayout::RowMajor, - false, - 4 - ); - - for(int i = 0; i < result.getCount(); ++i) - outputBuffer[i] = result[i];; -} diff --git a/tests/cooperative-vector/CoopVec/matrix-mul-packed.slang b/tests/cooperative-vector/CoopVec/matrix-mul-packed.slang deleted file mode 100644 index e56660561..000000000 --- a/tests/cooperative-vector/CoopVec/matrix-mul-packed.slang +++ /dev/null @@ -1,39 +0,0 @@ -//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -xslang -skip-spirv-validation -//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type -//Test(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. - -// CHECK: type: int32_t -// CHECK-NEXT: 30 -// CHECK-NEXT: 70 -// CHECK-NEXT: 110 -// CHECK-NEXT: 150 - -//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer -RWStructuredBuffer outputBuffer; -//TEST_INPUT:ubuffer(data=[67305985], stride=4),name=input -//[1 2 3 4] -ByteAddressBuffer input; - -//TEST_INPUT:ubuffer(data=[67305985 134678021 202050057 269422093], stride=4),name=matrix -//[1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16] -ByteAddressBuffer matrix; - -[numthreads(1, 1, 1)] -void computeMain() -{ - let vec = coopVecLoad<1, int32_t>(input); - let result = coopVecMatMulPacked( - vec, - CoopVecComponentType::SignedInt8Packed, - 4, - matrix, - 0, - CoopVecComponentType::SignedInt8, - CoopVecMatrixLayout::RowMajor, - false, - 4 - ); - - for(int i = 0; i < result.getCount(); ++i) - outputBuffer[i] = result[i];; -} diff --git a/tests/cooperative-vector/CoopVec/matrix-mul-rw-packed.slang b/tests/cooperative-vector/CoopVec/matrix-mul-rw-packed.slang deleted file mode 100644 index 7ff925427..000000000 --- a/tests/cooperative-vector/CoopVec/matrix-mul-rw-packed.slang +++ /dev/null @@ -1,41 +0,0 @@ -//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -xslang -skip-spirv-validation -//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type - -// Disabled because HLSL can't multiply from *RW*ByteAddressBuffers -//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. - -// CHECK: type: int32_t -// CHECK-NEXT: 30 -// CHECK-NEXT: 70 -// CHECK-NEXT: 110 -// CHECK-NEXT: 150 - -//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer -RWStructuredBuffer outputBuffer; -//TEST_INPUT:ubuffer(data=[67305985], stride=4),name=input -//[1 2 3 4] -ByteAddressBuffer input; - -//TEST_INPUT:ubuffer(data=[67305985 134678021 202050057 269422093], stride=4),name=matrix -//[1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16] -RWByteAddressBuffer matrix; - -[numthreads(1, 1, 1)] -void computeMain() -{ - let vec = coopVecLoad<1, int32_t>(input); - CoopVec result = coopVecMatMulPacked( - vec, - CoopVecComponentType::SignedInt8Packed, - 4, - matrix, - 0, - CoopVecComponentType::SignedInt8, - CoopVecMatrixLayout::RowMajor, - false, - 4 - ); - - for(int i = 0; i < result.getCount(); ++i) - outputBuffer[i] = result[i];; -} diff --git a/tests/cooperative-vector/CoopVec/matrix-mul-rw.slang b/tests/cooperative-vector/CoopVec/matrix-mul-rw.slang deleted file mode 100644 index ddc328580..000000000 --- a/tests/cooperative-vector/CoopVec/matrix-mul-rw.slang +++ /dev/null @@ -1,40 +0,0 @@ -//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -xslang -skip-spirv-validation -//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type - -// Disabled because HLSL doesn't support int8 -//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. - -// CHECK: type: int32_t -// CHECK-NEXT: 30 -// CHECK-NEXT: 70 -// CHECK-NEXT: 110 -// CHECK-NEXT: 150 - -//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer -RWStructuredBuffer outputBuffer; -//TEST_INPUT:ubuffer(data=[67305985], stride=4),name=input -//[1 2 3 4] -ByteAddressBuffer input; - -//TEST_INPUT:ubuffer(data=[67305985 134678021 202050057 269422093], stride=4),name=matrix -//[1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16] -RWByteAddressBuffer matrix; - -[numthreads(1, 1, 1)] -void computeMain() -{ - CoopVec vec = coopVecLoad<4, int8_t>(input); - CoopVec result = coopVecMatMul( - vec, - CoopVecComponentType::SignedInt8, - matrix, - 0, - CoopVecComponentType::SignedInt8, - CoopVecMatrixLayout::RowMajor, - false, - 4 - ); - - for(int i = 0; i < result.getCount(); ++i) - outputBuffer[i] = result[i];; -} diff --git a/tests/cooperative-vector/CoopVec/matrix-mul-rwbyteaddress-packed.slang b/tests/cooperative-vector/CoopVec/matrix-mul-rwbyteaddress-packed.slang deleted file mode 100644 index 7ff925427..000000000 --- a/tests/cooperative-vector/CoopVec/matrix-mul-rwbyteaddress-packed.slang +++ /dev/null @@ -1,41 +0,0 @@ -//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -xslang -skip-spirv-validation -//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type - -// Disabled because HLSL can't multiply from *RW*ByteAddressBuffers -//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. - -// CHECK: type: int32_t -// CHECK-NEXT: 30 -// CHECK-NEXT: 70 -// CHECK-NEXT: 110 -// CHECK-NEXT: 150 - -//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer -RWStructuredBuffer outputBuffer; -//TEST_INPUT:ubuffer(data=[67305985], stride=4),name=input -//[1 2 3 4] -ByteAddressBuffer input; - -//TEST_INPUT:ubuffer(data=[67305985 134678021 202050057 269422093], stride=4),name=matrix -//[1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16] -RWByteAddressBuffer matrix; - -[numthreads(1, 1, 1)] -void computeMain() -{ - let vec = coopVecLoad<1, int32_t>(input); - CoopVec result = coopVecMatMulPacked( - vec, - CoopVecComponentType::SignedInt8Packed, - 4, - matrix, - 0, - CoopVecComponentType::SignedInt8, - CoopVecMatrixLayout::RowMajor, - false, - 4 - ); - - for(int i = 0; i < result.getCount(); ++i) - outputBuffer[i] = result[i];; -} diff --git a/tests/cooperative-vector/CoopVec/matrix-mul-structuredbuffer-packed.slang b/tests/cooperative-vector/CoopVec/matrix-mul-structuredbuffer-packed.slang deleted file mode 100644 index 756f4366a..000000000 --- a/tests/cooperative-vector/CoopVec/matrix-mul-structuredbuffer-packed.slang +++ /dev/null @@ -1,42 +0,0 @@ -//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -xslang -skip-spirv-validation - -// These platforms don't support these operations from structured buffers -//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type -//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. - -// CHECK: type: int32_t -// CHECK-NEXT: 30 -// CHECK-NEXT: 70 -// CHECK-NEXT: 110 -// CHECK-NEXT: 150 - -//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer -RWStructuredBuffer outputBuffer; - -//TEST_INPUT:ubuffer(data=[67305985], stride=4),name=input -//[1 2 3 4] -StructuredBuffer input; - -//TEST_INPUT:ubuffer(data=[67305985 134678021 202050057 269422093], stride=4),name=matrix -//[1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16] -StructuredBuffer matrix; - -[numthreads(1, 1, 1)] -void computeMain() -{ - let vec = coopVecLoad<1, int32_t>(input); - let result = coopVecMatMulPacked( - vec, - CoopVecComponentType::SignedInt8Packed, - 4, - matrix, - 0, - CoopVecComponentType::SignedInt8, - CoopVecMatrixLayout::RowMajor, - false, - 4 - ); - - for(int i = 0; i < result.getCount(); ++i) - outputBuffer[i] = result[i];; -} diff --git a/tests/cooperative-vector/CoopVec/matrix-mul.slang b/tests/cooperative-vector/CoopVec/matrix-mul.slang deleted file mode 100644 index 0d6f3f6a9..000000000 --- a/tests/cooperative-vector/CoopVec/matrix-mul.slang +++ /dev/null @@ -1,40 +0,0 @@ -//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -xslang -skip-spirv-validation -//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type - -// Disabled because HLSL doesn't support int8 -//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. - -// CHECK: type: int32_t -// CHECK-NEXT: 30 -// CHECK-NEXT: 70 -// CHECK-NEXT: 110 -// CHECK-NEXT: 150 - -//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer -RWStructuredBuffer outputBuffer; -//TEST_INPUT:ubuffer(data=[67305985], stride=4),name=input -//[1 2 3 4] -ByteAddressBuffer input; - -//TEST_INPUT:ubuffer(data=[67305985 134678021 202050057 269422093], stride=4),name=matrix -//[1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16] -ByteAddressBuffer matrix; - -[numthreads(1, 1, 1)] -void computeMain() -{ - let vec = coopVecLoad<4, int8_t>(input); - let result = coopVecMatMul( - vec, - CoopVecComponentType::SignedInt8, - matrix, - 0, - CoopVecComponentType::SignedInt8, - CoopVecMatrixLayout::RowMajor, - false, - 4 - ); - - for(int i = 0; i < result.getCount(); ++i) - outputBuffer[i] = result[i];; -} diff --git a/tests/cooperative-vector/CoopVec/max.slang b/tests/cooperative-vector/CoopVec/max.slang deleted file mode 100644 index 829c1628d..000000000 --- a/tests/cooperative-vector/CoopVec/max.slang +++ /dev/null @@ -1,30 +0,0 @@ -//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -xslang -skip-spirv-validation -//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. -//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type - -// CHECK: type: float -// CHECK-NEXT: 5.0 -// CHECK-NEXT: 4.0 -// CHECK-NEXT: 3.0 -// CHECK-NEXT: 4.0 - -//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer -RWStructuredBuffer outputBuffer; - -//TEST_INPUT:ubuffer(data=[1.0 2.0 3.0 4.0], stride=4),name=input1 -ByteAddressBuffer input1; - -//TEST_INPUT:ubuffer(data=[5.0 4.0 2.0 1.0], stride=4),name=input2 -ByteAddressBuffer input2; - -[numthreads(1, 1, 1)] -void computeMain() -{ - CoopVec vec1 = coopVecLoad<4, float>(input1); - CoopVec vec2 = coopVecLoad<4, float>(input2); - - CoopVec result = max(vec1, vec2); - - for(int i = 0; i < result.getCount(); ++i) - outputBuffer[i] = result[i];; -} diff --git a/tests/cooperative-vector/CoopVec/min.slang b/tests/cooperative-vector/CoopVec/min.slang deleted file mode 100644 index 4a5c45deb..000000000 --- a/tests/cooperative-vector/CoopVec/min.slang +++ /dev/null @@ -1,30 +0,0 @@ -//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -xslang -skip-spirv-validation -//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. -//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type - -// CHECK: type: float -// CHECK-NEXT: 1.000000 -// CHECK-NEXT: 2.000000 -// CHECK-NEXT: 3.000000 -// CHECK-NEXT: 2.000000 - -//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer -RWStructuredBuffer outputBuffer; - -//TEST_INPUT:ubuffer(data=[1.0 2.0 3.0 4.0], stride=4),name=input1 -ByteAddressBuffer input1; - -//TEST_INPUT:ubuffer(data=[5.0 4.0 3.0 2.0], stride=4),name=input2 -ByteAddressBuffer input2; - -[numthreads(1, 1, 1)] -void computeMain() -{ - CoopVec vec1 = coopVecLoad<4, float>(input1); - CoopVec vec2 = coopVecLoad<4, float>(input2); - - CoopVec result = min(vec1, vec2); - - for(int i = 0; i < result.getCount(); ++i) - outputBuffer[i] = result[i];; -} diff --git a/tests/cooperative-vector/CoopVec/mod.slang b/tests/cooperative-vector/CoopVec/mod.slang deleted file mode 100644 index bc55eecab..000000000 --- a/tests/cooperative-vector/CoopVec/mod.slang +++ /dev/null @@ -1,46 +0,0 @@ -//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -xslang -skip-spirv-validation -emit-spirv-directly -//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. -//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu - -// CHECK: 0 -// CHECK-NEXT: 0 -// CHECK-NEXT: 1 -// CHECK-NEXT: 2 -// CHECK-NEXT: 0 -// CHECK-NEXT: 0 -// CHECK-NEXT: 1 -// CHECK-NEXT: 2 -// CHECK-NEXT: 0 -// CHECK-NEXT: 0 -// CHECK-NEXT: 1 -// CHECK-NEXT: 2 - -//TEST_INPUT:ubuffer(data=[0 0 0 0 0 0 0 0 0 0 0 0], stride=4):out,name=outputBuffer -RWByteAddressBuffer outputBuffer; - -//TEST_INPUT:ubuffer(data=[4 3 5 7], stride=4),name=input1 -ByteAddressBuffer input1; - -//TEST_INPUT:ubuffer(data=[2 3 4 5], stride=4),name=input2 -ByteAddressBuffer input2; - -[numthreads(1, 1, 1)] -void computeMain() -{ - let vec1 = coopVecLoad<4, int32_t>(input1); - let vec2 = coopVecLoad<4, int32_t>(input2); - - let vec3 = CoopVec(vec1); - let vec4 = CoopVec(vec2); - - let vec5 = CoopVec(vec1); - let vec6 = CoopVec(vec2); - - let result = vec1 % vec2; - let result2 = CoopVec(vec3 % vec4); - let result3 = CoopVec(vec5 % vec6); - - result.store(outputBuffer); - result2.store(outputBuffer, 16); - result3.store(outputBuffer, 32); -} diff --git a/tests/cooperative-vector/CoopVec/mul.slang b/tests/cooperative-vector/CoopVec/mul.slang deleted file mode 100644 index ba01c224b..000000000 --- a/tests/cooperative-vector/CoopVec/mul.slang +++ /dev/null @@ -1,30 +0,0 @@ -//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -xslang -skip-spirv-validation -//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. -//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type - -// CHECK: type: int32_t -// CHECK-NEXT: 2 -// CHECK-NEXT: 6 -// CHECK-NEXT: 12 -// CHECK-NEXT: 20 - -//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer -RWStructuredBuffer outputBuffer; - -//TEST_INPUT:ubuffer(data=[1 2 3 4], stride=4),name=input1 -ByteAddressBuffer input1; - -//TEST_INPUT:ubuffer(data=[2 3 4 5], stride=4),name=input2 -ByteAddressBuffer input2; - -[numthreads(1, 1, 1)] -void computeMain() -{ - CoopVec vec1 = coopVecLoad<4, int32_t>(input1); - CoopVec vec2 = coopVecLoad<4, int32_t>(input2); - - CoopVec result = vec1 * vec2; - - for(int i = 0; i < result.getCount(); ++i) - outputBuffer[i] = result[i];; -} diff --git a/tests/cooperative-vector/CoopVec/out.slang b/tests/cooperative-vector/CoopVec/out.slang deleted file mode 100644 index ec1bd44ac..000000000 --- a/tests/cooperative-vector/CoopVec/out.slang +++ /dev/null @@ -1,24 +0,0 @@ -//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -xslang -skip-spirv-validation - -// CHECK: type: float -// CHECK-NEXT: 2.000000 -// CHECK-NEXT: 4.000000 -// CHECK-NEXT: 6.000000 -// CHECK-NEXT: 8.000000 - -//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer -RWStructuredBuffer outputBuffer; - -void doubleCoopVec(CoopVec vec, out CoopVec result) -{ - result = vec * 2.0; -} - -[numthreads(1, 1, 1)] -void computeMain() -{ - let vec = CoopVec(1.0, 2.0, 3.0, 4.0); - CoopVec result; - doubleCoopVec(vec, result); - result.store(outputBuffer, 0); -} diff --git a/tests/cooperative-vector/CoopVec/outer-product-structuredbuffer.slang b/tests/cooperative-vector/CoopVec/outer-product-structuredbuffer.slang deleted file mode 100644 index f050c80b9..000000000 --- a/tests/cooperative-vector/CoopVec/outer-product-structuredbuffer.slang +++ /dev/null @@ -1,69 +0,0 @@ -//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type - -// These platforms don't support these operations into structured buffers -//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. -//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type - -// CHECK: type: half -// CHECK-NEXT: 112.000000 -// CHECK-NEXT: 2.000000 -// CHECK-NEXT: 3.000000 -// CHECK-NEXT: 4.000000 -// CHECK-NEXT: 5.000000 -// CHECK-NEXT: 6.000000 -// CHECK-NEXT: 7.000000 -// CHECK-NEXT: 8.000000 -// CHECK-NEXT: 2.000000 -// CHECK-NEXT: 4.000000 -// CHECK-NEXT: 6.000000 -// CHECK-NEXT: 8.000000 -// CHECK-NEXT: 10.000000 -// CHECK-NEXT: 12.000000 -// CHECK-NEXT: 14.000000 -// CHECK-NEXT: 16.000000 -// CHECK-NEXT: 3.000000 -// CHECK-NEXT: 6.000000 -// CHECK-NEXT: 9.000000 -// CHECK-NEXT: 12.000000 -// CHECK-NEXT: 15.000000 -// CHECK-NEXT: 18.000000 -// CHECK-NEXT: 21.000000 -// CHECK-NEXT: 24.000000 -// CHECK-NEXT: 4.000000 -// CHECK-NEXT: 8.000000 -// CHECK-NEXT: 12.000000 -// CHECK-NEXT: 16.000000 -// CHECK-NEXT: 20.000000 -// CHECK-NEXT: 24.000000 -// CHECK-NEXT: 28.000000 -// CHECK-NEXT: 32.000000 - -//TEST_INPUT:ubuffer(data=[ 0x40003C00 0x44004200 ], stride=4),name=inputA -// [1,2,3,4] -StructuredBuffer inputA; - -//TEST_INPUT:ubuffer(data=[ 0x40003C00 0x44004200 0x46004500 0x48004700 ], stride=4),name=inputB -// [1,2,3,4,5,6,7,8] -StructuredBuffer inputB; - -//TEST_INPUT:ubuffer(data=[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0], stride=4):out,name=output -RWStructuredBuffer output; - -[numthreads(1, 1, 1)] -void computeMain() -{ - let vecA = coopVecLoad<4>(inputA); - let vecB = coopVecLoad<8>(inputB); - - output[0] = half(111); - - coopVecOuterProductAccumulate( - vecA, - vecB, - output, - 0, - 32, - CoopVecMatrixLayout::RowMajor, - CoopVecComponentType::Float16, - ); -} diff --git a/tests/cooperative-vector/CoopVec/outer-product.slang b/tests/cooperative-vector/CoopVec/outer-product.slang deleted file mode 100644 index e59b10e4b..000000000 --- a/tests/cooperative-vector/CoopVec/outer-product.slang +++ /dev/null @@ -1,73 +0,0 @@ -//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type - -// HLSL doesn't support the training operations -//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. - -// Disabled because of some pecularities stemming from our lowering of half to float -//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type - -// CHECK: type: half -// CHECK-NEXT: 112.000000 -// CHECK-NEXT: 2.000000 -// CHECK-NEXT: 3.000000 -// CHECK-NEXT: 4.000000 -// CHECK-NEXT: 5.000000 -// CHECK-NEXT: 6.000000 -// CHECK-NEXT: 7.000000 -// CHECK-NEXT: 8.000000 -// CHECK-NEXT: 2.000000 -// CHECK-NEXT: 4.000000 -// CHECK-NEXT: 6.000000 -// CHECK-NEXT: 8.000000 -// CHECK-NEXT: 10.000000 -// CHECK-NEXT: 12.000000 -// CHECK-NEXT: 14.000000 -// CHECK-NEXT: 16.000000 -// CHECK-NEXT: 3.000000 -// CHECK-NEXT: 6.000000 -// CHECK-NEXT: 9.000000 -// CHECK-NEXT: 12.000000 -// CHECK-NEXT: 15.000000 -// CHECK-NEXT: 18.000000 -// CHECK-NEXT: 21.000000 -// CHECK-NEXT: 24.000000 -// CHECK-NEXT: 4.000000 -// CHECK-NEXT: 8.000000 -// CHECK-NEXT: 12.000000 -// CHECK-NEXT: 16.000000 -// CHECK-NEXT: 20.000000 -// CHECK-NEXT: 24.000000 -// CHECK-NEXT: 28.000000 -// CHECK-NEXT: 32.000000 - -//TEST_INPUT:ubuffer(data=[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0], stride=2):out,name=outputBuffer -RWStructuredBuffer outputBuffer; - -//TEST_INPUT:ubuffer(data=[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0], stride=4),name=output -RWByteAddressBuffer output; - -[numthreads(1, 1, 1)] -void computeMain() -{ - CoopVec vecA; - CoopVec vecB; - for(int i = 0; i < vecA.getCount(); ++i) - vecA[i] = half(i+1); - for(int i = 0; i < vecB.getCount(); ++i) - vecB[i] = half(i+1); - - output.Store(0, half(111)); - - coopVecOuterProductAccumulate( - vecA, - vecB, - output, - 0, - 32, - CoopVecMatrixLayout::RowMajor, - CoopVecComponentType::Float16, - ); - - for(int i = 0; i < vecA.getCount() * vecB.getCount(); ++i) - outputBuffer[i] = output.Load(i * 2); -} diff --git a/tests/cooperative-vector/CoopVec/parameter.slang b/tests/cooperative-vector/CoopVec/parameter.slang deleted file mode 100644 index 91e405c45..000000000 --- a/tests/cooperative-vector/CoopVec/parameter.slang +++ /dev/null @@ -1,22 +0,0 @@ -//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -xslang -skip-spirv-validation - -// CHECK: type: float -// CHECK-NEXT: 2.000000 -// CHECK-NEXT: 4.000000 -// CHECK-NEXT: 6.000000 -// CHECK-NEXT: 8.000000 - -//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer -RWStructuredBuffer outputBuffer; - -void processCoopVec(CoopVec vec) -{ - (vec * 2.0).store(outputBuffer, 0); -} - -[numthreads(1, 1, 1)] -void computeMain() -{ - let vec = CoopVec(1.0, 2.0, 3.0, 4.0); - processCoopVec(vec); -} diff --git a/tests/cooperative-vector/CoopVec/reduce-sum-accumulate-structuredbuffer.slang b/tests/cooperative-vector/CoopVec/reduce-sum-accumulate-structuredbuffer.slang deleted file mode 100644 index 17c45734e..000000000 --- a/tests/cooperative-vector/CoopVec/reduce-sum-accumulate-structuredbuffer.slang +++ /dev/null @@ -1,41 +0,0 @@ -//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -xslang -skip-spirv-validation -///TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type - -// HLSL doesn't support the training operations -//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. - -// CHECK: type: half -// CHECK-NEXT: 112.000000 -// CHECK-NEXT: 2.000000 -// CHECK-NEXT: 3.000000 -// CHECK-NEXT: 4.000000 - - -//TEST_INPUT:ubuffer(data=[0 0 0 0 ], stride=2):out,name=outputBuffer -RWStructuredBuffer outputBuffer; - -//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4),name=inputA -ByteAddressBuffer inputA; - -//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4),name=output -RWByteAddressBuffer output; - -[numthreads(1, 1, 1)] -void computeMain() -{ - CoopVec vecA; - for(int i = 0; i < vecA.getCount(); ++i) - vecA[i] = half(i+1); - - output.Store(0, half(111)); - - coopVecReduceSumAccumulate( - vecA, - output, - 0, - ); - - for(int i = 0; i < vecA.getCount(); ++i) - outputBuffer[i] = output.Load(i * 2); -} - diff --git a/tests/cooperative-vector/CoopVec/reduce-sum-accumulate.slang b/tests/cooperative-vector/CoopVec/reduce-sum-accumulate.slang deleted file mode 100644 index 17c45734e..000000000 --- a/tests/cooperative-vector/CoopVec/reduce-sum-accumulate.slang +++ /dev/null @@ -1,41 +0,0 @@ -//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -xslang -skip-spirv-validation -///TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type - -// HLSL doesn't support the training operations -//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. - -// CHECK: type: half -// CHECK-NEXT: 112.000000 -// CHECK-NEXT: 2.000000 -// CHECK-NEXT: 3.000000 -// CHECK-NEXT: 4.000000 - - -//TEST_INPUT:ubuffer(data=[0 0 0 0 ], stride=2):out,name=outputBuffer -RWStructuredBuffer outputBuffer; - -//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4),name=inputA -ByteAddressBuffer inputA; - -//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4),name=output -RWByteAddressBuffer output; - -[numthreads(1, 1, 1)] -void computeMain() -{ - CoopVec vecA; - for(int i = 0; i < vecA.getCount(); ++i) - vecA[i] = half(i+1); - - output.Store(0, half(111)); - - coopVecReduceSumAccumulate( - vecA, - output, - 0, - ); - - for(int i = 0; i < vecA.getCount(); ++i) - outputBuffer[i] = output.Load(i * 2); -} - diff --git a/tests/cooperative-vector/CoopVec/return.slang b/tests/cooperative-vector/CoopVec/return.slang deleted file mode 100644 index b5c7b52a7..000000000 --- a/tests/cooperative-vector/CoopVec/return.slang +++ /dev/null @@ -1,23 +0,0 @@ -//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -xslang -skip-spirv-validation - -// CHECK: type: float -// CHECK-NEXT: 2.000000 -// CHECK-NEXT: 4.000000 -// CHECK-NEXT: 6.000000 -// CHECK-NEXT: 8.000000 - -//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer -RWStructuredBuffer outputBuffer; - -CoopVec doubleCoopVec(CoopVec vec) -{ - return vec * 2.0; -} - -[numthreads(1, 1, 1)] -void computeMain() -{ - let vec = CoopVec(1.0, 2.0, 3.0, 4.0); - let result = doubleCoopVec(vec); - result.store(outputBuffer, 0); -} diff --git a/tests/cooperative-vector/CoopVec/scalar-mul.slang b/tests/cooperative-vector/CoopVec/scalar-mul.slang deleted file mode 100644 index 03574425c..000000000 --- a/tests/cooperative-vector/CoopVec/scalar-mul.slang +++ /dev/null @@ -1,25 +0,0 @@ -//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -xslang -skip-spirv-validation -//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. -//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type - -// CHECK: type: float -// CHECK-NEXT: 2.000000 -// CHECK-NEXT: 4.000000 -// CHECK-NEXT: 6.000000 -// CHECK-NEXT: 8.000000 - -//TEST_INPUT:ubuffer(data=[1.0 2.0 3.0 4.0], stride=4),name=input1 -ByteAddressBuffer input1; - -//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer -RWStructuredBuffer outputBuffer; - -[numthreads(1, 1, 1)] -void computeMain() -{ - CoopVec vec = coopVecLoad<4, float>(input1); - CoopVec result = vec * 2.0; - - for(int i = 0; i < result.getCount(); ++i) - outputBuffer[i] = result[i];; -} diff --git a/tests/cooperative-vector/CoopVec/simple.slang b/tests/cooperative-vector/CoopVec/simple.slang deleted file mode 100644 index 9450840bc..000000000 --- a/tests/cooperative-vector/CoopVec/simple.slang +++ /dev/null @@ -1,24 +0,0 @@ -//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -xslang -skip-spirv-validation -//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. -//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type - -// CHECK: type: int32_t -// CHECK-NEXT: 1 -// CHECK-NEXT: 2 -// CHECK-NEXT: 3 -// CHECK-NEXT: 4 - -//TEST_INPUT:ubuffer(data=[1 2 3 4], stride=4),name=buf -ByteAddressBuffer inputBuffer; - -//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer -RWStructuredBuffer outputBuffer; - -[numthreads(1, 1, 1)] -void computeMain() -{ - var result = coopVecLoad<4, int32_t>(inputBuffer); - - for(int i = 0; i < result.getCount(); ++i) - outputBuffer[i] = result[i];; -} diff --git a/tests/cooperative-vector/CoopVec/step.slang b/tests/cooperative-vector/CoopVec/step.slang deleted file mode 100644 index cf428f40e..000000000 --- a/tests/cooperative-vector/CoopVec/step.slang +++ /dev/null @@ -1,30 +0,0 @@ -//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -xslang -skip-spirv-validation -//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. -//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type - -// CHECK: type: float -// CHECK-NEXT: 0.000000 -// CHECK-NEXT: 0.000000 -// CHECK-NEXT: 1.000000 -// CHECK-NEXT: 1.000000 - -//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer -RWStructuredBuffer outputBuffer; - -//TEST_INPUT:ubuffer(data=[2.0 3.0 4.0 5.0], stride=4),name=input1 -ByteAddressBuffer input1; - -//TEST_INPUT:ubuffer(data=[1.0 2.0 5.0 6.0], stride=4),name=input2 -ByteAddressBuffer input2; - -[numthreads(1, 1, 1)] -void computeMain() -{ - CoopVec edge = coopVecLoad<4, float>(input1); - CoopVec x = coopVecLoad<4, float>(input2); - - CoopVec result = step(edge, x); - - for(int i = 0; i < result.getCount(); ++i) - outputBuffer[i] = result[i];; -} diff --git a/tests/cooperative-vector/CoopVec/struct.slang b/tests/cooperative-vector/CoopVec/struct.slang deleted file mode 100644 index 6f6b8a4f9..000000000 --- a/tests/cooperative-vector/CoopVec/struct.slang +++ /dev/null @@ -1,31 +0,0 @@ -//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -xslang -skip-spirv-validation - -// CHECK: type: float -// CHECK-NEXT: 1.000000 -// CHECK-NEXT: 2.000000 -// CHECK-NEXT: 3.000000 -// CHECK-NEXT: 4.000000 -// CHECK-NEXT: 5.000000 -// CHECK-NEXT: 6.000000 -// CHECK-NEXT: 7.000000 -// CHECK-NEXT: 8.000000 - -//TEST_INPUT:ubuffer(data=[0 0 0 0 0 0 0 0], stride=4):out,name=outputBuffer -RWStructuredBuffer outputBuffer; - -struct MyStruct -{ - CoopVec vec1; - CoopVec vec2; -}; - -[numthreads(1, 1, 1)] -void computeMain() -{ - MyStruct s; - s.vec1 = CoopVec(1.0, 2.0, 3.0, 4.0); - s.vec2 = CoopVec(5.0, 6.0, 7.0, 8.0); - - s.vec1.store(outputBuffer, 0); - s.vec2.store(outputBuffer, 16); -} diff --git a/tests/cooperative-vector/CoopVec/sub.slang b/tests/cooperative-vector/CoopVec/sub.slang deleted file mode 100644 index c94881c34..000000000 --- a/tests/cooperative-vector/CoopVec/sub.slang +++ /dev/null @@ -1,30 +0,0 @@ -//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -xslang -skip-spirv-validation -//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. -//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type - -// CHECK: type: int32_t -// CHECK-NEXT: 1 -// CHECK-NEXT: 1 -// CHECK-NEXT: 1 -// CHECK-NEXT: 1 - -//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer -RWStructuredBuffer outputBuffer; - -//TEST_INPUT:ubuffer(data=[2 3 4 5], stride=4),name=input1 -ByteAddressBuffer input1; - -//TEST_INPUT:ubuffer(data=[1 2 3 4], stride=4),name=input2 -ByteAddressBuffer input2; - -[numthreads(1, 1, 1)] -void computeMain() -{ - CoopVec vec1 = coopVecLoad<4, int32_t>(input1); - CoopVec vec2 = coopVecLoad<4, int32_t>(input2); - - CoopVec result = vec1 - vec2; - - for(int i = 0; i < result.getCount(); ++i) - outputBuffer[i] = result[i];; -} diff --git a/tests/cooperative-vector/CoopVec/subscript-in-func.slang b/tests/cooperative-vector/CoopVec/subscript-in-func.slang deleted file mode 100644 index 74c7f86c3..000000000 --- a/tests/cooperative-vector/CoopVec/subscript-in-func.slang +++ /dev/null @@ -1,26 +0,0 @@ -//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -xslang -skip-spirv-validation - -// CHECK: type: float -// CHECK-NEXT: 1.000000 -// CHECK-NEXT: 4.000000 -// CHECK-NEXT: 9.000000 -// CHECK-NEXT: 16.000000 - -//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer -RWStructuredBuffer outputBuffer; - -void squareCoopVecElements(CoopVec vec) -{ - for (int i = 0; i < 4; ++i) - { - vec[i] = vec[i] * vec[i]; - } - vec.store(outputBuffer, 0); -} - -[numthreads(1, 1, 1)] -void computeMain() -{ - CoopVec vec = CoopVec(1.0, 2.0, 3.0, 4.0); - squareCoopVecElements(vec); -} diff --git a/tests/cooperative-vector/CoopVec/subscript.slang b/tests/cooperative-vector/CoopVec/subscript.slang deleted file mode 100644 index fee3df54e..000000000 --- a/tests/cooperative-vector/CoopVec/subscript.slang +++ /dev/null @@ -1,25 +0,0 @@ -//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -xslang -skip-spirv-validation -emit-spirv-directly -//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. -//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type - -// CHECK: type: int32_t -// CHECK-NEXT: 2 -// CHECK-NEXT: 4 -// CHECK-NEXT: 6 -// CHECK-NEXT: 8 - -//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer -RWStructuredBuffer outputBuffer; - -[numthreads(1, 1, 1)] -void computeMain() -{ - CoopVec vec; - vec[0] = 2; - vec[1] = vec[0]+2; - vec[2] = vec[1]+2; - vec[3] = vec[2]+2; - - for(int i = 0; i < vec.getCount(); ++i) - outputBuffer[i] = vec[i];; -} diff --git a/tests/cooperative-vector/CoopVec/tanh.slang b/tests/cooperative-vector/CoopVec/tanh.slang deleted file mode 100644 index 27c547bbf..000000000 --- a/tests/cooperative-vector/CoopVec/tanh.slang +++ /dev/null @@ -1,28 +0,0 @@ -//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -xslang -skip-spirv-validation -//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. -//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type - -// Hilariously low precision because the different APIs don't agree (they're -// not specced to of course, so it's ok) -// CHECK: type: float -// CHECK-NEXT: 0.761 -// CHECK-NEXT: 0.964 -// CHECK-NEXT: 0.995 -// CHECK-NEXT: 0.999 - -//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer -RWStructuredBuffer outputBuffer; - -//TEST_INPUT:ubuffer(data=[1.0 2.0 3.0 4.0], stride=4),name=input -ByteAddressBuffer input; - -[numthreads(1, 1, 1)] -void computeMain() -{ - CoopVec vec = coopVecLoad<4, float>(input); - - CoopVec result = tanh(vec); - - for(int i = 0; i < result.getCount(); ++i) - outputBuffer[i] = result[i];; -} diff --git a/tests/cooperative-vector/CoopVec/unary.slang b/tests/cooperative-vector/CoopVec/unary.slang deleted file mode 100644 index cf4f95342..000000000 --- a/tests/cooperative-vector/CoopVec/unary.slang +++ /dev/null @@ -1,25 +0,0 @@ -//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -xslang -skip-spirv-validation -xslang -skip-spirv-validation -//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. -//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type - -// CHECK: type: int32_t -// CHECK-NEXT: -1 -// CHECK-NEXT: -2 -// CHECK-NEXT: -3 -// CHECK-NEXT: -4 - -//TEST_INPUT:ubuffer(data=[1 2 3 4], stride=4),name=input1 -ByteAddressBuffer input1; - -//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer -RWStructuredBuffer outputBuffer; - -[numthreads(1, 1, 1)] -void computeMain() -{ - CoopVec vec1 = coopVecLoad<4, int32_t>(input1); - CoopVec negVec = -vec1; - - for(int i = 0; i < negVec.getCount(); ++i) - outputBuffer[i] = negVec[i];; -} diff --git a/tests/cooperative-vector/CoopVec/variadic-init-bad-length.slang b/tests/cooperative-vector/CoopVec/variadic-init-bad-length.slang deleted file mode 100644 index 1f4c92d29..000000000 --- a/tests/cooperative-vector/CoopVec/variadic-init-bad-length.slang +++ /dev/null @@ -1,14 +0,0 @@ -//DIAGNOSTIC_TEST:SIMPLE(filecheck=CHECK): -target spirv - -//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer -RWStructuredBuffer outputBuffer; - -[numthreads(1, 1, 1)] -void computeMain() -{ - let result = CoopVec(1,2,3,4,5); - // CHECK: error 41400: static assertion failed, number of arguments to CoopVec constructor must match number of elements - - for(int i = 0; i < result.getCount(); ++i) - outputBuffer[i] = result[i];; -} diff --git a/tests/cooperative-vector/CoopVec/variadic-init-cast.slang b/tests/cooperative-vector/CoopVec/variadic-init-cast.slang deleted file mode 100644 index 888568ba1..000000000 --- a/tests/cooperative-vector/CoopVec/variadic-init-cast.slang +++ /dev/null @@ -1,20 +0,0 @@ -//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -emit-spirv-directly -//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. -//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type - -// CHECK: type: float -// CHECK-NEXT: 1.0 -// CHECK-NEXT: 2.0 -// CHECK-NEXT: 3.0 -// CHECK-NEXT: 4.0 - -//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer -RWStructuredBuffer outputBuffer; - -[numthreads(1, 1, 1)] -void computeMain() -{ - let result = CoopVec(int(1),half(2),uint(3),double(4)); - for(int i = 0; i < result.getCount(); ++i) - outputBuffer[i] = result[i];; -} diff --git a/tests/cooperative-vector/CoopVec/variadic-init.slang b/tests/cooperative-vector/CoopVec/variadic-init.slang deleted file mode 100644 index 6a1f30efc..000000000 --- a/tests/cooperative-vector/CoopVec/variadic-init.slang +++ /dev/null @@ -1,20 +0,0 @@ -//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. -//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type - -// CHECK: type: int32_t -// CHECK-NEXT: 1 -// CHECK-NEXT: 2 -// CHECK-NEXT: 3 -// CHECK-NEXT: 4 - -//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer -RWStructuredBuffer outputBuffer; - -[numthreads(1, 1, 1)] -void computeMain() -{ - let result = CoopVec(1,2,3,4); - for(int i = 0; i < result.getCount(); ++i) - outputBuffer[i] = result[i];; -} diff --git a/tests/cooperative-vector/add.slang b/tests/cooperative-vector/add.slang new file mode 100644 index 000000000..7b522c79a --- /dev/null +++ b/tests/cooperative-vector/add.slang @@ -0,0 +1,30 @@ +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -xslang -skip-spirv-validation +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -use-dxil -output-using-type -profile cs_6_8 -dx12-experimental -Xslang... -Xdxc -Vd -X. +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type + +// CHECK: type: int32_t +// CHECK-NEXT: 1 +// CHECK-NEXT: 3 +// CHECK-NEXT: 5 +// CHECK-NEXT: 7 + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer +RWStructuredBuffer outputBuffer; + +//TEST_INPUT:ubuffer(data=[1 2 3 4], stride=4),name=input1 +ByteAddressBuffer input1; + +//TEST_INPUT:ubuffer(data=[0 1 2 3], stride=4),name=input2 +ByteAddressBuffer input2; + +[numthreads(1, 1, 1)] +void computeMain() +{ + CoopVec vec1 = coopVecLoad<4, int32_t>(input1); + CoopVec vec2 = coopVecLoad<4, int32_t>(input2); + + let result = vec1 + vec2; + + for(int i = 0; i < result.getCount(); ++i) + outputBuffer[i] = result[i]; +} diff --git a/tests/cooperative-vector/array.slang b/tests/cooperative-vector/array.slang new file mode 100644 index 000000000..b63ff2f91 --- /dev/null +++ b/tests/cooperative-vector/array.slang @@ -0,0 +1,25 @@ +//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -xslang -skip-spirv-validation + +// CHECK: type: float +// CHECK-NEXT: 1.000000 +// CHECK-NEXT: 2.000000 +// CHECK-NEXT: 3.000000 +// CHECK-NEXT: 4.000000 +// CHECK-NEXT: 5.000000 +// CHECK-NEXT: 6.000000 +// CHECK-NEXT: 7.000000 +// CHECK-NEXT: 8.000000 + +//TEST_INPUT:ubuffer(data=[0 0 0 0 0 0 0 0], stride=4):out,name=outputBuffer +RWStructuredBuffer outputBuffer; + +[numthreads(1, 1, 1)] +void computeMain() +{ + CoopVec vecArray[2]; + vecArray[0] = CoopVec(1.0, 2.0, 3.0, 4.0); + vecArray[1] = CoopVec(5.0, 6.0, 7.0, 8.0); + + vecArray[0].store(outputBuffer, 0); + vecArray[1].store(outputBuffer, 16); +} diff --git a/tests/cooperative-vector/atan.slang b/tests/cooperative-vector/atan.slang new file mode 100644 index 000000000..b5ef43898 --- /dev/null +++ b/tests/cooperative-vector/atan.slang @@ -0,0 +1,26 @@ +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -xslang -skip-spirv-validation +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -dx12-experimental -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type + +// CHECK: type: float +// CHECK-NEXT: 0.785398 +// CHECK-NEXT: 1.107149 +// CHECK-NEXT: 1.249046 +// CHECK-NEXT: 1.325818 + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer +RWStructuredBuffer outputBuffer; + +//TEST_INPUT:ubuffer(data=[1.0 2.0 3.0 4.0], stride=4),name=input +ByteAddressBuffer input; + +[numthreads(1, 1, 1)] +void computeMain() +{ + CoopVec vec = coopVecLoad<4, float>(input); + + CoopVec result = atan(vec); + + for(int i = 0; i < result.getCount(); ++i) + outputBuffer[i] = result[i];; +} diff --git a/tests/cooperative-vector/clamp.slang b/tests/cooperative-vector/clamp.slang new file mode 100644 index 000000000..dae692a4f --- /dev/null +++ b/tests/cooperative-vector/clamp.slang @@ -0,0 +1,28 @@ +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -xslang -skip-spirv-validation +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -dx12-experimental -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type + +// CHECK: type: float +// CHECK-NEXT: 2.0 +// CHECK-NEXT: 2.0 +// CHECK-NEXT: 3.0 +// CHECK-NEXT: 4.0 + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer +RWStructuredBuffer outputBuffer; + +//TEST_INPUT:ubuffer(data=[1.0 2.0 3.0 5.0], stride=4),name=input +ByteAddressBuffer input; + +[numthreads(1, 1, 1)] +void computeMain() +{ + CoopVec vec = coopVecLoad<4, float>(input); + CoopVec minVal = CoopVec(2.0); + CoopVec maxVal = CoopVec(4.0); + + CoopVec result = clamp(vec, minVal, maxVal); + + for(int i = 0; i < result.getCount(); ++i) + outputBuffer[i] = result[i];; +} diff --git a/tests/cooperative-vector/comparison.slang b/tests/cooperative-vector/comparison.slang new file mode 100644 index 000000000..e9d7e5e97 --- /dev/null +++ b/tests/cooperative-vector/comparison.slang @@ -0,0 +1,32 @@ +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -xslang -skip-spirv-validation +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -dx12-experimental -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type + +// CHECK: type: uint32_t +// CHECK-NEXT: 0 +// CHECK-NEXT: 1 +// CHECK-NEXT: 1 + +//TEST_INPUT:ubuffer(data=[1.0 2.0 3.0 4.0], stride=4),name=input1 +ByteAddressBuffer input1; + +//TEST_INPUT:ubuffer(data=[1.0 3.0 2.0 4.0], stride=4),name=input2 +ByteAddressBuffer input2; + +//TEST_INPUT:ubuffer(data=[0 0 0], stride=4):out,name=outputBuffer +RWStructuredBuffer outputBuffer; + +[numthreads(1, 1, 1)] +void computeMain() +{ + CoopVec vec1 = coopVecLoad<4, float>(input1); + CoopVec vec2 = coopVecLoad<4, float>(input2); + + uint32_t equals = vec1 == vec2 ? 1 : 0; + uint32_t lessThan = vec1 < vec2 ? 1 : 0; + uint32_t lessThanOrEquals = vec1 <= vec2 ? 1 : 0; + + outputBuffer[0] = equals; + outputBuffer[1] = lessThan; + outputBuffer[2] = lessThanOrEquals; +} diff --git a/tests/cooperative-vector/conversion.slang b/tests/cooperative-vector/conversion.slang new file mode 100644 index 000000000..f212e46e5 --- /dev/null +++ b/tests/cooperative-vector/conversion.slang @@ -0,0 +1,28 @@ +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -xslang -skip-spirv-validation +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -dx12-experimental -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type + +// CHECK: type: float +// CHECK-NEXT: 2.000000 +// CHECK-NEXT: 4.000000 +// CHECK-NEXT: 6.000000 +// CHECK-NEXT: 8.000000 + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer +RWStructuredBuffer outputBuffer; + +//TEST_INPUT:ubuffer(data=[1 2 3 4], stride=4),name=input +ByteAddressBuffer input; + +[numthreads(1, 1, 1)] +void computeMain() +{ + let intVec = coopVecLoad<4, int>(input); + let floatVec = CoopVec(intVec); + let uintVec = CoopVec(intVec); + let floatVec2 = CoopVec(uintVec); + + let result = floatVec + floatVec2; + for(int i = 0; i < result.getCount(); ++i) + outputBuffer[i] = result[i]; +} diff --git a/tests/cooperative-vector/copyFrom.slang b/tests/cooperative-vector/copyFrom.slang new file mode 100644 index 000000000..ff9275718 --- /dev/null +++ b/tests/cooperative-vector/copyFrom.slang @@ -0,0 +1,22 @@ +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -emit-spirv-directly +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -dx12-experimental -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type + +// CHECK: type: int32_t +// CHECK-NEXT: 1 +// CHECK-NEXT: 2 +// CHECK-NEXT: 3 +// CHECK-NEXT: 4 + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer +RWStructuredBuffer outputBuffer; + +[numthreads(1, 1, 1)] +void computeMain() +{ + let v = CoopVec(1,2,3,4); + var result : CoopVec; + result.copyFrom(v); + for(int i = 0; i < result.getCount(); ++i) + outputBuffer[i] = result[i];; +} diff --git a/tests/cooperative-vector/div.slang b/tests/cooperative-vector/div.slang new file mode 100644 index 000000000..50aee7e06 --- /dev/null +++ b/tests/cooperative-vector/div.slang @@ -0,0 +1,30 @@ +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -xslang -skip-spirv-validation +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -dx12-experimental -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type + +// CHECK: type: int32_t +// CHECK-NEXT: 2 +// CHECK-NEXT: 1 +// CHECK-NEXT: 1 +// CHECK-NEXT: 0 + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer +RWStructuredBuffer outputBuffer; + +//TEST_INPUT:ubuffer(data=[4 3 5 2], stride=4),name=input1 +ByteAddressBuffer input1; + +//TEST_INPUT:ubuffer(data=[2 3 4 5], stride=4),name=input2 +ByteAddressBuffer input2; + +[numthreads(1, 1, 1)] +void computeMain() +{ + CoopVec vec1 = coopVecLoad<4, int32_t>(input1); + CoopVec vec2 = coopVecLoad<4, int32_t>(input2); + + CoopVec result = vec1 / vec2; + + for(int i = 0; i < result.getCount(); ++i) + outputBuffer[i] = result[i];; +} diff --git a/tests/cooperative-vector/exp.slang b/tests/cooperative-vector/exp.slang new file mode 100644 index 000000000..f60ddb474 --- /dev/null +++ b/tests/cooperative-vector/exp.slang @@ -0,0 +1,27 @@ +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -xslang -skip-spirv-validation +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -dx12-experimental -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type + +// CHECK: type: float +// CHECK-NEXT: 2.7182 +// CHECK-NEXT: 7.3890 +// CHECK-NEXT: 20.0855 +// CHECK-NEXT: 54.5981 + + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer +RWStructuredBuffer outputBuffer; + +//TEST_INPUT:ubuffer(data=[1.0 2.0 3.0 4.0], stride=4),name=input +ByteAddressBuffer input; + +[numthreads(1, 1, 1)] +void computeMain() +{ + CoopVec vec = coopVecLoad<4, float>(input); + + CoopVec result = exp(vec); + + for(int i = 0; i < result.getCount(); ++i) + outputBuffer[i] = result[i];; +} diff --git a/tests/cooperative-vector/fill.slang b/tests/cooperative-vector/fill.slang new file mode 100644 index 000000000..90f82be26 --- /dev/null +++ b/tests/cooperative-vector/fill.slang @@ -0,0 +1,21 @@ +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -emit-spirv-directly +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -dx12-experimental -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type + +// CHECK: type: int32_t +// CHECK-NEXT: 10 +// CHECK-NEXT: 10 +// CHECK-NEXT: 10 +// CHECK-NEXT: 10 + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer +RWStructuredBuffer outputBuffer; + +[numthreads(1, 1, 1)] +void computeMain() +{ + var result : CoopVec; + result.fill(10); + for(int i = 0; i < result.getCount(); ++i) + outputBuffer[i] = result[i];; +} diff --git a/tests/cooperative-vector/fma.slang b/tests/cooperative-vector/fma.slang new file mode 100644 index 000000000..b7a6e16a3 --- /dev/null +++ b/tests/cooperative-vector/fma.slang @@ -0,0 +1,34 @@ +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -xslang -skip-spirv-validation +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -dx12-experimental -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type + +// CHECK: type: float +// CHECK-NEXT: 5.000000 +// CHECK-NEXT: 10.000000 +// CHECK-NEXT: 17.000000 +// CHECK-NEXT: 26.000000 + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer +RWStructuredBuffer outputBuffer; + +//TEST_INPUT:ubuffer(data=[1.0 2.0 3.0 4.0], stride=4),name=input1 +ByteAddressBuffer input1; + +//TEST_INPUT:ubuffer(data=[2.0 3.0 4.0 5.0], stride=4),name=input2 +ByteAddressBuffer input2; + +//TEST_INPUT:ubuffer(data=[3.0 4.0 5.0 6.0], stride=4),name=input3 +ByteAddressBuffer input3; + +[numthreads(1, 1, 1)] +void computeMain() +{ + CoopVec vec1 = coopVecLoad<4, float>(input1); + CoopVec vec2 = coopVecLoad<4, float>(input2); + CoopVec vec3 = coopVecLoad<4, float>(input3); + + CoopVec result = fma(vec1, vec2, vec3); + + for(int i = 0; i < result.getCount(); ++i) + outputBuffer[i] = result[i];; +} diff --git a/tests/cooperative-vector/glsl/cast.slang b/tests/cooperative-vector/glsl/cast.slang deleted file mode 100644 index 263ad5026..000000000 --- a/tests/cooperative-vector/glsl/cast.slang +++ /dev/null @@ -1,30 +0,0 @@ -//DISABLE_TEST:CROSS_COMPILE: -profile glsl_450+spirv_1_4 -stage compute -entry computeMain -target spirv-assembly - -RWStructuredBuffer outputBuffer; - -StructuredBuffer buf; - -[numthreads(4, 1, 1)] -void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) -{ - coopvecNV r_int; - coopvecNV r = coopvecNV(r_int); - coopvecNV v = coopvecNV(1); - int offset = 0; - int layout = gl_CooperativeVectorMatrixLayoutRowMajorNV; - bool transpose = false; - int matrixStride = 4; - coopVecMatMulNV( - r, - v, - gl_ComponentTypeFloat32NV, - buf, - offset, - gl_ComponentTypeFloat32NV, - 8, - 16, - layout, - transpose, - matrixStride); - outputBuffer[dispatchThreadID.x] = r[0]; -} diff --git a/tests/cooperative-vector/glsl/cast.slang.glsl b/tests/cooperative-vector/glsl/cast.slang.glsl deleted file mode 100644 index 7194c02fc..000000000 --- a/tests/cooperative-vector/glsl/cast.slang.glsl +++ /dev/null @@ -1,23 +0,0 @@ -#version 450 -#extension GL_NV_cooperative_vector : require -layout(row_major) uniform; -layout(row_major) buffer; -layout(std430, binding = 1) readonly buffer StructuredBuffer_float_t_0 { - float _data[]; -} buf_0; -layout(std430, binding = 0) buffer StructuredBuffer_float_t_1 { - float _data[]; -} outputBuffer_0; -layout(local_size_x = 4, local_size_y = 1, local_size_z = 1) in; -void main() -{ - coopvecNV r_int_0; - coopvecNV _S1 = (coopvecNV((r_int_0))); - coopvecNV r_0 = _S1; - coopvecNV _S2 = (coopvecNV((1))); - coopVecMatMulNV((r_0), (_S2), (1), (buf_0)._data, (0U), (1), (8U), (16U), (0), (false), (4U)); - float _S3 = r_0[0U]; - outputBuffer_0._data[gl_GlobalInvocationID.x] = _S3; - return; -} - diff --git a/tests/cooperative-vector/glsl/groupshared-sized.slang b/tests/cooperative-vector/glsl/groupshared-sized.slang deleted file mode 100644 index 74ccac6a2..000000000 --- a/tests/cooperative-vector/glsl/groupshared-sized.slang +++ /dev/null @@ -1,37 +0,0 @@ -//DISABLE_TEST:CROSS_COMPILE: -profile glsl_450+spirv_1_4 -stage compute -entry computeMain -target spirv-assembly - -RWStructuredBuffer outputBuffer; - -groupshared float buf[100]; - -[numthreads(4, 1, 1)] -void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) -{ - coopvecNV r; - coopvecNV v; - if(dispatchThreadID.x == 0) - { - for(int i = 0; i < 100; ++i) - { - buf[i] = float(i); - } - } - coopVecLoadNV(v, buf, 0); - int offset = 0; - int layout = gl_CooperativeVectorMatrixLayoutRowMajorNV; - bool transpose = false; - int matrixStride = 4; - coopVecMatMulNV( - r, - v, - gl_ComponentTypeFloat32NV, - buf, - offset, - gl_ComponentTypeFloat32NV, - 8, - 16, - layout, - transpose, - matrixStride); - outputBuffer[dispatchThreadID.x] = r[0]; -} diff --git a/tests/cooperative-vector/glsl/groupshared-sized.slang.glsl b/tests/cooperative-vector/glsl/groupshared-sized.slang.glsl deleted file mode 100644 index f1f4b5a27..000000000 --- a/tests/cooperative-vector/glsl/groupshared-sized.slang.glsl +++ /dev/null @@ -1,38 +0,0 @@ -#version 450 -#extension GL_NV_cooperative_vector : require -layout(row_major) uniform; -layout(row_major) buffer; -layout(std430, binding = 0) buffer StructuredBuffer_float_t_0 { - float _data[]; -} outputBuffer_0; -shared float buf_0[100]; - -layout(local_size_x = 4, local_size_y = 1, local_size_z = 1) in; -void main() -{ - coopvecNV r_0; - coopvecNV v_0; - uint _S1 = gl_GlobalInvocationID.x; - if(_S1 == 0U) - { - int i_0 = 0; - for(;;) - { - if(i_0 < 100) - { - } - else - { - break; - } - buf_0[i_0] = float(i_0); - i_0 = i_0 + 1; - } - } - coopVecLoadNV((v_0), (buf_0), (0U)); - coopvecNV _S2 = v_0; - coopVecMatMulNV((r_0), (_S2), (1), (buf_0), (0U), (1), (8U), (16U), (0), (false), (4U)); - float _S3 = r_0[0U]; - outputBuffer_0._data[uint(_S1)] = _S3; - return; -} diff --git a/tests/cooperative-vector/glsl/load-store.slang b/tests/cooperative-vector/glsl/load-store.slang deleted file mode 100644 index 04a0cd585..000000000 --- a/tests/cooperative-vector/glsl/load-store.slang +++ /dev/null @@ -1,13 +0,0 @@ -//DISABLE_TEST:CROSS_COMPILE: -profile glsl_450+spirv_1_4 -stage compute -entry computeMain -target spirv-assembly - -RWStructuredBuffer rwBuf; -StructuredBuffer buf; - -[numthreads(4, 1, 1)] -void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) -{ - coopvecNV r; - coopVecLoadNV(r, rwBuf, 0); - coopVecLoadNV(r, buf, 1); - coopVecStoreNV(r, rwBuf, 2); -} diff --git a/tests/cooperative-vector/glsl/load-store.slang.glsl b/tests/cooperative-vector/glsl/load-store.slang.glsl deleted file mode 100644 index 3844e2ff0..000000000 --- a/tests/cooperative-vector/glsl/load-store.slang.glsl +++ /dev/null @@ -1,20 +0,0 @@ -#version 450 -#extension GL_NV_cooperative_vector : require -layout(row_major) uniform; -layout(row_major) buffer; -layout(std430, binding = 0) buffer StructuredBuffer_float_t_0 { - float _data[]; -} rwBuf_0; -layout(std430, binding = 1) readonly buffer StructuredBuffer_float_t_1 { - float _data[]; -} buf_0; -layout(local_size_x = 4, local_size_y = 1, local_size_z = 1) in; -void main() -{ - coopvecNV r_0; - coopVecLoadNV((r_0), (rwBuf_0)._data, (0U)); - coopVecLoadNV((r_0), (buf_0)._data, (1U)); - coopVecStoreNV((r_0), (rwBuf_0)._data, (2U)); - return; -} - diff --git a/tests/cooperative-vector/glsl/only-arith.slang b/tests/cooperative-vector/glsl/only-arith.slang deleted file mode 100644 index 8a6d3d0d9..000000000 --- a/tests/cooperative-vector/glsl/only-arith.slang +++ /dev/null @@ -1,18 +0,0 @@ -//DISABLE_TEST:CROSS_COMPILE: -profile glsl_450+spirv_1_4 -stage compute -entry computeMain -target spirv-assembly - -// Disabled because we don't output the extension because although the -// coopvecNV type is used, it isn't *declared* here (and we don't attach -// requirements to the add operations); - -RWStructuredBuffer outputBuffer; - -StructuredBuffer buf; - -[numthreads(4, 1, 1)] -void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) -{ - coopvecNV r; - coopvecNV v = coopvecNV(1); - r = v + v; - outputBuffer[dispatchThreadID.x] = r[0]; -} diff --git a/tests/cooperative-vector/glsl/only-arith.slang.glsl b/tests/cooperative-vector/glsl/only-arith.slang.glsl deleted file mode 100644 index db3372d70..000000000 --- a/tests/cooperative-vector/glsl/only-arith.slang.glsl +++ /dev/null @@ -1,16 +0,0 @@ -#version 450 -#extension GL_NV_cooperative_vector : require -layout(row_major) uniform; -layout(row_major) buffer; -layout(std430, binding = 0) buffer _S1 { - float _data[]; -} outputBuffer_0; -layout(local_size_x = 4, local_size_y = 1, local_size_z = 1) in; -void main() -{ - const coopvecNV v_0 = coopvecNV(1.0); - const coopvecNV r_0 = v_0 + v_0; - float _S2 = r_0[0U]; - ((outputBuffer_0)._data[(gl_GlobalInvocationID.x)]) = _S2; - return; -} diff --git a/tests/cooperative-vector/glsl/outer-product-accumulate.slang b/tests/cooperative-vector/glsl/outer-product-accumulate.slang deleted file mode 100644 index 1db30cb0d..000000000 --- a/tests/cooperative-vector/glsl/outer-product-accumulate.slang +++ /dev/null @@ -1,19 +0,0 @@ -//DISABLE_TEST:CROSS_COMPILE: -profile glsl_450+spirv_1_4 -stage compute -entry computeMain -target spirv-assembly -emit-spirv-via-glsl - -RWByteAddressBuffer buf; - -[numthreads(4, 1, 1)] -void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) -{ - coopvecNV op0 = coopvecNV(1); - coopvecNV op1 = coopvecNV(2); - - coopVecOuterProductAccumulateNV( - op0, - op1, - buf, - 0, // firstElement - 4, // matrixStride - gl_CooperativeVectorMatrixLayoutRowMajorNV, - gl_ComponentTypeFloat32NV); -} diff --git a/tests/cooperative-vector/glsl/outer-product-accumulate.slang.glsl b/tests/cooperative-vector/glsl/outer-product-accumulate.slang.glsl deleted file mode 100644 index 09d781824..000000000 --- a/tests/cooperative-vector/glsl/outer-product-accumulate.slang.glsl +++ /dev/null @@ -1,17 +0,0 @@ -#version 450 -#extension GL_NV_cooperative_vector : require -layout(row_major) uniform; -layout(row_major) buffer; -layout(std430, binding = 0) buffer _S1 -{ - uint _data[]; -} buf_0; -layout(local_size_x = 4, local_size_y = 1, local_size_z = 1) in; -void main() -{ - coopvecNV _S2 = (coopvecNV((1.0))); - coopvecNV _S3 = (coopvecNV((2.0))); - coopVecOuterProductAccumulateNV((_S2), (_S3), (buf_0)._data, (0U), (4U), (0), (1)); - return; -} - diff --git a/tests/cooperative-vector/glsl/simple.slang b/tests/cooperative-vector/glsl/simple.slang deleted file mode 100644 index 4128f6827..000000000 --- a/tests/cooperative-vector/glsl/simple.slang +++ /dev/null @@ -1,35 +0,0 @@ -//DISABLE_TEST:CROSS_COMPILE(filecheck=CHECK): -profile glsl_450+spirv_1_4 -stage compute -entry computeMain -target spirv-assembly -emit-spirv-via-glsl - -RWStructuredBuffer outputBuffer; - -StructuredBuffer buf; - -[numthreads(4, 1, 1)] -void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) -{ - // CHECK: %[[VAR1:[a-zA-Z0-9_]+]] = OpTypeCooperativeVectorNV %int %uint_16 - // CHECK: OpConstantCompositeReplicateEXT %9 %int_1 - coopvecNV v = coopvecNV(1); - - // CHECK: %[[VAR2:[a-zA-Z0-9_]+]] = OpTypeCooperativeVectorNV %int %uint_8 - coopvecNV r; - int offset = 0; - int layout = gl_CooperativeVectorMatrixLayoutRowMajorNV; - bool transpose = false; - int matrixStride = 4; - - // CHECK: OpCooperativeVectorMatrixMulNV %[[VAR2]] %{{.*}} %int_1 %{{.*}} %uint_0 %int_1 %uint_8 %uint_16 %int_0 %false %uint_4 MatrixBSignedComponentsKHR|MatrixResultSignedComponentsKHR - coopVecMatMulNV( - r, - v, - gl_ComponentTypeFloat32NV, - buf, - offset, - gl_ComponentTypeFloat32NV, - 8, - 16, - layout, - transpose, - matrixStride); - outputBuffer[dispatchThreadID.x] = r[0]; -} diff --git a/tests/cooperative-vector/glsl/simple.slang.glsl b/tests/cooperative-vector/glsl/simple.slang.glsl deleted file mode 100644 index cf5f0566e..000000000 --- a/tests/cooperative-vector/glsl/simple.slang.glsl +++ /dev/null @@ -1,20 +0,0 @@ -#version 450 -#extension GL_NV_cooperative_vector : require -layout(row_major) uniform; -layout(row_major) buffer; -layout(std430, binding = 1) readonly buffer StructuredBuffer_float_t_0 { - float _data[]; -} buf_0; -layout(std430, binding = 0) buffer StructuredBuffer_float_t_1 { - float _data[]; -} outputBuffer_0; -layout(local_size_x = 4, local_size_y = 1, local_size_z = 1) in; -void main() -{ - coopvecNV _S1 = (coopvecNV((1))); - coopvecNV r_0; - coopVecMatMulNV((r_0), (_S1), (1), (buf_0)._data, (0U), (1), (8U), (16U), (0), (false), (4U)); - float _S2 = r_0[0U]; - outputBuffer_0._data[gl_GlobalInvocationID.x] = _S2; - return; -} diff --git a/tests/cooperative-vector/inout.slang b/tests/cooperative-vector/inout.slang new file mode 100644 index 000000000..8181a2019 --- /dev/null +++ b/tests/cooperative-vector/inout.slang @@ -0,0 +1,23 @@ +//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -xslang -skip-spirv-validation + +// CHECK: type: float +// CHECK-NEXT: 2.000000 +// CHECK-NEXT: 4.000000 +// CHECK-NEXT: 6.000000 +// CHECK-NEXT: 8.000000 + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer +RWStructuredBuffer outputBuffer; + +void doubleCoopVec(inout CoopVec vec) +{ + vec = vec * 2.0; +} + +[numthreads(1, 1, 1)] +void computeMain() +{ + var vec = CoopVec(1.0, 2.0, 3.0, 4.0); + doubleCoopVec(vec); + vec.store(outputBuffer, 0); +} diff --git a/tests/cooperative-vector/load-store-arbitrary-array-vec.slang b/tests/cooperative-vector/load-store-arbitrary-array-vec.slang new file mode 100644 index 000000000..f577ae5f3 --- /dev/null +++ b/tests/cooperative-vector/load-store-arbitrary-array-vec.slang @@ -0,0 +1,35 @@ +//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -xslang -skip-spirv-validation + +// CHECK: 1 +// CHECK-NEXT: 2 +// CHECK-NEXT: 3 +// CHECK-NEXT: 4 +// CHECK-NEXT: 5 +// CHECK-NEXT: 6 +// CHECK-NEXT: 7 +// CHECK-NEXT: 8 +// CHECK-NEXT: 9 +// CHECK-NEXT: A +// CHECK-NEXT: B +// CHECK-NEXT: C +// CHECK-NEXT: D +// CHECK-NEXT: E +// CHECK-NEXT: F + +//TEST_INPUT:ubuffer(data=[1 2 3 4 5 6 7 8 9 10 11 12 13 14 15]):name=input +RWByteAddressBuffer input; + +//TEST_INPUT:ubuffer(data=[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]):out,name=outputBuffer +RWStructuredBuffer outputBuffer; + +groupshared float3[5] temp; + +[numthreads(1, 1, 1)] +void computeMain() +{ + let vec = coopVecLoad<15, uint32_t>(input); + vec.storeAny(temp); + let result = CoopVec.loadAny(temp); + for(int i = 0; i < result.getCount(); ++i) + outputBuffer[i] = result[i];; +} diff --git a/tests/cooperative-vector/load-store-arbitrary-array.slang b/tests/cooperative-vector/load-store-arbitrary-array.slang new file mode 100644 index 000000000..d8353d1c1 --- /dev/null +++ b/tests/cooperative-vector/load-store-arbitrary-array.slang @@ -0,0 +1,35 @@ +//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -xslang -skip-spirv-validation + +// CHECK: 1 +// CHECK-NEXT: 2 +// CHECK-NEXT: 3 +// CHECK-NEXT: 4 +// CHECK-NEXT: 5 +// CHECK-NEXT: 6 +// CHECK-NEXT: 7 +// CHECK-NEXT: 8 +// CHECK-NEXT: 9 +// CHECK-NEXT: A +// CHECK-NEXT: B +// CHECK-NEXT: C +// CHECK-NEXT: D +// CHECK-NEXT: E +// CHECK-NEXT: F + +//TEST_INPUT:ubuffer(data=[1 2 3 4 5 6 7 8 9 10 11 12 13 14 15]):name=input +RWByteAddressBuffer input; + +//TEST_INPUT:ubuffer(data=[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]):out,name=outputBuffer +RWStructuredBuffer outputBuffer; + +groupshared float[15] temp; + +[numthreads(1, 1, 1)] +void computeMain() +{ + let vec = coopVecLoad<15, uint32_t>(input); + vec.storeAny(temp); + let result = CoopVec.loadAny(temp); + for(int i = 0; i < result.getCount(); ++i) + outputBuffer[i] = result[i]; +} diff --git a/tests/cooperative-vector/load-store-groupshared.slang b/tests/cooperative-vector/load-store-groupshared.slang new file mode 100644 index 000000000..842d664ee --- /dev/null +++ b/tests/cooperative-vector/load-store-groupshared.slang @@ -0,0 +1,27 @@ +//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -xslang -skip-spirv-validation +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -dx12-experimental -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type + +// CHECK: 1 +// CHECK-NEXT: 2 +// CHECK-NEXT: 3 +// CHECK-NEXT: 4 +// CHECK-NEXT: 5 + +//TEST_INPUT:ubuffer(data=[1 2 3 4 5]):name=input +RWByteAddressBuffer input; + +//TEST_INPUT:ubuffer(data=[0 0 0 0 0]):out,name=outputBuffer +RWStructuredBuffer outputBuffer; + +groupshared uint32_t[5] temp; + +[numthreads(1, 1, 1)] +void computeMain() +{ + let vec = coopVecLoad<5, uint32_t>(input); + vec.store(temp); + let result = coopVecLoadGroupshared<5>(temp); + for(int i = 0; i < result.getCount(); ++i) + outputBuffer[i] = result[i];; +} diff --git a/tests/cooperative-vector/load-store-rwbyteaddressbuffer.slang b/tests/cooperative-vector/load-store-rwbyteaddressbuffer.slang new file mode 100644 index 000000000..098ef8a5d --- /dev/null +++ b/tests/cooperative-vector/load-store-rwbyteaddressbuffer.slang @@ -0,0 +1,22 @@ +//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -xslang -skip-spirv-validation +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -dx12-experimental -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu + +// CHECK: 1 +// CHECK-NEXT: 2 +// CHECK-NEXT: 3 +// CHECK-NEXT: 4 +// CHECK-NEXT: 5 + +//TEST_INPUT:ubuffer(data=[1 2 3 4 5]):name=input +RWByteAddressBuffer input; + +//TEST_INPUT:ubuffer(data=[0 0 0 0 0]):out,name=outputBuffer +RWByteAddressBuffer outputBuffer; + +[numthreads(1, 1, 1)] +void computeMain() +{ + let result = coopVecLoad<5, uint32_t>(input); + result.store(outputBuffer); +} diff --git a/tests/cooperative-vector/load-store-rwstructuredbuffer.slang b/tests/cooperative-vector/load-store-rwstructuredbuffer.slang new file mode 100644 index 000000000..6a89aa59e --- /dev/null +++ b/tests/cooperative-vector/load-store-rwstructuredbuffer.slang @@ -0,0 +1,30 @@ +//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -xslang -skip-spirv-validation +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type + +// HLSL doesn't support structured buffers for CoopVec +//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -dx12-experimental -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. + +// CHECK: type: int32_t +// CHECK-NEXT: 5 +// CHECK-NEXT: 6 +// CHECK-NEXT: 7 +// CHECK-NEXT: 8 +// CHECK-NEXT: 1 +// CHECK-NEXT: 2 +// CHECK-NEXT: 3 +// CHECK-NEXT: 4 + +//TEST_INPUT:ubuffer(data=[1 2 3 4 5 6 7 8], stride=4),name=buf +RWStructuredBuffer inputBuffer; + +//TEST_INPUT:ubuffer(data=[0 0 0 0 0 0 0 0], stride=4):out,name=outputBuffer +RWStructuredBuffer outputBuffer; + +[numthreads(1, 1, 1)] +void computeMain() +{ + let a = coopVecLoad<4>(inputBuffer, 0); + let b = coopVecLoad<4>(inputBuffer, 4*4); + b.store(outputBuffer, 0); + a.store(outputBuffer, 4*4); +} diff --git a/tests/cooperative-vector/log.slang b/tests/cooperative-vector/log.slang new file mode 100644 index 000000000..c5372f875 --- /dev/null +++ b/tests/cooperative-vector/log.slang @@ -0,0 +1,26 @@ +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -xslang -skip-spirv-validation +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -dx12-experimental -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type + +// CHECK: type: float +// CHECK-NEXT: 0.000000 +// CHECK-NEXT: 0.693147 +// CHECK-NEXT: 1.098612 +// CHECK-NEXT: 1.386294 + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer +RWStructuredBuffer outputBuffer; + +//TEST_INPUT:ubuffer(data=[1.0 2.0 3.0 4.0], stride=4),name=input +ByteAddressBuffer input; + +[numthreads(1, 1, 1)] +void computeMain() +{ + CoopVec vec = coopVecLoad<4, float>(input); + + CoopVec result = log(vec); + + for(int i = 0; i < result.getCount(); ++i) + outputBuffer[i] = result[i];; +} diff --git a/tests/cooperative-vector/matrix-mul-bias-mut.slang b/tests/cooperative-vector/matrix-mul-bias-mut.slang new file mode 100644 index 000000000..557b1296e --- /dev/null +++ b/tests/cooperative-vector/matrix-mul-bias-mut.slang @@ -0,0 +1,48 @@ +//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -xslang -skip-spirv-validation +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type + +// Disabled because HLSL doesn't support int8 +//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -dx12-experimental -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. + +// CHECK: type: int32_t +// CHECK-NEXT: 8035 +// CHECK-NEXT: 8076 +// CHECK-NEXT: 8117 +// CHECK-NEXT: 8158 + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer +RWStructuredBuffer outputBuffer; + +//TEST_INPUT:ubuffer(data=[67305985], stride=4),name=input +//[1 2 3 4] +ByteAddressBuffer input; + +//TEST_INPUT:ubuffer(data=[67305985 134678021 202050057 269422093], stride=4),name=matrix +//[1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16] +ByteAddressBuffer matrix; + +//TEST_INPUT:ubuffer(data=[5 6 7 8], stride=4),name=bias +ByteAddressBuffer bias; + +[numthreads(1, 1, 1)] +void computeMain() +{ + CoopVec vec = coopVecLoad<4, int8_t>(input); + var result = CoopVec(8000); + result.matMulAddAccum( + vec, + CoopVecComponentType::SignedInt8, + matrix, + 0, + CoopVecComponentType::SignedInt8, + bias, + 0, + CoopVecComponentType::SignedInt32, + CoopVecMatrixLayout::RowMajor, + false, + 4 + ); + + for(int i = 0; i < result.getCount(); ++i) + outputBuffer[i] = result[i];; +} diff --git a/tests/cooperative-vector/matrix-mul-bias-packed-mut.slang b/tests/cooperative-vector/matrix-mul-bias-packed-mut.slang new file mode 100644 index 000000000..c560919fb --- /dev/null +++ b/tests/cooperative-vector/matrix-mul-bias-packed-mut.slang @@ -0,0 +1,47 @@ +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -xslang -skip-spirv-validation +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -dx12-experimental -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type + +// CHECK: type: int32_t +// CHECK-NEXT: 8035 +// CHECK-NEXT: 8076 +// CHECK-NEXT: 8117 +// CHECK-NEXT: 8158 + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer +RWStructuredBuffer outputBuffer; + +//TEST_INPUT:ubuffer(data=[67305985], stride=4),name=input +//[1 2 3 4] +ByteAddressBuffer input; + +//TEST_INPUT:ubuffer(data=[67305985 134678021 202050057 269422093], stride=4),name=matrix +//[1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16] +ByteAddressBuffer matrix; + +//TEST_INPUT:ubuffer(data=[5 6 7 8], stride=4),name=bias +ByteAddressBuffer bias; + +[numthreads(1, 1, 1)] +void computeMain() +{ + let vec = coopVecLoad<1, int32_t>(input); + var result = CoopVec(8000); + result.matMulAddAccumPacked( + vec, + CoopVecComponentType::SignedInt8Packed, + 4, + matrix, + 0, + CoopVecComponentType::SignedInt8, + bias, + 0, + CoopVecComponentType::SignedInt32, + CoopVecMatrixLayout::RowMajor, + false, + 4 + ); + + for(int i = 0; i < result.getCount(); ++i) + outputBuffer[i] = result[i];; +} diff --git a/tests/cooperative-vector/matrix-mul-bias-packed.slang b/tests/cooperative-vector/matrix-mul-bias-packed.slang new file mode 100644 index 000000000..9b4810600 --- /dev/null +++ b/tests/cooperative-vector/matrix-mul-bias-packed.slang @@ -0,0 +1,46 @@ +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -xslang -skip-spirv-validation +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -dx12-experimental -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type + +// CHECK: type: int32_t +// CHECK-NEXT: 35 +// CHECK-NEXT: 76 +// CHECK-NEXT: 117 +// CHECK-NEXT: 158 + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer +RWStructuredBuffer outputBuffer; + +//TEST_INPUT:ubuffer(data=[67305985], stride=4),name=input +//[1 2 3 4] +ByteAddressBuffer input; + +//TEST_INPUT:ubuffer(data=[67305985 134678021 202050057 269422093], stride=4),name=matrix +//[1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16] +ByteAddressBuffer matrix; + +//TEST_INPUT:ubuffer(data=[5 6 7 8], stride=4),name=bias +ByteAddressBuffer bias; + +[numthreads(1, 1, 1)] +void computeMain() +{ + let vec = coopVecLoad<1, int32_t>(input); + let result = coopVecMatMulAddPacked( + vec, + CoopVecComponentType::SignedInt8Packed, + 4, + matrix, + 0, + CoopVecComponentType::SignedInt8, + bias, + 0, + CoopVecComponentType::SignedInt32, + CoopVecMatrixLayout::RowMajor, + false, + 4 + ); + + for(int i = 0; i < result.getCount(); ++i) + outputBuffer[i] = result[i];; +} diff --git a/tests/cooperative-vector/matrix-mul-bias-rw-packed.slang b/tests/cooperative-vector/matrix-mul-bias-rw-packed.slang new file mode 100644 index 000000000..009de68aa --- /dev/null +++ b/tests/cooperative-vector/matrix-mul-bias-rw-packed.slang @@ -0,0 +1,48 @@ +//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -xslang -skip-spirv-validation +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type + +// Disabled because HLSL can't multiply from *RW*ByteAddressBuffers +//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -dx12-experimental -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. + +// CHECK: type: int32_t +// CHECK-NEXT: 35 +// CHECK-NEXT: 76 +// CHECK-NEXT: 117 +// CHECK-NEXT: 158 + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer +RWStructuredBuffer outputBuffer; + +//TEST_INPUT:ubuffer(data=[67305985], stride=4),name=input +//[1 2 3 4] +ByteAddressBuffer input; + +//TEST_INPUT:ubuffer(data=[67305985 134678021 202050057 269422093], stride=4),name=matrix +//[1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16] +RWByteAddressBuffer matrix; + +//TEST_INPUT:ubuffer(data=[5 6 7 8], stride=4),name=bias +RWByteAddressBuffer bias; + +[numthreads(1, 1, 1)] +void computeMain() +{ + let vec = coopVecLoad<1, int32_t>(input); + CoopVec result = coopVecMatMulAddPacked( + vec, + CoopVecComponentType::SignedInt8Packed, + 4, + matrix, + 0, + CoopVecComponentType::SignedInt8, + bias, + 0, + CoopVecComponentType::SignedInt32, + CoopVecMatrixLayout::RowMajor, + false, + 4 + ); + + for(int i = 0; i < result.getCount(); ++i) + outputBuffer[i] = result[i];; +} diff --git a/tests/cooperative-vector/matrix-mul-bias-rw.slang b/tests/cooperative-vector/matrix-mul-bias-rw.slang new file mode 100644 index 000000000..ac80af360 --- /dev/null +++ b/tests/cooperative-vector/matrix-mul-bias-rw.slang @@ -0,0 +1,47 @@ +//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -xslang -skip-spirv-validation +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type + +// Disabled because HLSL doesn't support int8 +//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -dx12-experimental -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. + +// CHECK: type: int32_t +// CHECK-NEXT: 35 +// CHECK-NEXT: 76 +// CHECK-NEXT: 117 +// CHECK-NEXT: 158 + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer +RWStructuredBuffer outputBuffer; + +//TEST_INPUT:ubuffer(data=[67305985], stride=4),name=input +//[1 2 3 4] +ByteAddressBuffer input; + +//TEST_INPUT:ubuffer(data=[67305985 134678021 202050057 269422093], stride=4),name=matrix +//[1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16] +RWByteAddressBuffer matrix; + +//TEST_INPUT:ubuffer(data=[5 6 7 8], stride=4),name=bias +RWByteAddressBuffer bias; + +[numthreads(1, 1, 1)] +void computeMain() +{ + CoopVec vec = coopVecLoad<4, int8_t>(input); + CoopVec result = coopVecMatMulAdd( + vec, + CoopVecComponentType::SignedInt8, + matrix, + 0, + CoopVecComponentType::SignedInt8, + bias, + 0, + CoopVecComponentType::SignedInt32, + CoopVecMatrixLayout::RowMajor, + false, + 4 + ); + + for(int i = 0; i < result.getCount(); ++i) + outputBuffer[i] = result[i];; +} diff --git a/tests/cooperative-vector/matrix-mul-bias-rwbyteaddress-packed.slang b/tests/cooperative-vector/matrix-mul-bias-rwbyteaddress-packed.slang new file mode 100644 index 000000000..40b967bdd --- /dev/null +++ b/tests/cooperative-vector/matrix-mul-bias-rwbyteaddress-packed.slang @@ -0,0 +1,49 @@ +//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -xslang -skip-spirv-validation +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type + +// Disabled because HLSL can't multiply from *RW*ByteAddressBuffers +//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -dx12-experimental -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. + +// CHECK: type: int32_t +// CHECK-NEXT: 35 +// CHECK-NEXT: 76 +// CHECK-NEXT: 117 +// CHECK-NEXT: 158 + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer +RWStructuredBuffer outputBuffer; + +//TEST_INPUT:ubuffer(data=[67305985], stride=4),name=input +//[1 2 3 4] +ByteAddressBuffer input; + +//TEST_INPUT:ubuffer(data=[67305985 134678021 202050057 269422093], stride=4),name=matrix +//[1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16] +RWByteAddressBuffer matrix; + +//TEST_INPUT:ubuffer(data=[5 6 7 8], stride=4),name=bias +RWByteAddressBuffer bias; + +[numthreads(1, 1, 1)] +void computeMain() +{ + let vec = coopVecLoad<1, int32_t>(input); + CoopVec result = coopVecMatMulAddPacked( + vec, + CoopVecComponentType::SignedInt8Packed, + 4, + matrix, + 0, + CoopVecComponentType::SignedInt8, + bias, + 0, + CoopVecComponentType::SignedInt32, + CoopVecMatrixLayout::RowMajor, + false, + 4 + ); + + for(int i = 0; i < result.getCount(); ++i) + outputBuffer[i] = result[i];; +} + diff --git a/tests/cooperative-vector/matrix-mul-bias-structuredbuffer-packed.slang b/tests/cooperative-vector/matrix-mul-bias-structuredbuffer-packed.slang new file mode 100644 index 000000000..899720973 --- /dev/null +++ b/tests/cooperative-vector/matrix-mul-bias-structuredbuffer-packed.slang @@ -0,0 +1,47 @@ +//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -xslang -skip-spirv-validation + +// These platforms don't support these operations from structured buffers +//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type +//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -dx12-experimental -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. + +// CHECK: type: int32_t +// CHECK-NEXT: 35 +// CHECK-NEXT: 76 +// CHECK-NEXT: 117 +// CHECK-NEXT: 158 + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer +RWStructuredBuffer outputBuffer; + +//TEST_INPUT:ubuffer(data=[67305985], stride=4),name=input +//[1 2 3 4] +StructuredBuffer input; + +//TEST_INPUT:ubuffer(data=[67305985 134678021 202050057 269422093], stride=4),name=matrix +//[1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16] +StructuredBuffer matrix; + +//TEST_INPUT:ubuffer(data=[5 6 7 8], stride=4),name=bias +StructuredBuffer bias; + +[numthreads(1, 1, 1)] +void computeMain() +{ + let vec = coopVecLoad<1>(input); + let result = coopVecMatMulAddPacked( + vec, + CoopVecComponentType::SignedInt8Packed, + 4, + matrix, + 0, + CoopVecComponentType::SignedInt8, + bias, + 0, + CoopVecComponentType::SignedInt32, + CoopVecMatrixLayout::RowMajor, + false, + 4 + ); + + result.store(outputBuffer); +} diff --git a/tests/cooperative-vector/matrix-mul-bias.slang b/tests/cooperative-vector/matrix-mul-bias.slang new file mode 100644 index 000000000..3bc05d7cc --- /dev/null +++ b/tests/cooperative-vector/matrix-mul-bias.slang @@ -0,0 +1,47 @@ +//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -xslang -skip-spirv-validation +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type + +// Disabled because HLSL doesn't support int8 +//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -dx12-experimental -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. + +// CHECK: type: int32_t +// CHECK-NEXT: 35 +// CHECK-NEXT: 76 +// CHECK-NEXT: 117 +// CHECK-NEXT: 158 + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer +RWStructuredBuffer outputBuffer; + +//TEST_INPUT:ubuffer(data=[67305985], stride=4),name=input +//[1 2 3 4] +ByteAddressBuffer input; + +//TEST_INPUT:ubuffer(data=[67305985 134678021 202050057 269422093], stride=4),name=matrix +//[1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16] +ByteAddressBuffer matrix; + +//TEST_INPUT:ubuffer(data=[5 6 7 8], stride=4),name=bias +ByteAddressBuffer bias; + +[numthreads(1, 1, 1)] +void computeMain() +{ + CoopVec vec = coopVecLoad<4, int8_t>(input); + let result = coopVecMatMulAdd( + vec, + CoopVecComponentType::SignedInt8, + matrix, + 0, + CoopVecComponentType::SignedInt8, + bias, + 0, + CoopVecComponentType::SignedInt32, + CoopVecMatrixLayout::RowMajor, + false, + 4 + ); + + for(int i = 0; i < result.getCount(); ++i) + outputBuffer[i] = result[i];; +} diff --git a/tests/cooperative-vector/matrix-mul-byteaddress.slang b/tests/cooperative-vector/matrix-mul-byteaddress.slang new file mode 100644 index 000000000..4c0e246ef --- /dev/null +++ b/tests/cooperative-vector/matrix-mul-byteaddress.slang @@ -0,0 +1,40 @@ +//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -xslang -skip-spirv-validation +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type + +// Disabled because HLSL doesn't support int8 +//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -dx12-experimental -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. + +// CHECK: type: int32_t +// CHECK-NEXT: 30 +// CHECK-NEXT: 70 +// CHECK-NEXT: 110 +// CHECK-NEXT: 150 + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer +RWStructuredBuffer outputBuffer; +//TEST_INPUT:ubuffer(data=[67305985], stride=4),name=input +//[1 2 3 4] +ByteAddressBuffer input; + +//TEST_INPUT:ubuffer(data=[67305985 134678021 202050057 269422093], stride=4),name=matrix +//[1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16] +ByteAddressBuffer matrix; + +[numthreads(1, 1, 1)] +void computeMain() +{ + CoopVec vec = coopVecLoad<4, int8_t>(input); + let result = coopVecMatMul( + vec, + CoopVecComponentType::SignedInt8, + matrix, + 0, + CoopVecComponentType::SignedInt8, + CoopVecMatrixLayout::RowMajor, + false, + 4 + ); + + for(int i = 0; i < result.getCount(); ++i) + outputBuffer[i] = result[i];; +} diff --git a/tests/cooperative-vector/matrix-mul-mut.slang b/tests/cooperative-vector/matrix-mul-mut.slang new file mode 100644 index 000000000..e269e7892 --- /dev/null +++ b/tests/cooperative-vector/matrix-mul-mut.slang @@ -0,0 +1,41 @@ +//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -xslang -skip-spirv-validation +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type + +// Disabled because HLSL doesn't support int8 +//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -dx12-experimental -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. + +// CHECK: type: int32_t +// CHECK-NEXT: 31 +// CHECK-NEXT: 71 +// CHECK-NEXT: 111 +// CHECK-NEXT: 151 + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer +RWStructuredBuffer outputBuffer; +//TEST_INPUT:ubuffer(data=[67305985], stride=4),name=input +//[1 2 3 4] +ByteAddressBuffer input; + +//TEST_INPUT:ubuffer(data=[67305985 134678021 202050057 269422093], stride=4),name=matrix +//[1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16] +ByteAddressBuffer matrix; + +[numthreads(1, 1, 1)] +void computeMain() +{ + let vec = coopVecLoad<4, int8_t>(input); + var result = CoopVec(1); + result.matMulAccum( + vec, + CoopVecComponentType::SignedInt8, + matrix, + 0, + CoopVecComponentType::SignedInt8, + CoopVecMatrixLayout::RowMajor, + false, + 4 + ); + + for(int i = 0; i < result.getCount(); ++i) + outputBuffer[i] = result[i];; +} diff --git a/tests/cooperative-vector/matrix-mul-packed-mut.slang b/tests/cooperative-vector/matrix-mul-packed-mut.slang new file mode 100644 index 000000000..c71854467 --- /dev/null +++ b/tests/cooperative-vector/matrix-mul-packed-mut.slang @@ -0,0 +1,40 @@ +//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -xslang -skip-spirv-validation +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type +//Test(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. + +// CHECK: type: int32_t +// CHECK-NEXT: 31 +// CHECK-NEXT: 71 +// CHECK-NEXT: 111 +// CHECK-NEXT: 151 + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer +RWStructuredBuffer outputBuffer; +//TEST_INPUT:ubuffer(data=[67305985], stride=4),name=input +//[1 2 3 4] +ByteAddressBuffer input; + +//TEST_INPUT:ubuffer(data=[67305985 134678021 202050057 269422093], stride=4),name=matrix +//[1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16] +ByteAddressBuffer matrix; + +[numthreads(1, 1, 1)] +void computeMain() +{ + let vec = coopVecLoad<1, int32_t>(input); + var result = CoopVec(1); + result.matMulAccumPacked( + vec, + CoopVecComponentType::SignedInt8Packed, + 4, + matrix, + 0, + CoopVecComponentType::SignedInt8, + CoopVecMatrixLayout::RowMajor, + false, + 4 + ); + + for(int i = 0; i < result.getCount(); ++i) + outputBuffer[i] = result[i];; +} diff --git a/tests/cooperative-vector/matrix-mul-packed.slang b/tests/cooperative-vector/matrix-mul-packed.slang new file mode 100644 index 000000000..e56660561 --- /dev/null +++ b/tests/cooperative-vector/matrix-mul-packed.slang @@ -0,0 +1,39 @@ +//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -xslang -skip-spirv-validation +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type +//Test(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. + +// CHECK: type: int32_t +// CHECK-NEXT: 30 +// CHECK-NEXT: 70 +// CHECK-NEXT: 110 +// CHECK-NEXT: 150 + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer +RWStructuredBuffer outputBuffer; +//TEST_INPUT:ubuffer(data=[67305985], stride=4),name=input +//[1 2 3 4] +ByteAddressBuffer input; + +//TEST_INPUT:ubuffer(data=[67305985 134678021 202050057 269422093], stride=4),name=matrix +//[1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16] +ByteAddressBuffer matrix; + +[numthreads(1, 1, 1)] +void computeMain() +{ + let vec = coopVecLoad<1, int32_t>(input); + let result = coopVecMatMulPacked( + vec, + CoopVecComponentType::SignedInt8Packed, + 4, + matrix, + 0, + CoopVecComponentType::SignedInt8, + CoopVecMatrixLayout::RowMajor, + false, + 4 + ); + + for(int i = 0; i < result.getCount(); ++i) + outputBuffer[i] = result[i];; +} diff --git a/tests/cooperative-vector/matrix-mul-rw-packed.slang b/tests/cooperative-vector/matrix-mul-rw-packed.slang new file mode 100644 index 000000000..260cdd5bc --- /dev/null +++ b/tests/cooperative-vector/matrix-mul-rw-packed.slang @@ -0,0 +1,41 @@ +//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -xslang -skip-spirv-validation +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type + +// Disabled because HLSL can't multiply from *RW*ByteAddressBuffers +//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -dx12-experimental -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. + +// CHECK: type: int32_t +// CHECK-NEXT: 30 +// CHECK-NEXT: 70 +// CHECK-NEXT: 110 +// CHECK-NEXT: 150 + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer +RWStructuredBuffer outputBuffer; +//TEST_INPUT:ubuffer(data=[67305985], stride=4),name=input +//[1 2 3 4] +ByteAddressBuffer input; + +//TEST_INPUT:ubuffer(data=[67305985 134678021 202050057 269422093], stride=4),name=matrix +//[1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16] +RWByteAddressBuffer matrix; + +[numthreads(1, 1, 1)] +void computeMain() +{ + let vec = coopVecLoad<1, int32_t>(input); + CoopVec result = coopVecMatMulPacked( + vec, + CoopVecComponentType::SignedInt8Packed, + 4, + matrix, + 0, + CoopVecComponentType::SignedInt8, + CoopVecMatrixLayout::RowMajor, + false, + 4 + ); + + for(int i = 0; i < result.getCount(); ++i) + outputBuffer[i] = result[i];; +} diff --git a/tests/cooperative-vector/matrix-mul-rw.slang b/tests/cooperative-vector/matrix-mul-rw.slang new file mode 100644 index 000000000..887c66093 --- /dev/null +++ b/tests/cooperative-vector/matrix-mul-rw.slang @@ -0,0 +1,40 @@ +//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -xslang -skip-spirv-validation +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type + +// Disabled because HLSL doesn't support int8 +//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -dx12-experimental -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. + +// CHECK: type: int32_t +// CHECK-NEXT: 30 +// CHECK-NEXT: 70 +// CHECK-NEXT: 110 +// CHECK-NEXT: 150 + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer +RWStructuredBuffer outputBuffer; +//TEST_INPUT:ubuffer(data=[67305985], stride=4),name=input +//[1 2 3 4] +ByteAddressBuffer input; + +//TEST_INPUT:ubuffer(data=[67305985 134678021 202050057 269422093], stride=4),name=matrix +//[1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16] +RWByteAddressBuffer matrix; + +[numthreads(1, 1, 1)] +void computeMain() +{ + CoopVec vec = coopVecLoad<4, int8_t>(input); + CoopVec result = coopVecMatMul( + vec, + CoopVecComponentType::SignedInt8, + matrix, + 0, + CoopVecComponentType::SignedInt8, + CoopVecMatrixLayout::RowMajor, + false, + 4 + ); + + for(int i = 0; i < result.getCount(); ++i) + outputBuffer[i] = result[i];; +} diff --git a/tests/cooperative-vector/matrix-mul-rwbyteaddress-packed.slang b/tests/cooperative-vector/matrix-mul-rwbyteaddress-packed.slang new file mode 100644 index 000000000..260cdd5bc --- /dev/null +++ b/tests/cooperative-vector/matrix-mul-rwbyteaddress-packed.slang @@ -0,0 +1,41 @@ +//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -xslang -skip-spirv-validation +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type + +// Disabled because HLSL can't multiply from *RW*ByteAddressBuffers +//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -dx12-experimental -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. + +// CHECK: type: int32_t +// CHECK-NEXT: 30 +// CHECK-NEXT: 70 +// CHECK-NEXT: 110 +// CHECK-NEXT: 150 + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer +RWStructuredBuffer outputBuffer; +//TEST_INPUT:ubuffer(data=[67305985], stride=4),name=input +//[1 2 3 4] +ByteAddressBuffer input; + +//TEST_INPUT:ubuffer(data=[67305985 134678021 202050057 269422093], stride=4),name=matrix +//[1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16] +RWByteAddressBuffer matrix; + +[numthreads(1, 1, 1)] +void computeMain() +{ + let vec = coopVecLoad<1, int32_t>(input); + CoopVec result = coopVecMatMulPacked( + vec, + CoopVecComponentType::SignedInt8Packed, + 4, + matrix, + 0, + CoopVecComponentType::SignedInt8, + CoopVecMatrixLayout::RowMajor, + false, + 4 + ); + + for(int i = 0; i < result.getCount(); ++i) + outputBuffer[i] = result[i];; +} diff --git a/tests/cooperative-vector/matrix-mul-structuredbuffer-packed.slang b/tests/cooperative-vector/matrix-mul-structuredbuffer-packed.slang new file mode 100644 index 000000000..27d05a764 --- /dev/null +++ b/tests/cooperative-vector/matrix-mul-structuredbuffer-packed.slang @@ -0,0 +1,42 @@ +//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -xslang -skip-spirv-validation + +// These platforms don't support these operations from structured buffers +//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type +//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -dx12-experimental -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. + +// CHECK: type: int32_t +// CHECK-NEXT: 30 +// CHECK-NEXT: 70 +// CHECK-NEXT: 110 +// CHECK-NEXT: 150 + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer +RWStructuredBuffer outputBuffer; + +//TEST_INPUT:ubuffer(data=[67305985], stride=4),name=input +//[1 2 3 4] +StructuredBuffer input; + +//TEST_INPUT:ubuffer(data=[67305985 134678021 202050057 269422093], stride=4),name=matrix +//[1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16] +StructuredBuffer matrix; + +[numthreads(1, 1, 1)] +void computeMain() +{ + let vec = coopVecLoad<1, int32_t>(input); + let result = coopVecMatMulPacked( + vec, + CoopVecComponentType::SignedInt8Packed, + 4, + matrix, + 0, + CoopVecComponentType::SignedInt8, + CoopVecMatrixLayout::RowMajor, + false, + 4 + ); + + for(int i = 0; i < result.getCount(); ++i) + outputBuffer[i] = result[i];; +} diff --git a/tests/cooperative-vector/matrix-mul.slang b/tests/cooperative-vector/matrix-mul.slang new file mode 100644 index 000000000..b34556695 --- /dev/null +++ b/tests/cooperative-vector/matrix-mul.slang @@ -0,0 +1,40 @@ +//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -xslang -skip-spirv-validation +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type + +// Disabled because HLSL doesn't support int8 +//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -dx12-experimental -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. + +// CHECK: type: int32_t +// CHECK-NEXT: 30 +// CHECK-NEXT: 70 +// CHECK-NEXT: 110 +// CHECK-NEXT: 150 + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer +RWStructuredBuffer outputBuffer; +//TEST_INPUT:ubuffer(data=[67305985], stride=4),name=input +//[1 2 3 4] +ByteAddressBuffer input; + +//TEST_INPUT:ubuffer(data=[67305985 134678021 202050057 269422093], stride=4),name=matrix +//[1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16] +ByteAddressBuffer matrix; + +[numthreads(1, 1, 1)] +void computeMain() +{ + let vec = coopVecLoad<4, int8_t>(input); + let result = coopVecMatMul( + vec, + CoopVecComponentType::SignedInt8, + matrix, + 0, + CoopVecComponentType::SignedInt8, + CoopVecMatrixLayout::RowMajor, + false, + 4 + ); + + for(int i = 0; i < result.getCount(); ++i) + outputBuffer[i] = result[i];; +} diff --git a/tests/cooperative-vector/max.slang b/tests/cooperative-vector/max.slang new file mode 100644 index 000000000..e7b22c1dc --- /dev/null +++ b/tests/cooperative-vector/max.slang @@ -0,0 +1,30 @@ +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -xslang -skip-spirv-validation +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -dx12-experimental -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type + +// CHECK: type: float +// CHECK-NEXT: 5.0 +// CHECK-NEXT: 4.0 +// CHECK-NEXT: 3.0 +// CHECK-NEXT: 4.0 + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer +RWStructuredBuffer outputBuffer; + +//TEST_INPUT:ubuffer(data=[1.0 2.0 3.0 4.0], stride=4),name=input1 +ByteAddressBuffer input1; + +//TEST_INPUT:ubuffer(data=[5.0 4.0 2.0 1.0], stride=4),name=input2 +ByteAddressBuffer input2; + +[numthreads(1, 1, 1)] +void computeMain() +{ + CoopVec vec1 = coopVecLoad<4, float>(input1); + CoopVec vec2 = coopVecLoad<4, float>(input2); + + CoopVec result = max(vec1, vec2); + + for(int i = 0; i < result.getCount(); ++i) + outputBuffer[i] = result[i];; +} diff --git a/tests/cooperative-vector/min.slang b/tests/cooperative-vector/min.slang new file mode 100644 index 000000000..d4142c2e8 --- /dev/null +++ b/tests/cooperative-vector/min.slang @@ -0,0 +1,30 @@ +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -xslang -skip-spirv-validation +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -dx12-experimental -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type + +// CHECK: type: float +// CHECK-NEXT: 1.000000 +// CHECK-NEXT: 2.000000 +// CHECK-NEXT: 3.000000 +// CHECK-NEXT: 2.000000 + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer +RWStructuredBuffer outputBuffer; + +//TEST_INPUT:ubuffer(data=[1.0 2.0 3.0 4.0], stride=4),name=input1 +ByteAddressBuffer input1; + +//TEST_INPUT:ubuffer(data=[5.0 4.0 3.0 2.0], stride=4),name=input2 +ByteAddressBuffer input2; + +[numthreads(1, 1, 1)] +void computeMain() +{ + CoopVec vec1 = coopVecLoad<4, float>(input1); + CoopVec vec2 = coopVecLoad<4, float>(input2); + + CoopVec result = min(vec1, vec2); + + for(int i = 0; i < result.getCount(); ++i) + outputBuffer[i] = result[i];; +} diff --git a/tests/cooperative-vector/mod.slang b/tests/cooperative-vector/mod.slang new file mode 100644 index 000000000..79409caf3 --- /dev/null +++ b/tests/cooperative-vector/mod.slang @@ -0,0 +1,46 @@ +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -xslang -skip-spirv-validation -emit-spirv-directly +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -dx12-experimental -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu + +// CHECK: 0 +// CHECK-NEXT: 0 +// CHECK-NEXT: 1 +// CHECK-NEXT: 2 +// CHECK-NEXT: 0 +// CHECK-NEXT: 0 +// CHECK-NEXT: 1 +// CHECK-NEXT: 2 +// CHECK-NEXT: 0 +// CHECK-NEXT: 0 +// CHECK-NEXT: 1 +// CHECK-NEXT: 2 + +//TEST_INPUT:ubuffer(data=[0 0 0 0 0 0 0 0 0 0 0 0], stride=4):out,name=outputBuffer +RWByteAddressBuffer outputBuffer; + +//TEST_INPUT:ubuffer(data=[4 3 5 7], stride=4),name=input1 +ByteAddressBuffer input1; + +//TEST_INPUT:ubuffer(data=[2 3 4 5], stride=4),name=input2 +ByteAddressBuffer input2; + +[numthreads(1, 1, 1)] +void computeMain() +{ + let vec1 = coopVecLoad<4, int32_t>(input1); + let vec2 = coopVecLoad<4, int32_t>(input2); + + let vec3 = CoopVec(vec1); + let vec4 = CoopVec(vec2); + + let vec5 = CoopVec(vec1); + let vec6 = CoopVec(vec2); + + let result = vec1 % vec2; + let result2 = CoopVec(vec3 % vec4); + let result3 = CoopVec(vec5 % vec6); + + result.store(outputBuffer); + result2.store(outputBuffer, 16); + result3.store(outputBuffer, 32); +} diff --git a/tests/cooperative-vector/mul.slang b/tests/cooperative-vector/mul.slang new file mode 100644 index 000000000..6b9c85c12 --- /dev/null +++ b/tests/cooperative-vector/mul.slang @@ -0,0 +1,30 @@ +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -xslang -skip-spirv-validation +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -dx12-experimental -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type + +// CHECK: type: int32_t +// CHECK-NEXT: 2 +// CHECK-NEXT: 6 +// CHECK-NEXT: 12 +// CHECK-NEXT: 20 + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer +RWStructuredBuffer outputBuffer; + +//TEST_INPUT:ubuffer(data=[1 2 3 4], stride=4),name=input1 +ByteAddressBuffer input1; + +//TEST_INPUT:ubuffer(data=[2 3 4 5], stride=4),name=input2 +ByteAddressBuffer input2; + +[numthreads(1, 1, 1)] +void computeMain() +{ + CoopVec vec1 = coopVecLoad<4, int32_t>(input1); + CoopVec vec2 = coopVecLoad<4, int32_t>(input2); + + CoopVec result = vec1 * vec2; + + for(int i = 0; i < result.getCount(); ++i) + outputBuffer[i] = result[i];; +} diff --git a/tests/cooperative-vector/out.slang b/tests/cooperative-vector/out.slang new file mode 100644 index 000000000..ec1bd44ac --- /dev/null +++ b/tests/cooperative-vector/out.slang @@ -0,0 +1,24 @@ +//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -xslang -skip-spirv-validation + +// CHECK: type: float +// CHECK-NEXT: 2.000000 +// CHECK-NEXT: 4.000000 +// CHECK-NEXT: 6.000000 +// CHECK-NEXT: 8.000000 + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer +RWStructuredBuffer outputBuffer; + +void doubleCoopVec(CoopVec vec, out CoopVec result) +{ + result = vec * 2.0; +} + +[numthreads(1, 1, 1)] +void computeMain() +{ + let vec = CoopVec(1.0, 2.0, 3.0, 4.0); + CoopVec result; + doubleCoopVec(vec, result); + result.store(outputBuffer, 0); +} diff --git a/tests/cooperative-vector/outer-product-structuredbuffer.slang b/tests/cooperative-vector/outer-product-structuredbuffer.slang new file mode 100644 index 000000000..0a862ffd2 --- /dev/null +++ b/tests/cooperative-vector/outer-product-structuredbuffer.slang @@ -0,0 +1,69 @@ +//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type + +// These platforms don't support these operations into structured buffers +//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -dx12-experimental -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. +//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type + +// CHECK: type: half +// CHECK-NEXT: 112.000000 +// CHECK-NEXT: 2.000000 +// CHECK-NEXT: 3.000000 +// CHECK-NEXT: 4.000000 +// CHECK-NEXT: 5.000000 +// CHECK-NEXT: 6.000000 +// CHECK-NEXT: 7.000000 +// CHECK-NEXT: 8.000000 +// CHECK-NEXT: 2.000000 +// CHECK-NEXT: 4.000000 +// CHECK-NEXT: 6.000000 +// CHECK-NEXT: 8.000000 +// CHECK-NEXT: 10.000000 +// CHECK-NEXT: 12.000000 +// CHECK-NEXT: 14.000000 +// CHECK-NEXT: 16.000000 +// CHECK-NEXT: 3.000000 +// CHECK-NEXT: 6.000000 +// CHECK-NEXT: 9.000000 +// CHECK-NEXT: 12.000000 +// CHECK-NEXT: 15.000000 +// CHECK-NEXT: 18.000000 +// CHECK-NEXT: 21.000000 +// CHECK-NEXT: 24.000000 +// CHECK-NEXT: 4.000000 +// CHECK-NEXT: 8.000000 +// CHECK-NEXT: 12.000000 +// CHECK-NEXT: 16.000000 +// CHECK-NEXT: 20.000000 +// CHECK-NEXT: 24.000000 +// CHECK-NEXT: 28.000000 +// CHECK-NEXT: 32.000000 + +//TEST_INPUT:ubuffer(data=[ 0x40003C00 0x44004200 ], stride=4),name=inputA +// [1,2,3,4] +StructuredBuffer inputA; + +//TEST_INPUT:ubuffer(data=[ 0x40003C00 0x44004200 0x46004500 0x48004700 ], stride=4),name=inputB +// [1,2,3,4,5,6,7,8] +StructuredBuffer inputB; + +//TEST_INPUT:ubuffer(data=[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0], stride=4):out,name=output +RWStructuredBuffer output; + +[numthreads(1, 1, 1)] +void computeMain() +{ + let vecA = coopVecLoad<4>(inputA); + let vecB = coopVecLoad<8>(inputB); + + output[0] = half(111); + + coopVecOuterProductAccumulate( + vecA, + vecB, + output, + 0, + 32, + CoopVecMatrixLayout::RowMajor, + CoopVecComponentType::Float16, + ); +} diff --git a/tests/cooperative-vector/outer-product.slang b/tests/cooperative-vector/outer-product.slang new file mode 100644 index 000000000..77f9422a9 --- /dev/null +++ b/tests/cooperative-vector/outer-product.slang @@ -0,0 +1,73 @@ +//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type + +// HLSL doesn't support the training operations +//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -dx12-experimental -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. + +// Disabled because of some pecularities stemming from our lowering of half to float +//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type + +// CHECK: type: half +// CHECK-NEXT: 112.000000 +// CHECK-NEXT: 2.000000 +// CHECK-NEXT: 3.000000 +// CHECK-NEXT: 4.000000 +// CHECK-NEXT: 5.000000 +// CHECK-NEXT: 6.000000 +// CHECK-NEXT: 7.000000 +// CHECK-NEXT: 8.000000 +// CHECK-NEXT: 2.000000 +// CHECK-NEXT: 4.000000 +// CHECK-NEXT: 6.000000 +// CHECK-NEXT: 8.000000 +// CHECK-NEXT: 10.000000 +// CHECK-NEXT: 12.000000 +// CHECK-NEXT: 14.000000 +// CHECK-NEXT: 16.000000 +// CHECK-NEXT: 3.000000 +// CHECK-NEXT: 6.000000 +// CHECK-NEXT: 9.000000 +// CHECK-NEXT: 12.000000 +// CHECK-NEXT: 15.000000 +// CHECK-NEXT: 18.000000 +// CHECK-NEXT: 21.000000 +// CHECK-NEXT: 24.000000 +// CHECK-NEXT: 4.000000 +// CHECK-NEXT: 8.000000 +// CHECK-NEXT: 12.000000 +// CHECK-NEXT: 16.000000 +// CHECK-NEXT: 20.000000 +// CHECK-NEXT: 24.000000 +// CHECK-NEXT: 28.000000 +// CHECK-NEXT: 32.000000 + +//TEST_INPUT:ubuffer(data=[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0], stride=2):out,name=outputBuffer +RWStructuredBuffer outputBuffer; + +//TEST_INPUT:ubuffer(data=[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0], stride=4),name=output +RWByteAddressBuffer output; + +[numthreads(1, 1, 1)] +void computeMain() +{ + CoopVec vecA; + CoopVec vecB; + for(int i = 0; i < vecA.getCount(); ++i) + vecA[i] = half(i+1); + for(int i = 0; i < vecB.getCount(); ++i) + vecB[i] = half(i+1); + + output.Store(0, half(111)); + + coopVecOuterProductAccumulate( + vecA, + vecB, + output, + 0, + 32, + CoopVecMatrixLayout::RowMajor, + CoopVecComponentType::Float16, + ); + + for(int i = 0; i < vecA.getCount() * vecB.getCount(); ++i) + outputBuffer[i] = output.Load(i * 2); +} diff --git a/tests/cooperative-vector/parameter.slang b/tests/cooperative-vector/parameter.slang new file mode 100644 index 000000000..91e405c45 --- /dev/null +++ b/tests/cooperative-vector/parameter.slang @@ -0,0 +1,22 @@ +//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -xslang -skip-spirv-validation + +// CHECK: type: float +// CHECK-NEXT: 2.000000 +// CHECK-NEXT: 4.000000 +// CHECK-NEXT: 6.000000 +// CHECK-NEXT: 8.000000 + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer +RWStructuredBuffer outputBuffer; + +void processCoopVec(CoopVec vec) +{ + (vec * 2.0).store(outputBuffer, 0); +} + +[numthreads(1, 1, 1)] +void computeMain() +{ + let vec = CoopVec(1.0, 2.0, 3.0, 4.0); + processCoopVec(vec); +} diff --git a/tests/cooperative-vector/reduce-sum-accumulate-structuredbuffer.slang b/tests/cooperative-vector/reduce-sum-accumulate-structuredbuffer.slang new file mode 100644 index 000000000..99964434e --- /dev/null +++ b/tests/cooperative-vector/reduce-sum-accumulate-structuredbuffer.slang @@ -0,0 +1,41 @@ +//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -xslang -skip-spirv-validation +///TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type + +// HLSL doesn't support the training operations +//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -dx12-experimental -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. + +// CHECK: type: half +// CHECK-NEXT: 112.000000 +// CHECK-NEXT: 2.000000 +// CHECK-NEXT: 3.000000 +// CHECK-NEXT: 4.000000 + + +//TEST_INPUT:ubuffer(data=[0 0 0 0 ], stride=2):out,name=outputBuffer +RWStructuredBuffer outputBuffer; + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4),name=inputA +ByteAddressBuffer inputA; + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4),name=output +RWByteAddressBuffer output; + +[numthreads(1, 1, 1)] +void computeMain() +{ + CoopVec vecA; + for(int i = 0; i < vecA.getCount(); ++i) + vecA[i] = half(i+1); + + output.Store(0, half(111)); + + coopVecReduceSumAccumulate( + vecA, + output, + 0, + ); + + for(int i = 0; i < vecA.getCount(); ++i) + outputBuffer[i] = output.Load(i * 2); +} + diff --git a/tests/cooperative-vector/reduce-sum-accumulate.slang b/tests/cooperative-vector/reduce-sum-accumulate.slang new file mode 100644 index 000000000..99964434e --- /dev/null +++ b/tests/cooperative-vector/reduce-sum-accumulate.slang @@ -0,0 +1,41 @@ +//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -xslang -skip-spirv-validation +///TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type + +// HLSL doesn't support the training operations +//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -dx12-experimental -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. + +// CHECK: type: half +// CHECK-NEXT: 112.000000 +// CHECK-NEXT: 2.000000 +// CHECK-NEXT: 3.000000 +// CHECK-NEXT: 4.000000 + + +//TEST_INPUT:ubuffer(data=[0 0 0 0 ], stride=2):out,name=outputBuffer +RWStructuredBuffer outputBuffer; + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4),name=inputA +ByteAddressBuffer inputA; + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4),name=output +RWByteAddressBuffer output; + +[numthreads(1, 1, 1)] +void computeMain() +{ + CoopVec vecA; + for(int i = 0; i < vecA.getCount(); ++i) + vecA[i] = half(i+1); + + output.Store(0, half(111)); + + coopVecReduceSumAccumulate( + vecA, + output, + 0, + ); + + for(int i = 0; i < vecA.getCount(); ++i) + outputBuffer[i] = output.Load(i * 2); +} + diff --git a/tests/cooperative-vector/return.slang b/tests/cooperative-vector/return.slang new file mode 100644 index 000000000..b5c7b52a7 --- /dev/null +++ b/tests/cooperative-vector/return.slang @@ -0,0 +1,23 @@ +//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -xslang -skip-spirv-validation + +// CHECK: type: float +// CHECK-NEXT: 2.000000 +// CHECK-NEXT: 4.000000 +// CHECK-NEXT: 6.000000 +// CHECK-NEXT: 8.000000 + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer +RWStructuredBuffer outputBuffer; + +CoopVec doubleCoopVec(CoopVec vec) +{ + return vec * 2.0; +} + +[numthreads(1, 1, 1)] +void computeMain() +{ + let vec = CoopVec(1.0, 2.0, 3.0, 4.0); + let result = doubleCoopVec(vec); + result.store(outputBuffer, 0); +} diff --git a/tests/cooperative-vector/scalar-mul.slang b/tests/cooperative-vector/scalar-mul.slang new file mode 100644 index 000000000..e3e92abf8 --- /dev/null +++ b/tests/cooperative-vector/scalar-mul.slang @@ -0,0 +1,25 @@ +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -xslang -skip-spirv-validation +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -dx12-experimental -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type + +// CHECK: type: float +// CHECK-NEXT: 2.000000 +// CHECK-NEXT: 4.000000 +// CHECK-NEXT: 6.000000 +// CHECK-NEXT: 8.000000 + +//TEST_INPUT:ubuffer(data=[1.0 2.0 3.0 4.0], stride=4),name=input1 +ByteAddressBuffer input1; + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer +RWStructuredBuffer outputBuffer; + +[numthreads(1, 1, 1)] +void computeMain() +{ + CoopVec vec = coopVecLoad<4, float>(input1); + CoopVec result = vec * 2.0; + + for(int i = 0; i < result.getCount(); ++i) + outputBuffer[i] = result[i];; +} diff --git a/tests/cooperative-vector/simple.slang b/tests/cooperative-vector/simple.slang new file mode 100644 index 000000000..6456be1a4 --- /dev/null +++ b/tests/cooperative-vector/simple.slang @@ -0,0 +1,24 @@ +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -xslang -skip-spirv-validation +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -dx12-experimental -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type + +// CHECK: type: int32_t +// CHECK-NEXT: 1 +// CHECK-NEXT: 2 +// CHECK-NEXT: 3 +// CHECK-NEXT: 4 + +//TEST_INPUT:ubuffer(data=[1 2 3 4], stride=4),name=buf +ByteAddressBuffer inputBuffer; + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer +RWStructuredBuffer outputBuffer; + +[numthreads(1, 1, 1)] +void computeMain() +{ + var result = coopVecLoad<4, int32_t>(inputBuffer); + + for(int i = 0; i < result.getCount(); ++i) + outputBuffer[i] = result[i];; +} diff --git a/tests/cooperative-vector/step.slang b/tests/cooperative-vector/step.slang new file mode 100644 index 000000000..72fafd6a7 --- /dev/null +++ b/tests/cooperative-vector/step.slang @@ -0,0 +1,30 @@ +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -xslang -skip-spirv-validation +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -dx12-experimental -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type + +// CHECK: type: float +// CHECK-NEXT: 0.000000 +// CHECK-NEXT: 0.000000 +// CHECK-NEXT: 1.000000 +// CHECK-NEXT: 1.000000 + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer +RWStructuredBuffer outputBuffer; + +//TEST_INPUT:ubuffer(data=[2.0 3.0 4.0 5.0], stride=4),name=input1 +ByteAddressBuffer input1; + +//TEST_INPUT:ubuffer(data=[1.0 2.0 5.0 6.0], stride=4),name=input2 +ByteAddressBuffer input2; + +[numthreads(1, 1, 1)] +void computeMain() +{ + CoopVec edge = coopVecLoad<4, float>(input1); + CoopVec x = coopVecLoad<4, float>(input2); + + CoopVec result = step(edge, x); + + for(int i = 0; i < result.getCount(); ++i) + outputBuffer[i] = result[i];; +} diff --git a/tests/cooperative-vector/struct.slang b/tests/cooperative-vector/struct.slang new file mode 100644 index 000000000..6f6b8a4f9 --- /dev/null +++ b/tests/cooperative-vector/struct.slang @@ -0,0 +1,31 @@ +//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -xslang -skip-spirv-validation + +// CHECK: type: float +// CHECK-NEXT: 1.000000 +// CHECK-NEXT: 2.000000 +// CHECK-NEXT: 3.000000 +// CHECK-NEXT: 4.000000 +// CHECK-NEXT: 5.000000 +// CHECK-NEXT: 6.000000 +// CHECK-NEXT: 7.000000 +// CHECK-NEXT: 8.000000 + +//TEST_INPUT:ubuffer(data=[0 0 0 0 0 0 0 0], stride=4):out,name=outputBuffer +RWStructuredBuffer outputBuffer; + +struct MyStruct +{ + CoopVec vec1; + CoopVec vec2; +}; + +[numthreads(1, 1, 1)] +void computeMain() +{ + MyStruct s; + s.vec1 = CoopVec(1.0, 2.0, 3.0, 4.0); + s.vec2 = CoopVec(5.0, 6.0, 7.0, 8.0); + + s.vec1.store(outputBuffer, 0); + s.vec2.store(outputBuffer, 16); +} diff --git a/tests/cooperative-vector/sub.slang b/tests/cooperative-vector/sub.slang new file mode 100644 index 000000000..b438b4cf3 --- /dev/null +++ b/tests/cooperative-vector/sub.slang @@ -0,0 +1,30 @@ +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -xslang -skip-spirv-validation +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -dx12-experimental -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type + +// CHECK: type: int32_t +// CHECK-NEXT: 1 +// CHECK-NEXT: 1 +// CHECK-NEXT: 1 +// CHECK-NEXT: 1 + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer +RWStructuredBuffer outputBuffer; + +//TEST_INPUT:ubuffer(data=[2 3 4 5], stride=4),name=input1 +ByteAddressBuffer input1; + +//TEST_INPUT:ubuffer(data=[1 2 3 4], stride=4),name=input2 +ByteAddressBuffer input2; + +[numthreads(1, 1, 1)] +void computeMain() +{ + CoopVec vec1 = coopVecLoad<4, int32_t>(input1); + CoopVec vec2 = coopVecLoad<4, int32_t>(input2); + + CoopVec result = vec1 - vec2; + + for(int i = 0; i < result.getCount(); ++i) + outputBuffer[i] = result[i];; +} diff --git a/tests/cooperative-vector/subscript-in-func.slang b/tests/cooperative-vector/subscript-in-func.slang new file mode 100644 index 000000000..74c7f86c3 --- /dev/null +++ b/tests/cooperative-vector/subscript-in-func.slang @@ -0,0 +1,26 @@ +//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -xslang -skip-spirv-validation + +// CHECK: type: float +// CHECK-NEXT: 1.000000 +// CHECK-NEXT: 4.000000 +// CHECK-NEXT: 9.000000 +// CHECK-NEXT: 16.000000 + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer +RWStructuredBuffer outputBuffer; + +void squareCoopVecElements(CoopVec vec) +{ + for (int i = 0; i < 4; ++i) + { + vec[i] = vec[i] * vec[i]; + } + vec.store(outputBuffer, 0); +} + +[numthreads(1, 1, 1)] +void computeMain() +{ + CoopVec vec = CoopVec(1.0, 2.0, 3.0, 4.0); + squareCoopVecElements(vec); +} diff --git a/tests/cooperative-vector/subscript.slang b/tests/cooperative-vector/subscript.slang new file mode 100644 index 000000000..1d41bec62 --- /dev/null +++ b/tests/cooperative-vector/subscript.slang @@ -0,0 +1,25 @@ +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -xslang -skip-spirv-validation -emit-spirv-directly +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -dx12-experimental -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type + +// CHECK: type: int32_t +// CHECK-NEXT: 2 +// CHECK-NEXT: 4 +// CHECK-NEXT: 6 +// CHECK-NEXT: 8 + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer +RWStructuredBuffer outputBuffer; + +[numthreads(1, 1, 1)] +void computeMain() +{ + CoopVec vec; + vec[0] = 2; + vec[1] = vec[0]+2; + vec[2] = vec[1]+2; + vec[3] = vec[2]+2; + + for(int i = 0; i < vec.getCount(); ++i) + outputBuffer[i] = vec[i];; +} diff --git a/tests/cooperative-vector/tanh.slang b/tests/cooperative-vector/tanh.slang new file mode 100644 index 000000000..8091aea0c --- /dev/null +++ b/tests/cooperative-vector/tanh.slang @@ -0,0 +1,28 @@ +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -xslang -skip-spirv-validation +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -dx12-experimental -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type + +// Hilariously low precision because the different APIs don't agree (they're +// not specced to of course, so it's ok) +// CHECK: type: float +// CHECK-NEXT: 0.761 +// CHECK-NEXT: 0.964 +// CHECK-NEXT: 0.995 +// CHECK-NEXT: 0.999 + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer +RWStructuredBuffer outputBuffer; + +//TEST_INPUT:ubuffer(data=[1.0 2.0 3.0 4.0], stride=4),name=input +ByteAddressBuffer input; + +[numthreads(1, 1, 1)] +void computeMain() +{ + CoopVec vec = coopVecLoad<4, float>(input); + + CoopVec result = tanh(vec); + + for(int i = 0; i < result.getCount(); ++i) + outputBuffer[i] = result[i];; +} diff --git a/tests/cooperative-vector/unary.slang b/tests/cooperative-vector/unary.slang new file mode 100644 index 000000000..d9b81cec5 --- /dev/null +++ b/tests/cooperative-vector/unary.slang @@ -0,0 +1,25 @@ +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -xslang -skip-spirv-validation -xslang -skip-spirv-validation +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -dx12-experimental -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type + +// CHECK: type: int32_t +// CHECK-NEXT: -1 +// CHECK-NEXT: -2 +// CHECK-NEXT: -3 +// CHECK-NEXT: -4 + +//TEST_INPUT:ubuffer(data=[1 2 3 4], stride=4),name=input1 +ByteAddressBuffer input1; + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer +RWStructuredBuffer outputBuffer; + +[numthreads(1, 1, 1)] +void computeMain() +{ + CoopVec vec1 = coopVecLoad<4, int32_t>(input1); + CoopVec negVec = -vec1; + + for(int i = 0; i < negVec.getCount(); ++i) + outputBuffer[i] = negVec[i];; +} diff --git a/tests/cooperative-vector/variadic-init-bad-length.slang b/tests/cooperative-vector/variadic-init-bad-length.slang new file mode 100644 index 000000000..1f4c92d29 --- /dev/null +++ b/tests/cooperative-vector/variadic-init-bad-length.slang @@ -0,0 +1,14 @@ +//DIAGNOSTIC_TEST:SIMPLE(filecheck=CHECK): -target spirv + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer +RWStructuredBuffer outputBuffer; + +[numthreads(1, 1, 1)] +void computeMain() +{ + let result = CoopVec(1,2,3,4,5); + // CHECK: error 41400: static assertion failed, number of arguments to CoopVec constructor must match number of elements + + for(int i = 0; i < result.getCount(); ++i) + outputBuffer[i] = result[i];; +} diff --git a/tests/cooperative-vector/variadic-init-cast.slang b/tests/cooperative-vector/variadic-init-cast.slang new file mode 100644 index 000000000..5d9778345 --- /dev/null +++ b/tests/cooperative-vector/variadic-init-cast.slang @@ -0,0 +1,20 @@ +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -emit-spirv-directly +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -dx12-experimental -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type + +// CHECK: type: float +// CHECK-NEXT: 1.0 +// CHECK-NEXT: 2.0 +// CHECK-NEXT: 3.0 +// CHECK-NEXT: 4.0 + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer +RWStructuredBuffer outputBuffer; + +[numthreads(1, 1, 1)] +void computeMain() +{ + let result = CoopVec(int(1),half(2),uint(3),double(4)); + for(int i = 0; i < result.getCount(); ++i) + outputBuffer[i] = result[i];; +} diff --git a/tests/cooperative-vector/variadic-init.slang b/tests/cooperative-vector/variadic-init.slang new file mode 100644 index 000000000..f101725fb --- /dev/null +++ b/tests/cooperative-vector/variadic-init.slang @@ -0,0 +1,20 @@ +//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -dx12-experimental -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type + +// CHECK: type: int32_t +// CHECK-NEXT: 1 +// CHECK-NEXT: 2 +// CHECK-NEXT: 3 +// CHECK-NEXT: 4 + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer +RWStructuredBuffer outputBuffer; + +[numthreads(1, 1, 1)] +void computeMain() +{ + let result = CoopVec(1,2,3,4); + for(int i = 0; i < result.getCount(); ++i) + outputBuffer[i] = result[i];; +} -- cgit v1.2.3