Skip to content

[NFC] Remove unused functions in ExecutionTest.cpp and assert.cpp #7129

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 3 additions & 0 deletions lib/Support/assert.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
#include "assert.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/raw_ostream.h"

#if defined(LLVM_ASSERTIONS_TRAP) || !defined(WIN32)
namespace {
void llvm_assert_trap(const char *_Message, const char *_File, unsigned _Line,
const char *_Function) {
Expand All @@ -18,6 +20,7 @@ void llvm_assert_trap(const char *_Message, const char *_File, unsigned _Line,
LLVM_BUILTIN_TRAP;
}
} // namespace
#endif

#ifdef _WIN32
#include "dxc/Support/Global.h"
Expand Down
54 changes: 0 additions & 54 deletions tools/clang/unittests/HLSLExec/ExecutionTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6880,22 +6880,6 @@ ToleranceType ToleranceStringToEnum(LPCWSTR toleranceType) {
}
}

static bool CompareOutputWithExpectedValueFloat(
float output, float ref, ToleranceType type, double tolerance,
hlsl::DXIL::Float32DenormMode mode = hlsl::DXIL::Float32DenormMode::Any) {
if (type == ToleranceType::RELATIVE_EPSILON) {
return CompareFloatRelativeEpsilon(output, ref, (int)tolerance, mode);
} else if (type == ToleranceType::EPSILON) {
return CompareFloatEpsilon(output, ref, (float)tolerance, mode);
} else if (type == ToleranceType::ULP) {
return CompareFloatULP(output, ref, (int)tolerance, mode);
} else {
LogErrorFmt(L"Failed to read comparison type %S", type);
}

return false;
}

static bool CompareOutputWithExpectedValueFloat(
float output, float ref, LPCWSTR type, double tolerance,
hlsl::DXIL::Float32DenormMode mode = hlsl::DXIL::Float32DenormMode::Any) {
Expand All @@ -6919,21 +6903,6 @@ static bool VerifyOutputWithExpectedValueFloat(
CompareOutputWithExpectedValueFloat(output, ref, type, tolerance, mode));
}

static bool CompareOutputWithExpectedValueHalf(uint16_t output, uint16_t ref,
ToleranceType type,
double tolerance) {
if (type == ToleranceType::RELATIVE_EPSILON) {
return CompareHalfRelativeEpsilon(output, ref, (int)tolerance);
} else if (type == ToleranceType::EPSILON) {
return CompareHalfEpsilon(output, ref, (float)tolerance);
} else if (type == ToleranceType::ULP) {
return CompareHalfULP(output, ref, (float)tolerance);
} else {
LogErrorFmt(L"Failed to read comparison type %S", type);
return false;
}
}

static bool CompareOutputWithExpectedValueHalf(uint16_t output, uint16_t ref,
LPCWSTR type, double tolerance) {
if (_wcsicmp(type, L"Relative") == 0) {
Expand All @@ -6954,29 +6923,6 @@ static bool VerifyOutputWithExpectedValueHalf(uint16_t output, uint16_t ref,
CompareOutputWithExpectedValueHalf(output, ref, type, tolerance));
}

template <typename T>
static bool CompareOutputWithExpectedValue(T output, T ref,
ToleranceType toleranceType,
double tolerance) {
if (std::is_same<T, DirectX::PackedVector::HALF>::value) { // uint16 treated
// as half
return CompareOutputWithExpectedValueHalf((uint16_t)output, (uint16_t)ref,
toleranceType, tolerance);
} else if (std::is_integral<T>::value &&
std::is_signed<T>::value) { // signed ints
return CompareOutputWithExpectedValueInt((int)output, (int)ref,
(int)tolerance);
} else if (std::is_integral<T>::value) { // unsigned ints
return CompareOutputWithExpectedValueUInt((uint32_t)output, (uint32_t)ref,
(uint32_t)tolerance);
} else if (std::is_floating_point<T>::value) { // floating point
return CompareOutputWithExpectedValueFloat((float)output, (float)ref,
toleranceType, tolerance);
}

DXASSERT_NOMSG("Invalid Parameter Type");
}

template <typename T>
static bool CompareOutputWithExpectedValue(T output, T ref,
LPCWSTR toleranceType,
Expand Down