For V_CMP_CLASS_F16_t16_e64 and V_CMPX_CLASS_F16_t16_e64,
https://reviews.llvm.org/D133723 changed the value type of src1 from i32 to i16.
These src1 operands are 16 bits, therefore need to be encoded as true16
operands. So the _e32 type was correctly set to VGPR_32_Lo128.
In _e64 form the operand class went from
VSrc_b32 to VSrc_b16. For some reason, we cannot encode inline literals for
VSrc_b16, see 5f5f566b265db00f577ead268400d99f34ba9cdd. In this phase of
the true16 implementation, VSrc_b16 and VSrc_b32 are still similar,
except from that quirk of inlines. So set the operand class to regain
that function.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
The semantics of this instruction are strange, and we should probably improve on the inline literal support for 16 bit operands, so if you have any thoughts on this patch or future improvements please let me know.
For some reason, we cannot encode inline literals for VSrc_b16.
This is true for inline floating-point constants only. Integer inline constants may be used without limitations, so I do not see any problems using VSrc_b16 for src1.
Before D133723, inline floating-point constants were allowed. Arguably they should be allowed ( https://developer.amd.com/wp-content/resources/RDNA2_Shader_ISA_November2020.pdf "Note that the S1 has a format of f16 since floating point literal
constants are interpreted as 16 bit value for this opcode"), though I don't know if they would be emitted by codegen.
Thanks, I see. I forgot that there are special opcodes with 16 bit integer operands which should be handled differently. I'll take a closer look at the issue.
5f5f566b265d is really a hardware bug, so it's possible it's been fixed on newer hardware (don't think it was ever properly communicated as one to fix though)
Last time I read SP3 documentation for GFX11, this issue was presented as a feature, not a bug. There was also a special flag to label opcodes which correctly handled fp inline constants for 16 bit integer operands.
LGTM. Created a separate issue we might want to tackle in the future: https://github.com/llvm/llvm-project/issues/58167.