diff options
| author | Yong He <yonghe@outlook.com> | 2023-03-21 15:44:43 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-03-21 15:44:43 -0700 |
| commit | 5d2c5dd9f748d728abf2a4361fca71a7f9ec65b6 (patch) | |
| tree | ba7a6b01b90bbb449469eae4f638b8e8f180e151 /tests/bugs | |
| parent | 96caba75e8dfbb879eff12cbe1a4c148a259f684 (diff) | |
Fix IntVal type check. (#2718)
* Fix IntVal type check.
* add test case result.
---------
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'tests/bugs')
| -rw-r--r-- | tests/bugs/array-size-groupshared.slang | 42 | ||||
| -rw-r--r-- | tests/bugs/array-size-groupshared.slang.expected.txt | 5 |
2 files changed, 47 insertions, 0 deletions
diff --git a/tests/bugs/array-size-groupshared.slang b/tests/bugs/array-size-groupshared.slang new file mode 100644 index 000000000..1acda0292 --- /dev/null +++ b/tests/bugs/array-size-groupshared.slang @@ -0,0 +1,42 @@ +// array-size-group-shared.slang +//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj -output-using-type + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer +RWStructuredBuffer<uint> outputBuffer; + +interface IA +{ + static const int M; +} +struct B : IA +{ + static const int M = 2; +} +struct GenType<T : __BuiltinIntegerType, A: IA, let N : int, let M : int> +{ + static const int HalfN = N > 1? N / A.M : 1; + static const int P = M + N; + [ForceInline] + Ref<uint> weights(int index) + { + static groupshared uint w[P]; + return w[index]; + } + T sum(T arr[HalfN]) + { + T rs = T(0); + for (int i = 0; i < P; i++) + weights(i) = i; + for (int i = 0; i < HalfN; i++) + rs += arr[i]; + return rs; + } +} + +[numthreads(1, 1, 1)] +void computeMain(uint3 dispatchThreadID: SV_DispatchThreadID) +{ + int arr[2] = { 1, 2 }; + GenType<int, B, 4, 2> obj; + outputBuffer[0] = obj.sum(arr); +}
\ No newline at end of file diff --git a/tests/bugs/array-size-groupshared.slang.expected.txt b/tests/bugs/array-size-groupshared.slang.expected.txt new file mode 100644 index 000000000..ae5bfa02a --- /dev/null +++ b/tests/bugs/array-size-groupshared.slang.expected.txt @@ -0,0 +1,5 @@ +type: uint32_t +3 +0 +0 +0 |
