From 972bd3c4c24b06501c52127416afb763a066b8ad Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Thu, 29 Apr 2021 09:01:46 -0400 Subject: Support for escaped paths in tools (#1823) * #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. * Fix typo. * Disable path canonical test on linux because CI issue. --- tests/compute/transcendental-double.slang | 28 ++++++++++++++++++++++ .../transcendental-double.slang.expected.txt | 9 +++++++ tests/compute/transcendental.slang | 28 ++++++++-------------- tests/compute/transcendental.slang.expected.txt | 25 +++++++------------ 4 files changed, 56 insertions(+), 34 deletions(-) create mode 100644 tests/compute/transcendental-double.slang create mode 100644 tests/compute/transcendental-double.slang.expected.txt (limited to 'tests') diff --git a/tests/compute/transcendental-double.slang b/tests/compute/transcendental-double.slang new file mode 100644 index 000000000..19ea417d8 --- /dev/null +++ b/tests/compute/transcendental-double.slang @@ -0,0 +1,28 @@ +//TEST(compute):COMPARE_COMPUTE:-cuda -output-using-type -shaderobj +//TEST(compute):COMPARE_COMPUTE:-cpu -output-using-type -shaderobj +//TEST(compute):COMPARE_COMPUTE: -output-using-type -shaderobj + +// Cos values are all 0 on D3d12(!) +//DISABLE_TEST(compute):COMPARE_COMPUTE: -dx12 -output-using-type -shaderobj +// When using double on vulkan the values are incorrect(!) +//DISABLE_TEST(compute,vulkan):COMPARE_COMPUTE:-vk -output-using-type -shaderobj + +//TEST_INPUT:ubuffer(data=[0 0 0 0 0 0 0 0], stride=4):out,name=outputBuffer +RWStructuredBuffer outputBuffer : register(u0); + +float quantize(double value) +{ + return int(value * 256) * 1.0f / 256.0f; +} + +[numthreads(4, 1, 1)] +void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) +{ + float values[] = { -9, 9, -3, 3 }; + + int tid = int(dispatchThreadID.x); + float value = values[tid]; + + outputBuffer[tid * 2 + 0] = quantize(sin(double(value))); + outputBuffer[tid * 2 + 1] = quantize(cos(double(value))); +} diff --git a/tests/compute/transcendental-double.slang.expected.txt b/tests/compute/transcendental-double.slang.expected.txt new file mode 100644 index 000000000..ceef37fce --- /dev/null +++ b/tests/compute/transcendental-double.slang.expected.txt @@ -0,0 +1,9 @@ +type: float +-0.410156 +-0.910156 +0.410156 +-0.910156 +-0.140625 +-0.988281 +0.140625 +-0.988281 diff --git a/tests/compute/transcendental.slang b/tests/compute/transcendental.slang index e9feb4d95..cf8548939 100644 --- a/tests/compute/transcendental.slang +++ b/tests/compute/transcendental.slang @@ -1,19 +1,14 @@ -//TEST(compute):COMPARE_COMPUTE:-cuda -shaderobj -//TEST(compute):COMPARE_COMPUTE:-cpu -shaderobj -//TEST(compute):COMPARE_COMPUTE: -shaderobj -//TEST(compute,vulcan):COMPARE_COMPUTE:-vk -shaderobj +//TEST(compute):COMPARE_COMPUTE:-cuda -output-using-type -shaderobj +//TEST(compute):COMPARE_COMPUTE:-cpu -output-using-type -shaderobj +//TEST(compute):COMPARE_COMPUTE: -output-using-type -shaderobj +//TEST(compute,vulkan):COMPARE_COMPUTE:-vk -output-using-type -shaderobj -//TEST_INPUT:ubuffer(data=[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0], stride=4):out,name=outputBuffer -RWStructuredBuffer outputBuffer : register(u0); +//TEST_INPUT:ubuffer(data=[0 0 0 0 0 0 0 0], stride=4):out,name=outputBuffer +RWStructuredBuffer outputBuffer : register(u0); -int quantize(double value) +float quantize(float value) { - return int(value * 256); -} - -int quantize(float value) -{ - return int(value * 256); + return int(value * 256) * 1.0f / 256.0f; } [numthreads(4, 1, 1)] @@ -24,9 +19,6 @@ void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) int tid = int(dispatchThreadID.x); float value = values[tid]; - outputBuffer[tid * 4] = quantize(sin(value)); - outputBuffer[tid * 4 + 1] = quantize(cos(value)); - - outputBuffer[tid * 4 + 2] = quantize(sin(double(value))); - outputBuffer[tid * 4 + 3] = quantize(cos(double(value))); + outputBuffer[tid * 2] = quantize(sin(value)); + outputBuffer[tid * 2 + 1] = quantize(cos(value)); } \ No newline at end of file diff --git a/tests/compute/transcendental.slang.expected.txt b/tests/compute/transcendental.slang.expected.txt index 4a525cc7c..ceef37fce 100644 --- a/tests/compute/transcendental.slang.expected.txt +++ b/tests/compute/transcendental.slang.expected.txt @@ -1,16 +1,9 @@ -FFFFFF97 -FFFFFF17 -FFFFFF97 -FFFFFF17 -69 -FFFFFF17 -69 -FFFFFF17 -FFFFFFDC -FFFFFF03 -FFFFFFDC -FFFFFF03 -24 -FFFFFF03 -24 -FFFFFF03 +type: float +-0.410156 +-0.910156 +0.410156 +-0.910156 +-0.140625 +-0.988281 +0.140625 +-0.988281 -- cgit v1.2.3