This is an archive of the discontinued LLVM Phabricator instance.

[mlir][spirv] Allow unnamed entry point functions
ClosedPublic

Authored by alexbatashev on Feb 19 2022, 1:30 AM.

Details

Summary

SPIR-V specification does not require a function to have a name
if it is an entry point. Adjust deserializer to allow those kinds
of SPIR-V binaries.

Diff Detail

Event Timeline

alexbatashev created this revision.Feb 19 2022, 1:30 AM
alexbatashev requested review of this revision.Feb 19 2022, 1:30 AM
antiagainst accepted this revision.Feb 23 2022, 7:51 AM
antiagainst added inline comments.
mlir/lib/Target/SPIRV/Deserialization/DeserializeOps.cpp
350–358

Hmm, this is actually an arbitrary implementation detail inside the deserializer for unnamed functions. Actually the input model can have the function names with this prefix too. So I'm wondering whether we should instead use an attribute like unnamed on the function to indicate it's unnamed, rather than relying on the naming implementation detail here.. Anyway, I guess it's fine now; I'll approve this. Could you put a comment in the above?

// The deserializer uses "spirv_fn_<id>" as the function name if the input SPIR-V blob does not contain a name for it. We should use a more clear indication for such case rather than relying on naming details.
This revision is now accepted and ready to land.Feb 23 2022, 7:51 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptJul 18 2022, 9:03 AM
Herald added a subscriber: bzcheeseman. · View Herald Transcript