Skip to content

Commit 3e4d455

Browse files
authored
[BACKEND][AMD] Add ScopedNoAliasAAWrapperPass to MIR swap pipeline (#9309)
1 parent 4278d7f commit 3e4d455

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

python/src/llvm.cc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include "mlir/Target/LLVMIR/ModuleTranslation.h"
44
#include "triton/Tools/Sys/GetEnv.hpp"
55
#include "llvm/ADT/SmallVector.h"
6+
#include "llvm/Analysis/ScopedNoAliasAA.h"
67
#include "llvm/CodeGen/MIRParser/MIRParser.h"
78
#include "llvm/CodeGen/MachineModuleInfo.h"
89
#include "llvm/CodeGen/MachineRegisterInfo.h"
@@ -466,6 +467,16 @@ std::string translateMIRToASM(const std::string &mirPath,
466467
// Create PassManager
467468
llvm::legacy::PassManager pass;
468469

470+
// IMPORTANT: Add ScopedNoAliasAAWrapperPass to ensure alias analysis
471+
// understands !alias.scope and !noalias metadata during machine scheduling.
472+
//
473+
// When loading MIR directly (swap path), we skip the normal IR optimization
474+
// passes that would register ScopedNoAliasAA. Without this, the machine
475+
// scheduler cannot prove that async buffer loads (BUFFER_LOAD_DWORDX4_LDS)
476+
// don't alias with LDS reads (DS_READ), resulting in unnecessary memory
477+
// dependencies and ~30% performance regression.
478+
pass.add(llvm::createScopedNoAliasAAWrapperPass());
479+
469480
// Emit code from MIR
470481
std::string result;
471482
{

0 commit comments

Comments
 (0)