Get error messages when deserializing spirv binary

When I deserialized my spirv binary translated with llvm-spirv, I got the following error message.

function name mismatch between OpEntryPoint and OpFunction

After tracing the code, I found there is a place checking whether the name of OpEntryPoint is the same as OpFunction, and it means spirv module have to use OpName instruction to name OpFunction’s result id the same as OpEntrypoint. In my case, llvm-spirv didn’t do that ( The result id of the OpFunction has no name ) . I would like to ask Is it necessary to check the rule?

Right, the SPIR-V spec does not require OpName for functions. In the SPIR-V dialect, functions and other module-level ops are referenced using symbols instead of SSA values, so we’d need a symbol there and that’s why the check there. Though it’s mostly due to early development. There was a patch to relax this requirement (⚙ D120181 [mlir][spirv] Allow unnamed entry point functions); I just addressed the comment there and landed it. Hopefully this addresses your issue. :slight_smile:

1 Like