Skip to content
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
10 changes: 10 additions & 0 deletions third_party/xla/xla/backends/gpu/codegen/triton/support.cc
Original file line number Diff line number Diff line change
Expand Up @@ -676,6 +676,16 @@ CodegenDecision IsTritonSupportedDot(
CodegenDecision IsTritonSupportedScaledDot(
const HloScaledDotInstruction& dot,
const se::GpuComputeCapability& gpu_version) {
if (gpu_version.IsCuda()) {
auto cc = gpu_version.cuda_compute_capability();
if (!cc || !cc->IsAtLeastAmpere()) {
return CodegenDecision::Forbid(
"Scaled dot is not supported by Triton for pre-Ampere GPUs.");
}
} else if (!gpu_version.IsRocm()) {
return CodegenDecision::Forbid(
"Scaled dot is only supported on CUDA and ROCm.");
}
CHECK_GE(dot.operand_count(), 4);
PrimitiveType lhs_type = dot.operand(0)->shape().element_type();
PrimitiveType rhs_type = dot.operand(1)->shape().element_type();
Expand Down
21 changes: 21 additions & 0 deletions third_party/xla/xla/backends/gpu/codegen/triton/support_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2628,6 +2628,27 @@ INSTANTIATE_TEST_SUITE_P(
::testing::Bool()),
ScaledDotTestName);

TEST_F(HloHardwareIndependentTestBase, ScaledDotPreAmpereIsRejected) {
const std::string kHlo = R"(
HloModule ScaledDotPreAmpere

ENTRY triton_computation {
lhs = f8e4m3fn[16, 32] parameter(0)
lhs_scale = f8e8m0fnu[16, 1] parameter(1)
rhs = f8e4m3fn[32, 16] parameter(2)
rhs_scale = f8e8m0fnu[1, 16] parameter(3)
ROOT dot = f32[16, 16] scaled-dot(lhs, rhs, lhs_scale, rhs_scale),
lhs_contracting_dims={1},
rhs_contracting_dims={0},
backend_config={sizes:[16]}
}
)";
TF_ASSERT_OK_AND_ASSIGN(auto module, ParseAndReturnVerifiedModule(kHlo));
const HloInstruction* dot = module->entry_computation()->root_instruction();
EXPECT_FALSE(IsTritonSupportedInstruction(
*dot, se::GpuComputeCapability(se::CudaComputeCapability::Volta())));
}

TEST_P(SupportTestWithTilingParam, NestedFusionsAreRejected) {
// Nested fusions are not supported by xtile emitter.
absl::string_view hlo_text = R"(
Expand Down
6 changes: 6 additions & 0 deletions third_party/xla/xla/backends/gpu/codegen/triton/tests/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -181,14 +181,17 @@ xla_test(
"//xla/backends/gpu/codegen/triton:xtile_compiler",
"//xla/backends/gpu/codegen/triton:xtile_test_base",
"//xla/backends/gpu/tests:gpu_pjrt_codegen_test",
"//xla/backends/gpu/transforms:composite_rewriter",
"//xla/codegen/xtile:block_level_parameters",
"//xla/codegen/xtile:xtile_config_proto_cc",
"//xla/hlo/ir:hlo",
"//xla/hlo/parser:hlo_parser",
"//xla/hlo/testlib:filecheck",
"//xla/hlo/testlib:hlo_hardware_independent_test_base",
"//xla/hlo/testlib:verified_hlo_module",
"//xla/service:algorithm_util",
"//xla/service/gpu:backend_configs_cc",
"//xla/service/gpu:gpu_compiler",
"//xla/service/gpu:gpu_device_info_for_tests",
"//xla/service/gpu:target_constants",
"//xla/stream_executor:device_description",
Expand All @@ -202,7 +205,9 @@ xla_test(
"//xla/tsl/platform:errors",
"//xla/tsl/platform:statusor",
"//xla/tsl/platform:test",
"@com_google_absl//absl/algorithm:container",
"@com_google_absl//absl/log",
"@com_google_absl//absl/log:check",
"@com_google_absl//absl/random:distributions",
"@com_google_absl//absl/status",
"@com_google_absl//absl/status:status_macros",
Expand All @@ -211,6 +216,7 @@ xla_test(
"@com_google_absl//absl/types:span",
"@com_google_googletest//:gtest",
"@eigen_archive//:eigen3",
"@llvm-project//llvm:Support",
"@llvm-project//llvm:TargetParser",
"@llvm-project//llvm:ir_headers",
"@llvm-project//mlir:IR",
Expand Down
Loading
Loading