Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
fe97f53
Add min precision type infrastructure for long vector tests
alsepkow Mar 11, 2026
4172cd8
Add min precision test class and test entries for long vectors
alsepkow Mar 11, 2026
54731ff
Fix ambiguous operator overload in min precision wrapper types
alsepkow Mar 11, 2026
011c9c5
Fix C2666: make int/uint constructors explicit on HLSLMin16Float_t
alsepkow Mar 11, 2026
3e4aa58
Add missing constructors and operators to min precision int types
alsepkow Mar 11, 2026
bf0b3f5
Fix abs ambiguity for unsigned wrapper and constexpr literal type
alsepkow Mar 11, 2026
a5e03b9
Update MinPrecision test class GUID
alsepkow Mar 11, 2026
250f29f
Update comment: clarify why FP specials are excluded
alsepkow Mar 11, 2026
15cdf7a
Add Cast test entries and remove unused explicit conversion operators
alsepkow Mar 11, 2026
d9e5f73
Remove WaveMultiPrefixBit* tests for min precision integer types
alsepkow Mar 11, 2026
f087900
Merge min precision tests into Core class and remove device check
alsepkow Mar 12, 2026
ad5bb9a
Use full-precision types for buffer I/O with min precision types
alsepkow Mar 14, 2026
59e5616
Remove Divide and Modulus tests for min16int
alsepkow Mar 14, 2026
4604c6e
Use float16-exact values for min16float test input data
alsepkow Mar 14, 2026
4e654b6
Constrain min16int/uint input data to 16-bit range
alsepkow Mar 14, 2026
351dda7
Remove wave/quad op tests for min precision types
alsepkow Mar 14, 2026
d8cfc9e
Use half-precision ULP for min16float dot product tolerance
alsepkow Mar 14, 2026
7088172
Add comment explaining why IO_TYPE and IO_OUT_TYPE are both needed
alsepkow Mar 16, 2026
b5e69b5
Make min precision wrapper constructors constexpr
alsepkow Mar 17, 2026
501e73c
Remove unnecessary static_asserts from min precision wrappers
alsepkow Mar 17, 2026
7f8613d
Remove unused WaveMultiPrefixBitwise input sets for min precision types
alsepkow Mar 17, 2026
b723e86
Gate IO_TYPE/IO_OUT_TYPE behind MIN_PRECISION preprocessor flag
alsepkow Mar 17, 2026
bbfb624
Revert IO_OUT_TYPE to OUT_TYPE for ops excluded from min precision
alsepkow Mar 17, 2026
cc2c4b1
Refactor: use dispatchMinPrecisionTest and HLK_MIN_PRECISION_TEST macro
alsepkow Mar 17, 2026
17c5a2e
Replace getIOTypeString with template-based type trait
alsepkow Mar 17, 2026
0c39a8e
Move IO type string into DataType struct
alsepkow Mar 17, 2026
e97d4bd
Some cleanup
alsepkow Mar 17, 2026
eb9c0e5
Remove bit shift tests for min precision types
alsepkow Mar 17, 2026
354fe61
Add wave and quad op tests for min precision types
alsepkow Mar 17, 2026
f07f7b2
Add comment explaining extra static_cast in waveMultiPrefixBitOr
alsepkow Mar 17, 2026
212db31
Rename IO_TYPE/IO_OUT_TYPE to BUFFER_TYPE/BUFFER_OUT_TYPE
alsepkow Mar 17, 2026
cb6175a
Extract getWaveSize helper and clarify mirrors comments
alsepkow Mar 18, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
227 changes: 227 additions & 0 deletions tools/clang/unittests/HLSLExec/LongVectorTestData.h
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,184 @@ struct HLSLHalf_t {
DirectX::PackedVector::HALF Val = 0;
};

// Min precision wrapper types. Without -enable-16bit-types, min precision types
// are 32-bit in DXIL storage. These thin wrappers provide distinct C++ types
// that map to different HLSL type strings via DATA_TYPE.
struct HLSLMin16Float_t {
constexpr HLSLMin16Float_t() : Val(0.0f) {}
constexpr HLSLMin16Float_t(float F) : Val(F) {}
constexpr HLSLMin16Float_t(double D) : Val(static_cast<float>(D)) {}
explicit constexpr HLSLMin16Float_t(int I) : Val(static_cast<float>(I)) {}
explicit constexpr HLSLMin16Float_t(uint32_t U)
: Val(static_cast<float>(U)) {}

constexpr operator float() const { return Val; }

bool operator==(const HLSLMin16Float_t &O) const { return Val == O.Val; }
bool operator!=(const HLSLMin16Float_t &O) const { return Val != O.Val; }
bool operator<(const HLSLMin16Float_t &O) const { return Val < O.Val; }
bool operator>(const HLSLMin16Float_t &O) const { return Val > O.Val; }
bool operator<=(const HLSLMin16Float_t &O) const { return Val <= O.Val; }
bool operator>=(const HLSLMin16Float_t &O) const { return Val >= O.Val; }

HLSLMin16Float_t operator+(const HLSLMin16Float_t &O) const {
return HLSLMin16Float_t(Val + O.Val);
}
HLSLMin16Float_t operator-(const HLSLMin16Float_t &O) const {
return HLSLMin16Float_t(Val - O.Val);
}
HLSLMin16Float_t operator*(const HLSLMin16Float_t &O) const {
return HLSLMin16Float_t(Val * O.Val);
}
HLSLMin16Float_t operator/(const HLSLMin16Float_t &O) const {
return HLSLMin16Float_t(Val / O.Val);
}
HLSLMin16Float_t operator%(const HLSLMin16Float_t &O) const {
return HLSLMin16Float_t(std::fmod(Val, O.Val));
}

friend std::wostream &operator<<(std::wostream &Os,
const HLSLMin16Float_t &Obj) {
Os << Obj.Val;
return Os;
}
friend std::ostream &operator<<(std::ostream &Os,
const HLSLMin16Float_t &Obj) {
Os << Obj.Val;
return Os;
}

float Val;
};
struct HLSLMin16Int_t {
constexpr HLSLMin16Int_t() : Val(0) {}
constexpr HLSLMin16Int_t(int32_t I) : Val(I) {}
constexpr HLSLMin16Int_t(int64_t I) : Val(static_cast<int32_t>(I)) {}
constexpr HLSLMin16Int_t(uint32_t U) : Val(static_cast<int32_t>(U)) {}
constexpr HLSLMin16Int_t(uint64_t U) : Val(static_cast<int32_t>(U)) {}
constexpr HLSLMin16Int_t(float F) : Val(static_cast<int32_t>(F)) {}
constexpr HLSLMin16Int_t(double D) : Val(static_cast<int32_t>(D)) {}

constexpr operator int32_t() const { return Val; }

bool operator==(const HLSLMin16Int_t &O) const { return Val == O.Val; }
bool operator!=(const HLSLMin16Int_t &O) const { return Val != O.Val; }
bool operator<(const HLSLMin16Int_t &O) const { return Val < O.Val; }
bool operator>(const HLSLMin16Int_t &O) const { return Val > O.Val; }
bool operator<=(const HLSLMin16Int_t &O) const { return Val <= O.Val; }
bool operator>=(const HLSLMin16Int_t &O) const { return Val >= O.Val; }

HLSLMin16Int_t operator+(const HLSLMin16Int_t &O) const {
return HLSLMin16Int_t(Val + O.Val);
}
HLSLMin16Int_t operator-(const HLSLMin16Int_t &O) const {
return HLSLMin16Int_t(Val - O.Val);
}
HLSLMin16Int_t operator*(const HLSLMin16Int_t &O) const {
return HLSLMin16Int_t(Val * O.Val);
}
HLSLMin16Int_t operator/(const HLSLMin16Int_t &O) const {
return HLSLMin16Int_t(Val / O.Val);
}
HLSLMin16Int_t operator%(const HLSLMin16Int_t &O) const {
return HLSLMin16Int_t(Val % O.Val);
}
HLSLMin16Int_t operator&(const HLSLMin16Int_t &O) const {
return HLSLMin16Int_t(Val & O.Val);
}
HLSLMin16Int_t operator|(const HLSLMin16Int_t &O) const {
return HLSLMin16Int_t(Val | O.Val);
}
HLSLMin16Int_t operator^(const HLSLMin16Int_t &O) const {
return HLSLMin16Int_t(Val ^ O.Val);
}
HLSLMin16Int_t operator<<(const HLSLMin16Int_t &O) const {
return HLSLMin16Int_t(Val << O.Val);
}
HLSLMin16Int_t operator>>(const HLSLMin16Int_t &O) const {
return HLSLMin16Int_t(Val >> O.Val);
}
HLSLMin16Int_t operator&&(const HLSLMin16Int_t &O) const {
return HLSLMin16Int_t(Val && O.Val);
}
HLSLMin16Int_t operator||(const HLSLMin16Int_t &O) const {
return HLSLMin16Int_t(Val || O.Val);
}
friend std::wostream &operator<<(std::wostream &Os,
const HLSLMin16Int_t &Obj) {
Os << Obj.Val;
return Os;
}
friend std::ostream &operator<<(std::ostream &Os, const HLSLMin16Int_t &Obj) {
Os << Obj.Val;
return Os;
}

int32_t Val;
};
struct HLSLMin16Uint_t {
constexpr HLSLMin16Uint_t() : Val(0) {}
constexpr HLSLMin16Uint_t(uint32_t U) : Val(U) {}
constexpr HLSLMin16Uint_t(uint64_t U) : Val(static_cast<uint32_t>(U)) {}
constexpr HLSLMin16Uint_t(int32_t I) : Val(static_cast<uint32_t>(I)) {}
constexpr HLSLMin16Uint_t(float F) : Val(static_cast<uint32_t>(F)) {}
constexpr HLSLMin16Uint_t(double D) : Val(static_cast<uint32_t>(D)) {}

constexpr operator uint32_t() const { return Val; }

bool operator==(const HLSLMin16Uint_t &O) const { return Val == O.Val; }
bool operator!=(const HLSLMin16Uint_t &O) const { return Val != O.Val; }
bool operator<(const HLSLMin16Uint_t &O) const { return Val < O.Val; }
bool operator>(const HLSLMin16Uint_t &O) const { return Val > O.Val; }
bool operator<=(const HLSLMin16Uint_t &O) const { return Val <= O.Val; }
bool operator>=(const HLSLMin16Uint_t &O) const { return Val >= O.Val; }

HLSLMin16Uint_t operator+(const HLSLMin16Uint_t &O) const {
return HLSLMin16Uint_t(Val + O.Val);
}
HLSLMin16Uint_t operator-(const HLSLMin16Uint_t &O) const {
return HLSLMin16Uint_t(Val - O.Val);
}
HLSLMin16Uint_t operator*(const HLSLMin16Uint_t &O) const {
return HLSLMin16Uint_t(Val * O.Val);
}
HLSLMin16Uint_t operator/(const HLSLMin16Uint_t &O) const {
return HLSLMin16Uint_t(Val / O.Val);
}
HLSLMin16Uint_t operator%(const HLSLMin16Uint_t &O) const {
return HLSLMin16Uint_t(Val % O.Val);
}
HLSLMin16Uint_t operator&(const HLSLMin16Uint_t &O) const {
return HLSLMin16Uint_t(Val & O.Val);
}
HLSLMin16Uint_t operator|(const HLSLMin16Uint_t &O) const {
return HLSLMin16Uint_t(Val | O.Val);
}
HLSLMin16Uint_t operator^(const HLSLMin16Uint_t &O) const {
return HLSLMin16Uint_t(Val ^ O.Val);
}
HLSLMin16Uint_t operator<<(const HLSLMin16Uint_t &O) const {
return HLSLMin16Uint_t(Val << O.Val);
}
HLSLMin16Uint_t operator>>(const HLSLMin16Uint_t &O) const {
return HLSLMin16Uint_t(Val >> O.Val);
}

bool operator&&(const HLSLMin16Uint_t &O) const { return Val && O.Val; }
bool operator||(const HLSLMin16Uint_t &O) const { return Val || O.Val; }
friend std::wostream &operator<<(std::wostream &Os,
const HLSLMin16Uint_t &Obj) {
Os << Obj.Val;
return Os;
}
friend std::ostream &operator<<(std::ostream &Os,
const HLSLMin16Uint_t &Obj) {
Os << Obj.Val;
return Os;
}

uint32_t Val;
};
enum class InputSet {
#define INPUT_SET(SYMBOL) SYMBOL,
#include "LongVectorOps.def"
Expand Down Expand Up @@ -450,6 +628,55 @@ INPUT_SET(InputSet::SelectCond, 0.0, 1.0);
INPUT_SET(InputSet::AllOnes, 1.0);
END_INPUT_SETS()

// Min precision input sets. All values are exactly representable in float16
// to avoid precision mismatch between CPU-side expected values and GPU-side
// min precision computation. No FP specials (INF/NaN/denorm) as min precision
// types do not support them.
BEGIN_INPUT_SETS(HLSLMin16Float_t)
INPUT_SET(InputSet::Default1, -1.0f, -1.0f, 1.0f, -0.03125f, 1.0f, -0.03125f,
1.0f, -0.03125f, 1.0f, -0.03125f);
INPUT_SET(InputSet::Default2, 1.0f, -1.0f, 1.0f, -1.0f, 1.0f, -1.0f, 1.0f,
-1.0f, 1.0f, -1.0f);
INPUT_SET(InputSet::Default3, -1.0f, 1.0f, -1.0f, 1.0f, -1.0f, 1.0f, -1.0f,
1.0f, -1.0f, 1.0f);
INPUT_SET(InputSet::Zero, 0.0f);
INPUT_SET(InputSet::RangeHalfPi, -1.0625f, 0.046875f, -1.046875f, 0.3125f,
1.4375f, -0.875f, 1.375f, -0.71875f, -0.8125f, 0.5625f);
INPUT_SET(InputSet::RangeOne, 0.328125f, 0.71875f, -0.953125f, 0.671875f,
-0.03125f, 0.5f, 0.84375f, -0.671875f, -0.6875f, -0.90625f);
INPUT_SET(InputSet::Positive, 1.0f, 1.0f, 342.0f, 0.03125f, 5504.0f, 0.03125f,
1.0f, 0.03125f, 331.25f, 3250.0f);
INPUT_SET(InputSet::SelectCond, 0.0f, 1.0f);
INPUT_SET(InputSet::AllOnes, 1.0f);
END_INPUT_SETS()

// Values constrained to int16 range. Kept small to avoid overflow ambiguity.
// Shift amounts limited so results fit in int16 (-32768..32767).
BEGIN_INPUT_SETS(HLSLMin16Int_t)
INPUT_SET(InputSet::Default1, -6, 1, 7, 3, 8, 4, -3, 8, 8, -2);
INPUT_SET(InputSet::Default2, 5, -6, -3, -2, 9, 3, 1, -3, -7, 2);
INPUT_SET(InputSet::Default3, -5, 6, 3, 2, -9, -3, -1, 3, 7, -2);
INPUT_SET(InputSet::Zero, 0);
INPUT_SET(InputSet::NoZero, 1);
INPUT_SET(InputSet::SelectCond, 0, 1);
INPUT_SET(InputSet::AllOnes, 1);
INPUT_SET(InputSet::WaveMultiPrefixBitwise, 0x0, 0x1, 0x3, 0x4, 0x10, 0x12, 0xF,
-1);
END_INPUT_SETS()

// Values constrained to uint16 range. Kept small so that multiply, mad,
// subtract, shift, and wave prefix products do not overflow 16 bits.
BEGIN_INPUT_SETS(HLSLMin16Uint_t)
INPUT_SET(InputSet::Default1, 3, 199, 3, 200, 5, 10, 22, 8, 9, 10);
INPUT_SET(InputSet::Default2, 2, 111, 3, 4, 5, 9, 21, 8, 9, 10);
INPUT_SET(InputSet::Default3, 4, 112, 4, 5, 3, 7, 21, 1, 11, 9);
INPUT_SET(InputSet::Zero, 0);
INPUT_SET(InputSet::SelectCond, 0, 1);
INPUT_SET(InputSet::AllOnes, 1);
INPUT_SET(InputSet::WaveMultiPrefixBitwise, 0x0, 0x1, 0x3, 0x4, 0x10, 0x12, 0xF,
std::numeric_limits<uint16_t>::max());
END_INPUT_SETS()

#undef BEGIN_INPUT_SETS
#undef INPUT_SET
#undef END_INPUT_SETS
Expand Down
Loading
Loading