From bb9b8f88bbf365a34f935dbad8cbce2d90007472 Mon Sep 17 00:00:00 2001 From: Ashley Coleman Date: Mon, 6 Apr 2026 17:10:06 -0600 Subject: [PATCH 1/5] [SM6.10][HLK][LinAlg] Address lingering feedback --- .../clang/unittests/HLSLExec/LinAlgTests.cpp | 105 +++++++++--------- 1 file changed, 55 insertions(+), 50 deletions(-) diff --git a/tools/clang/unittests/HLSLExec/LinAlgTests.cpp b/tools/clang/unittests/HLSLExec/LinAlgTests.cpp index 3ab1ac1df8..2ec95e10e2 100644 --- a/tools/clang/unittests/HLSLExec/LinAlgTests.cpp +++ b/tools/clang/unittests/HLSLExec/LinAlgTests.cpp @@ -254,21 +254,10 @@ static VariantCompType makeExpected(ComponentType CompType, size_t NumElements, return std::vector(); } -static bool shouldSkipBecauseSM610Unsupported(ID3D12Device *Device) { - // Never skip in an HLK environment -#ifdef _HLK_CONF - return false; -#endif - - // Don't skip if a device is available - if (Device) - return false; - - // Skip GPU execution +static void logCompiledButSkipping() { hlsl_test::LogCommentFmt( L"Shader compiled OK; skipping execution (no SM 6.10 device)"); WEX::Logging::Log::Result(WEX::Logging::TestResults::Skipped); - return true; } class DxilConf_SM610_LinAlg { @@ -299,49 +288,34 @@ class DxilConf_SM610_LinAlg { TEST_METHOD(ElementAccess_Wave_16x16_F16); private: - bool createDevice(); + D3D_SHADER_MODEL createDevice(); CComPtr D3DDevice; dxc::SpecificDllLoader DxcSupport; bool VerboseLogging = false; bool EmulateTest = false; bool Initialized = false; + bool CompileOnly = false; std::optional D3D12SDK; WEX::TestExecution::SetVerifyOutput VerifyOutput{ WEX::TestExecution::VerifyOutputSettings::LogOnlyFailures}; }; -/// Creates the device and setups the test scenario with the following variants -/// HLK build: Require SM6.10 supported fail otherwise -/// Non-HLK, no SM6.10 support: Compile shaders, then exit with skip -/// Non-HLK, SM6.10 support: Compile shaders and run full test -bool DxilConf_SM610_LinAlg::createDevice() { - bool FailIfRequirementsNotMet = false; -#ifdef _HLK_CONF - FailIfRequirementsNotMet = true; -#endif +/// Attempts to create a device. If tests are being emulated this an SM6.8 +/// device is attempted. Durning normal execution SM6.10 is required. +D3D_SHADER_MODEL DxilConf_SM610_LinAlg::createDevice() { + if (EmulateTest) { + if(D3D12SDK->createDevice(&D3DDevice, D3D_SHADER_MODEL_6_8, false)) + return D3D_SHADER_MODEL_6_8; - const bool SkipUnsupported = FailIfRequirementsNotMet; - if (!D3D12SDK->createDevice(&D3DDevice, D3D_SHADER_MODEL_6_10, - SkipUnsupported)) { - if (FailIfRequirementsNotMet) { - hlsl_test::LogErrorFmt( - L"Device creation failed, resulting in test failure, since " - L"FailIfRequirementsNotMet is set. The expectation is that this " - L"test will only be executed if something has previously " - L"determined that the system meets the requirements of this " - L"test."); - return false; - } + return D3D_SHADER_MODEL_NONE; } - if (EmulateTest) { - hlsl_test::LogWarningFmt(L"EmulateTest flag set. Tests are NOT REAL"); - return D3D12SDK->createDevice(&D3DDevice, D3D_SHADER_MODEL_6_8, false); - } + if (D3D12SDK->createDevice(&D3DDevice, D3D_SHADER_MODEL_6_10, false)) + return D3D_SHADER_MODEL_6_10; - return true; + return D3D_SHADER_MODEL_NONE; } bool DxilConf_SM610_LinAlg::setupClass() { @@ -354,7 +328,26 @@ bool DxilConf_SM610_LinAlg::setupClass() { VerboseLogging); WEX::TestExecution::RuntimeParameters::TryGetValue(L"EmulateTest", EmulateTest); - return createDevice(); + D3D_SHADER_MODEL SupportedSM = createDevice(); + + if (EmulateTest) { + hlsl_test::LogWarningFmt(L"EmulateTest flag set. Tests are NOT REAL"); + if (SupportedSM != D3D_SHADER_MODEL_6_8) { + hlsl_test::LogErrorFmt( + L"Device creation failed. Expected a driver supporting SM6.8"); + return false; + } + } + +#ifdef _HLK_CONF + if (SupportedSM != D3D_SHADER_MODEL_6_10) { + hlsl_test::LogErrorFmt( + L"Device creation failed. Expected a driver supporting SM6.10"); + return false; + } +#endif + + CompileOnly = SupportedSM == D3D_SHADER_MODEL_NONE; } return true; @@ -366,11 +359,17 @@ bool DxilConf_SM610_LinAlg::setupMethod() { if (D3DDevice && D3DDevice->GetDeviceRemovedReason() == S_OK) return true; + // Device is expected to be null. No point in recreating it + if (CompileOnly) + return true; + hlsl_test::LogCommentFmt(L"Device was lost!"); D3DDevice.Release(); hlsl_test::LogCommentFmt(L"Recreating device"); - return createDevice(); + + // !CompileOnly implies we expect it to succeeded + return createDevice() != D3D_SHADER_MODEL_NONE; } static const char LoadStoreShader[] = R"( @@ -400,7 +399,7 @@ static const char LoadStoreShader[] = R"( static void runLoadStoreRoundtrip(ID3D12Device *Device, dxc::SpecificDllLoader &DxcSupport, - const MatrixParams &Params, bool Verbose) { + const MatrixParams &Params, bool Verbose, bool CompileOnly) { const size_t NumElements = Params.totalElements(); const size_t BufferSize = Params.totalBytes(); @@ -417,8 +416,10 @@ static void runLoadStoreRoundtrip(ID3D12Device *Device, // Always verify the shader compiles. compileShader(DxcSupport, LoadStoreShader, Target.c_str(), Args, Verbose); - if (shouldSkipBecauseSM610Unsupported(Device)) + if (CompileOnly) { + logCompiledButSkipping(); return; + } auto Expected = makeExpected(Params.CompType, NumElements, 1, true); @@ -457,7 +458,7 @@ void DxilConf_SM610_LinAlg::LoadStoreRoundtrip_Wave_16x16_F16() { Params.NumThreads = 4; Params.Enable16Bit = true; Params.EmulateTest = EmulateTest; - runLoadStoreRoundtrip(D3DDevice, DxcSupport, Params, VerboseLogging); + runLoadStoreRoundtrip(D3DDevice, DxcSupport, Params, VerboseLogging, CompileOnly); } static const char SplatStoreShader[] = R"( @@ -493,7 +494,7 @@ static const char SplatStoreShader[] = R"( static void runSplatStore(ID3D12Device *Device, dxc::SpecificDllLoader &DxcSupport, const MatrixParams &Params, float FillValue, - bool Verbose) { + bool Verbose, bool CompileOnly) { const size_t NumElements = Params.totalElements(); const size_t BufferSize = Params.totalBytes(); std::string Target = "cs_6_10"; @@ -508,8 +509,10 @@ static void runSplatStore(ID3D12Device *Device, // Always verify the shader compiles. compileShader(DxcSupport, SplatStoreShader, Target.c_str(), Args, Verbose); - if (shouldSkipBecauseSM610Unsupported(Device)) + if (CompileOnly) { + logCompiledButSkipping(); return; + } auto Expected = makeExpected(Params.CompType, NumElements, FillValue, false); @@ -538,7 +541,7 @@ void DxilConf_SM610_LinAlg::SplatStore_Wave_16x16_F16() { Params.NumThreads = 4; Params.Enable16Bit = true; Params.EmulateTest = EmulateTest; - runSplatStore(D3DDevice, DxcSupport, Params, 42.0f, VerboseLogging); + runSplatStore(D3DDevice, DxcSupport, Params, 42.0f, VerboseLogging, CompileOnly); } static const char ElementAccessShader[] = R"( @@ -598,7 +601,7 @@ static const char ElementAccessShader[] = R"( static void runElementAccess(ID3D12Device *Device, dxc::SpecificDllLoader &DxcSupport, - const MatrixParams &Params, bool Verbose) { + const MatrixParams &Params, bool Verbose, bool CompileOnly) { const size_t NumElements = Params.totalElements(); const size_t NumThreads = Params.NumThreads; const size_t InputBufSize = Params.totalBytes(); @@ -621,8 +624,10 @@ static void runElementAccess(ID3D12Device *Device, compileShader(DxcSupport, ElementAccessShader, Target.c_str(), Args, Verbose); - if (shouldSkipBecauseSM610Unsupported(Device)) + if (CompileOnly) { + logCompiledButSkipping(); return; + } auto Expected = makeExpected(Params.CompType, NumElements, 1, true); @@ -673,7 +678,7 @@ void DxilConf_SM610_LinAlg::ElementAccess_Wave_16x16_F16() { Params.NumThreads = 4; Params.Enable16Bit = true; Params.EmulateTest = EmulateTest; - runElementAccess(D3DDevice, DxcSupport, Params, VerboseLogging); + runElementAccess(D3DDevice, DxcSupport, Params, VerboseLogging, CompileOnly); } } // namespace LinAlg From c7b57090d748f8aa210931fc057de19ad9c3b8a5 Mon Sep 17 00:00:00 2001 From: Ashley Coleman Date: Mon, 6 Apr 2026 18:46:59 -0600 Subject: [PATCH 2/5] Moves doValuesMatch functions to HLSLTestDataTypes.h This move requires the following non-move changes - includes were updated - doValuesMatch were marked inline to avoid redef errors - using statements were added to LongVectors.cpp to match previous names --- .../unittests/HLSLExec/HlslTestDataTypes.h | 98 +++++++++++++++++ .../clang/unittests/HLSLExec/LongVectors.cpp | 100 +----------------- 2 files changed, 103 insertions(+), 95 deletions(-) diff --git a/tools/clang/unittests/HLSLExec/HlslTestDataTypes.h b/tools/clang/unittests/HLSLExec/HlslTestDataTypes.h index b81cffbc27..6de078d7ce 100644 --- a/tools/clang/unittests/HLSLExec/HlslTestDataTypes.h +++ b/tools/clang/unittests/HLSLExec/HlslTestDataTypes.h @@ -10,9 +10,12 @@ #include +#include + #include #include +#include "HlslTestUtils.h" #include "dxc/Support/Global.h" // These types bridge the gap between C++ and HLSL type representations. @@ -460,6 +463,101 @@ struct HLSLMin16Uint_t { uint32_t Val; }; +enum class ValidationType { + Epsilon, + Ulp, +}; + +template +inline bool doValuesMatch(T A, T B, double Tolerance, ValidationType) { + if (Tolerance == 0.0) + return A == B; + + T Diff = A > B ? A - B : B - A; + return Diff <= Tolerance; +} + +inline bool doValuesMatch(HLSLBool_t A, HLSLBool_t B, double, ValidationType) { + return A == B; +} + +inline bool doValuesMatch(HLSLHalf_t A, HLSLHalf_t B, double Tolerance, + ValidationType ValidationType) { + switch (ValidationType) { + case ValidationType::Epsilon: + return CompareHalfEpsilon(A.Val, B.Val, static_cast(Tolerance)); + case ValidationType::Ulp: + return CompareHalfULP(A.Val, B.Val, static_cast(Tolerance)); + default: + hlsl_test::LogErrorFmt( + L"Invalid ValidationType. Expecting Epsilon or ULP."); + return false; + } +} + +// Min precision float comparison: convert to half and compare in fp16 space. +// This reuses the same tolerance values as HLSLHalf_t. Min precision is at +// least 16-bit, so fp16 tolerances are an upper bound for all cases. +inline bool doValuesMatch(HLSLMin16Float_t A, HLSLMin16Float_t B, double Tolerance, + ValidationType ValidationType) { + auto HalfA = DirectX::PackedVector::XMConvertFloatToHalf(A.Val); + auto HalfB = DirectX::PackedVector::XMConvertFloatToHalf(B.Val); + switch (ValidationType) { + case ValidationType::Epsilon: + return CompareHalfEpsilon(HalfA, HalfB, static_cast(Tolerance)); + case ValidationType::Ulp: + return CompareHalfULP(HalfA, HalfB, static_cast(Tolerance)); + default: + hlsl_test::LogErrorFmt( + L"Invalid ValidationType. Expecting Epsilon or ULP."); + return false; + } +} + +inline bool doValuesMatch(HLSLMin16Int_t A, HLSLMin16Int_t B, double, ValidationType) { + return A == B; +} + +inline bool doValuesMatch(HLSLMin16Uint_t A, HLSLMin16Uint_t B, double, + ValidationType) { + return A == B; +} + +inline bool doValuesMatch(float A, float B, double Tolerance, + ValidationType ValidationType) { + switch (ValidationType) { + case ValidationType::Epsilon: + return CompareFloatEpsilon(A, B, static_cast(Tolerance)); + case ValidationType::Ulp: { + // Tolerance is in ULPs. Convert to int for the comparison. + const int IntTolerance = static_cast(Tolerance); + return CompareFloatULP(A, B, IntTolerance); + }; + default: + hlsl_test::LogErrorFmt( + L"Invalid ValidationType. Expecting Epsilon or ULP."); + return false; + } +} + +inline bool doValuesMatch(double A, double B, double Tolerance, + ValidationType ValidationType) { + switch (ValidationType) { + case ValidationType::Epsilon: + return CompareDoubleEpsilon(A, B, Tolerance); + case ValidationType::Ulp: { + // Tolerance is in ULPs. Convert to int64_t for the comparison. + const int64_t IntTolerance = static_cast(Tolerance); + return CompareDoubleULP(A, B, IntTolerance); + }; + default: + hlsl_test::LogErrorFmt( + L"Invalid ValidationType. Expecting Epsilon or ULP."); + return false; + } +} + + } // namespace HLSLTestDataTypes #endif diff --git a/tools/clang/unittests/HLSLExec/LongVectors.cpp b/tools/clang/unittests/HLSLExec/LongVectors.cpp index 10bc3392e4..1202d0359b 100644 --- a/tools/clang/unittests/HLSLExec/LongVectors.cpp +++ b/tools/clang/unittests/HLSLExec/LongVectors.cpp @@ -10,8 +10,8 @@ #include "ShaderOpTest.h" #include "dxc/Support/Global.h" +#include "HlslTestDataTypes.h" #include "HlslTestUtils.h" - #include "HlslExecTestUtils.h" #include @@ -67,6 +67,10 @@ DATA_TYPE(double, "double", 8) #undef DATA_TYPE + +using HLSLTestDataTypes::doValuesMatch; +using HLSLTestDataTypes::ValidationType; + template constexpr bool isFloatingPointType() { return std::is_same_v || std::is_same_v || std::is_same_v || std::is_same_v; @@ -195,100 +199,6 @@ void logLongVector(const std::vector &Values, const std::wstring &Name) { hlsl_test::LogCommentFmt(Wss.str().c_str()); } -enum class ValidationType { - Epsilon, - Ulp, -}; - -template -bool doValuesMatch(T A, T B, double Tolerance, ValidationType) { - if (Tolerance == 0.0) - return A == B; - - T Diff = A > B ? A - B : B - A; - return Diff <= Tolerance; -} - -bool doValuesMatch(HLSLBool_t A, HLSLBool_t B, double, ValidationType) { - return A == B; -} - -bool doValuesMatch(HLSLHalf_t A, HLSLHalf_t B, double Tolerance, - ValidationType ValidationType) { - switch (ValidationType) { - case ValidationType::Epsilon: - return CompareHalfEpsilon(A.Val, B.Val, static_cast(Tolerance)); - case ValidationType::Ulp: - return CompareHalfULP(A.Val, B.Val, static_cast(Tolerance)); - default: - hlsl_test::LogErrorFmt( - L"Invalid ValidationType. Expecting Epsilon or ULP."); - return false; - } -} - -// Min precision float comparison: convert to half and compare in fp16 space. -// This reuses the same tolerance values as HLSLHalf_t. Min precision is at -// least 16-bit, so fp16 tolerances are an upper bound for all cases. -bool doValuesMatch(HLSLMin16Float_t A, HLSLMin16Float_t B, double Tolerance, - ValidationType ValidationType) { - auto HalfA = DirectX::PackedVector::XMConvertFloatToHalf(A.Val); - auto HalfB = DirectX::PackedVector::XMConvertFloatToHalf(B.Val); - switch (ValidationType) { - case ValidationType::Epsilon: - return CompareHalfEpsilon(HalfA, HalfB, static_cast(Tolerance)); - case ValidationType::Ulp: - return CompareHalfULP(HalfA, HalfB, static_cast(Tolerance)); - default: - hlsl_test::LogErrorFmt( - L"Invalid ValidationType. Expecting Epsilon or ULP."); - return false; - } -} - -bool doValuesMatch(HLSLMin16Int_t A, HLSLMin16Int_t B, double, ValidationType) { - return A == B; -} - -bool doValuesMatch(HLSLMin16Uint_t A, HLSLMin16Uint_t B, double, - ValidationType) { - return A == B; -} - -bool doValuesMatch(float A, float B, double Tolerance, - ValidationType ValidationType) { - switch (ValidationType) { - case ValidationType::Epsilon: - return CompareFloatEpsilon(A, B, static_cast(Tolerance)); - case ValidationType::Ulp: { - // Tolerance is in ULPs. Convert to int for the comparison. - const int IntTolerance = static_cast(Tolerance); - return CompareFloatULP(A, B, IntTolerance); - }; - default: - hlsl_test::LogErrorFmt( - L"Invalid ValidationType. Expecting Epsilon or ULP."); - return false; - } -} - -bool doValuesMatch(double A, double B, double Tolerance, - ValidationType ValidationType) { - switch (ValidationType) { - case ValidationType::Epsilon: - return CompareDoubleEpsilon(A, B, Tolerance); - case ValidationType::Ulp: { - // Tolerance is in ULPs. Convert to int64_t for the comparison. - const int64_t IntTolerance = static_cast(Tolerance); - return CompareDoubleULP(A, B, IntTolerance); - }; - default: - hlsl_test::LogErrorFmt( - L"Invalid ValidationType. Expecting Epsilon or ULP."); - return false; - } -} - template bool doVectorsMatch(const std::vector &ActualValues, const std::vector &ExpectedValues, double Tolerance, From 5aba071d433067da12a6347db798f0a0b358e83d Mon Sep 17 00:00:00 2001 From: Ashley Coleman Date: Mon, 6 Apr 2026 19:05:20 -0600 Subject: [PATCH 3/5] Use existing match functions --- tools/clang/unittests/HLSLExec/LinAlgTests.cpp | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/tools/clang/unittests/HLSLExec/LinAlgTests.cpp b/tools/clang/unittests/HLSLExec/LinAlgTests.cpp index 2ec95e10e2..f05d771c58 100644 --- a/tools/clang/unittests/HLSLExec/LinAlgTests.cpp +++ b/tools/clang/unittests/HLSLExec/LinAlgTests.cpp @@ -39,6 +39,8 @@ using hlsl::DXIL::MatrixScope; using hlsl::DXIL::MatrixUse; using HLSLTestDataTypes::HLSLHalf_t; +using HLSLTestDataTypes::doValuesMatch; +using HLSLTestDataTypes::ValidationType; using VariantCompType = std::variant, std::vector, std::vector>; @@ -111,10 +113,7 @@ static bool verifyFloatBuffer(const float *Actual, const float *Expected, float Tolerance = 0.0f) { bool Success = true; for (size_t I = 0; I < Count; I++) { - float Diff = Actual[I] - Expected[I]; - if (Diff < 0) - Diff = -Diff; - if (Diff > Tolerance) { + if (!doValuesMatch(Actual[I], Expected[I], Tolerance, ValidationType::Epsilon)) { hlsl_test::LogErrorFmt(L"Mismatch at index %zu: actual=%f, expected=%f", I, static_cast(Actual[I]), static_cast(Expected[I])); @@ -132,7 +131,7 @@ static bool verifyIntBuffer(const int32_t *Actual, const int32_t *Expected, size_t Count, bool Verbose) { bool Success = true; for (size_t I = 0; I < Count; I++) { - if (Actual[I] != Expected[I]) { + if (!doValuesMatch(Actual[I], Expected[I], 0.0, ValidationType::Epsilon)) { hlsl_test::LogErrorFmt(L"Mismatch at index %zu: actual=%d, expected=%d", I, Actual[I], Expected[I]); Success = false; @@ -149,10 +148,7 @@ static bool verifyHalfBuffer(const HLSLHalf_t *Actual, bool Verbose, HLSLHalf_t Tolerance = 0.0f) { bool Success = true; for (size_t I = 0; I < Count; I++) { - HLSLHalf_t Diff = Actual[I] - Expected[I]; - if (Diff < 0.0f) - Diff = -Diff; - if (Diff > Tolerance) { + if (!doValuesMatch(Actual[I], Expected[I], Tolerance, ValidationType::Epsilon)) { hlsl_test::LogErrorFmt(L"Mismatch at index %zu: actual=%f, expected=%f", I, static_cast(Actual[I]), static_cast(Expected[I])); From 5bc67a22217b11a8a1918f54593a308d5e047cb2 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 7 Apr 2026 01:09:21 +0000 Subject: [PATCH 4/5] chore: autopublish 2026-04-07T01:09:20Z --- .../unittests/HLSLExec/HlslTestDataTypes.h | 16 +++++++------- .../clang/unittests/HLSLExec/LinAlgTests.cpp | 22 ++++++++++++------- .../clang/unittests/HLSLExec/LongVectors.cpp | 3 +-- 3 files changed, 23 insertions(+), 18 deletions(-) diff --git a/tools/clang/unittests/HLSLExec/HlslTestDataTypes.h b/tools/clang/unittests/HLSLExec/HlslTestDataTypes.h index 6de078d7ce..81d0c89b54 100644 --- a/tools/clang/unittests/HLSLExec/HlslTestDataTypes.h +++ b/tools/clang/unittests/HLSLExec/HlslTestDataTypes.h @@ -482,7 +482,7 @@ inline bool doValuesMatch(HLSLBool_t A, HLSLBool_t B, double, ValidationType) { } inline bool doValuesMatch(HLSLHalf_t A, HLSLHalf_t B, double Tolerance, - ValidationType ValidationType) { + ValidationType ValidationType) { switch (ValidationType) { case ValidationType::Epsilon: return CompareHalfEpsilon(A.Val, B.Val, static_cast(Tolerance)); @@ -498,8 +498,8 @@ inline bool doValuesMatch(HLSLHalf_t A, HLSLHalf_t B, double Tolerance, // Min precision float comparison: convert to half and compare in fp16 space. // This reuses the same tolerance values as HLSLHalf_t. Min precision is at // least 16-bit, so fp16 tolerances are an upper bound for all cases. -inline bool doValuesMatch(HLSLMin16Float_t A, HLSLMin16Float_t B, double Tolerance, - ValidationType ValidationType) { +inline bool doValuesMatch(HLSLMin16Float_t A, HLSLMin16Float_t B, + double Tolerance, ValidationType ValidationType) { auto HalfA = DirectX::PackedVector::XMConvertFloatToHalf(A.Val); auto HalfB = DirectX::PackedVector::XMConvertFloatToHalf(B.Val); switch (ValidationType) { @@ -514,17 +514,18 @@ inline bool doValuesMatch(HLSLMin16Float_t A, HLSLMin16Float_t B, double Toleran } } -inline bool doValuesMatch(HLSLMin16Int_t A, HLSLMin16Int_t B, double, ValidationType) { +inline bool doValuesMatch(HLSLMin16Int_t A, HLSLMin16Int_t B, double, + ValidationType) { return A == B; } inline bool doValuesMatch(HLSLMin16Uint_t A, HLSLMin16Uint_t B, double, - ValidationType) { + ValidationType) { return A == B; } inline bool doValuesMatch(float A, float B, double Tolerance, - ValidationType ValidationType) { + ValidationType ValidationType) { switch (ValidationType) { case ValidationType::Epsilon: return CompareFloatEpsilon(A, B, static_cast(Tolerance)); @@ -541,7 +542,7 @@ inline bool doValuesMatch(float A, float B, double Tolerance, } inline bool doValuesMatch(double A, double B, double Tolerance, - ValidationType ValidationType) { + ValidationType ValidationType) { switch (ValidationType) { case ValidationType::Epsilon: return CompareDoubleEpsilon(A, B, Tolerance); @@ -557,7 +558,6 @@ inline bool doValuesMatch(double A, double B, double Tolerance, } } - } // namespace HLSLTestDataTypes #endif diff --git a/tools/clang/unittests/HLSLExec/LinAlgTests.cpp b/tools/clang/unittests/HLSLExec/LinAlgTests.cpp index f05d771c58..f3591424ee 100644 --- a/tools/clang/unittests/HLSLExec/LinAlgTests.cpp +++ b/tools/clang/unittests/HLSLExec/LinAlgTests.cpp @@ -38,8 +38,8 @@ using hlsl::DXIL::LinalgMatrixLayout; using hlsl::DXIL::MatrixScope; using hlsl::DXIL::MatrixUse; -using HLSLTestDataTypes::HLSLHalf_t; using HLSLTestDataTypes::doValuesMatch; +using HLSLTestDataTypes::HLSLHalf_t; using HLSLTestDataTypes::ValidationType; using VariantCompType = std::variant, std::vector, @@ -113,7 +113,8 @@ static bool verifyFloatBuffer(const float *Actual, const float *Expected, float Tolerance = 0.0f) { bool Success = true; for (size_t I = 0; I < Count; I++) { - if (!doValuesMatch(Actual[I], Expected[I], Tolerance, ValidationType::Epsilon)) { + if (!doValuesMatch(Actual[I], Expected[I], Tolerance, + ValidationType::Epsilon)) { hlsl_test::LogErrorFmt(L"Mismatch at index %zu: actual=%f, expected=%f", I, static_cast(Actual[I]), static_cast(Expected[I])); @@ -148,7 +149,8 @@ static bool verifyHalfBuffer(const HLSLHalf_t *Actual, bool Verbose, HLSLHalf_t Tolerance = 0.0f) { bool Success = true; for (size_t I = 0; I < Count; I++) { - if (!doValuesMatch(Actual[I], Expected[I], Tolerance, ValidationType::Epsilon)) { + if (!doValuesMatch(Actual[I], Expected[I], Tolerance, + ValidationType::Epsilon)) { hlsl_test::LogErrorFmt(L"Mismatch at index %zu: actual=%f, expected=%f", I, static_cast(Actual[I]), static_cast(Expected[I])); @@ -302,7 +304,7 @@ class DxilConf_SM610_LinAlg { /// device is attempted. Durning normal execution SM6.10 is required. D3D_SHADER_MODEL DxilConf_SM610_LinAlg::createDevice() { if (EmulateTest) { - if(D3D12SDK->createDevice(&D3DDevice, D3D_SHADER_MODEL_6_8, false)) + if (D3D12SDK->createDevice(&D3DDevice, D3D_SHADER_MODEL_6_8, false)) return D3D_SHADER_MODEL_6_8; return D3D_SHADER_MODEL_NONE; @@ -395,7 +397,8 @@ static const char LoadStoreShader[] = R"( static void runLoadStoreRoundtrip(ID3D12Device *Device, dxc::SpecificDllLoader &DxcSupport, - const MatrixParams &Params, bool Verbose, bool CompileOnly) { + const MatrixParams &Params, bool Verbose, + bool CompileOnly) { const size_t NumElements = Params.totalElements(); const size_t BufferSize = Params.totalBytes(); @@ -454,7 +457,8 @@ void DxilConf_SM610_LinAlg::LoadStoreRoundtrip_Wave_16x16_F16() { Params.NumThreads = 4; Params.Enable16Bit = true; Params.EmulateTest = EmulateTest; - runLoadStoreRoundtrip(D3DDevice, DxcSupport, Params, VerboseLogging, CompileOnly); + runLoadStoreRoundtrip(D3DDevice, DxcSupport, Params, VerboseLogging, + CompileOnly); } static const char SplatStoreShader[] = R"( @@ -537,7 +541,8 @@ void DxilConf_SM610_LinAlg::SplatStore_Wave_16x16_F16() { Params.NumThreads = 4; Params.Enable16Bit = true; Params.EmulateTest = EmulateTest; - runSplatStore(D3DDevice, DxcSupport, Params, 42.0f, VerboseLogging, CompileOnly); + runSplatStore(D3DDevice, DxcSupport, Params, 42.0f, VerboseLogging, + CompileOnly); } static const char ElementAccessShader[] = R"( @@ -597,7 +602,8 @@ static const char ElementAccessShader[] = R"( static void runElementAccess(ID3D12Device *Device, dxc::SpecificDllLoader &DxcSupport, - const MatrixParams &Params, bool Verbose, bool CompileOnly) { + const MatrixParams &Params, bool Verbose, + bool CompileOnly) { const size_t NumElements = Params.totalElements(); const size_t NumThreads = Params.NumThreads; const size_t InputBufSize = Params.totalBytes(); diff --git a/tools/clang/unittests/HLSLExec/LongVectors.cpp b/tools/clang/unittests/HLSLExec/LongVectors.cpp index 1202d0359b..d9473ce591 100644 --- a/tools/clang/unittests/HLSLExec/LongVectors.cpp +++ b/tools/clang/unittests/HLSLExec/LongVectors.cpp @@ -10,9 +10,9 @@ #include "ShaderOpTest.h" #include "dxc/Support/Global.h" +#include "HlslExecTestUtils.h" #include "HlslTestDataTypes.h" #include "HlslTestUtils.h" -#include "HlslExecTestUtils.h" #include #include @@ -67,7 +67,6 @@ DATA_TYPE(double, "double", 8) #undef DATA_TYPE - using HLSLTestDataTypes::doValuesMatch; using HLSLTestDataTypes::ValidationType; From 48c779c49c8ebab458f9ae1de40771a9a279e01f Mon Sep 17 00:00:00 2001 From: Ashley Coleman Date: Mon, 6 Apr 2026 19:10:32 -0600 Subject: [PATCH 5/5] Update tools/clang/unittests/HLSLExec/LinAlgTests.cpp --- tools/clang/unittests/HLSLExec/LinAlgTests.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/clang/unittests/HLSLExec/LinAlgTests.cpp b/tools/clang/unittests/HLSLExec/LinAlgTests.cpp index f3591424ee..6221f7f1df 100644 --- a/tools/clang/unittests/HLSLExec/LinAlgTests.cpp +++ b/tools/clang/unittests/HLSLExec/LinAlgTests.cpp @@ -300,8 +300,8 @@ class DxilConf_SM610_LinAlg { WEX::TestExecution::VerifyOutputSettings::LogOnlyFailures}; }; -/// Attempts to create a device. If tests are being emulated this an SM6.8 -/// device is attempted. Durning normal execution SM6.10 is required. +/// Attempts to create a device. If shaders are being emulated then a SM6.8 +/// device is attempted. Otherwise a SM6.10 device is attempted D3D_SHADER_MODEL DxilConf_SM610_LinAlg::createDevice() { if (EmulateTest) { if (D3D12SDK->createDevice(&D3DDevice, D3D_SHADER_MODEL_6_8, false))