From f54718e69ff860b2f73bad404ea80336536c2bd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Saffran?= Date: Fri, 24 Oct 2025 12:59:05 -0700 Subject: [PATCH 01/16] adding test? --- tools/clang/unittests/HLSLExec/LongVectorOps.def | 5 +++++ tools/clang/unittests/HLSLExec/LongVectors.cpp | 14 ++++++++++++++ tools/clang/unittests/HLSLExec/ShaderOpArith.xml | 8 ++++++++ 3 files changed, 27 insertions(+) diff --git a/tools/clang/unittests/HLSLExec/LongVectorOps.def b/tools/clang/unittests/HLSLExec/LongVectorOps.def index c4f96e1b5a..7f4a7dc9e0 100644 --- a/tools/clang/unittests/HLSLExec/LongVectorOps.def +++ b/tools/clang/unittests/HLSLExec/LongVectorOps.def @@ -18,6 +18,7 @@ INPUT_SET(NoZero) INPUT_SET(Positive) INPUT_SET(Bitwise) INPUT_SET(SelectCond) +INPUT_SET(IsFinite) #undef INPUT_SET @@ -137,6 +138,10 @@ OP_DEFAULT(Binary, Logical_Or, 2, "or", ",") OP(Ternary, Select, 3, "TestSelect", "", " -DFUNC_TEST_SELECT=1", "LongVectorOp", SelectCond, Default2, Default3) + +OP_DEFAULT(BooleanFloat, IsFinite, 1, "", "") + + // For the 'any' and 'all' reduction operation, we test with three different // input data sets to cover the different cases of the operation. 'Any' returns // true if any of the inputs are non-zero, false otherwise. This is in diff --git a/tools/clang/unittests/HLSLExec/LongVectors.cpp b/tools/clang/unittests/HLSLExec/LongVectors.cpp index 93a46d02fb..f1523b3a82 100644 --- a/tools/clang/unittests/HLSLExec/LongVectors.cpp +++ b/tools/clang/unittests/HLSLExec/LongVectors.cpp @@ -1140,6 +1140,17 @@ STRICT_OP_1(OpType::LoadAndStore_DT_SB_SRV, (A)); STRICT_OP_1(OpType::LoadAndStore_RD_SB_UAV, (A)); STRICT_OP_1(OpType::LoadAndStore_RD_SB_SRV, (A)); +// +// Float Ops +// + +#define BOOLEAN_FLOAT_OP(OP, IMPL) \ + template struct Op : StrictValidation { \ + HLSLBool_t operator()(T A) { return IMPL; } \ + }; + +BOOLEAN_FLOAT_OP(OpType::IsFinite, (std::isfinite(A))); + // // dispatchTest // @@ -1915,6 +1926,9 @@ class DxilConf_SM69_Vectorized { HLK_TEST(LoadAndStore_RD_SB_SRV, double); HLK_TEST(LoadAndStore_RD_SB_UAV, double); + // Boolean Float + HLK_TEST(IsFinite, float) + private: bool Initialized = false; bool VerboseLogging = false; diff --git a/tools/clang/unittests/HLSLExec/ShaderOpArith.xml b/tools/clang/unittests/HLSLExec/ShaderOpArith.xml index f89a87ca68..76e7c3e154 100644 --- a/tools/clang/unittests/HLSLExec/ShaderOpArith.xml +++ b/tools/clang/unittests/HLSLExec/ShaderOpArith.xml @@ -4112,6 +4112,14 @@ void MSMain(uint GID : SV_GroupIndex, } #endif + #ifdef FUNC_TEST_ISFINITE + vector TestIsFinite(vector Vector) + { + vector IsFinite = isfinite(Vector); + return IsFinite; + } + #endif + #ifdef FUNC_SHUFFLE_VECTOR vector TestShuffleVector(TYPE Scalar) { From b8585b8e528bae31487495c24d5efa213eec9233 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Saffran?= Date: Fri, 24 Oct 2025 13:02:00 -0700 Subject: [PATCH 02/16] remove input set --- tools/clang/unittests/HLSLExec/LongVectorOps.def | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/clang/unittests/HLSLExec/LongVectorOps.def b/tools/clang/unittests/HLSLExec/LongVectorOps.def index 7f4a7dc9e0..01bdc818fb 100644 --- a/tools/clang/unittests/HLSLExec/LongVectorOps.def +++ b/tools/clang/unittests/HLSLExec/LongVectorOps.def @@ -18,7 +18,6 @@ INPUT_SET(NoZero) INPUT_SET(Positive) INPUT_SET(Bitwise) INPUT_SET(SelectCond) -INPUT_SET(IsFinite) #undef INPUT_SET From 0495fd57ec9d38f6007a9beb52de79a14cbbfed3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Saffran?= Date: Fri, 24 Oct 2025 14:47:15 -0700 Subject: [PATCH 03/16] adding test --- tools/clang/unittests/HLSLExec/LongVectorOps.def | 4 ++-- tools/clang/unittests/HLSLExec/LongVectorTestData.h | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/tools/clang/unittests/HLSLExec/LongVectorOps.def b/tools/clang/unittests/HLSLExec/LongVectorOps.def index 01bdc818fb..53d230dfcc 100644 --- a/tools/clang/unittests/HLSLExec/LongVectorOps.def +++ b/tools/clang/unittests/HLSLExec/LongVectorOps.def @@ -137,8 +137,8 @@ OP_DEFAULT(Binary, Logical_Or, 2, "or", ",") OP(Ternary, Select, 3, "TestSelect", "", " -DFUNC_TEST_SELECT=1", "LongVectorOp", SelectCond, Default2, Default3) - -OP_DEFAULT(BooleanFloat, IsFinite, 1, "", "") +OP(Ternary, IsFinite, 1, "TestIsFinite", "", " -DFUNC_TEST_ISFINITE=1", + "LongVectorOp", Default1, Default2, Default3) // For the 'any' and 'all' reduction operation, we test with three different diff --git a/tools/clang/unittests/HLSLExec/LongVectorTestData.h b/tools/clang/unittests/HLSLExec/LongVectorTestData.h index 24a4301299..9ec9b752c3 100644 --- a/tools/clang/unittests/HLSLExec/LongVectorTestData.h +++ b/tools/clang/unittests/HLSLExec/LongVectorTestData.h @@ -351,7 +351,8 @@ INPUT_SET(InputSet::SelectCond, 0.0, 1.0); END_INPUT_SETS() BEGIN_INPUT_SETS(float) -INPUT_SET(InputSet::Default1, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, +INPUT_SET(InputSet::Default1, 1.0, -1.0, 1.0, + std::numeric_limits::infinity(), 1.0, -1.0, 1.0, -1.0, 1.0, -1.0); INPUT_SET(InputSet::Default2, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0); From 271cb0aadda9d6603a0d98be38ce2cd9804f388f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Saffran?= Date: Mon, 27 Oct 2025 11:29:49 -0700 Subject: [PATCH 04/16] fix --- tools/clang/unittests/HLSLExec/LongVectorOps.def | 5 +++-- tools/clang/unittests/HLSLExec/LongVectorTestData.h | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/tools/clang/unittests/HLSLExec/LongVectorOps.def b/tools/clang/unittests/HLSLExec/LongVectorOps.def index 53d230dfcc..3b2aeec51e 100644 --- a/tools/clang/unittests/HLSLExec/LongVectorOps.def +++ b/tools/clang/unittests/HLSLExec/LongVectorOps.def @@ -18,6 +18,7 @@ INPUT_SET(NoZero) INPUT_SET(Positive) INPUT_SET(Bitwise) INPUT_SET(SelectCond) +INPUT_SET(Infinite) #undef INPUT_SET @@ -137,8 +138,8 @@ OP_DEFAULT(Binary, Logical_Or, 2, "or", ",") OP(Ternary, Select, 3, "TestSelect", "", " -DFUNC_TEST_SELECT=1", "LongVectorOp", SelectCond, Default2, Default3) -OP(Ternary, IsFinite, 1, "TestIsFinite", "", " -DFUNC_TEST_ISFINITE=1", - "LongVectorOp", Default1, Default2, Default3) +OP(Unary, IsFinite, 1, "TestIsFinite", "", " -DFUNC_TEST_ISFINITE=1", + "LongVectorOp", Default1, Default2, Infinite) // For the 'any' and 'all' reduction operation, we test with three different diff --git a/tools/clang/unittests/HLSLExec/LongVectorTestData.h b/tools/clang/unittests/HLSLExec/LongVectorTestData.h index 9ec9b752c3..d56813b2bf 100644 --- a/tools/clang/unittests/HLSLExec/LongVectorTestData.h +++ b/tools/clang/unittests/HLSLExec/LongVectorTestData.h @@ -351,8 +351,7 @@ INPUT_SET(InputSet::SelectCond, 0.0, 1.0); END_INPUT_SETS() BEGIN_INPUT_SETS(float) -INPUT_SET(InputSet::Default1, 1.0, -1.0, 1.0, - std::numeric_limits::infinity(), 1.0, -1.0, 1.0, -1.0, 1.0, +INPUT_SET(InputSet::Default1, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0); INPUT_SET(InputSet::Default2, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0); @@ -365,6 +364,8 @@ INPUT_SET(InputSet::RangeOne, 0.727f, 0.331f, -0.957f, 0.677f, -0.025f, 0.495f, INPUT_SET(InputSet::Positive, 1.0f, 1.0f, 65535.0f, 0.01f, 5531.0f, 0.01f, 1.0f, 0.01f, 331.2330f, 3250.01f); INPUT_SET(InputSet::SelectCond, 0.0f, 1.0f); +INPUT_SET(InputSet::Infinite, + std::numeric_limits::infinity(), -std::numeric_limits::infinity(), 32); END_INPUT_SETS() BEGIN_INPUT_SETS(double) From 27f4e319e1aee6aa52dec82d1e3a8038bd1759d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Saffran?= Date: Mon, 27 Oct 2025 12:08:19 -0700 Subject: [PATCH 05/16] adding other numeric types test --- .../clang/unittests/HLSLExec/LongVectorOps.def | 2 +- .../unittests/HLSLExec/LongVectorTestData.h | 18 ++++++++++++++++-- tools/clang/unittests/HLSLExec/LongVectors.cpp | 12 +++++++++--- 3 files changed, 26 insertions(+), 6 deletions(-) diff --git a/tools/clang/unittests/HLSLExec/LongVectorOps.def b/tools/clang/unittests/HLSLExec/LongVectorOps.def index 3b2aeec51e..c7e270f5a0 100644 --- a/tools/clang/unittests/HLSLExec/LongVectorOps.def +++ b/tools/clang/unittests/HLSLExec/LongVectorOps.def @@ -139,7 +139,7 @@ OP(Ternary, Select, 3, "TestSelect", "", " -DFUNC_TEST_SELECT=1", "LongVectorOp", SelectCond, Default2, Default3) OP(Unary, IsFinite, 1, "TestIsFinite", "", " -DFUNC_TEST_ISFINITE=1", - "LongVectorOp", Default1, Default2, Infinite) + "LongVectorOp", Infinite, Default2, Default3) // For the 'any' and 'all' reduction operation, we test with three different diff --git a/tools/clang/unittests/HLSLExec/LongVectorTestData.h b/tools/clang/unittests/HLSLExec/LongVectorTestData.h index d56813b2bf..6217c1b97e 100644 --- a/tools/clang/unittests/HLSLExec/LongVectorTestData.h +++ b/tools/clang/unittests/HLSLExec/LongVectorTestData.h @@ -262,6 +262,7 @@ INPUT_SET(InputSet::Default3, true, false, true, false, true, true, true, true, INPUT_SET(InputSet::Zero, false); INPUT_SET(InputSet::NoZero, true); INPUT_SET(InputSet::SelectCond, false, true); +INPUT_SET(InputSet::Infinite, std::numeric_limits::infinity()); END_INPUT_SETS() BEGIN_INPUT_SETS(int16_t) @@ -275,6 +276,8 @@ INPUT_SET(InputSet::Bitwise, std::numeric_limits::min(), -1, 0, 1, 3, 6, 9, 0x5555, static_cast(0xAAAA), std::numeric_limits::max()); INPUT_SET(InputSet::SelectCond, 0, 1); +INPUT_SET(InputSet::Infinite, std::numeric_limits::infinity(), + -std::numeric_limits::infinity()); END_INPUT_SETS() BEGIN_INPUT_SETS(int32_t) @@ -288,6 +291,8 @@ INPUT_SET(InputSet::Bitwise, std::numeric_limits::min(), -1, 0, 1, 3, 6, 9, 0x55555555, static_cast(0xAAAAAAAA), std::numeric_limits::max()); INPUT_SET(InputSet::SelectCond, 0, 1); +INPUT_SET(InputSet::Infinite, std::numeric_limits::infinity(), + -std::numeric_limits::infinity()); END_INPUT_SETS() BEGIN_INPUT_SETS(int64_t) @@ -301,6 +306,8 @@ INPUT_SET(InputSet::Bitwise, std::numeric_limits::min(), -1, 0, 1, 3, 6, 9, 0x5555555555555555LL, 0xAAAAAAAAAAAAAAAALL, std::numeric_limits::max()); INPUT_SET(InputSet::SelectCond, 0, 1); +INPUT_SET(InputSet::Infinite, std::numeric_limits::infinity(), + -std::numeric_limits::infinity()); END_INPUT_SETS() BEGIN_INPUT_SETS(uint16_t) @@ -311,6 +318,7 @@ INPUT_SET(InputSet::BitShiftRhs, 1, 6, 3, 0, 9, 3, 12, 13, 14, 15); INPUT_SET(InputSet::Bitwise, 0, 1, 3, 6, 9, 0x5555, 0xAAAA, 0x8000, 127, std::numeric_limits::max()); INPUT_SET(InputSet::SelectCond, 0, 1); +INPUT_SET(InputSet::Infinite, std::numeric_limits::infinity()); END_INPUT_SETS() BEGIN_INPUT_SETS(uint32_t) @@ -321,6 +329,7 @@ INPUT_SET(InputSet::BitShiftRhs, 1, 6, 3, 0, 9, 3, 30, 31, 32); INPUT_SET(InputSet::Bitwise, 0, 1, 3, 6, 9, 0x55555555, 0xAAAAAAAA, 0x80000000, 127, std::numeric_limits::max()); INPUT_SET(InputSet::SelectCond, 0, 1); +INPUT_SET(InputSet::Infinite, std::numeric_limits::infinity()); END_INPUT_SETS() BEGIN_INPUT_SETS(uint64_t) @@ -332,6 +341,7 @@ INPUT_SET(InputSet::Bitwise, 0, 1, 3, 6, 9, 0x5555555555555555, 0xAAAAAAAAAAAAAAAA, 0x8000000000000000, 127, std::numeric_limits::max()); INPUT_SET(InputSet::SelectCond, 0, 1); +INPUT_SET(InputSet::Infinite, std::numeric_limits::infinity()); END_INPUT_SETS() BEGIN_INPUT_SETS(HLSLHalf_t) @@ -348,6 +358,8 @@ INPUT_SET(InputSet::RangeOne, 0.331, 0.727, -0.957, 0.677, -0.025, 0.495, 0.855, INPUT_SET(InputSet::Positive, 1.0, 1.0, 342.0, 0.01, 5531.0, 0.01, 1.0, 0.01, 331.2330, 3250.01); INPUT_SET(InputSet::SelectCond, 0.0, 1.0); +INPUT_SET(InputSet::Infinite, std::numeric_limits::infinity(), + -std::numeric_limits::infinity()); END_INPUT_SETS() BEGIN_INPUT_SETS(float) @@ -364,8 +376,8 @@ INPUT_SET(InputSet::RangeOne, 0.727f, 0.331f, -0.957f, 0.677f, -0.025f, 0.495f, INPUT_SET(InputSet::Positive, 1.0f, 1.0f, 65535.0f, 0.01f, 5531.0f, 0.01f, 1.0f, 0.01f, 331.2330f, 3250.01f); INPUT_SET(InputSet::SelectCond, 0.0f, 1.0f); -INPUT_SET(InputSet::Infinite, - std::numeric_limits::infinity(), -std::numeric_limits::infinity(), 32); +INPUT_SET(InputSet::Infinite, std::numeric_limits::infinity(), + -std::numeric_limits::infinity()); END_INPUT_SETS() BEGIN_INPUT_SETS(double) @@ -384,6 +396,8 @@ INPUT_SET(InputSet::SplitDouble, 0.0, -1.0, 1.0, -1.0, 12345678.87654321, -1.0, INPUT_SET(InputSet::Positive, 1.0, 1.0, 65535.0, 0.01, 5531.0, 0.01, 1.0, 0.01, 331.2330, 3250.01); INPUT_SET(InputSet::SelectCond, 0.0, 1.0); +INPUT_SET(InputSet::Infinite, std::numeric_limits::infinity(), + -std::numeric_limits::infinity()); END_INPUT_SETS() #undef BEGIN_INPUT_SETS diff --git a/tools/clang/unittests/HLSLExec/LongVectors.cpp b/tools/clang/unittests/HLSLExec/LongVectors.cpp index f1523b3a82..25bb291d2f 100644 --- a/tools/clang/unittests/HLSLExec/LongVectors.cpp +++ b/tools/clang/unittests/HLSLExec/LongVectors.cpp @@ -1491,6 +1491,15 @@ class DxilConf_SM69_Vectorized { HLK_TEST(ShuffleVector, float); HLK_TEST(ShuffleVector, double); + HLK_TEST(IsFinite, int16_t); + HLK_TEST(IsFinite, int32_t); + HLK_TEST(IsFinite, int64_t); + HLK_TEST(IsFinite, uint16_t); + HLK_TEST(IsFinite, uint32_t); + HLK_TEST(IsFinite, uint64_t); + HLK_TEST(IsFinite, HLSLHalf_t); + HLK_TEST(IsFinite, float); + HLK_TEST(IsFinite, double); // Explicit Cast HLK_TEST(CastToInt16, HLSLBool_t); @@ -1926,9 +1935,6 @@ class DxilConf_SM69_Vectorized { HLK_TEST(LoadAndStore_RD_SB_SRV, double); HLK_TEST(LoadAndStore_RD_SB_UAV, double); - // Boolean Float - HLK_TEST(IsFinite, float) - private: bool Initialized = false; bool VerboseLogging = false; From 5d66ed8127ef9d6dbc605dddde19e1f7e4d0cd89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Saffran?= Date: Mon, 27 Oct 2025 12:09:42 -0700 Subject: [PATCH 06/16] clean up --- tools/clang/unittests/HLSLExec/LongVectorTestData.h | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/clang/unittests/HLSLExec/LongVectorTestData.h b/tools/clang/unittests/HLSLExec/LongVectorTestData.h index 6217c1b97e..cb7927f4d2 100644 --- a/tools/clang/unittests/HLSLExec/LongVectorTestData.h +++ b/tools/clang/unittests/HLSLExec/LongVectorTestData.h @@ -262,7 +262,6 @@ INPUT_SET(InputSet::Default3, true, false, true, false, true, true, true, true, INPUT_SET(InputSet::Zero, false); INPUT_SET(InputSet::NoZero, true); INPUT_SET(InputSet::SelectCond, false, true); -INPUT_SET(InputSet::Infinite, std::numeric_limits::infinity()); END_INPUT_SETS() BEGIN_INPUT_SETS(int16_t) From 068f4fcc355d26eddfb1c07749450f59c2da1ed1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Saffran?= Date: Mon, 27 Oct 2025 12:14:46 -0700 Subject: [PATCH 07/16] reduce tests to only float point types --- tools/clang/unittests/HLSLExec/LongVectorTestData.h | 9 --------- tools/clang/unittests/HLSLExec/LongVectors.cpp | 7 +------ 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/tools/clang/unittests/HLSLExec/LongVectorTestData.h b/tools/clang/unittests/HLSLExec/LongVectorTestData.h index cb7927f4d2..ae28405be6 100644 --- a/tools/clang/unittests/HLSLExec/LongVectorTestData.h +++ b/tools/clang/unittests/HLSLExec/LongVectorTestData.h @@ -275,8 +275,6 @@ INPUT_SET(InputSet::Bitwise, std::numeric_limits::min(), -1, 0, 1, 3, 6, 9, 0x5555, static_cast(0xAAAA), std::numeric_limits::max()); INPUT_SET(InputSet::SelectCond, 0, 1); -INPUT_SET(InputSet::Infinite, std::numeric_limits::infinity(), - -std::numeric_limits::infinity()); END_INPUT_SETS() BEGIN_INPUT_SETS(int32_t) @@ -290,8 +288,6 @@ INPUT_SET(InputSet::Bitwise, std::numeric_limits::min(), -1, 0, 1, 3, 6, 9, 0x55555555, static_cast(0xAAAAAAAA), std::numeric_limits::max()); INPUT_SET(InputSet::SelectCond, 0, 1); -INPUT_SET(InputSet::Infinite, std::numeric_limits::infinity(), - -std::numeric_limits::infinity()); END_INPUT_SETS() BEGIN_INPUT_SETS(int64_t) @@ -305,8 +301,6 @@ INPUT_SET(InputSet::Bitwise, std::numeric_limits::min(), -1, 0, 1, 3, 6, 9, 0x5555555555555555LL, 0xAAAAAAAAAAAAAAAALL, std::numeric_limits::max()); INPUT_SET(InputSet::SelectCond, 0, 1); -INPUT_SET(InputSet::Infinite, std::numeric_limits::infinity(), - -std::numeric_limits::infinity()); END_INPUT_SETS() BEGIN_INPUT_SETS(uint16_t) @@ -317,7 +311,6 @@ INPUT_SET(InputSet::BitShiftRhs, 1, 6, 3, 0, 9, 3, 12, 13, 14, 15); INPUT_SET(InputSet::Bitwise, 0, 1, 3, 6, 9, 0x5555, 0xAAAA, 0x8000, 127, std::numeric_limits::max()); INPUT_SET(InputSet::SelectCond, 0, 1); -INPUT_SET(InputSet::Infinite, std::numeric_limits::infinity()); END_INPUT_SETS() BEGIN_INPUT_SETS(uint32_t) @@ -328,7 +321,6 @@ INPUT_SET(InputSet::BitShiftRhs, 1, 6, 3, 0, 9, 3, 30, 31, 32); INPUT_SET(InputSet::Bitwise, 0, 1, 3, 6, 9, 0x55555555, 0xAAAAAAAA, 0x80000000, 127, std::numeric_limits::max()); INPUT_SET(InputSet::SelectCond, 0, 1); -INPUT_SET(InputSet::Infinite, std::numeric_limits::infinity()); END_INPUT_SETS() BEGIN_INPUT_SETS(uint64_t) @@ -340,7 +332,6 @@ INPUT_SET(InputSet::Bitwise, 0, 1, 3, 6, 9, 0x5555555555555555, 0xAAAAAAAAAAAAAAAA, 0x8000000000000000, 127, std::numeric_limits::max()); INPUT_SET(InputSet::SelectCond, 0, 1); -INPUT_SET(InputSet::Infinite, std::numeric_limits::infinity()); END_INPUT_SETS() BEGIN_INPUT_SETS(HLSLHalf_t) diff --git a/tools/clang/unittests/HLSLExec/LongVectors.cpp b/tools/clang/unittests/HLSLExec/LongVectors.cpp index 25bb291d2f..d6d13c0a9f 100644 --- a/tools/clang/unittests/HLSLExec/LongVectors.cpp +++ b/tools/clang/unittests/HLSLExec/LongVectors.cpp @@ -1491,12 +1491,6 @@ class DxilConf_SM69_Vectorized { HLK_TEST(ShuffleVector, float); HLK_TEST(ShuffleVector, double); - HLK_TEST(IsFinite, int16_t); - HLK_TEST(IsFinite, int32_t); - HLK_TEST(IsFinite, int64_t); - HLK_TEST(IsFinite, uint16_t); - HLK_TEST(IsFinite, uint32_t); - HLK_TEST(IsFinite, uint64_t); HLK_TEST(IsFinite, HLSLHalf_t); HLK_TEST(IsFinite, float); HLK_TEST(IsFinite, double); @@ -1935,6 +1929,7 @@ class DxilConf_SM69_Vectorized { HLK_TEST(LoadAndStore_RD_SB_SRV, double); HLK_TEST(LoadAndStore_RD_SB_UAV, double); + private: bool Initialized = false; bool VerboseLogging = false; From c51afa99f017cefc107948801ab18eaae70d3d70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Saffran?= Date: Mon, 27 Oct 2025 12:15:11 -0700 Subject: [PATCH 08/16] format --- tools/clang/unittests/HLSLExec/LongVectors.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/clang/unittests/HLSLExec/LongVectors.cpp b/tools/clang/unittests/HLSLExec/LongVectors.cpp index d6d13c0a9f..472f2fde9d 100644 --- a/tools/clang/unittests/HLSLExec/LongVectors.cpp +++ b/tools/clang/unittests/HLSLExec/LongVectors.cpp @@ -1929,7 +1929,6 @@ class DxilConf_SM69_Vectorized { HLK_TEST(LoadAndStore_RD_SB_SRV, double); HLK_TEST(LoadAndStore_RD_SB_UAV, double); - private: bool Initialized = false; bool VerboseLogging = false; From dbbc86810dd14d9b00e775a1692899e749b9c14d Mon Sep 17 00:00:00 2001 From: Joao Saffran Date: Tue, 28 Oct 2025 17:57:48 -0700 Subject: [PATCH 09/16] add weird values --- tools/clang/unittests/HLSLExec/LongVectorTestData.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tools/clang/unittests/HLSLExec/LongVectorTestData.h b/tools/clang/unittests/HLSLExec/LongVectorTestData.h index ae28405be6..7e8f985266 100644 --- a/tools/clang/unittests/HLSLExec/LongVectorTestData.h +++ b/tools/clang/unittests/HLSLExec/LongVectorTestData.h @@ -348,8 +348,9 @@ INPUT_SET(InputSet::RangeOne, 0.331, 0.727, -0.957, 0.677, -0.025, 0.495, 0.855, INPUT_SET(InputSet::Positive, 1.0, 1.0, 342.0, 0.01, 5531.0, 0.01, 1.0, 0.01, 331.2330, 3250.01); INPUT_SET(InputSet::SelectCond, 0.0, 1.0); -INPUT_SET(InputSet::Infinite, std::numeric_limits::infinity(), - -std::numeric_limits::infinity()); +// HLSLHalf_t cast this to float when assigning it. +INPUT_SET(InputSet::Infinite, std::numeric_limits::infinity(), + -std::numeric_limits::infinity(), std::numeric_limits::signaling_NaN(), -std::numeric_limits::signaling_NaN(), std::numeric_limits::quiet_NaN(), -std::numeric_limits::quiet_NaN(), 0.0, -0.0, std::numeric_limits::min(), std::numeric_limits::max(), -std::numeric_limits::min(), -std::numeric_limits::max(), std::numeric_limits::denorm_min(), std::numeric_limits::denorm_min() * 10.0, 1.0 / 3.0); END_INPUT_SETS() BEGIN_INPUT_SETS(float) @@ -367,7 +368,7 @@ INPUT_SET(InputSet::Positive, 1.0f, 1.0f, 65535.0f, 0.01f, 5531.0f, 0.01f, 1.0f, 0.01f, 331.2330f, 3250.01f); INPUT_SET(InputSet::SelectCond, 0.0f, 1.0f); INPUT_SET(InputSet::Infinite, std::numeric_limits::infinity(), - -std::numeric_limits::infinity()); + -std::numeric_limits::infinity(), std::numeric_limits::signaling_NaN(), -std::numeric_limits::signaling_NaN(), std::numeric_limits::quiet_NaN(), -std::numeric_limits::quiet_NaN(), 0.0f, -0.0f, std::numeric_limits::min(), std::numeric_limits::max(), -std::numeric_limits::min(), -std::numeric_limits::max(), std::numeric_limits::denorm_min(), std::numeric_limits::denorm_min() * 10.0f, 1.0f / 3.0f); END_INPUT_SETS() BEGIN_INPUT_SETS(double) @@ -387,7 +388,8 @@ INPUT_SET(InputSet::Positive, 1.0, 1.0, 65535.0, 0.01, 5531.0, 0.01, 1.0, 0.01, 331.2330, 3250.01); INPUT_SET(InputSet::SelectCond, 0.0, 1.0); INPUT_SET(InputSet::Infinite, std::numeric_limits::infinity(), - -std::numeric_limits::infinity()); + -std::numeric_limits::infinity(), std::numeric_limits::signaling_NaN(), -std::numeric_limits::signaling_NaN(), std::numeric_limits::quiet_NaN(), -std::numeric_limits::quiet_NaN(), 0.0, -0.0, std::numeric_limits::min(), std::numeric_limits::max(), -std::numeric_limits::min(), -std::numeric_limits::max(), std::numeric_limits::denorm_min(), std::numeric_limits::denorm_min() * 10.0, 1.0 / 3.0); + END_INPUT_SETS() #undef BEGIN_INPUT_SETS From eab4ea4763e0fc0a1b41838a297ff2587cccac73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Saffran?= Date: Tue, 28 Oct 2025 18:19:59 -0700 Subject: [PATCH 10/16] remove double --- .../unittests/HLSLExec/LongVectorOps.def | 8 ++--- .../unittests/HLSLExec/LongVectorTestData.h | 29 ++++++++++++++----- .../clang/unittests/HLSLExec/LongVectors.cpp | 6 ++-- 3 files changed, 29 insertions(+), 14 deletions(-) diff --git a/tools/clang/unittests/HLSLExec/LongVectorOps.def b/tools/clang/unittests/HLSLExec/LongVectorOps.def index c7e270f5a0..0baeb27c98 100644 --- a/tools/clang/unittests/HLSLExec/LongVectorOps.def +++ b/tools/clang/unittests/HLSLExec/LongVectorOps.def @@ -18,7 +18,7 @@ INPUT_SET(NoZero) INPUT_SET(Positive) INPUT_SET(Bitwise) INPUT_SET(SelectCond) -INPUT_SET(Infinite) +INPUT_SET(Float) #undef INPUT_SET @@ -126,6 +126,9 @@ OP_DEFAULT(UnaryMath, Log10, 1, "log10", "") OP_DEFAULT(UnaryMath, Log2, 1, "log2", "") OP_DEFAULT_DEFINES(UnaryMath, Frexp, 1, "TestFrexp", "", " -DFUNC_FREXP=1") +OP(UnaryMath, IsFinite, 1, "TestIsFinite", "", " -DFUNC_TEST_ISFINITE=1", + "LongVectorOp", Float, Default2, Default3) + OP_DEFAULT(BinaryComparison, LessThan, 2, "", "<") OP_DEFAULT(BinaryComparison, LessEqual, 2, "", "<=") OP_DEFAULT(BinaryComparison, GreaterThan, 2, "", ">") @@ -138,9 +141,6 @@ OP_DEFAULT(Binary, Logical_Or, 2, "or", ",") OP(Ternary, Select, 3, "TestSelect", "", " -DFUNC_TEST_SELECT=1", "LongVectorOp", SelectCond, Default2, Default3) -OP(Unary, IsFinite, 1, "TestIsFinite", "", " -DFUNC_TEST_ISFINITE=1", - "LongVectorOp", Infinite, Default2, Default3) - // For the 'any' and 'all' reduction operation, we test with three different // input data sets to cover the different cases of the operation. 'Any' returns diff --git a/tools/clang/unittests/HLSLExec/LongVectorTestData.h b/tools/clang/unittests/HLSLExec/LongVectorTestData.h index 7e8f985266..1d13a22ae7 100644 --- a/tools/clang/unittests/HLSLExec/LongVectorTestData.h +++ b/tools/clang/unittests/HLSLExec/LongVectorTestData.h @@ -349,8 +349,17 @@ INPUT_SET(InputSet::Positive, 1.0, 1.0, 342.0, 0.01, 5531.0, 0.01, 1.0, 0.01, 331.2330, 3250.01); INPUT_SET(InputSet::SelectCond, 0.0, 1.0); // HLSLHalf_t cast this to float when assigning it. -INPUT_SET(InputSet::Infinite, std::numeric_limits::infinity(), - -std::numeric_limits::infinity(), std::numeric_limits::signaling_NaN(), -std::numeric_limits::signaling_NaN(), std::numeric_limits::quiet_NaN(), -std::numeric_limits::quiet_NaN(), 0.0, -0.0, std::numeric_limits::min(), std::numeric_limits::max(), -std::numeric_limits::min(), -std::numeric_limits::max(), std::numeric_limits::denorm_min(), std::numeric_limits::denorm_min() * 10.0, 1.0 / 3.0); +INPUT_SET(InputSet::Float, std::numeric_limits::infinity(), + -std::numeric_limits::infinity(), + std::numeric_limits::signaling_NaN(), + -std::numeric_limits::signaling_NaN(), + std::numeric_limits::quiet_NaN(), + -std::numeric_limits::quiet_NaN(), 0.0, -0.0, + std::numeric_limits::min(), std::numeric_limits::max(), + -std::numeric_limits::min(), + -std::numeric_limits::max(), + std::numeric_limits::denorm_min(), + std::numeric_limits::denorm_min() * 10.0, 1.0 / 3.0); END_INPUT_SETS() BEGIN_INPUT_SETS(float) @@ -367,8 +376,17 @@ INPUT_SET(InputSet::RangeOne, 0.727f, 0.331f, -0.957f, 0.677f, -0.025f, 0.495f, INPUT_SET(InputSet::Positive, 1.0f, 1.0f, 65535.0f, 0.01f, 5531.0f, 0.01f, 1.0f, 0.01f, 331.2330f, 3250.01f); INPUT_SET(InputSet::SelectCond, 0.0f, 1.0f); -INPUT_SET(InputSet::Infinite, std::numeric_limits::infinity(), - -std::numeric_limits::infinity(), std::numeric_limits::signaling_NaN(), -std::numeric_limits::signaling_NaN(), std::numeric_limits::quiet_NaN(), -std::numeric_limits::quiet_NaN(), 0.0f, -0.0f, std::numeric_limits::min(), std::numeric_limits::max(), -std::numeric_limits::min(), -std::numeric_limits::max(), std::numeric_limits::denorm_min(), std::numeric_limits::denorm_min() * 10.0f, 1.0f / 3.0f); +INPUT_SET(InputSet::Float, std::numeric_limits::infinity(), + -std::numeric_limits::infinity(), + std::numeric_limits::signaling_NaN(), + -std::numeric_limits::signaling_NaN(), + std::numeric_limits::quiet_NaN(), + -std::numeric_limits::quiet_NaN(), 0.0f, -0.0f, + std::numeric_limits::min(), std::numeric_limits::max(), + -std::numeric_limits::min(), + -std::numeric_limits::max(), + std::numeric_limits::denorm_min(), + std::numeric_limits::denorm_min() * 10.0f, 1.0f / 3.0f); END_INPUT_SETS() BEGIN_INPUT_SETS(double) @@ -387,9 +405,6 @@ INPUT_SET(InputSet::SplitDouble, 0.0, -1.0, 1.0, -1.0, 12345678.87654321, -1.0, INPUT_SET(InputSet::Positive, 1.0, 1.0, 65535.0, 0.01, 5531.0, 0.01, 1.0, 0.01, 331.2330, 3250.01); INPUT_SET(InputSet::SelectCond, 0.0, 1.0); -INPUT_SET(InputSet::Infinite, std::numeric_limits::infinity(), - -std::numeric_limits::infinity(), std::numeric_limits::signaling_NaN(), -std::numeric_limits::signaling_NaN(), std::numeric_limits::quiet_NaN(), -std::numeric_limits::quiet_NaN(), 0.0, -0.0, std::numeric_limits::min(), std::numeric_limits::max(), -std::numeric_limits::min(), -std::numeric_limits::max(), std::numeric_limits::denorm_min(), std::numeric_limits::denorm_min() * 10.0, 1.0 / 3.0); - END_INPUT_SETS() #undef BEGIN_INPUT_SETS diff --git a/tools/clang/unittests/HLSLExec/LongVectors.cpp b/tools/clang/unittests/HLSLExec/LongVectors.cpp index 472f2fde9d..e2769ad9a5 100644 --- a/tools/clang/unittests/HLSLExec/LongVectors.cpp +++ b/tools/clang/unittests/HLSLExec/LongVectors.cpp @@ -1491,9 +1491,6 @@ class DxilConf_SM69_Vectorized { HLK_TEST(ShuffleVector, float); HLK_TEST(ShuffleVector, double); - HLK_TEST(IsFinite, HLSLHalf_t); - HLK_TEST(IsFinite, float); - HLK_TEST(IsFinite, double); // Explicit Cast HLK_TEST(CastToInt16, HLSLBool_t); @@ -1685,6 +1682,9 @@ class DxilConf_SM69_Vectorized { HLK_TEST(Abs, double); HLK_TEST(Sign, double); + HLK_TEST(IsFinite, HLSLHalf_t); + HLK_TEST(IsFinite, float); + // Binary Comparison HLK_TEST(LessThan, int16_t); From a4de02ce01d3cba0fede7b669e3076efac8e3cae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Saffran?= Date: Wed, 29 Oct 2025 12:51:58 -0700 Subject: [PATCH 11/16] adding other tests --- tools/clang/unittests/HLSLExec/LongVectorOps.def | 5 ++++- tools/clang/unittests/HLSLExec/LongVectors.cpp | 10 +++++++++- tools/clang/unittests/HLSLExec/ShaderOpArith.xml | 16 ++++++++++++++++ 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/tools/clang/unittests/HLSLExec/LongVectorOps.def b/tools/clang/unittests/HLSLExec/LongVectorOps.def index 0baeb27c98..e552774eef 100644 --- a/tools/clang/unittests/HLSLExec/LongVectorOps.def +++ b/tools/clang/unittests/HLSLExec/LongVectorOps.def @@ -128,6 +128,10 @@ OP_DEFAULT_DEFINES(UnaryMath, Frexp, 1, "TestFrexp", "", " -DFUNC_FREXP=1") OP(UnaryMath, IsFinite, 1, "TestIsFinite", "", " -DFUNC_TEST_ISFINITE=1", "LongVectorOp", Float, Default2, Default3) +OP(UnaryMath, IsInf, 1, "TestIsInf", "", " -DFUNC_TEST_ISINF=1", + "LongVectorOp", Float, Default2, Default3) +OP(UnaryMath, IsNan, 1, "TestIsNan", "", " -DFUNC_TEST_ISNAN=1", + "LongVectorOp", Float, Default2, Default3) OP_DEFAULT(BinaryComparison, LessThan, 2, "", "<") OP_DEFAULT(BinaryComparison, LessEqual, 2, "", "<=") @@ -141,7 +145,6 @@ OP_DEFAULT(Binary, Logical_Or, 2, "or", ",") OP(Ternary, Select, 3, "TestSelect", "", " -DFUNC_TEST_SELECT=1", "LongVectorOp", SelectCond, Default2, Default3) - // For the 'any' and 'all' reduction operation, we test with three different // input data sets to cover the different cases of the operation. 'Any' returns // true if any of the inputs are non-zero, false otherwise. This is in diff --git a/tools/clang/unittests/HLSLExec/LongVectors.cpp b/tools/clang/unittests/HLSLExec/LongVectors.cpp index e2769ad9a5..1235bb2806 100644 --- a/tools/clang/unittests/HLSLExec/LongVectors.cpp +++ b/tools/clang/unittests/HLSLExec/LongVectors.cpp @@ -1150,7 +1150,9 @@ STRICT_OP_1(OpType::LoadAndStore_RD_SB_SRV, (A)); }; BOOLEAN_FLOAT_OP(OpType::IsFinite, (std::isfinite(A))); - +BOOLEAN_FLOAT_OP(OpType::IsInf, (std::isinf(A))); +BOOLEAN_FLOAT_OP(OpType::IsNan, (std::isnan(A))); +#undef BOOLEAN_FLOAT_OP // // dispatchTest // @@ -1685,6 +1687,12 @@ class DxilConf_SM69_Vectorized { HLK_TEST(IsFinite, HLSLHalf_t); HLK_TEST(IsFinite, float); + HLK_TEST(IsInf, HLSLHalf_t); + HLK_TEST(IsInf, float); + + HLK_TEST(IsNan, HLSLHalf_t); + HLK_TEST(IsNan, float); + // Binary Comparison HLK_TEST(LessThan, int16_t); diff --git a/tools/clang/unittests/HLSLExec/ShaderOpArith.xml b/tools/clang/unittests/HLSLExec/ShaderOpArith.xml index 76e7c3e154..e8912d5d88 100644 --- a/tools/clang/unittests/HLSLExec/ShaderOpArith.xml +++ b/tools/clang/unittests/HLSLExec/ShaderOpArith.xml @@ -4120,6 +4120,22 @@ void MSMain(uint GID : SV_GroupIndex, } #endif + #ifdef FUNC_TEST_ISINF + vector TestIsInf(vector Vector) + { + vector IsInf = isinf(Vector); + return IsInf; + } + #endif + + #ifdef FUNC_TEST_ISNAN + vector TestIsNan(vector Vector) + { + vector IsNan = isnan(Vector); + return IsNan; + } + #endif + #ifdef FUNC_SHUFFLE_VECTOR vector TestShuffleVector(TYPE Scalar) { From 57a6be99560a384270f741d6dc0ad57bddc411f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Saffran?= Date: Wed, 29 Oct 2025 13:26:27 -0700 Subject: [PATCH 12/16] rename input set --- tools/clang/unittests/HLSLExec/LongVectorOps.def | 8 ++++---- tools/clang/unittests/HLSLExec/LongVectorTestData.h | 4 ++-- tools/clang/unittests/HLSLExec/LongVectors.cpp | 10 +++++----- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/tools/clang/unittests/HLSLExec/LongVectorOps.def b/tools/clang/unittests/HLSLExec/LongVectorOps.def index e552774eef..a8498d6b35 100644 --- a/tools/clang/unittests/HLSLExec/LongVectorOps.def +++ b/tools/clang/unittests/HLSLExec/LongVectorOps.def @@ -18,7 +18,7 @@ INPUT_SET(NoZero) INPUT_SET(Positive) INPUT_SET(Bitwise) INPUT_SET(SelectCond) -INPUT_SET(Float) +INPUT_SET(FloatSpecial) #undef INPUT_SET @@ -127,11 +127,11 @@ OP_DEFAULT(UnaryMath, Log2, 1, "log2", "") OP_DEFAULT_DEFINES(UnaryMath, Frexp, 1, "TestFrexp", "", " -DFUNC_FREXP=1") OP(UnaryMath, IsFinite, 1, "TestIsFinite", "", " -DFUNC_TEST_ISFINITE=1", - "LongVectorOp", Float, Default2, Default3) + "LongVectorOp", FloatSpecial, Default2, Default3) OP(UnaryMath, IsInf, 1, "TestIsInf", "", " -DFUNC_TEST_ISINF=1", - "LongVectorOp", Float, Default2, Default3) + "LongVectorOp", FloatSpecial, Default2, Default3) OP(UnaryMath, IsNan, 1, "TestIsNan", "", " -DFUNC_TEST_ISNAN=1", - "LongVectorOp", Float, Default2, Default3) + "LongVectorOp", FloatSpecial, Default2, Default3) OP_DEFAULT(BinaryComparison, LessThan, 2, "", "<") OP_DEFAULT(BinaryComparison, LessEqual, 2, "", "<=") diff --git a/tools/clang/unittests/HLSLExec/LongVectorTestData.h b/tools/clang/unittests/HLSLExec/LongVectorTestData.h index 1d13a22ae7..92b0b97811 100644 --- a/tools/clang/unittests/HLSLExec/LongVectorTestData.h +++ b/tools/clang/unittests/HLSLExec/LongVectorTestData.h @@ -349,7 +349,7 @@ INPUT_SET(InputSet::Positive, 1.0, 1.0, 342.0, 0.01, 5531.0, 0.01, 1.0, 0.01, 331.2330, 3250.01); INPUT_SET(InputSet::SelectCond, 0.0, 1.0); // HLSLHalf_t cast this to float when assigning it. -INPUT_SET(InputSet::Float, std::numeric_limits::infinity(), +INPUT_SET(InputSet::FloatSpecial, std::numeric_limits::infinity(), -std::numeric_limits::infinity(), std::numeric_limits::signaling_NaN(), -std::numeric_limits::signaling_NaN(), @@ -376,7 +376,7 @@ INPUT_SET(InputSet::RangeOne, 0.727f, 0.331f, -0.957f, 0.677f, -0.025f, 0.495f, INPUT_SET(InputSet::Positive, 1.0f, 1.0f, 65535.0f, 0.01f, 5531.0f, 0.01f, 1.0f, 0.01f, 331.2330f, 3250.01f); INPUT_SET(InputSet::SelectCond, 0.0f, 1.0f); -INPUT_SET(InputSet::Float, std::numeric_limits::infinity(), +INPUT_SET(InputSet::FloatSpecial, std::numeric_limits::infinity(), -std::numeric_limits::infinity(), std::numeric_limits::signaling_NaN(), -std::numeric_limits::signaling_NaN(), diff --git a/tools/clang/unittests/HLSLExec/LongVectors.cpp b/tools/clang/unittests/HLSLExec/LongVectors.cpp index 1235bb2806..9bc3a7d5d6 100644 --- a/tools/clang/unittests/HLSLExec/LongVectors.cpp +++ b/tools/clang/unittests/HLSLExec/LongVectors.cpp @@ -1144,15 +1144,15 @@ STRICT_OP_1(OpType::LoadAndStore_RD_SB_SRV, (A)); // Float Ops // -#define BOOLEAN_FLOAT_OP(OP, IMPL) \ +#define FLOAT_SPECIAL_OP(OP, IMPL) \ template struct Op : StrictValidation { \ HLSLBool_t operator()(T A) { return IMPL; } \ }; -BOOLEAN_FLOAT_OP(OpType::IsFinite, (std::isfinite(A))); -BOOLEAN_FLOAT_OP(OpType::IsInf, (std::isinf(A))); -BOOLEAN_FLOAT_OP(OpType::IsNan, (std::isnan(A))); -#undef BOOLEAN_FLOAT_OP +FLOAT_SPECIAL_OP(OpType::IsFinite, (std::isfinite(A))); +FLOAT_SPECIAL_OP(OpType::IsInf, (std::isinf(A))); +FLOAT_SPECIAL_OP(OpType::IsNan, (std::isnan(A))); +#undef FLOAT_SPECIAL_OP // // dispatchTest // From 76ca7cec0bde6fa412fb79f869df837c03d79834 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Saffran?= Date: Wed, 29 Oct 2025 15:54:15 -0700 Subject: [PATCH 13/16] using OP_DEFAULT --- .../unittests/HLSLExec/LongVectorOps.def | 9 +++---- .../unittests/HLSLExec/ShaderOpArith.xml | 24 ------------------- 2 files changed, 3 insertions(+), 30 deletions(-) diff --git a/tools/clang/unittests/HLSLExec/LongVectorOps.def b/tools/clang/unittests/HLSLExec/LongVectorOps.def index a8498d6b35..002b84a1f2 100644 --- a/tools/clang/unittests/HLSLExec/LongVectorOps.def +++ b/tools/clang/unittests/HLSLExec/LongVectorOps.def @@ -126,12 +126,9 @@ OP_DEFAULT(UnaryMath, Log10, 1, "log10", "") OP_DEFAULT(UnaryMath, Log2, 1, "log2", "") OP_DEFAULT_DEFINES(UnaryMath, Frexp, 1, "TestFrexp", "", " -DFUNC_FREXP=1") -OP(UnaryMath, IsFinite, 1, "TestIsFinite", "", " -DFUNC_TEST_ISFINITE=1", - "LongVectorOp", FloatSpecial, Default2, Default3) -OP(UnaryMath, IsInf, 1, "TestIsInf", "", " -DFUNC_TEST_ISINF=1", - "LongVectorOp", FloatSpecial, Default2, Default3) -OP(UnaryMath, IsNan, 1, "TestIsNan", "", " -DFUNC_TEST_ISNAN=1", - "LongVectorOp", FloatSpecial, Default2, Default3) +OP_DEFAULT(FloatSpecial, IsFinite, 1, "isfinite", "") +OP_DEFAULT(FloatSpecial, IsInf, 1, "isinf", "") +OP_DEFAULT(FloatSpecial, IsNan, 1, "isnan", "") OP_DEFAULT(BinaryComparison, LessThan, 2, "", "<") OP_DEFAULT(BinaryComparison, LessEqual, 2, "", "<=") diff --git a/tools/clang/unittests/HLSLExec/ShaderOpArith.xml b/tools/clang/unittests/HLSLExec/ShaderOpArith.xml index e8912d5d88..f89a87ca68 100644 --- a/tools/clang/unittests/HLSLExec/ShaderOpArith.xml +++ b/tools/clang/unittests/HLSLExec/ShaderOpArith.xml @@ -4112,30 +4112,6 @@ void MSMain(uint GID : SV_GroupIndex, } #endif - #ifdef FUNC_TEST_ISFINITE - vector TestIsFinite(vector Vector) - { - vector IsFinite = isfinite(Vector); - return IsFinite; - } - #endif - - #ifdef FUNC_TEST_ISINF - vector TestIsInf(vector Vector) - { - vector IsInf = isinf(Vector); - return IsInf; - } - #endif - - #ifdef FUNC_TEST_ISNAN - vector TestIsNan(vector Vector) - { - vector IsNan = isnan(Vector); - return IsNan; - } - #endif - #ifdef FUNC_SHUFFLE_VECTOR vector TestShuffleVector(TYPE Scalar) { From 3bd82885a962bfdbf584e347ab15cd0e1cf033ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Saffran?= Date: Wed, 29 Oct 2025 16:03:12 -0700 Subject: [PATCH 14/16] addressing comments --- tools/clang/unittests/HLSLExec/LongVectorTestData.h | 3 ++- tools/clang/unittests/HLSLExec/LongVectors.cpp | 9 +++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/tools/clang/unittests/HLSLExec/LongVectorTestData.h b/tools/clang/unittests/HLSLExec/LongVectorTestData.h index 92b0b97811..769edd0ae6 100644 --- a/tools/clang/unittests/HLSLExec/LongVectorTestData.h +++ b/tools/clang/unittests/HLSLExec/LongVectorTestData.h @@ -348,7 +348,8 @@ INPUT_SET(InputSet::RangeOne, 0.331, 0.727, -0.957, 0.677, -0.025, 0.495, 0.855, INPUT_SET(InputSet::Positive, 1.0, 1.0, 342.0, 0.01, 5531.0, 0.01, 1.0, 0.01, 331.2330, 3250.01); INPUT_SET(InputSet::SelectCond, 0.0, 1.0); -// HLSLHalf_t cast this to float when assigning it. +// HLSLHalf_t has a constructor which accepts a float and converts it to half precision by +// clamping to the representable range via DirectX::PackedVector::XMConvertFloatToHalf. INPUT_SET(InputSet::FloatSpecial, std::numeric_limits::infinity(), -std::numeric_limits::infinity(), std::numeric_limits::signaling_NaN(), diff --git a/tools/clang/unittests/HLSLExec/LongVectors.cpp b/tools/clang/unittests/HLSLExec/LongVectors.cpp index 9bc3a7d5d6..f252a61e2c 100644 --- a/tools/clang/unittests/HLSLExec/LongVectors.cpp +++ b/tools/clang/unittests/HLSLExec/LongVectors.cpp @@ -1153,6 +1153,7 @@ FLOAT_SPECIAL_OP(OpType::IsFinite, (std::isfinite(A))); FLOAT_SPECIAL_OP(OpType::IsInf, (std::isinf(A))); FLOAT_SPECIAL_OP(OpType::IsNan, (std::isnan(A))); #undef FLOAT_SPECIAL_OP + // // dispatchTest // @@ -1684,13 +1685,13 @@ class DxilConf_SM69_Vectorized { HLK_TEST(Abs, double); HLK_TEST(Sign, double); + // Float Special HLK_TEST(IsFinite, HLSLHalf_t); - HLK_TEST(IsFinite, float); - HLK_TEST(IsInf, HLSLHalf_t); - HLK_TEST(IsInf, float); - HLK_TEST(IsNan, HLSLHalf_t); + + HLK_TEST(IsFinite, float); + HLK_TEST(IsInf, float); HLK_TEST(IsNan, float); // Binary Comparison From 500ba14e3faeca44bf281dadc4c25a4710f58fa5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Saffran?= Date: Wed, 29 Oct 2025 16:04:28 -0700 Subject: [PATCH 15/16] format --- tools/clang/unittests/HLSLExec/LongVectors.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/clang/unittests/HLSLExec/LongVectors.cpp b/tools/clang/unittests/HLSLExec/LongVectors.cpp index f252a61e2c..f928bdd9cf 100644 --- a/tools/clang/unittests/HLSLExec/LongVectors.cpp +++ b/tools/clang/unittests/HLSLExec/LongVectors.cpp @@ -1686,6 +1686,7 @@ class DxilConf_SM69_Vectorized { HLK_TEST(Sign, double); // Float Special + HLK_TEST(IsFinite, HLSLHalf_t); HLK_TEST(IsInf, HLSLHalf_t); HLK_TEST(IsNan, HLSLHalf_t); From 56930db325146bf5037604979086f3728ad5bb7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Saffran?= Date: Wed, 29 Oct 2025 16:40:35 -0700 Subject: [PATCH 16/16] format --- tools/clang/unittests/HLSLExec/LongVectorTestData.h | 5 +++-- tools/clang/unittests/HLSLExec/LongVectors.cpp | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/tools/clang/unittests/HLSLExec/LongVectorTestData.h b/tools/clang/unittests/HLSLExec/LongVectorTestData.h index 769edd0ae6..e713413e5d 100644 --- a/tools/clang/unittests/HLSLExec/LongVectorTestData.h +++ b/tools/clang/unittests/HLSLExec/LongVectorTestData.h @@ -348,8 +348,9 @@ INPUT_SET(InputSet::RangeOne, 0.331, 0.727, -0.957, 0.677, -0.025, 0.495, 0.855, INPUT_SET(InputSet::Positive, 1.0, 1.0, 342.0, 0.01, 5531.0, 0.01, 1.0, 0.01, 331.2330, 3250.01); INPUT_SET(InputSet::SelectCond, 0.0, 1.0); -// HLSLHalf_t has a constructor which accepts a float and converts it to half precision by -// clamping to the representable range via DirectX::PackedVector::XMConvertFloatToHalf. +// HLSLHalf_t has a constructor which accepts a float and converts it to half +// precision by clamping to the representable range via +// DirectX::PackedVector::XMConvertFloatToHalf. INPUT_SET(InputSet::FloatSpecial, std::numeric_limits::infinity(), -std::numeric_limits::infinity(), std::numeric_limits::signaling_NaN(), diff --git a/tools/clang/unittests/HLSLExec/LongVectors.cpp b/tools/clang/unittests/HLSLExec/LongVectors.cpp index f928bdd9cf..27b6bd023e 100644 --- a/tools/clang/unittests/HLSLExec/LongVectors.cpp +++ b/tools/clang/unittests/HLSLExec/LongVectors.cpp @@ -1686,11 +1686,11 @@ class DxilConf_SM69_Vectorized { HLK_TEST(Sign, double); // Float Special - + HLK_TEST(IsFinite, HLSLHalf_t); HLK_TEST(IsInf, HLSLHalf_t); HLK_TEST(IsNan, HLSLHalf_t); - + HLK_TEST(IsFinite, float); HLK_TEST(IsInf, float); HLK_TEST(IsNan, float);