summaryrefslogtreecommitdiffstats
path: root/tests/cooperative-vector
diff options
context:
space:
mode:
authorMukund Keshava <mkeshava@nvidia.com>2025-06-10 10:18:24 +0530
committerGitHub <noreply@github.com>2025-06-10 04:48:24 +0000
commitd70da65a90ccd73439895a43b3958c0ea1441f35 (patch)
treee6f0c1cd8413e3e213a29bf233b5fc3a3fdf2eaf /tests/cooperative-vector
parentab6b5f28d332f201fd96b7e05070116684d02899 (diff)
Add optix support for coopvec (#7286)
* WiP: Add coopvec support for Optix * format code * fix minor issues * Fix review comments --------- Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
Diffstat (limited to 'tests/cooperative-vector')
-rw-r--r--tests/cooperative-vector/exp2.slang27
-rw-r--r--tests/cooperative-vector/log2.slang26
2 files changed, 53 insertions, 0 deletions
diff --git a/tests/cooperative-vector/exp2.slang b/tests/cooperative-vector/exp2.slang
new file mode 100644
index 000000000..ddff55453
--- /dev/null
+++ b/tests/cooperative-vector/exp2.slang
@@ -0,0 +1,27 @@
+//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -render-feature cooperative-vector -output-using-type -emit-spirv-directly
+//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -render-feature cooperative-vector -dx12-experimental -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. -capability hlsl_coopvec_poc
+//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type
+
+// CHECK: type: float
+// CHECK-NEXT: 2.000000
+// CHECK-NEXT: 4.000000
+// CHECK-NEXT: 8.000000
+// CHECK-NEXT: 16.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=input
+ByteAddressBuffer input;
+
+[numthreads(1, 1, 1)]
+void computeMain()
+{
+ CoopVec<float, 4> vec = coopVecLoad<4, float>(input);
+
+ CoopVec<float, 4> result = exp2(vec);
+
+ for(int i = 0; i < result.getCount(); ++i)
+ outputBuffer[i] = result[i];
+}
diff --git a/tests/cooperative-vector/log2.slang b/tests/cooperative-vector/log2.slang
new file mode 100644
index 000000000..bacdf8fde
--- /dev/null
+++ b/tests/cooperative-vector/log2.slang
@@ -0,0 +1,26 @@
+//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -render-feature cooperative-vector -output-using-type -emit-spirv-directly
+//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -render-feature cooperative-vector -dx12-experimental -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. -capability hlsl_coopvec_poc
+//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type
+
+// CHECK: type: float
+// CHECK-NEXT: 0.000000
+// CHECK-NEXT: 1.000000
+// CHECK-NEXT: 1.584962
+// 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=input
+ByteAddressBuffer input;
+
+[numthreads(1, 1, 1)]
+void computeMain()
+{
+ CoopVec<float, 4> vec = coopVecLoad<4, float>(input);
+
+ CoopVec<float, 4> result = log2(vec);
+
+ for(int i = 0; i < result.getCount(); ++i)
+ outputBuffer[i] = result[i];
+}