summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/cooperative-vector/CoopVec/add.slang30
-rw-r--r--tests/cooperative-vector/CoopVec/array.slang25
-rw-r--r--tests/cooperative-vector/CoopVec/atan.slang26
-rw-r--r--tests/cooperative-vector/CoopVec/clamp.slang28
-rw-r--r--tests/cooperative-vector/CoopVec/comparison.slang32
-rw-r--r--tests/cooperative-vector/CoopVec/conversion.slang28
-rw-r--r--tests/cooperative-vector/CoopVec/copyFrom.slang22
-rw-r--r--tests/cooperative-vector/CoopVec/div.slang30
-rw-r--r--tests/cooperative-vector/CoopVec/exp.slang27
-rw-r--r--tests/cooperative-vector/CoopVec/fill.slang21
-rw-r--r--tests/cooperative-vector/CoopVec/fma.slang34
-rw-r--r--tests/cooperative-vector/CoopVec/inout.slang23
-rw-r--r--tests/cooperative-vector/CoopVec/load-store-arbitrary-array-vec.slang35
-rw-r--r--tests/cooperative-vector/CoopVec/load-store-arbitrary-array.slang35
-rw-r--r--tests/cooperative-vector/CoopVec/load-store-groupshared.slang27
-rw-r--r--tests/cooperative-vector/CoopVec/load-store-rwbyteaddressbuffer.slang22
-rw-r--r--tests/cooperative-vector/CoopVec/load-store-rwstructuredbuffer.slang30
-rw-r--r--tests/cooperative-vector/CoopVec/log.slang26
-rw-r--r--tests/cooperative-vector/CoopVec/matrix-mul-bias-mut.slang48
-rw-r--r--tests/cooperative-vector/CoopVec/matrix-mul-bias-packed-mut.slang47
-rw-r--r--tests/cooperative-vector/CoopVec/matrix-mul-bias-packed.slang46
-rw-r--r--tests/cooperative-vector/CoopVec/matrix-mul-bias-rw-packed.slang48
-rw-r--r--tests/cooperative-vector/CoopVec/matrix-mul-bias-rw.slang47
-rw-r--r--tests/cooperative-vector/CoopVec/matrix-mul-bias-rwbyteaddress-packed.slang49
-rw-r--r--tests/cooperative-vector/CoopVec/matrix-mul-bias-structuredbuffer-packed.slang47
-rw-r--r--tests/cooperative-vector/CoopVec/matrix-mul-bias.slang47
-rw-r--r--tests/cooperative-vector/CoopVec/matrix-mul-byteaddress.slang40
-rw-r--r--tests/cooperative-vector/CoopVec/matrix-mul-mut.slang41
-rw-r--r--tests/cooperative-vector/CoopVec/matrix-mul-packed-mut.slang40
-rw-r--r--tests/cooperative-vector/CoopVec/matrix-mul-packed.slang39
-rw-r--r--tests/cooperative-vector/CoopVec/matrix-mul-rw-packed.slang41
-rw-r--r--tests/cooperative-vector/CoopVec/matrix-mul-rw.slang40
-rw-r--r--tests/cooperative-vector/CoopVec/matrix-mul-rwbyteaddress-packed.slang41
-rw-r--r--tests/cooperative-vector/CoopVec/matrix-mul-structuredbuffer-packed.slang42
-rw-r--r--tests/cooperative-vector/CoopVec/matrix-mul.slang40
-rw-r--r--tests/cooperative-vector/CoopVec/max.slang30
-rw-r--r--tests/cooperative-vector/CoopVec/min.slang30
-rw-r--r--tests/cooperative-vector/CoopVec/mod.slang46
-rw-r--r--tests/cooperative-vector/CoopVec/mul.slang30
-rw-r--r--tests/cooperative-vector/CoopVec/out.slang24
-rw-r--r--tests/cooperative-vector/CoopVec/outer-product-structuredbuffer.slang69
-rw-r--r--tests/cooperative-vector/CoopVec/outer-product.slang73
-rw-r--r--tests/cooperative-vector/CoopVec/parameter.slang22
-rw-r--r--tests/cooperative-vector/CoopVec/reduce-sum-accumulate-structuredbuffer.slang41
-rw-r--r--tests/cooperative-vector/CoopVec/reduce-sum-accumulate.slang41
-rw-r--r--tests/cooperative-vector/CoopVec/return.slang23
-rw-r--r--tests/cooperative-vector/CoopVec/scalar-mul.slang25
-rw-r--r--tests/cooperative-vector/CoopVec/simple.slang24
-rw-r--r--tests/cooperative-vector/CoopVec/step.slang30
-rw-r--r--tests/cooperative-vector/CoopVec/struct.slang31
-rw-r--r--tests/cooperative-vector/CoopVec/sub.slang30
-rw-r--r--tests/cooperative-vector/CoopVec/subscript-in-func.slang26
-rw-r--r--tests/cooperative-vector/CoopVec/subscript.slang25
-rw-r--r--tests/cooperative-vector/CoopVec/tanh.slang28
-rw-r--r--tests/cooperative-vector/CoopVec/unary.slang25
-rw-r--r--tests/cooperative-vector/CoopVec/variadic-init-bad-length.slang14
-rw-r--r--tests/cooperative-vector/CoopVec/variadic-init-cast.slang20
-rw-r--r--tests/cooperative-vector/CoopVec/variadic-init.slang20
-rw-r--r--tests/cooperative-vector/cast.slang30
-rw-r--r--tests/cooperative-vector/cast.slang.glsl23
-rw-r--r--tests/cooperative-vector/groupshared-sized.slang37
-rw-r--r--tests/cooperative-vector/groupshared-sized.slang.glsl38
-rw-r--r--tests/cooperative-vector/load-store.slang13
-rw-r--r--tests/cooperative-vector/load-store.slang.glsl20
-rw-r--r--tests/cooperative-vector/only-arith.slang18
-rw-r--r--tests/cooperative-vector/only-arith.slang.glsl16
-rw-r--r--tests/cooperative-vector/outer-product-accumulate.slang19
-rw-r--r--tests/cooperative-vector/outer-product-accumulate.slang.glsl17
-rw-r--r--tests/cooperative-vector/simple.slang35
-rw-r--r--tests/cooperative-vector/simple.slang.glsl20
70 files changed, 2257 insertions, 0 deletions
diff --git a/tests/cooperative-vector/CoopVec/add.slang b/tests/cooperative-vector/CoopVec/add.slang
new file mode 100644
index 000000000..082d19468
--- /dev/null
+++ b/tests/cooperative-vector/CoopVec/add.slang
@@ -0,0 +1,30 @@
+//DISABLE_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<int32_t> 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<int, 4> vec1 = coopVecLoad<4, int32_t>(input1);
+ CoopVec<int, 4> 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
new file mode 100644
index 000000000..b63ff2f91
--- /dev/null
+++ b/tests/cooperative-vector/CoopVec/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<float> outputBuffer;
+
+[numthreads(1, 1, 1)]
+void computeMain()
+{
+ CoopVec<float, 4> vecArray[2];
+ vecArray[0] = CoopVec<float, 4>(1.0, 2.0, 3.0, 4.0);
+ vecArray[1] = CoopVec<float, 4>(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
new file mode 100644
index 000000000..1dfd62986
--- /dev/null
+++ b/tests/cooperative-vector/CoopVec/atan.slang
@@ -0,0 +1,26 @@
+//DISABLE_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<float> 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<float, 4> vec = coopVecLoad<4, float>(input);
+
+ CoopVec<float, 4> 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
new file mode 100644
index 000000000..b5639eeb4
--- /dev/null
+++ b/tests/cooperative-vector/CoopVec/clamp.slang
@@ -0,0 +1,28 @@
+//DISABLE_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<float> 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<float, 4> vec = coopVecLoad<4, float>(input);
+ CoopVec<float, 4> minVal = CoopVec<float, 4>(2.0);
+ CoopVec<float, 4> maxVal = CoopVec<float, 4>(4.0);
+
+ CoopVec<float, 4> 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
new file mode 100644
index 000000000..b410176bc
--- /dev/null
+++ b/tests/cooperative-vector/CoopVec/comparison.slang
@@ -0,0 +1,32 @@
+//DISABLE_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<uint> outputBuffer;
+
+[numthreads(1, 1, 1)]
+void computeMain()
+{
+ CoopVec<float, 4> vec1 = coopVecLoad<4, float>(input1);
+ CoopVec<float, 4> 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
new file mode 100644
index 000000000..02d125f58
--- /dev/null
+++ b/tests/cooperative-vector/CoopVec/conversion.slang
@@ -0,0 +1,28 @@
+//DISABLE_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<float> 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<float, 4>(intVec);
+ let uintVec = CoopVec<uint, 4>(intVec);
+ let floatVec2 = CoopVec<float, 4>(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
new file mode 100644
index 000000000..eb8697d33
--- /dev/null
+++ b/tests/cooperative-vector/CoopVec/copyFrom.slang
@@ -0,0 +1,22 @@
+//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<int32_t> outputBuffer;
+
+[numthreads(1, 1, 1)]
+void computeMain()
+{
+ let v = CoopVec<float, 4>(1,2,3,4);
+ var result : CoopVec<int32_t, 4>;
+ 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
new file mode 100644
index 000000000..6708a54f1
--- /dev/null
+++ b/tests/cooperative-vector/CoopVec/div.slang
@@ -0,0 +1,30 @@
+//DISABLE_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<int32_t> 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<int, 4> vec1 = coopVecLoad<4, int32_t>(input1);
+ CoopVec<int, 4> vec2 = coopVecLoad<4, int32_t>(input2);
+
+ CoopVec<int, 4> 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
new file mode 100644
index 000000000..f2d3fe716
--- /dev/null
+++ b/tests/cooperative-vector/CoopVec/exp.slang
@@ -0,0 +1,27 @@
+//DISABLE_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<float> 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<float, 4> vec = coopVecLoad<4, float>(input);
+
+ CoopVec<float, 4> 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
new file mode 100644
index 000000000..fe36b4ed6
--- /dev/null
+++ b/tests/cooperative-vector/CoopVec/fill.slang
@@ -0,0 +1,21 @@
+//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: 10
+// CHECK-NEXT: 10
+// CHECK-NEXT: 10
+// CHECK-NEXT: 10
+
+//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer
+RWStructuredBuffer<int32_t> outputBuffer;
+
+[numthreads(1, 1, 1)]
+void computeMain()
+{
+ var result : CoopVec<int32_t, 4>;
+ 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
new file mode 100644
index 000000000..434cdef32
--- /dev/null
+++ b/tests/cooperative-vector/CoopVec/fma.slang
@@ -0,0 +1,34 @@
+//DISABLE_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<float> 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<float, 4> vec1 = coopVecLoad<4, float>(input1);
+ CoopVec<float, 4> vec2 = coopVecLoad<4, float>(input2);
+ CoopVec<float, 4> vec3 = coopVecLoad<4, float>(input3);
+
+ CoopVec<float, 4> 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
new file mode 100644
index 000000000..8181a2019
--- /dev/null
+++ b/tests/cooperative-vector/CoopVec/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<float> outputBuffer;
+
+void doubleCoopVec(inout CoopVec<float, 4> vec)
+{
+ vec = vec * 2.0;
+}
+
+[numthreads(1, 1, 1)]
+void computeMain()
+{
+ var vec = CoopVec<float, 4>(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
new file mode 100644
index 000000000..f577ae5f3
--- /dev/null
+++ b/tests/cooperative-vector/CoopVec/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<uint32_t> outputBuffer;
+
+groupshared float3[5] temp;
+
+[numthreads(1, 1, 1)]
+void computeMain()
+{
+ let vec = coopVecLoad<15, uint32_t>(input);
+ vec.storeAny(temp);
+ let result = CoopVec<uint32_t, 15>.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
new file mode 100644
index 000000000..d8353d1c1
--- /dev/null
+++ b/tests/cooperative-vector/CoopVec/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<uint32_t> outputBuffer;
+
+groupshared float[15] temp;
+
+[numthreads(1, 1, 1)]
+void computeMain()
+{
+ let vec = coopVecLoad<15, uint32_t>(input);
+ vec.storeAny(temp);
+ let result = CoopVec<uint32_t, 15>.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
new file mode 100644
index 000000000..331c12735
--- /dev/null
+++ b/tests/cooperative-vector/CoopVec/load-store-groupshared.slang
@@ -0,0 +1,27 @@
+//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<uint32_t> 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
new file mode 100644
index 000000000..88fed1cd6
--- /dev/null
+++ b/tests/cooperative-vector/CoopVec/load-store-rwbyteaddressbuffer.slang
@@ -0,0 +1,22 @@
+//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
new file mode 100644
index 000000000..4b143f5f8
--- /dev/null
+++ b/tests/cooperative-vector/CoopVec/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 -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<int32_t> inputBuffer;
+
+//TEST_INPUT:ubuffer(data=[0 0 0 0 0 0 0 0], stride=4):out,name=outputBuffer
+RWStructuredBuffer<int32_t> 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
new file mode 100644
index 000000000..6428799d1
--- /dev/null
+++ b/tests/cooperative-vector/CoopVec/log.slang
@@ -0,0 +1,26 @@
+//DISABLE_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<float> 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<float, 4> vec = coopVecLoad<4, float>(input);
+
+ CoopVec<float, 4> 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
new file mode 100644
index 000000000..798162c8a
--- /dev/null
+++ b/tests/cooperative-vector/CoopVec/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 -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<int32_t> 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<int8_t, 4> vec = coopVecLoad<4, int8_t>(input);
+ var result = CoopVec<int32_t, 4>(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
new file mode 100644
index 000000000..fdb10703c
--- /dev/null
+++ b/tests/cooperative-vector/CoopVec/matrix-mul-bias-packed-mut.slang
@@ -0,0 +1,47 @@
+//DISABLE_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<int32_t> 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<int32_t, 4>(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
new file mode 100644
index 000000000..325a106af
--- /dev/null
+++ b/tests/cooperative-vector/CoopVec/matrix-mul-bias-packed.slang
@@ -0,0 +1,46 @@
+//DISABLE_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<int32_t> 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<int32_t, 4>(
+ 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
new file mode 100644
index 000000000..0cd3fa216
--- /dev/null
+++ b/tests/cooperative-vector/CoopVec/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 -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<int32_t> 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<int32_t, 4> result = coopVecMatMulAddPacked<int32_t, 4>(
+ 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
new file mode 100644
index 000000000..e0b743259
--- /dev/null
+++ b/tests/cooperative-vector/CoopVec/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 -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<int32_t> 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<int8_t, 4> vec = coopVecLoad<4, int8_t>(input);
+ CoopVec<int32_t, 4> result = coopVecMatMulAdd<int32_t, 4, 4>(
+ 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
new file mode 100644
index 000000000..d365734c2
--- /dev/null
+++ b/tests/cooperative-vector/CoopVec/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 -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<int32_t> 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<int32_t, 4> result = coopVecMatMulAddPacked<int32_t, 4>(
+ 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
new file mode 100644
index 000000000..7b2cf6ee2
--- /dev/null
+++ b/tests/cooperative-vector/CoopVec/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 -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<int32_t> outputBuffer;
+
+//TEST_INPUT:ubuffer(data=[67305985], stride=4),name=input
+//[1 2 3 4]
+StructuredBuffer<int32_t> 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<uint8_t> matrix;
+
+//TEST_INPUT:ubuffer(data=[5 6 7 8], stride=4),name=bias
+StructuredBuffer<uint8_t> bias;
+
+[numthreads(1, 1, 1)]
+void computeMain()
+{
+ let vec = coopVecLoad<1>(input);
+ let result = coopVecMatMulAddPacked<int32_t, 4>(
+ 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
new file mode 100644
index 000000000..c560af3c0
--- /dev/null
+++ b/tests/cooperative-vector/CoopVec/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 -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<int32_t> 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<int8_t, 4> vec = coopVecLoad<4, int8_t>(input);
+ let result = coopVecMatMulAdd<int32_t, 4, 4>(
+ 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
new file mode 100644
index 000000000..4059f458c
--- /dev/null
+++ b/tests/cooperative-vector/CoopVec/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 -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<int32_t> 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<int8_t, 4> vec = coopVecLoad<4, int8_t>(input);
+ let result = coopVecMatMul<int32_t, 4, 4>(
+ 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
new file mode 100644
index 000000000..5f7d63b95
--- /dev/null
+++ b/tests/cooperative-vector/CoopVec/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 -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<int32_t> 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<int32_t, 4>(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
new file mode 100644
index 000000000..c71854467
--- /dev/null
+++ b/tests/cooperative-vector/CoopVec/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<int32_t> 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<int32_t, 4>(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
new file mode 100644
index 000000000..e56660561
--- /dev/null
+++ b/tests/cooperative-vector/CoopVec/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<int32_t> 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<int32_t, 4>(
+ 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
new file mode 100644
index 000000000..7ff925427
--- /dev/null
+++ b/tests/cooperative-vector/CoopVec/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 -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<int32_t> 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<int32_t, 4> result = coopVecMatMulPacked<int32_t, 4>(
+ 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
new file mode 100644
index 000000000..ddc328580
--- /dev/null
+++ b/tests/cooperative-vector/CoopVec/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 -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<int32_t> 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<int8_t, 4> vec = coopVecLoad<4, int8_t>(input);
+ CoopVec<int32_t, 4> result = coopVecMatMul<int32_t, 4, 4>(
+ 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
new file mode 100644
index 000000000..7ff925427
--- /dev/null
+++ b/tests/cooperative-vector/CoopVec/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 -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<int32_t> 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<int32_t, 4> result = coopVecMatMulPacked<int32_t, 4>(
+ 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
new file mode 100644
index 000000000..756f4366a
--- /dev/null
+++ b/tests/cooperative-vector/CoopVec/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 -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<int32_t> outputBuffer;
+
+//TEST_INPUT:ubuffer(data=[67305985], stride=4),name=input
+//[1 2 3 4]
+StructuredBuffer<int32_t> 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<uint8_t> matrix;
+
+[numthreads(1, 1, 1)]
+void computeMain()
+{
+ let vec = coopVecLoad<1, int32_t>(input);
+ let result = coopVecMatMulPacked<int32_t, 4>(
+ 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
new file mode 100644
index 000000000..0d6f3f6a9
--- /dev/null
+++ b/tests/cooperative-vector/CoopVec/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 -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<int32_t> 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<int32_t, 4, 4>(
+ 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
new file mode 100644
index 000000000..3b18f7782
--- /dev/null
+++ b/tests/cooperative-vector/CoopVec/max.slang
@@ -0,0 +1,30 @@
+//DISABLE_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<float> 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<float, 4> vec1 = coopVecLoad<4, float>(input1);
+ CoopVec<float, 4> vec2 = coopVecLoad<4, float>(input2);
+
+ CoopVec<float, 4> 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
new file mode 100644
index 000000000..ed4e5e7aa
--- /dev/null
+++ b/tests/cooperative-vector/CoopVec/min.slang
@@ -0,0 +1,30 @@
+//DISABLE_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<float> 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<float, 4> vec1 = coopVecLoad<4, float>(input1);
+ CoopVec<float, 4> vec2 = coopVecLoad<4, float>(input2);
+
+ CoopVec<float, 4> 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
new file mode 100644
index 000000000..a25516d1a
--- /dev/null
+++ b/tests/cooperative-vector/CoopVec/mod.slang
@@ -0,0 +1,46 @@
+//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: 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<float, 4>(vec1);
+ let vec4 = CoopVec<float, 4>(vec2);
+
+ let vec5 = CoopVec<uint, 4>(vec1);
+ let vec6 = CoopVec<uint, 4>(vec2);
+
+ let result = vec1 % vec2;
+ let result2 = CoopVec<int, 4>(vec3 % vec4);
+ let result3 = CoopVec<int, 4>(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
new file mode 100644
index 000000000..232421c0d
--- /dev/null
+++ b/tests/cooperative-vector/CoopVec/mul.slang
@@ -0,0 +1,30 @@
+//DISABLE_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<int32_t> 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<int, 4> vec1 = coopVecLoad<4, int32_t>(input1);
+ CoopVec<int, 4> vec2 = coopVecLoad<4, int32_t>(input2);
+
+ CoopVec<int, 4> 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
new file mode 100644
index 000000000..ec1bd44ac
--- /dev/null
+++ b/tests/cooperative-vector/CoopVec/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<float> outputBuffer;
+
+void doubleCoopVec(CoopVec<float, 4> vec, out CoopVec<float, 4> result)
+{
+ result = vec * 2.0;
+}
+
+[numthreads(1, 1, 1)]
+void computeMain()
+{
+ let vec = CoopVec<float, 4>(1.0, 2.0, 3.0, 4.0);
+ CoopVec<float, 4> 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
new file mode 100644
index 000000000..f050c80b9
--- /dev/null
+++ b/tests/cooperative-vector/CoopVec/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 -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<half> inputA;
+
+//TEST_INPUT:ubuffer(data=[ 0x40003C00 0x44004200 0x46004500 0x48004700 ], stride=4),name=inputB
+// [1,2,3,4,5,6,7,8]
+StructuredBuffer<half> 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<half> 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
new file mode 100644
index 000000000..e59b10e4b
--- /dev/null
+++ b/tests/cooperative-vector/CoopVec/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 -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<half> 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<half, 4> vecA;
+ CoopVec<half, 8> 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<half>(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<half>(i * 2);
+}
diff --git a/tests/cooperative-vector/CoopVec/parameter.slang b/tests/cooperative-vector/CoopVec/parameter.slang
new file mode 100644
index 000000000..91e405c45
--- /dev/null
+++ b/tests/cooperative-vector/CoopVec/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<float> outputBuffer;
+
+void processCoopVec(CoopVec<float, 4> vec)
+{
+ (vec * 2.0).store(outputBuffer, 0);
+}
+
+[numthreads(1, 1, 1)]
+void computeMain()
+{
+ let vec = CoopVec<float, 4>(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
new file mode 100644
index 000000000..17c45734e
--- /dev/null
+++ b/tests/cooperative-vector/CoopVec/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 -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<half> 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<half, 4> 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<half>(i * 2);
+}
+
diff --git a/tests/cooperative-vector/CoopVec/reduce-sum-accumulate.slang b/tests/cooperative-vector/CoopVec/reduce-sum-accumulate.slang
new file mode 100644
index 000000000..17c45734e
--- /dev/null
+++ b/tests/cooperative-vector/CoopVec/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 -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<half> 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<half, 4> 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<half>(i * 2);
+}
+
diff --git a/tests/cooperative-vector/CoopVec/return.slang b/tests/cooperative-vector/CoopVec/return.slang
new file mode 100644
index 000000000..b5c7b52a7
--- /dev/null
+++ b/tests/cooperative-vector/CoopVec/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<float> outputBuffer;
+
+CoopVec<float, 4> doubleCoopVec(CoopVec<float, 4> vec)
+{
+ return vec * 2.0;
+}
+
+[numthreads(1, 1, 1)]
+void computeMain()
+{
+ let vec = CoopVec<float, 4>(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
new file mode 100644
index 000000000..b15654be2
--- /dev/null
+++ b/tests/cooperative-vector/CoopVec/scalar-mul.slang
@@ -0,0 +1,25 @@
+//DISABLE_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<float> outputBuffer;
+
+[numthreads(1, 1, 1)]
+void computeMain()
+{
+ CoopVec<float, 4> vec = coopVecLoad<4, float>(input1);
+ CoopVec<float, 4> 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
new file mode 100644
index 000000000..3b65b7c8c
--- /dev/null
+++ b/tests/cooperative-vector/CoopVec/simple.slang
@@ -0,0 +1,24 @@
+//DISABLE_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<int32_t> 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
new file mode 100644
index 000000000..cfa86df28
--- /dev/null
+++ b/tests/cooperative-vector/CoopVec/step.slang
@@ -0,0 +1,30 @@
+//DISABLE_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<float> 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<float, 4> edge = coopVecLoad<4, float>(input1);
+ CoopVec<float, 4> x = coopVecLoad<4, float>(input2);
+
+ CoopVec<float, 4> 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
new file mode 100644
index 000000000..6f6b8a4f9
--- /dev/null
+++ b/tests/cooperative-vector/CoopVec/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<float> outputBuffer;
+
+struct MyStruct
+{
+ CoopVec<float, 4> vec1;
+ CoopVec<float, 4> vec2;
+};
+
+[numthreads(1, 1, 1)]
+void computeMain()
+{
+ MyStruct s;
+ s.vec1 = CoopVec<float, 4>(1.0, 2.0, 3.0, 4.0);
+ s.vec2 = CoopVec<float, 4>(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
new file mode 100644
index 000000000..ffb4944ed
--- /dev/null
+++ b/tests/cooperative-vector/CoopVec/sub.slang
@@ -0,0 +1,30 @@
+//DISABLE_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<int32_t> 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<int, 4> vec1 = coopVecLoad<4, int32_t>(input1);
+ CoopVec<int, 4> vec2 = coopVecLoad<4, int32_t>(input2);
+
+ CoopVec<int, 4> 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
new file mode 100644
index 000000000..74c7f86c3
--- /dev/null
+++ b/tests/cooperative-vector/CoopVec/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<float> outputBuffer;
+
+void squareCoopVecElements(CoopVec<float, 4> 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<float, 4> vec = CoopVec<float, 4>(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
new file mode 100644
index 000000000..c4df93e72
--- /dev/null
+++ b/tests/cooperative-vector/CoopVec/subscript.slang
@@ -0,0 +1,25 @@
+//DISABLE_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: 4
+// CHECK-NEXT: 6
+// CHECK-NEXT: 8
+
+//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer
+RWStructuredBuffer<int32_t> outputBuffer;
+
+[numthreads(1, 1, 1)]
+void computeMain()
+{
+ CoopVec<int32_t, 4> 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
new file mode 100644
index 000000000..ed698df6b
--- /dev/null
+++ b/tests/cooperative-vector/CoopVec/tanh.slang
@@ -0,0 +1,28 @@
+//DISABLE_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<float> 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<float, 4> vec = coopVecLoad<4, float>(input);
+
+ CoopVec<float, 4> 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
new file mode 100644
index 000000000..1f577afff
--- /dev/null
+++ b/tests/cooperative-vector/CoopVec/unary.slang
@@ -0,0 +1,25 @@
+//DISABLE_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<int32_t> outputBuffer;
+
+[numthreads(1, 1, 1)]
+void computeMain()
+{
+ CoopVec<int32_t, 4> vec1 = coopVecLoad<4, int32_t>(input1);
+ CoopVec<int32_t, 4> 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
new file mode 100644
index 000000000..1f4c92d29
--- /dev/null
+++ b/tests/cooperative-vector/CoopVec/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<int32_t> outputBuffer;
+
+[numthreads(1, 1, 1)]
+void computeMain()
+{
+ let result = CoopVec<int32_t, 4>(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
new file mode 100644
index 000000000..36af7bcd7
--- /dev/null
+++ b/tests/cooperative-vector/CoopVec/variadic-init-cast.slang
@@ -0,0 +1,20 @@
+//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: 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<float> outputBuffer;
+
+[numthreads(1, 1, 1)]
+void computeMain()
+{
+ let result = CoopVec<float, 4>(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
new file mode 100644
index 000000000..6a1f30efc
--- /dev/null
+++ b/tests/cooperative-vector/CoopVec/variadic-init.slang
@@ -0,0 +1,20 @@
+//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<int32_t> outputBuffer;
+
+[numthreads(1, 1, 1)]
+void computeMain()
+{
+ let result = CoopVec<int32_t, 4>(1,2,3,4);
+ for(int i = 0; i < result.getCount(); ++i)
+ outputBuffer[i] = result[i];;
+}
diff --git a/tests/cooperative-vector/cast.slang b/tests/cooperative-vector/cast.slang
new file mode 100644
index 000000000..263ad5026
--- /dev/null
+++ b/tests/cooperative-vector/cast.slang
@@ -0,0 +1,30 @@
+//DISABLE_TEST:CROSS_COMPILE: -profile glsl_450+spirv_1_4 -stage compute -entry computeMain -target spirv-assembly
+
+RWStructuredBuffer<float> outputBuffer;
+
+StructuredBuffer<float> buf;
+
+[numthreads(4, 1, 1)]
+void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
+{
+ coopvecNV<int, 8> r_int;
+ coopvecNV<float, 8> r = coopvecNV<float, 8>(r_int);
+ coopvecNV<int, 16> v = coopvecNV<int, 16>(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/cast.slang.glsl b/tests/cooperative-vector/cast.slang.glsl
new file mode 100644
index 000000000..7194c02fc
--- /dev/null
+++ b/tests/cooperative-vector/cast.slang.glsl
@@ -0,0 +1,23 @@
+#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<int, 8 > r_int_0;
+ coopvecNV<float, 8 > _S1 = (coopvecNV<float, 8>((r_int_0)));
+ coopvecNV<float, 8 > r_0 = _S1;
+ coopvecNV<int, 16 > _S2 = (coopvecNV<int, 16>((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/groupshared-sized.slang b/tests/cooperative-vector/groupshared-sized.slang
new file mode 100644
index 000000000..74ccac6a2
--- /dev/null
+++ b/tests/cooperative-vector/groupshared-sized.slang
@@ -0,0 +1,37 @@
+//DISABLE_TEST:CROSS_COMPILE: -profile glsl_450+spirv_1_4 -stage compute -entry computeMain -target spirv-assembly
+
+RWStructuredBuffer<float> outputBuffer;
+
+groupshared float buf[100];
+
+[numthreads(4, 1, 1)]
+void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
+{
+ coopvecNV<float, 8> r;
+ coopvecNV<int, 16> 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/groupshared-sized.slang.glsl b/tests/cooperative-vector/groupshared-sized.slang.glsl
new file mode 100644
index 000000000..f1f4b5a27
--- /dev/null
+++ b/tests/cooperative-vector/groupshared-sized.slang.glsl
@@ -0,0 +1,38 @@
+#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<float, 8 > r_0;
+ coopvecNV<int, 16 > 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<int, 16 > _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/load-store.slang b/tests/cooperative-vector/load-store.slang
new file mode 100644
index 000000000..04a0cd585
--- /dev/null
+++ b/tests/cooperative-vector/load-store.slang
@@ -0,0 +1,13 @@
+//DISABLE_TEST:CROSS_COMPILE: -profile glsl_450+spirv_1_4 -stage compute -entry computeMain -target spirv-assembly
+
+RWStructuredBuffer<float> rwBuf;
+StructuredBuffer<float> buf;
+
+[numthreads(4, 1, 1)]
+void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
+{
+ coopvecNV<float, 8> r;
+ coopVecLoadNV(r, rwBuf, 0);
+ coopVecLoadNV(r, buf, 1);
+ coopVecStoreNV(r, rwBuf, 2);
+}
diff --git a/tests/cooperative-vector/load-store.slang.glsl b/tests/cooperative-vector/load-store.slang.glsl
new file mode 100644
index 000000000..3844e2ff0
--- /dev/null
+++ b/tests/cooperative-vector/load-store.slang.glsl
@@ -0,0 +1,20 @@
+#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<float, 8 > 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/only-arith.slang b/tests/cooperative-vector/only-arith.slang
new file mode 100644
index 000000000..8a6d3d0d9
--- /dev/null
+++ b/tests/cooperative-vector/only-arith.slang
@@ -0,0 +1,18 @@
+//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<float> outputBuffer;
+
+StructuredBuffer<float> buf;
+
+[numthreads(4, 1, 1)]
+void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
+{
+ coopvecNV<float, 8> r;
+ coopvecNV<float, 8> v = coopvecNV<float, 8>(1);
+ r = v + v;
+ outputBuffer[dispatchThreadID.x] = r[0];
+}
diff --git a/tests/cooperative-vector/only-arith.slang.glsl b/tests/cooperative-vector/only-arith.slang.glsl
new file mode 100644
index 000000000..db3372d70
--- /dev/null
+++ b/tests/cooperative-vector/only-arith.slang.glsl
@@ -0,0 +1,16 @@
+#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<float, 8 > v_0 = coopvecNV<float, 8 >(1.0);
+ const coopvecNV<float, 8 > 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/outer-product-accumulate.slang b/tests/cooperative-vector/outer-product-accumulate.slang
new file mode 100644
index 000000000..1db30cb0d
--- /dev/null
+++ b/tests/cooperative-vector/outer-product-accumulate.slang
@@ -0,0 +1,19 @@
+//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<float, 8> op0 = coopvecNV<float, 8>(1);
+ coopvecNV<float, 16> op1 = coopvecNV<float, 16>(2);
+
+ coopVecOuterProductAccumulateNV(
+ op0,
+ op1,
+ buf,
+ 0, // firstElement
+ 4, // matrixStride
+ gl_CooperativeVectorMatrixLayoutRowMajorNV,
+ gl_ComponentTypeFloat32NV);
+}
diff --git a/tests/cooperative-vector/outer-product-accumulate.slang.glsl b/tests/cooperative-vector/outer-product-accumulate.slang.glsl
new file mode 100644
index 000000000..09d781824
--- /dev/null
+++ b/tests/cooperative-vector/outer-product-accumulate.slang.glsl
@@ -0,0 +1,17 @@
+#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<float, 8 > _S2 = (coopvecNV<float, 8>((1.0)));
+ coopvecNV<float, 16 > _S3 = (coopvecNV<float, 16>((2.0)));
+ coopVecOuterProductAccumulateNV((_S2), (_S3), (buf_0)._data, (0U), (4U), (0), (1));
+ return;
+}
+
diff --git a/tests/cooperative-vector/simple.slang b/tests/cooperative-vector/simple.slang
new file mode 100644
index 000000000..4128f6827
--- /dev/null
+++ b/tests/cooperative-vector/simple.slang
@@ -0,0 +1,35 @@
+//DISABLE_TEST:CROSS_COMPILE(filecheck=CHECK): -profile glsl_450+spirv_1_4 -stage compute -entry computeMain -target spirv-assembly -emit-spirv-via-glsl
+
+RWStructuredBuffer<float> outputBuffer;
+
+StructuredBuffer<float> 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<int, 16> v = coopvecNV<int, 16>(1);
+
+ // CHECK: %[[VAR2:[a-zA-Z0-9_]+]] = OpTypeCooperativeVectorNV %int %uint_8
+ coopvecNV<int, 8> 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/simple.slang.glsl b/tests/cooperative-vector/simple.slang.glsl
new file mode 100644
index 000000000..cf5f0566e
--- /dev/null
+++ b/tests/cooperative-vector/simple.slang.glsl
@@ -0,0 +1,20 @@
+#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<int, 16 > _S1 = (coopvecNV<int, 16>((1)));
+ coopvecNV<int, 8 > 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;
+}