From 0a6926003fd2300858e3089fe82f421543852395 Mon Sep 17 00:00:00 2001 From: Yong He Date: Mon, 27 Mar 2023 23:00:42 -0700 Subject: Translate all composed types into tuple types in pyBind. (#2744) * Translate all composed types into tuple types in pyBind. * Delete temp file. * Fix get tuple element code emit logic. --------- Co-authored-by: Yong He --- tests/autodiff/cuda-kernel-export.slang | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/autodiff/cuda-kernel-export.slang b/tests/autodiff/cuda-kernel-export.slang index 2700fb054..e16188abc 100644 --- a/tests/autodiff/cuda-kernel-export.slang +++ b/tests/autodiff/cuda-kernel-export.slang @@ -3,6 +3,22 @@ // Verify that we can output a cuda device function with [CudaDeviceExport]. // Disabled until we have FileCheck. +struct MySubType +{ + TorchTensor array[2]; +} + +struct MyType +{ + float2 v; + MySubType sub[2]; +} + +struct MyInput +{ + TorchTensor inValues; + float normalVal; +} [CudaKernel] void myKernel(TensorView inValues, TensorView outValues) @@ -13,9 +29,19 @@ void myKernel(TensorView inValues, TensorView outValues) } [TorchEntryPoint] -public __extern_cpp TorchTensor runCompute(TorchTensor inValues) +public __extern_cpp MyType runCompute(MyInput input) { + MyType rs; var outValues = TorchTensor.alloc(1); + let inValues = input.inValues; + __dispatch_kernel(myKernel, uint3(1, 1, 1), uint3(32, 1, 1))(inValues, outValues); - return outValues; + + rs.v = float2(1.0, 2.0); + rs.sub[0].array[0] = outValues; + rs.sub[0].array[1] = inValues; + + rs.sub[1].array[0] = inValues; + rs.sub[1].array[1] = outValues; + return rs; } \ No newline at end of file -- cgit v1.2.3