diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2022-05-06 16:35:15 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-05-06 16:35:15 -0400 |
| commit | 117f5e554839efc13066517461eafaf8f2fd96c6 (patch) | |
| tree | 5ee76efce85beccd28371adabbcedfce7eb05e7b /tests/hlsl | |
| parent | b915ae662b2e4bcaaeb6da62eb964356d0a978b4 (diff) | |
Initial work around groupshared (#2224)
* #include an absolute path didn't work - because paths were taken to always be relative.
* Allow rate modifier on parameter.
* Add test.
* Disable test for now as breaks on source comparison because around nvAPI.
Diffstat (limited to 'tests/hlsl')
| -rw-r--r-- | tests/hlsl/simple/rate-param.hlsl | 30 | ||||
| -rw-r--r-- | tests/hlsl/simple/rate-param.hlsl.expected | 49 |
2 files changed, 79 insertions, 0 deletions
diff --git a/tests/hlsl/simple/rate-param.hlsl b/tests/hlsl/simple/rate-param.hlsl new file mode 100644 index 000000000..5a36ba30e --- /dev/null +++ b/tests/hlsl/simple/rate-param.hlsl @@ -0,0 +1,30 @@ +// rate-param.slang +//DISABLE_TEST:SIMPLE: -target hlsl -entry computeMain -stage compute + +//TEST_INPUT:ubuffer(data=[0 0 0 0 ], stride=4):out,name outputBuffer +RWStructuredBuffer<int> outputBuffer; + +groupshared uint gs_values[4]; + +void someFunction(inout groupshared uint a[4], int index, int value) +{ + a[index] += value; +} + +[shader("compute")] +[numthreads(4, 1, 1)] +void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) +{ + int index = (int)dispatchThreadID.x; + + // Initialize + gs_values[3 - index] = index; + + GroupMemoryBarrierWithGroupSync(); + + someFunction(gs_values, index, index * 2 + 1); + + GroupMemoryBarrierWithGroupSync(); + + outputBuffer[index] = gs_values[index]; +} diff --git a/tests/hlsl/simple/rate-param.hlsl.expected b/tests/hlsl/simple/rate-param.hlsl.expected new file mode 100644 index 000000000..fd99b3fc1 --- /dev/null +++ b/tests/hlsl/simple/rate-param.hlsl.expected @@ -0,0 +1,49 @@ +result code = 0 +standard error = { +} +standard output = { +#ifdef SLANG_HLSL_ENABLE_NVAPI +#include "nvHLSLExtns.h" +#endif + +#pragma pack_matrix(column_major) + +#line 7 "tests/hlsl/simple/rate-param.hlsl" +static groupshared uint gs_values_0[int(4)]; + +void someFunction_0(groupshared inout uint a_0[int(4)], int index_0, int value_0) +{ + a_0[index_0] = a_0[index_0] + (uint) value_0; + return; +} + + +#line 5 +RWStructuredBuffer<int > outputBuffer_0 : register(u0); + + +#line 16 +[numthreads(4, 1, 1)] +void computeMain(uint3 dispatchThreadID_0 : SV_DISPATCHTHREADID) +{ + +#line 18 + int index_1 = (int) dispatchThreadID_0.x; + + + gs_values_0[int(3) - index_1] = (uint) index_1; + + GroupMemoryBarrierWithGroupSync(); + + someFunction_0(gs_values_0, index_1, index_1 * int(2) + int(1)); + + GroupMemoryBarrierWithGroupSync(); + + int _S1 = (int) gs_values_0[index_1]; + +#line 29 + outputBuffer_0[(uint) index_1] = _S1; + return; +} + +} |
