diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2021-04-30 16:51:25 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-04-30 13:51:25 -0700 |
| commit | 1a4a51301d084dd1c8c5906eb810eb6caf6f3963 (patch) | |
| tree | 3eac138d918853f88bb8e2b5f14ed36a57e54d7a /tests | |
| parent | c45f368ae404798db67a601749c6e0047fba75ef (diff) | |
Preliminary CUDA half maths (#1827)
* #include an absolute path didn't work - because paths were taken to always be relative.
* Split out StringEscapeUtil.
* Added StringEscapeUtil.
* Fix typo in unix quoting type.
* Small comment improvements.
* Try to fix linux linking issue.
* Fix typo.
* Attempt to fix linux link issue.
* Update VS proj even though nothing really changed.
* Fix another typo issue.
* Fix for windows issue.
Fixed bug.
* Make separate Utils for escaping.
* Fix typo.
* Split out into StringEscapeHandler.
* Windows shell does handle removing quotes (so remove code to remove them).
* Handle unescaping if not initiating using the shell.
* Slight improvement around shell like decoding.
* Simplify command extraction.
* Add shared-library category type.
* Fix bug in command extraction.
* Typo in transcendental category.
* Enable unit-test on in smoke test category.
* Make parsing failing output as a failing test.
* Fixes for transcendental tests. Disable tests that do not work.
* Changed category parsing.
* Removed the TestResult parameter from _gatherTestsForFile.
Made testsList only output.
* Remove testing if all tests were disabled.
* Make args of CommandLine always unescaped.
* Add category.
* Don't need escaping on unix/linux.
* Remove some no longer used functions.
* Add requireSMVersion to CUDAExtensionTracker.
* half-calc.slang now works for CUDA.
* bit-cast-16-bit works on CUDA.
* WIP handling of CUDA vector<half> types.
* Half swizzle CUDA.
* Half vector test.
* Fix swizzle half bug.
* Fix compilation issue with narrowing to Index.
Co-authored-by: Tim Foley <tfoleyNV@users.noreply.github.com>
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/compute/half-calc.slang | 2 | ||||
| -rw-r--r-- | tests/compute/half-vector-calc.slang | 35 | ||||
| -rw-r--r-- | tests/compute/half-vector-calc.slang.expected.txt | 5 | ||||
| -rw-r--r-- | tests/hlsl-intrinsic/bit-cast/bit-cast-16-bit.slang | 1 |
4 files changed, 42 insertions, 1 deletions
diff --git a/tests/compute/half-calc.slang b/tests/compute/half-calc.slang index 57efebe53..e0dd01315 100644 --- a/tests/compute/half-calc.slang +++ b/tests/compute/half-calc.slang @@ -1,6 +1,6 @@ //DISABLE_TEST(compute):COMPARE_COMPUTE:-dx12 -compute -use-dxil -profile cs_6_2 -render-features half -shaderobj //TEST(compute):COMPARE_COMPUTE:-vk -compute -profile cs_6_2 -render-features half -shaderobj - +//TEST(compute):COMPARE_COMPUTE:-cuda -compute -render-features half -shaderobj // Test for doing a calculation using half diff --git a/tests/compute/half-vector-calc.slang b/tests/compute/half-vector-calc.slang new file mode 100644 index 000000000..5594c38fd --- /dev/null +++ b/tests/compute/half-vector-calc.slang @@ -0,0 +1,35 @@ +//DISABLE_TEST(compute):COMPARE_COMPUTE:-dx12 -compute -output-using-type -use-dxil -profile cs_6_2 -render-features half -shaderobj +//TEST(compute):COMPARE_COMPUTE:-vk -compute -output-using-type -profile cs_6_2 -render-features half -shaderobj +//TEST(compute):COMPARE_COMPUTE:-cuda -compute -output-using-type -render-features half -shaderobj + +// Test for doing a calculation using half + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer +RWStructuredBuffer<float> outputBuffer; + +[numthreads(4, 1, 1)] +void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) +{ + uint tid = dispatchThreadID.x; + int x = tid.x; + + half2 v3 = half2(float(x)); + + half2 v0 = half2(x * 2.0f, x * 0.5f); + half3 v1 = half3(x * 2.0f, x * 0.5f, x - 1.0f); + half4 v2 = half4(x + 1, x - 1, x + 2 , x - 2); + + v1 += v0.yxy; + v1 += v2.wzy; + v2 += v0.xyxy; + + v0 = v0 + v0 * v0; + v1 = v1 + v1 * v1; + v2 = v2 + v2 * v2; + + half o2 = v2.x + v2.y + v2.z + v2.w; + half o1 = v1.x + v1.y + v1.z; + half o0 = v0.x + v0.y; + + outputBuffer[tid] = o0 + o1 + o2 + v3.y; +} diff --git a/tests/compute/half-vector-calc.slang.expected.txt b/tests/compute/half-vector-calc.slang.expected.txt new file mode 100644 index 000000000..64beb1dd1 --- /dev/null +++ b/tests/compute/half-vector-calc.slang.expected.txt @@ -0,0 +1,5 @@ +type: float +20.000000 +98.500000 +292.000000 +600.500000 diff --git a/tests/hlsl-intrinsic/bit-cast/bit-cast-16-bit.slang b/tests/hlsl-intrinsic/bit-cast/bit-cast-16-bit.slang index 0241ff9cd..28f8973f6 100644 --- a/tests/hlsl-intrinsic/bit-cast/bit-cast-16-bit.slang +++ b/tests/hlsl-intrinsic/bit-cast/bit-cast-16-bit.slang @@ -2,6 +2,7 @@ //TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -dx12 -use-dxil -profile sm_6_2 -shaderobj //TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute -shaderobj +//TEST(compute):COMPARE_COMPUTE_EX:-cuda -compute -shaderobj //TEST_INPUT:ubuffer(data=[0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16], stride=4):name inputBuffer RWStructuredBuffer<int> inputBuffer; |
