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

Add llvm flag #547

Open
wants to merge 3 commits into
base: triton-mlir
Choose a base branch
from
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
6 changes: 3 additions & 3 deletions include/triton/Tools/Sys/GetEnv.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@
namespace mlir::triton {

const std::set<std::string> ENV_VARS = {
"DISABLE_MMA_V3", "TRITON_DISABLE_LINE_INFO", "DISABLE_FAST_REDUCTION",
"ENABLE_TMA", "MLIR_ENABLE_DUMP", "LLVM_IR_ENABLE_DUMP",
"AMDGCN_ENABLE_DUMP", "TRUNCATE_F32_TO_BF16"};
"DISABLE_MMA_V3", "TRITON_DISABLE_LINE_INFO", "DISABLE_FAST_REDUCTION",
"ENABLE_TMA", "MLIR_ENABLE_DUMP", "LLVM_IR_ENABLE_DUMP",
"AMDGCN_ENABLE_DUMP", "TRUNCATE_F32_TO_BF16", "TRITON_LLVM_FLAG"};

namespace tools {

Expand Down
8 changes: 8 additions & 0 deletions lib/Target/HSACO/HSACOTranslation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,14 @@ std::string generate_amdgcn_assembly(llvm::Module *module,
if (machine == nullptr)
return "";

std::string llvm_flag = mlir::triton::tools::getenv("TRITON_LLVM_FLAG");
if (!llvm_flag.empty()) {
std::vector<char *> args;
args.push_back((char *)("triton"));
args.push_back((char *)(llvm_flag.c_str()));
llvm::cl::ParseCommandLineOptions(args.size(), &args[0]);
}

llvm::SmallVector<char, 0> buffer;
llvm::legacy::PassManager pass;
llvm::raw_svector_ostream stream(buffer);
Expand Down
5 changes: 2 additions & 3 deletions python/perf-kernels/06-fused-attention-fwd-transV.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,9 @@ def forward(ctx, q, k, v, sm_scale):
kpack = 1
else:
## D_HEAD = 128
## For fp16, pick BLOCK_M=256, num_warps=8
## For fp8, pick BLOCK_M=128, num_warps=4
## Tuning for MI300
## TODO (zhanglx): add tuning infra for FA
BLOCK_M = 128 if TORCH_HAS_FP8E4 and q.dtype == torch.float8_e4m3fnuz else 256
BLOCK_M = 128
BLOCK_N = 128
waves_per_eu = 2
num_warps = BLOCK_M // 32
Expand Down
Loading