Skip to content

Commit eb70013

Browse files
github-actions[bot]alsepkow
authored andcommitted
chore: autopublish 2026-03-04T22:38:44Z
1 parent 914167b commit eb70013

3 files changed

Lines changed: 66 additions & 94 deletions

File tree

tools/clang/unittests/HLSLExec/HLSLTestDataTypes.h

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -303,18 +303,10 @@ struct F8E4M3_t {
303303

304304
bool operator==(const F8E4M3_t &O) const { return Val == O.Val; }
305305
bool operator!=(const F8E4M3_t &O) const { return Val != O.Val; }
306-
bool operator<(const F8E4M3_t &O) const {
307-
return float(*this) < float(O);
308-
}
309-
bool operator>(const F8E4M3_t &O) const {
310-
return float(*this) > float(O);
311-
}
312-
bool operator<=(const F8E4M3_t &O) const {
313-
return float(*this) <= float(O);
314-
}
315-
bool operator>=(const F8E4M3_t &O) const {
316-
return float(*this) >= float(O);
317-
}
306+
bool operator<(const F8E4M3_t &O) const { return float(*this) < float(O); }
307+
bool operator>(const F8E4M3_t &O) const { return float(*this) > float(O); }
308+
bool operator<=(const F8E4M3_t &O) const { return float(*this) <= float(O); }
309+
bool operator>=(const F8E4M3_t &O) const { return float(*this) >= float(O); }
318310

319311
friend std::ostream &operator<<(std::ostream &Os, const F8E4M3_t &Obj) {
320312
Os << float(Obj);
@@ -413,18 +405,10 @@ struct F8E5M2_t {
413405

414406
bool operator==(const F8E5M2_t &O) const { return Val == O.Val; }
415407
bool operator!=(const F8E5M2_t &O) const { return Val != O.Val; }
416-
bool operator<(const F8E5M2_t &O) const {
417-
return float(*this) < float(O);
418-
}
419-
bool operator>(const F8E5M2_t &O) const {
420-
return float(*this) > float(O);
421-
}
422-
bool operator<=(const F8E5M2_t &O) const {
423-
return float(*this) <= float(O);
424-
}
425-
bool operator>=(const F8E5M2_t &O) const {
426-
return float(*this) >= float(O);
427-
}
408+
bool operator<(const F8E5M2_t &O) const { return float(*this) < float(O); }
409+
bool operator>(const F8E5M2_t &O) const { return float(*this) > float(O); }
410+
bool operator<=(const F8E5M2_t &O) const { return float(*this) <= float(O); }
411+
bool operator>=(const F8E5M2_t &O) const { return float(*this) >= float(O); }
428412

429413
friend std::ostream &operator<<(std::ostream &Os, const F8E5M2_t &Obj) {
430414
Os << float(Obj);

tools/clang/unittests/HLSLExec/LinearAlgebra.cpp

Lines changed: 25 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ namespace LinearAlgebra {
3131
//
3232

3333
enum class OpType : unsigned {
34-
#define OP(SYMBOL, ARITY, DEFINE, SHADER_NAME, INPUT_SET_1, INPUT_SET_2) \
35-
SYMBOL,
34+
#define OP(SYMBOL, ARITY, DEFINE, SHADER_NAME, INPUT_SET_1, INPUT_SET_2) SYMBOL,
3635
#include "LinearAlgebraOps.def"
3736
NumOpTypes
3837
};
@@ -47,8 +46,11 @@ struct Operation {
4746

4847
static constexpr Operation Operations[] = {
4948
#define OP(SYMBOL, ARITY, DEFINE, SHADER_NAME, INPUT_SET_1, INPUT_SET_2) \
50-
{ARITY, DEFINE, SHADER_NAME, \
51-
{InputSet::INPUT_SET_1, InputSet::INPUT_SET_2}, OpType::SYMBOL},
49+
{ARITY, \
50+
DEFINE, \
51+
SHADER_NAME, \
52+
{InputSet::INPUT_SET_1, InputSet::INPUT_SET_2}, \
53+
OpType::SYMBOL},
5254
#include "LinearAlgebraOps.def"
5355
};
5456

@@ -75,7 +77,7 @@ template <typename T> const DataType &getDataType() {
7577

7678
#define DATA_TYPE(TYPE, HLSL_STRING, COMP_TYPE, HLSL_SIZE, IS_16BIT) \
7779
template <> const DataType &getDataType<TYPE>() { \
78-
static DataType DT{HLSL_STRING, COMP_TYPE, IS_16BIT, HLSL_SIZE}; \
80+
static DataType DT{HLSL_STRING, COMP_TYPE, IS_16BIT, HLSL_SIZE}; \
7981
return DT; \
8082
}
8183

@@ -106,9 +108,7 @@ struct ValidationConfig {
106108
return {Tol, ValidationType::Epsilon};
107109
}
108110

109-
static ValidationConfig Ulp(double Tol) {
110-
return {Tol, ValidationType::Ulp};
111-
}
111+
static ValidationConfig Ulp(double Tol) { return {Tol, ValidationType::Ulp}; }
112112
};
113113

114114
// Default validation: ULP for floating point, exact for integers.
@@ -162,8 +162,7 @@ bool doValuesMatch(float A, float B, double Tolerance, ValidationType VType) {
162162
}
163163
}
164164

165-
bool doValuesMatch(double A, double B, double Tolerance,
166-
ValidationType VType) {
165+
bool doValuesMatch(double A, double B, double Tolerance, ValidationType VType) {
167166
switch (VType) {
168167
case ValidationType::Epsilon:
169168
return CompareDoubleEpsilon(A, B, Tolerance);
@@ -222,9 +221,9 @@ std::vector<MatrixDims> getMatrixSizesToTest() {
222221
// Build compiler options.
223222
//
224223

225-
std::string
226-
getCompilerOptionsString(const Operation &Op, const DataType &ElemType,
227-
size_t Rows, size_t Cols, size_t KDim = 0) {
224+
std::string getCompilerOptionsString(const Operation &Op,
225+
const DataType &ElemType, size_t Rows,
226+
size_t Cols, size_t KDim = 0) {
228227
std::stringstream Options;
229228

230229
if (ElemType.Is16Bit)
@@ -317,7 +316,7 @@ std::vector<T> buildIdentityMatrix(size_t Rows, size_t Cols) {
317316

318317
template <typename T>
319318
InputSets<T> buildTestInputs(const Operation &Op, size_t Rows, size_t Cols,
320-
size_t KDim) {
319+
size_t KDim) {
321320
InputSets<T> Inputs;
322321
const size_t NumElements = Rows * Cols;
323322

@@ -341,18 +340,17 @@ InputSets<T> buildTestInputs(const Operation &Op, size_t Rows, size_t Cols,
341340

342341
template <typename T>
343342
std::optional<std::vector<T>>
344-
runLinAlgTest(ID3D12Device *D3DDevice, bool VerboseLogging,
345-
const Operation &Op, const InputSets<T> &Inputs, size_t Rows,
346-
size_t Cols, size_t KDim, size_t ExpectedOutputSize) {
343+
runLinAlgTest(ID3D12Device *D3DDevice, bool VerboseLogging, const Operation &Op,
344+
const InputSets<T> &Inputs, size_t Rows, size_t Cols, size_t KDim,
345+
size_t ExpectedOutputSize) {
347346

348347
const DataType &ElemType = getDataType<T>();
349348

350349
std::string CompilerOptions =
351350
getCompilerOptionsString(Op, ElemType, Rows, Cols, KDim);
352351

353352
if (VerboseLogging)
354-
hlsl_test::LogCommentFmt(L"Compiler Options: %S",
355-
CompilerOptions.c_str());
353+
hlsl_test::LogCommentFmt(L"Compiler Options: %S", CompilerOptions.c_str());
356354

357355
dxc::SpecificDllLoader DxilDllLoader;
358356
CComPtr<IStream> TestXML;
@@ -473,8 +471,7 @@ template <typename T> struct ExpectedBuilder<OpType::MatrixAccumulate, T> {
473471
};
474472

475473
// MatrixMul: multiply input matrix by identity.
476-
template <typename T>
477-
struct Op<OpType::MatrixMul, T> : DefaultValidation<T> {};
474+
template <typename T> struct Op<OpType::MatrixMul, T> : DefaultValidation<T> {};
478475

479476
template <typename T> struct ExpectedBuilder<OpType::MatrixMul, T> {
480477
static std::vector<T> buildExpected(Op<OpType::MatrixMul, T> &,
@@ -546,11 +543,9 @@ class LinAlgTestClassCommon {
546543
WEX::TestExecution::RuntimeParameters::TryGetValue(L"VerboseLogging",
547544
VerboseLogging);
548545
if (VerboseLogging)
549-
hlsl_test::LogCommentFmt(
550-
L"Verbose logging is enabled for this test.");
546+
hlsl_test::LogCommentFmt(L"Verbose logging is enabled for this test.");
551547
else
552-
hlsl_test::LogCommentFmt(
553-
L"Verbose logging is disabled for this test.");
548+
hlsl_test::LogCommentFmt(L"Verbose logging is disabled for this test.");
554549

555550
bool FailIfRequirementsNotMet = false;
556551
#ifdef _HLK_CONF
@@ -614,22 +609,18 @@ class LinAlgTestClassCommon {
614609
class DxilConf_SM610_LinearAlgebra : public LinAlgTestClassCommon {
615610
public:
616611
BEGIN_TEST_CLASS(DxilConf_SM610_LinearAlgebra)
617-
TEST_CLASS_PROPERTY(
618-
"Kits.TestName",
619-
"D3D12 - Shader Model 6.10 - Linear Algebra Tests")
612+
TEST_CLASS_PROPERTY("Kits.TestName",
613+
"D3D12 - Shader Model 6.10 - Linear Algebra Tests")
620614
TEST_CLASS_PROPERTY("Kits.TestId", "a1b2c3d4-e5f6-7890-abcd-ef1234567890")
621-
TEST_CLASS_PROPERTY(
622-
"Kits.Description",
623-
"Validates SM 6.10 linear algebra matrix operations")
615+
TEST_CLASS_PROPERTY("Kits.Description",
616+
"Validates SM 6.10 linear algebra matrix operations")
624617
TEST_CLASS_PROPERTY(
625618
"Kits.Specification",
626619
"Device.Graphics.D3D12.DXILCore.ShaderModel610.CoreRequirement")
627620
TEST_METHOD_PROPERTY(L"Priority", L"0")
628621
END_TEST_CLASS()
629622

630-
TEST_CLASS_SETUP(setupClass) {
631-
return LinAlgTestClassCommon::setupClass();
632-
}
623+
TEST_CLASS_SETUP(setupClass) { return LinAlgTestClassCommon::setupClass(); }
633624
TEST_METHOD_SETUP(setupMethod) {
634625
return LinAlgTestClassCommon::setupMethod();
635626
}

tools/clang/unittests/HLSLExec/LinearAlgebraTestData.h

Lines changed: 33 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -16,54 +16,53 @@ namespace LinearAlgebra {
1616

1717
enum class InputSet { Seed, Fill, Identity };
1818

19-
template <typename T>
20-
const std::vector<T> &getInputSet(InputSet InputSet) {
19+
template <typename T> const std::vector<T> &getInputSet(InputSet InputSet) {
2120
static_assert(sizeof(T) == 0, "No InputSet for this type");
2221
}
2322

24-
#define BEGIN_INPUT_SETS(TYPE) \
25-
template <> \
26-
inline const std::vector<TYPE> &getInputSet<TYPE>(InputSet InputSet) { \
27-
using T = TYPE; \
23+
#define BEGIN_INPUT_SETS(TYPE) \
24+
template <> \
25+
inline const std::vector<TYPE> &getInputSet<TYPE>(InputSet InputSet) { \
26+
using T = TYPE; \
2827
switch (InputSet) {
2928

30-
#define INPUT_SET(SET, ...) \
31-
case SET: { \
32-
static std::vector<T> Data = {__VA_ARGS__}; \
33-
return Data; \
29+
#define INPUT_SET(SET, ...) \
30+
case SET: { \
31+
static std::vector<T> Data = {__VA_ARGS__}; \
32+
return Data; \
3433
}
3534

36-
#define END_INPUT_SETS() \
37-
default: \
38-
break; \
39-
} \
40-
VERIFY_FAIL("Missing input set"); \
41-
std::abort(); \
35+
#define END_INPUT_SETS() \
36+
default: \
37+
break; \
38+
} \
39+
VERIFY_FAIL("Missing input set"); \
40+
std::abort(); \
4241
}
4342

43+
using HLSLTestDataTypes::F8E4M3_t;
44+
using HLSLTestDataTypes::F8E5M2_t;
4445
using HLSLTestDataTypes::HLSLHalf_t;
4546
using HLSLTestDataTypes::SNormF16_t;
46-
using HLSLTestDataTypes::UNormF16_t;
4747
using HLSLTestDataTypes::SNormF32_t;
48-
using HLSLTestDataTypes::UNormF32_t;
4948
using HLSLTestDataTypes::SNormF64_t;
49+
using HLSLTestDataTypes::UNormF16_t;
50+
using HLSLTestDataTypes::UNormF32_t;
5051
using HLSLTestDataTypes::UNormF64_t;
51-
using HLSLTestDataTypes::F8E4M3_t;
52-
using HLSLTestDataTypes::F8E5M2_t;
5352

5453
BEGIN_INPUT_SETS(HLSLHalf_t)
55-
INPUT_SET(InputSet::Seed, HLSLHalf_t(1.0f), HLSLHalf_t(2.0f),
56-
HLSLHalf_t(3.0f), HLSLHalf_t(4.0f), HLSLHalf_t(5.0f),
57-
HLSLHalf_t(6.0f), HLSLHalf_t(7.0f), HLSLHalf_t(8.0f),
58-
HLSLHalf_t(9.0f), HLSLHalf_t(10.0f), HLSLHalf_t(11.0f),
59-
HLSLHalf_t(12.0f), HLSLHalf_t(13.0f), HLSLHalf_t(14.0f))
54+
INPUT_SET(InputSet::Seed, HLSLHalf_t(1.0f), HLSLHalf_t(2.0f), HLSLHalf_t(3.0f),
55+
HLSLHalf_t(4.0f), HLSLHalf_t(5.0f), HLSLHalf_t(6.0f),
56+
HLSLHalf_t(7.0f), HLSLHalf_t(8.0f), HLSLHalf_t(9.0f),
57+
HLSLHalf_t(10.0f), HLSLHalf_t(11.0f), HLSLHalf_t(12.0f),
58+
HLSLHalf_t(13.0f), HLSLHalf_t(14.0f))
6059
INPUT_SET(InputSet::Fill, HLSLHalf_t(42.0f))
6160
INPUT_SET(InputSet::Identity, HLSLHalf_t(1.0f))
6261
END_INPUT_SETS()
6362

6463
BEGIN_INPUT_SETS(float)
65-
INPUT_SET(InputSet::Seed, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f,
66-
9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f)
64+
INPUT_SET(InputSet::Seed, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f,
65+
10.0f, 11.0f, 12.0f, 13.0f, 14.0f)
6766
INPUT_SET(InputSet::Fill, 42.0f)
6867
INPUT_SET(InputSet::Identity, 1.0f)
6968
END_INPUT_SETS()
@@ -174,20 +173,18 @@ INPUT_SET(InputSet::Identity, UNormF32_t(1.0f))
174173
END_INPUT_SETS()
175174

176175
BEGIN_INPUT_SETS(SNormF64_t)
177-
INPUT_SET(InputSet::Seed, SNormF64_t(-0.9), SNormF64_t(-0.7),
178-
SNormF64_t(-0.5), SNormF64_t(-0.3), SNormF64_t(-0.1),
179-
SNormF64_t(0.1), SNormF64_t(0.2), SNormF64_t(0.3), SNormF64_t(0.4),
180-
SNormF64_t(0.5), SNormF64_t(0.6), SNormF64_t(0.7), SNormF64_t(0.8),
181-
SNormF64_t(0.9))
176+
INPUT_SET(InputSet::Seed, SNormF64_t(-0.9), SNormF64_t(-0.7), SNormF64_t(-0.5),
177+
SNormF64_t(-0.3), SNormF64_t(-0.1), SNormF64_t(0.1), SNormF64_t(0.2),
178+
SNormF64_t(0.3), SNormF64_t(0.4), SNormF64_t(0.5), SNormF64_t(0.6),
179+
SNormF64_t(0.7), SNormF64_t(0.8), SNormF64_t(0.9))
182180
INPUT_SET(InputSet::Fill, SNormF64_t(0.5))
183181
INPUT_SET(InputSet::Identity, SNormF64_t(1.0))
184182
END_INPUT_SETS()
185183

186184
BEGIN_INPUT_SETS(UNormF64_t)
187-
INPUT_SET(InputSet::Seed, UNormF64_t(0.05), UNormF64_t(0.1),
188-
UNormF64_t(0.15), UNormF64_t(0.2), UNormF64_t(0.25),
189-
UNormF64_t(0.3), UNormF64_t(0.35), UNormF64_t(0.4),
190-
UNormF64_t(0.45), UNormF64_t(0.5), UNormF64_t(0.55),
185+
INPUT_SET(InputSet::Seed, UNormF64_t(0.05), UNormF64_t(0.1), UNormF64_t(0.15),
186+
UNormF64_t(0.2), UNormF64_t(0.25), UNormF64_t(0.3), UNormF64_t(0.35),
187+
UNormF64_t(0.4), UNormF64_t(0.45), UNormF64_t(0.5), UNormF64_t(0.55),
191188
UNormF64_t(0.6), UNormF64_t(0.7), UNormF64_t(0.8))
192189
INPUT_SET(InputSet::Fill, UNormF64_t(0.5))
193190
INPUT_SET(InputSet::Identity, UNormF64_t(1.0))

0 commit comments

Comments
 (0)