[Mesa-dev] NIR issue with SPIRV ops that have operands with different bit-size

Samuel Iglesias Gonsálvez siglesias at igalia.com
Tue Apr 24 08:24:30 UTC 2018


Hello,

Recently, we have found problems between some SPIRV opcodes and NIR.

SPIR-V allows opcodes to mix different bit-sizes for their operands, such as for some bitfield operations and other ops like bitwise shifts.

In NIR, when the ALU opcode doesn't have specified bitsizes for their operands, it is expected to have both the same bitsize (see the assert in nir_build_alu() at nir_builder.h). I suppose this assumption comes from the time that NIR were only fed with GLSL IR but now with SPIR-V that assert is wrong.

Instead of adding new variants for the opcodes (such as nir_op_ishl16, or so) to workaround the issue, I think it is needed to fix this by removing this assumption from NIR and its validator. I send this email to ask for ideas and to find the best way to handle this.

What do you think?

Sam


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20180424/45c509d3/attachment.sig>


More information about the mesa-dev mailing list