Skip to content
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

Enable triton sparse gemm only for CUDA #27

Draft
wants to merge 1 commit into
base: rocm-jaxlib-v0.4.28-qa
Choose a base branch
from
Draft
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
1 change: 1 addition & 0 deletions xla/service/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -5387,6 +5387,7 @@ cc_library(
name = "elemental_ir_emitter",
srcs = ["elemental_ir_emitter.cc"],
hdrs = ["elemental_ir_emitter.h"],
local_defines = if_cuda_is_configured(["GOOGLE_CUDA=1"]),
deps = [
":algorithm_util",
":float8_fnuz_ir_emitter",
Expand Down
2 changes: 2 additions & 0 deletions xla/service/elemental_ir_emitter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2921,10 +2921,12 @@ absl::StatusOr<llvm::Value*> ElementalIrEmitter::EmitElementalDot(
"Algorithm not supported by the ElementalIrEmitter: %s",
PrecisionConfig::Algorithm_Name(hlo->precision_config().algorithm())));
}
#ifdef GOOGLE_CUDA
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hsharsha @i-chaochen
I believe better is to use something like ->

#ifndef TENSORFLOW_USE_ROCM

and also ->

local_defines = if_cuda_is_configured(["GOOGLE_CUDA=1"]) + if_rocm_is_configured(["TENSORFLOW_USE_ROCM=1"]),
 
to //xla/service:elemental_ir_emitter build target

const HloDotInstruction* dot = Cast<HloDotInstruction>(hlo);
if (dot->sparse_operands()) {
return Unimplemented("Sparse dot is supported by Triton emitter only.");
}
#endif
Copy link

@i-chaochen i-chaochen Jul 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIUC, sparse dot will require AddGemmFusionAutotuningPasses and that not only requires triton auotune, but also cudnn fusion front as well.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is to unblock JAX to use sparse dot operation. https://github.com/ROCm/frameworks-internal/issues/8118


auto lhs_generator = operand_to_generator.at(hlo->operand(0));
auto rhs_generator = operand_to_generator.at(hlo->operand(1));
Expand Down
Loading