KhronosGroup / SPIRV-LLVM-Translator

A tool and a library for bi-directional translation between SPIR-V and LLVM IR
Other
479 stars 213 forks source link

Missing SPIR-V 1.4 features/changes #2460

Open MrSidims opened 6 months ago

MrSidims commented 6 months ago

Following my AR from OpenCL Tooling TSG. The translator claims SPIR-V 1.4 support, yet there are few features missing

MrSidims commented 6 months ago

Comments:

  1. At this point of time I don't see an LLVM counterpart, so guess it's implementable only via SPIR-V friendly translation;

2 and 3. We can consider translating ptrtoint + cmp / sub to these instructions during forward translation, but probably we should instead just recognize SPIR-V friendly input and then during reverse translation generate ptrtoint + cmp / sub (either way with Builder::CreatePtrDiff)

  1. Pretty much straightforward;

  2. these decoration instructions are odd. I only see a single use-case for UserSemantic decorations for them, meanwhile the translator uses OpDecorate and OpMemberDecorate to store UserSemantic. And the translator is right in doing so as the spec puts no restrictions of what kind of literals to used for these 2 instructions;

    1. unlikely to represent right now, but probably should recognize it and skip.
vmaksimo commented 5 months ago

The only thing left is to clarify the possible cases where we actually need to use DecorateString and MemberDecorateString instructions. @MrSidims please link registry issue here once it's created. Thanks!

bashbaug commented 1 month ago

I created internal SPIR-V issue 810 to clarify OpDecorateString vs. OpDecorate, FYI.