summaryrefslogtreecommitdiffstats
path: root/tests/cuda
diff options
context:
space:
mode:
Diffstat (limited to 'tests/cuda')
-rw-r--r--tests/cuda/compile-to-cuda.slang29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/cuda/compile-to-cuda.slang b/tests/cuda/compile-to-cuda.slang
new file mode 100644
index 000000000..6166aaf0b
--- /dev/null
+++ b/tests/cuda/compile-to-cuda.slang
@@ -0,0 +1,29 @@
+//DISABLE_TEST(smoke):SIMPLE: -target ptx -entry computeMain -stage compute
+
+//TEST_INPUT:ubuffer(data=[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0], stride=4):out,name=outputBuffer
+RWStructuredBuffer<int> outputBuffer : register(u0);
+
+int quantize(double value)
+{
+ return int(value * 256);
+}
+
+int quantize(float value)
+{
+ return int(value * 256);
+}
+
+[numthreads(4, 1, 1)]
+void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
+{
+ float values[] = { -9, 9, -3, 3 };
+
+ int tid = int(dispatchThreadID.x);
+ float value = values[tid];
+
+ outputBuffer[tid * 4] = quantize(sin(value));
+ outputBuffer[tid * 4 + 1] = quantize(cos(value));
+
+ outputBuffer[tid * 4 + 2] = quantize(sin(double(value)));
+ outputBuffer[tid * 4 + 3] = quantize(cos(double(value)));
+}