From c74a700681b0be44a74f16b0f9eaad05bba159d2 Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Wed, 22 Jan 2020 11:06:20 -0500 Subject: WIP HLSL intrinsic coverage (#1171) * Added hlsl-intrinsic test folder. Enabled ceil as works across targets. * log10 support. * Fix float % on CPU/CUDA to match HLSL which is fmod (not fremainder). * Added log10 tests back to scalar-float.slang * Don't add the ( for $Sx - it's clearer what's going on without it. * Works on CUDA/CPU. Problem with asint/asuint do not seem to be found. * Only asuint exists for double. * Support countbits on CUDA and C++. * Fix typo in C++ population count. * First pass at int vector intrinsic tests. * Swizzle for int. * Bit cast tests on CUDA. * Fix warning on gcc. * Fix bit-cast-double execution on CUDA. * scalar-int test working on gcc release. --- tests/compute/bit-cast-double.slang | 21 ------- tests/compute/bit-cast-double.slang.expected.txt | 4 -- tests/compute/bit-cast.slang | 71 ------------------------ tests/compute/bit-cast.slang.expected.txt | 12 ---- 4 files changed, 108 deletions(-) delete mode 100644 tests/compute/bit-cast-double.slang delete mode 100644 tests/compute/bit-cast-double.slang.expected.txt delete mode 100644 tests/compute/bit-cast.slang delete mode 100644 tests/compute/bit-cast.slang.expected.txt (limited to 'tests/compute') diff --git a/tests/compute/bit-cast-double.slang b/tests/compute/bit-cast-double.slang deleted file mode 100644 index 6b0925a58..000000000 --- a/tests/compute/bit-cast-double.slang +++ /dev/null @@ -1,21 +0,0 @@ -//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -cpu -//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -dx12 -//TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute - -//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer -RWStructuredBuffer outputBuffer; - -[numthreads(4, 1, 1)] -void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) -{ - double d = double(dispatchThreadID.x); - - uint hi, low; - asuint(d, low, hi); - - // Reconstruct - double r = asdouble(low, hi); - - outputBuffer[dispatchThreadID.x] = int(r); -} \ No newline at end of file diff --git a/tests/compute/bit-cast-double.slang.expected.txt b/tests/compute/bit-cast-double.slang.expected.txt deleted file mode 100644 index bc856dafa..000000000 --- a/tests/compute/bit-cast-double.slang.expected.txt +++ /dev/null @@ -1,4 +0,0 @@ -0 -1 -2 -3 diff --git a/tests/compute/bit-cast.slang b/tests/compute/bit-cast.slang deleted file mode 100644 index a8fec61e3..000000000 --- a/tests/compute/bit-cast.slang +++ /dev/null @@ -1,71 +0,0 @@ -//TEST(compute):COMPARE_COMPUTE_EX:-cpu -compute -//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -dx12 -//TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute - -//TEST_INPUT:ubuffer(data=[0 0 0 0 0 0 0 0 0 0 0 0], stride=4):out,name outputBuffer - -RWStructuredBuffer outputBuffer; - -[numthreads(4, 1, 1)] -void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) -{ - const int id = asint(dispatchThreadID.x); - - { - int4 i4 = int4(id, id + 1, id + 2, id + 3); - - // Identity - int vector - i4 = asint(i4); - - uint3 u3 = asuint(i4.xyz); - // Identity - uint vec - u3 = asuint(u3); - - int2 i2 = asint(u3.xy); - uint u1 = asuint(i2.x); - - // Identity - uint scalar - u1 = asuint(u1); - - outputBuffer[id + 0] = int(u1); - } - - { - uint v = asuint(id); - uint4 u4 = uint4(v, v + 1, v + 2, v + 3); - int3 i3 = asint(u4.xyz); - uint2 u2 = asuint(i3.xy); - int i1 = asint(u2.x); - - // Identity - int scalar - i1 = asint(i1); - - outputBuffer[id + 4] = i1; - } - - { - // Make i4 holds id as floats so we know they are valid float values and not denormals - int4 i4 = int4(asint(float(id)), asint(float(id + 1)), asint(float(id + 2)), asint(float(id + 3))); - float4 f4 = asfloat(asfloat(i4)); - - // Identity - float vector - f4 = asfloat(f4); - - uint3 u3 = asuint(f4.xyz); - float2 f2 = asfloat(u3.xy); - uint u1 = asuint(f2.x); - - float f1 = asfloat(asfloat(u1)); - - // Identity - float scalar - f1 = asfloat(f1); - - int i1 = asint(f1); - - float f1_ = asfloat(i1); - int i1_ = asint(f1_); - - outputBuffer[id + 8] = (int)asfloat(i1_); - } -} \ No newline at end of file diff --git a/tests/compute/bit-cast.slang.expected.txt b/tests/compute/bit-cast.slang.expected.txt deleted file mode 100644 index f5414793f..000000000 --- a/tests/compute/bit-cast.slang.expected.txt +++ /dev/null @@ -1,12 +0,0 @@ -0 -1 -2 -3 -0 -1 -2 -3 -0 -1 -2 -3 \ No newline at end of file -- cgit v1.2.3