diff options
| author | Yong He <yonghe@outlook.com> | 2023-03-17 15:57:22 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-03-17 15:57:22 -0700 |
| commit | 7f11f883d0781952f002b3aa3222a3aa0040f18a (patch) | |
| tree | 08eaf10fef39211fbc3f124679bfe8a35775a5a7 /tests | |
| parent | 4b55bf6d75bdeed087728505a1c9b43d3a99af8d (diff) | |
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 <yhe@nvidia.com>
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/autodiff/cuda-kernel-export.slang | 14 |
1 files changed, 13 insertions, 1 deletions
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<MixedType> 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 |
