Skip to content

Commit

Permalink
adopted changes
Browse files Browse the repository at this point in the history
  • Loading branch information
i-chaochen authored and hsharsha committed Aug 22, 2024
1 parent ef368c5 commit e1d02ab
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions xla/service/gpu/buffer_comparator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ using ComparisonKernelT =
float, uint64_t, se::DeviceMemory<uint64_t>>;

struct ComparisonParams {
float relative_tol = 0.1f;
double relative_tol = 0.1f;
bool verbose = true;
const Shape *shape = nullptr;
se::Stream* stream = nullptr;
Expand Down Expand Up @@ -94,7 +94,8 @@ static absl::StatusOr<bool> DeviceCompare(
se::DeviceMemory<uint64_t> as_uint64(out.memory());
TF_RETURN_IF_ERROR(params.stream->ThenLaunch(
dim.thread_counts_per_block(), dim.block_counts(), comparison_kernel,
current_typed, expected_typed, params.relative_tol, buffer_size, as_uint64));
current_typed, expected_typed, static_cast<float>(params.relative_tol),
buffer_size, as_uint64));

uint64_t result = -1;
CHECK_EQ(out.memory().size(), sizeof(result));
Expand Down Expand Up @@ -151,9 +152,8 @@ static absl::StatusOr<bool> HostCompare(const ComparisonParams& params) {
!(std::abs(current_value_canonical - expected_value_canonical) /
(std::max(std::abs(current_value_canonical),
std::abs(expected_value_canonical)) +
1) <
static_cast<double>(params.relative_tol))) {
if(!params.verbose) return false; // Return immediately if not verbose.
1) < params.relative_tol)) {
if (!params.verbose) return false; // Return immediately if not verbose.
++differences_seen;
LOG(ERROR) << "Difference at " << i << ": " << current_value
<< ", expected " << expected_value;
Expand Down

0 comments on commit e1d02ab

Please sign in to comment.