From 7f11f883d0781952f002b3aa3222a3aa0040f18a Mon Sep 17 00:00:00 2001 From: Yong He Date: Fri, 17 Mar 2023 15:57:22 -0700 Subject: Add support for emitting cuda kernel and host functions. (#2712) * Add support for emitting cuda kernel and host functions. * Update test. * Fix cuda preamble emit. --------- Co-authored-by: Yong He --- tests/autodiff/cuda-kernel-export.slang | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/autodiff/cuda-kernel-export.slang b/tests/autodiff/cuda-kernel-export.slang index 0db4d8cea..54442498b 100644 --- a/tests/autodiff/cuda-kernel-export.slang +++ b/tests/autodiff/cuda-kernel-export.slang @@ -1,4 +1,4 @@ -//DISABLED_TEST:SIMPLE: -target cuda -line-directive-mode none +//DISABLE_TEST:SIMPLE: -target cuda -line-directive-mode none // Verify that we can output a cuda device function with [CudaDeviceExport]. // Disabled until we have FileCheck. @@ -27,3 +27,15 @@ void diffF(inout DifferentialPair m, float dout) { __bwd_diff(f)(m, dout); } + +[CudaKernel] +void myKernel(float* inValues, float* outValues) +{ + outValues[0] = sin(inValues[0]); +} + +[CudaHost] +public __extern_cpp void runCompute(float *inValues, float *outValues, uint3 dispathcSize) +{ + __dispatch_kernel(myKernel, uint3(128, 1, 1), dispathcSize)(inValues, outValues); +} \ No newline at end of file -- cgit v1.2.3