analyzeTemporalDivergence() was missing the check for always-uniform before
evaluating weather an instruction depends on a value defined in the cycle.
Fix for #60638
Details
- Reviewers
sameerds arsenm foad - Group Reviewers
Restricted Project - Commits
- rG5230f6c1c274: [llvm][GenericUniformity] Prevent assert while calculating temporal divergence
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
llvm/include/llvm/ADT/GenericUniformityImpl.h | ||
---|---|---|
814 | This is too complicated. Just swap lines 814 and 817. |
llvm/lib/CodeGen/MachineUniformityAnalysis.cpp | ||
---|---|---|
108 | What does it mean to continue here? Is it true that a physical register cannot be written inside the cycle? A comment explaining why will be useful. |
llvm/lib/CodeGen/MachineUniformityAnalysis.cpp | ||
---|---|---|
108 | Didn't get around to putting a lot of thought into it. Physical register operands need to be handled separately, which might also include sub-cases if it's an exec mask or function parameters/return values, etc. Continue here is just a placeholder until we have a way to deal with them. | |
llvm/test/Analysis/DivergenceAnalysis/AMDGPU/MIR/uses-value-from-cycle.mir | ||
5 | I took the tests from #60638 (extracted the GMIR input that was fed to uniformity analysis). I wasn't able to use @llvm.amdgcn.raw.atomic.buffer.load without including the IR section. Is there a workaround? |
llvm/lib/CodeGen/MachineUniformityAnalysis.cpp | ||
---|---|---|
108 | But if the exact conclusion is not known, then the correct conclusion is to be conservative. For example, it is always safer to assume that a value is divergent rather than assuming that it is uniform. In this particular case, it means that if we don't know whether the physical register was defined inside the cycle, then it is safer to assume that it was, and hence return true. Such a register will then be marked divergent by the caller. |
The commit description uses a number "60638" to refer to some issue, but there is no suitable context. If this is a github issue, just putting the whole URL might be better? And do note that this needs to be in the git commit, and not just the review description on this page.
llvm/test/Analysis/DivergenceAnalysis/AMDGPU/MIR/uses-value-from-cycle.mir | ||
---|---|---|
5 | The intrinsic declaration is broken in some way because it's having an address computed. The reference in SI_PC_ADD_REL_OFFSET indicates this wasn't recognized as an intrinsic. |
Will also append issue link to the commit message.
llvm/test/Analysis/DivergenceAnalysis/AMDGPU/MIR/uses-value-from-cycle.mir | ||
---|---|---|
5 | I didn't realize earlier that @llvm.amdgcn.raw.atomic.buffer.load.i32 is not actually an intrinsic just looks like one, hence appears to be broken. |
llvm/test/Analysis/DivergenceAnalysis/AMDGPU/MIR/uses-value-from-cycle.mir | ||
---|---|---|
5 | This must have a test, but simpler |
The change itself looks okay to me. But please wait for comments on whether the tests are okay.
This is too complicated. Just swap lines 814 and 817.