Pre-gfx10 all MODE-setting instructions were S_SETREG_B32 which is
marked as having unmodeled side effects, which makes the machine
scheduler treat it as a barrier. Now that we have proper implicit $mode
operands we can use a no-side-effects S_SETMODE_B32 pseudo instead for
setregs that only touch the FP MODE bits, to give the scheduler more
freedom.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
llvm/lib/Target/AMDGPU/SOPInstructions.td | ||
---|---|---|
849 | I don't like defining pseudos that look like real instruction names. I would prefer to call this something like S_SETREG_B32_mode or something like that |
llvm/lib/Target/AMDGPU/SOPInstructions.td | ||
---|---|---|
866 | I'm not sure this will be encoded correctly since it's repeating the same instruction definition and not adding the physical aliases. Can you add tests checking the encoding? I think this needs to use PseudoInstExpansion |
llvm/lib/Target/AMDGPU/SOPInstructions.td | ||
---|---|---|
866 |
| |
866 |
You mean something like adding -show-mc-encoding to test/CodeGen/AMDGPU/llvm.amdgcn.s.setreg.ll ?
I'm not sure how to do that, because at the place where I want to define S_SETREG_IMM32_B32_mode, I don't know what real instruction it should expand to (S_SETREG_B32_gfx6_gfx7 vs S_SETREG_B32_vi vs S_SETREG_B32_gfx10). Is there an example I could follow? |
llvm/lib/Target/AMDGPU/SOPInstructions.td | ||
---|---|---|
866 | Yes. Oh right, this mechanism doesn't have a way handle multiple alternative encodings. I thought this wasn't an issue for scalar instructions, which I thought had a stable encoding. You could hack around this in emitInstruction. I do think we need better infrastructure for dealing with this problem though. |
The encoding seems OK. I can pre-commit the -show-mc-encoding change to make that clearer if you want.
LGTM, but it would be slightly nicer to factor the instruction definition into a class to avoid repeating the operand definition and asm string
I don't like defining pseudos that look like real instruction names. I would prefer to call this something like
S_SETREG_B32_mode or something like that