diff options
Diffstat (limited to 'tests/cuda')
| -rw-r--r-- | tests/cuda/require-prelude.slang | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/cuda/require-prelude.slang b/tests/cuda/require-prelude.slang new file mode 100644 index 000000000..a5e7fb19b --- /dev/null +++ b/tests/cuda/require-prelude.slang @@ -0,0 +1,38 @@ + +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -compute -output-using-type +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cuda -compute -output-using-type +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -compute -output-using-type + +int myIntrinsicFunc() +{ + __target_switch + { + case cpp: + case hlsl: + case cuda: + __requirePrelude(R"(#define MY_CUDA_INTRINSIC 100)"); + __intrinsic_asm "(MY_CUDA_INTRINSIC)"; + } +} + +int myIntrinsicFunc1() +{ + __target_switch + { + case cpp: + case hlsl: + case cuda: + __requirePrelude(R"(#define MY_CUDA_INTRINSIC 100)"); + __intrinsic_asm "(MY_CUDA_INTRINSIC + 1)"; + } +} + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer +RWStructuredBuffer<uint> outputBuffer; + +[numthreads(1, 1, 1)] +void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) +{ + // CHECK: 201 + outputBuffer[0] = myIntrinsicFunc() + myIntrinsicFunc1(); +} |
