summaryrefslogtreecommitdiff
path: root/tests/diagnostics
diff options
context:
space:
mode:
Diffstat (limited to 'tests/diagnostics')
-rw-r--r--tests/diagnostics/cuda-kernel-differentiable-params.slang18
-rw-r--r--tests/diagnostics/cuda-kernel-non-void-return.slang17
2 files changed, 35 insertions, 0 deletions
diff --git a/tests/diagnostics/cuda-kernel-differentiable-params.slang b/tests/diagnostics/cuda-kernel-differentiable-params.slang
new file mode 100644
index 000000000..0e7604b3d
--- /dev/null
+++ b/tests/diagnostics/cuda-kernel-differentiable-params.slang
@@ -0,0 +1,18 @@
+//DIAGNOSTIC_TEST:SIMPLE(filecheck=CHECK):
+
+// Simple check to see if the compiler throws an error if a CUDA kernel is declared with non-void return type.
+
+[CudaKernel]
+[Differentiable]
+void myBadKernel(float x, TensorView<float> t1, TensorView<float> t2)
+{
+ // CHECK: tests/diagnostics/cuda-kernel-differentiable-params.slang([[@LINE-2]]): error 31214: differentiable kernel entry point cannot have differentiable parameters. Consider using DiffTensorView to pass differentiable data, or marking this parameter with 'no_diff'
+ // CHECK-NEXT: void myBadKernel(float x, TensorView<float> t1, TensorView<float> t2)
+ // CHECK-NEXT: ^
+}
+
+[CudaKernel]
+void myGoodKernel(float x, TensorView<float> t1, TensorView<float> t2)
+{
+
+} \ No newline at end of file
diff --git a/tests/diagnostics/cuda-kernel-non-void-return.slang b/tests/diagnostics/cuda-kernel-non-void-return.slang
new file mode 100644
index 000000000..75c8bc6d4
--- /dev/null
+++ b/tests/diagnostics/cuda-kernel-non-void-return.slang
@@ -0,0 +1,17 @@
+//DIAGNOSTIC_TEST:SIMPLE(filecheck=CHECK):
+
+// Simple check to see if the compiler throws an error if a CUDA kernel is declared with non-void return type.
+
+[CudaKernel]
+float myBadKernel(TensorView<float> t1, TensorView<float> t2)
+{
+ // CHECK: tests/diagnostics/cuda-kernel-non-void-return.slang([[@LINE-2]]): error 31213: return type of a CUDA kernel function cannot be non-void.
+ // CHECK-NEXT: float myBadKernel(TensorView<float> t1, TensorView<float> t2)
+ // CHECK-NEXT: ^~~~~~~~~~~
+}
+
+[CudaKernel]
+void myGoodKernel(TensorView<float> t1, TensorView<float> t2)
+{
+
+} \ No newline at end of file