Skip to content
Open
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
10 changes: 6 additions & 4 deletions third_party/xla/xla/service/gpu/gpu_float_support.cc
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,12 @@ bool GpuFloatSupport::IsSupported(const HloInstruction& hlo) const {
case HloOpcode::kSubtract:
case HloOpcode::kMultiply: {
if (LowPrecisionType() == BF16) {
auto* cuda_compute_capability =
std::get_if<se::CudaComputeCapability>(&compute_capability_);
return cuda_compute_capability != nullptr &&
cuda_compute_capability->IsAtLeastHopper();
if (std::holds_alternative<se::CudaComputeCapability>(compute_capability_)){
return std::get<se::CudaComputeCapability>(compute_capability_).IsAtLeastHopper();
}
else if (std::holds_alternative<se::RocmComputeCapability>(compute_capability_)){
return std::get<se::RocmComputeCapability>(compute_capability_).gfx9_mi200_or_later();
}
}
return false;
}
Expand Down
6 changes: 6 additions & 0 deletions third_party/xla/xla/service/gpu/gpu_float_support_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -253,5 +253,11 @@ TEST_F(FloatSupportTest, ShouldKeepBf16OnHopper) {
/*should_convert_rhs=*/false, BF16);
}

TEST_F(FloatSupportTest, ShouldKeepBf16OnMI200orLater) {
TestDotConversion(BF16, BF16, F32, se::RocmComputeCapability("gfx940"),
/*should_convert_lhs=*/false,
/*should_convert_rhs=*/false, BF16);
}

} // namespace
} // namespace xla::gpu