Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
6cd466f
Basic implementation of priority long vector exec tests.
alsepkow Apr 4, 2025
fd13c5b
WIP adding vector sizes and types. Need to rebase to get vector size …
alsepkow Apr 8, 2025
47b01c0
Enforce arithmetic types
alsepkow Apr 8, 2025
80370c4
No more 1024 for now. StructuredBuffer size limit
alsepkow Apr 8, 2025
cf7698b
Some updates, only committing because this is a state I'm sharing wit…
alsepkow Apr 9, 2025
7a6e638
Add halfs
alsepkow Apr 10, 2025
c882ee9
Swapping to refactor
alsepkow Apr 10, 2025
546d090
Refactor and clean up. Squash to a single test method.
alsepkow Apr 11, 2025
8958c53
80 colums
alsepkow Apr 16, 2025
f45988b
80 colums
alsepkow Apr 16, 2025
c3694a5
Remove ngVect typo
alsepkow Apr 16, 2025
dff914d
revert external
alsepkow Apr 16, 2025
fc406fb
clang-format
alsepkow Apr 16, 2025
5e56816
Add a reasonable range for floats/doubles. Still looks like WARP clam…
alsepkow Apr 16, 2025
4ab641b
cleanup
alsepkow Apr 16, 2025
b631a74
VERIFY_FAILED
alsepkow Apr 16, 2025
60a11d5
Fix verify and some minor cleanup
alsepkow Apr 16, 2025
85c05f1
Swapped to byteaddressbuffer
alsepkow Apr 17, 2025
87ea300
Update comment
alsepkow Apr 17, 2025
35e50c2
Clean up logic to copy back based on underlying type
alsepkow Apr 17, 2025
3374433
Clang-format
alsepkow Apr 17, 2025
1c88388
Some code review
alsepkow Apr 17, 2025
7908e11
Clang-format
alsepkow Apr 17, 2025
9a47145
Prevent clamp logic on bools
alsepkow Apr 17, 2025
a1df6e8
Formatting update
alsepkow Apr 17, 2025
481fc9c
Need to implement ComparDoubleULP
alsepkow Apr 17, 2025
a35e1c4
Format
alsepkow Apr 17, 2025
254cfdf
Code review. Fix float comparisons. Pass clamp args in a buffer
alsepkow Apr 18, 2025
c8c76ed
Formatting
alsepkow Apr 18, 2025
032cf46
Skip tests when device doesn't support SM 6.9
alsepkow Apr 18, 2025
f9882eb
uint64_t instead of DWORD64 for linux build
alsepkow Apr 18, 2025
0528b7d
Copy ShaderOpArith.xml to bin
alsepkow Apr 18, 2025
a967e89
Code review. Clean up generator
alsepkow Apr 18, 2025
990f51d
fix denorm functions
alsepkow Apr 18, 2025
cd1abc9
Whoops
alsepkow Apr 18, 2025
86008b0
Whoops
alsepkow Apr 18, 2025
9a9f69a
Code review. Naming
alsepkow Apr 18, 2025
e148abb
All naming..
alsepkow Apr 18, 2025
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
50 changes: 44 additions & 6 deletions include/dxc/Test/HlslTestUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,17 @@ inline void LogErrorFmt(const wchar_t *fmt, ...) {
WEX::Logging::Log::Error(buf.data());
}

inline void LogErrorFmtThrow(const wchar_t *fmt, ...) {
va_list args;
va_start(args, fmt);
std::wstring buf(vFormatToWString(fmt, args));
va_end(args);
WEX::Logging::Log::Error(buf.data());

// Throws an exception to abort the test.
VERIFY_FAIL(L"Test error");
}

inline std::wstring
GetPathToHlslDataFile(const wchar_t *relative,
LPCWSTR paramName = HLSLDATAFILEPARAM,
Expand Down Expand Up @@ -459,15 +470,17 @@ inline bool GetTestParamUseWARP(bool defaultVal) {

#ifdef FP_SUBNORMAL

inline bool isdenorm(float f) { return FP_SUBNORMAL == std::fpclassify(f); }
template <typename T> inline bool isdenorm(T f) {
return FP_SUBNORMAL == std::fpclassify(f);
}

#else

inline bool isdenorm(float f) {
return (std::numeric_limits<float>::denorm_min() <= f &&
f < std::numeric_limits<float>::min()) ||
(-std::numeric_limits<float>::min() < f &&
f <= -std::numeric_limits<float>::denorm_min());
template <typename T> inline bool isdenorm(T f) {
return (std::numeric_limits<T>::denorm_min() <= f &&
f < std::numeric_limits<T>::min()) ||
(-std::numeric_limits<T>::min() < f &&
f <= -std::numeric_limits<T>::denorm_min());
}

#endif // FP_SUBNORMAL
Expand Down Expand Up @@ -515,6 +528,31 @@ inline bool isnanFloat16(uint16_t val) {
uint16_t ConvertFloat32ToFloat16(float val) throw();
float ConvertFloat16ToFloat32(uint16_t val) throw();

inline bool CompareDoubleULP(
const double &Src, const double &Ref, int64_t ULPTolerance,
hlsl::DXIL::Float32DenormMode Mode = hlsl::DXIL::Float32DenormMode::Any) {
if (Src == Ref) {
return true;
}
if (std::isnan(Src)) {
return std::isnan(Ref);
}

if (Mode == hlsl::DXIL::Float32DenormMode::Any) {
// If denorm expected, output can be sign preserved zero. Otherwise output
// should pass the regular ulp testing.
if (isdenorm(Ref) && Src == 0 && std::signbit(Src) == std::signbit(Ref))
return true;
}

// For FTZ or Preserve mode, we should get the expected number within
// ULPTolerance for any operations.
int64_t Diff = *((const uint64_t *)&Src) - *((const uint64_t *)&Ref);

uint64_t AbsoluteDiff = Diff < 0 ? -Diff : Diff;
return AbsoluteDiff <= (uint64_t)ULPTolerance;
}

inline bool CompareFloatULP(
const float &fsrc, const float &fref, int ULPTolerance,
hlsl::DXIL::Float32DenormMode mode = hlsl::DXIL::Float32DenormMode::Any) {
Expand Down
7 changes: 7 additions & 0 deletions tools/clang/unittests/HLSLExec/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,10 @@ endif()
file(TO_NATIVE_PATH "${CMAKE_CURRENT_SOURCE_DIR}" DOS_STYLE_SOURCE_DIR)
file(TO_NATIVE_PATH "${TAEF_BIN_DIR}" DOS_TAEF_BIN_DIR)
configure_file(ExecHLSLTests.vcxproj.user.txt ExecHLSLTests.vcxproj.user)

# Copy the ShaderOpArith.xml file to the output directory. It's used by the exec
# tests and it's convenient to have it copied here if you want to easily copy
# the tests to another machine after building.
set(XML_SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/ShaderOpArith.xml)
set(XML_DESTINATION ${CMAKE_BINARY_DIR}/${CMAKE_BUILD_TYPE}/bin)
file(COPY ${XML_SOURCE} DESTINATION ${XML_DESTINATION})
Loading