This is an archive of the discontinued LLVM Phabricator instance.

[AMDGPU] Only count global-to-global as indirect accesses
ClosedPublic

Authored by foad on Mar 31 2022, 5:55 AM.

Details

Summary

Previously any load (global, local or constant) feeding into a
global load or store would be counted as an indirect access. This
patch only counts global loads feeding into a global load or store.
The rationale is that the latency for global loads is generally
much larger than the other kinds.

As a side effect this makes it easier to write small kernels test
cases that are not counted as having indirect accesses, despite
the fact that arguments to the kernel are accessed with an SMEM
load.

Diff Detail

Event Timeline

foad created this revision.Mar 31 2022, 5:55 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 31 2022, 5:55 AM
foad requested review of this revision.Mar 31 2022, 5:55 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 31 2022, 5:55 AM

I'm really not sure what the "indirect access" heuristic was intended for, but at least this "fixes" test_indirect_through_phi and makes it possible to write a simple test case for D83676.

LGTM. I still think this pass needs to be moved to a machine analysis

rampitec accepted this revision.Mar 31 2022, 10:16 AM
This revision is now accepted and ready to land.Mar 31 2022, 10:16 AM
This revision was landed with ongoing or failed builds.Apr 1 2022, 5:51 AM
This revision was automatically updated to reflect the committed changes.
uabelho added a subscriber: uabelho.Apr 4 2022, 9:42 PM
uabelho added inline comments.
llvm/lib/Target/AMDGPU/AMDGPUPerfHintAnalysis.cpp
156

I think this was the last use of the isConstantAddr method. gcc now warns with

23:46:06 ../lib/Target/AMDGPU/AMDGPUPerfHintAnalysis.cpp:339:6: warning: 'bool {anonymous}::AMDGPUPerfHint::isConstantAddr(const llvm::Value*) const' defined but not used [-Wunused-function]
23:46:06   339 | bool AMDGPUPerfHint::isConstantAddr(const Value *V) const {
23:46:06       |      ^~~~~~~~~~~~~~

Should the unused isConstantAddr method be removed?

foad added inline comments.Apr 5 2022, 12:09 AM
llvm/lib/Target/AMDGPU/AMDGPUPerfHintAnalysis.cpp
156

Sorry about that, but I am hoping to land D83676 soon (it was approved once, just waiting for confirmation that it's still OK) which will start using isConstantAddr again.

uabelho added inline comments.Apr 5 2022, 12:13 AM
llvm/lib/Target/AMDGPU/AMDGPUPerfHintAnalysis.cpp
156

Ok, good to know. Thanks!