-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[AMDGPU] Enable "amdgpu-uniform-intrinsic-combine" pass in pipeline. #162819
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -148,6 +148,62 @@ static bool runUniformIntrinsicCombine(Module &M, ModuleAnalysisManager &AM) { | |||||||
return IsChanged; | ||||||||
} | ||||||||
|
||||||||
// Legacy PM version | ||||||||
static bool runUniformIntrinsicCombine(Module &M, ModulePass &P) { | ||||||||
bool IsChanged = false; | ||||||||
ValueMap<const Value *, bool> Tracker; | ||||||||
|
||||||||
for (Function &F : M) { | ||||||||
switch (F.getIntrinsicID()) { | ||||||||
case Intrinsic::amdgcn_permlane64: | ||||||||
case Intrinsic::amdgcn_readfirstlane: | ||||||||
case Intrinsic::amdgcn_readlane: | ||||||||
case Intrinsic::amdgcn_ballot: | ||||||||
break; | ||||||||
default: | ||||||||
continue; | ||||||||
} | ||||||||
|
||||||||
for (User *U : make_early_inc_range(F.users())) { | ||||||||
auto *II = cast<IntrinsicInst>(U); | ||||||||
Function *ParentF = II->getFunction(); | ||||||||
auto &UI = P.getAnalysis<UniformityInfoWrapperPass>(*ParentF) | ||||||||
.getUniformityInfo(); | ||||||||
IsChanged |= optimizeUniformIntrinsic(*II, UI, Tracker); | ||||||||
} | ||||||||
} | ||||||||
return IsChanged; | ||||||||
} | ||||||||
|
||||||||
namespace { | ||||||||
class AMDGPUUniformIntrinsicCombineLegacy : public ModulePass { | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This belongs with the base support PR? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think its ok to have separately. Initially, it was part of the base PR. after reviews I dropped it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this should have gone there, and the IR test needs both new and old PM run lines |
||||||||
public: | ||||||||
static char ID; | ||||||||
AMDGPUUniformIntrinsicCombineLegacy() : ModulePass(ID) { | ||||||||
initializeAMDGPUUniformIntrinsicCombineLegacyPass( | ||||||||
*PassRegistry::getPassRegistry()); | ||||||||
} | ||||||||
|
||||||||
private: | ||||||||
bool runOnModule(Module &M) override; | ||||||||
void getAnalysisUsage(AnalysisUsage &AU) const override { | ||||||||
AU.setPreservesCFG(); | ||||||||
AU.addRequired<UniformityInfoWrapperPass>(); | ||||||||
AU.addRequired<TargetPassConfig>(); | ||||||||
} | ||||||||
}; | ||||||||
} // namespace | ||||||||
|
||||||||
char AMDGPUUniformIntrinsicCombineLegacy::ID = 0; | ||||||||
char &llvm::AMDGPUUniformIntrinsicCombineLegacyPassID = | ||||||||
AMDGPUUniformIntrinsicCombineLegacy::ID; | ||||||||
|
||||||||
bool AMDGPUUniformIntrinsicCombineLegacy::runOnModule(Module &M) { | ||||||||
if (skipModule(M)) | ||||||||
return false; | ||||||||
return runUniformIntrinsicCombine(M, *this); | ||||||||
} | ||||||||
|
||||||||
PreservedAnalyses | ||||||||
AMDGPUUniformIntrinsicCombinePass::run(Module &M, ModuleAnalysisManager &AM) { | ||||||||
if (!runUniformIntrinsicCombine(M, AM)) | ||||||||
|
@@ -157,3 +213,14 @@ AMDGPUUniformIntrinsicCombinePass::run(Module &M, ModuleAnalysisManager &AM) { | |||||||
PA.preserve<UniformityInfoAnalysis>(); | ||||||||
return PA; | ||||||||
} | ||||||||
|
||||||||
INITIALIZE_PASS_BEGIN(AMDGPUUniformIntrinsicCombineLegacy, DEBUG_TYPE, | ||||||||
"AMDGPU Uniform Intrinsic Combine", false, false) | ||||||||
INITIALIZE_PASS_DEPENDENCY(UniformityInfoWrapperPass) | ||||||||
INITIALIZE_PASS_DEPENDENCY(TargetPassConfig) | ||||||||
INITIALIZE_PASS_END(AMDGPUUniformIntrinsicCombineLegacy, DEBUG_TYPE, | ||||||||
"AMDGPU Uniform Intrinsic Combine", false, false) | ||||||||
|
||||||||
ModulePass *llvm::createAMDGPUUniformIntrinsicCombineLegacyPass() { | ||||||||
return new AMDGPUUniformIntrinsicCombineLegacy(); | ||||||||
} | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is still running on optnone functions, another issue with doing this as a module pass