[PATCH] D83394: [AMDGPU] Avoid splitting FLAT offsets in unsafe ways
Nicolai Hähnle via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 16 12:38:57 PDT 2020
nhaehnle added inline comments.
================
Comment at: llvm/lib/Target/AMDGPU/AMDGPUISelDAGToDAG.cpp:1698
+ // into two pieces that are both >= 0 or both <= 0.
SDLoc DL(N);
----------------
arsenm wrote:
> Can you add a fixme to check if this is needed if we know the address isn't FLAT_ADDRESS?
Yes, I'm pretty sure it's needed. If we generate a FLAT instruction, the hardware will check apertures regardless, and you could run into the following scenario:
```
end_of_scratch_aperture: 0x2'0000'0000
vaddr: 0x1'ffff'fff0
inst_offset: 32
```
The hardware executes the flat instruction, sees that vaddr falls into the scratch aperture, and executes the instruction as accessing scratch memory.
The only way to fix that would be if we knew that there is never any memory mapped directly after the end of any of the apertures.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D83394/new/
https://reviews.llvm.org/D83394
More information about the llvm-commits
mailing list