This is an archive of the discontinued LLVM Phabricator instance.

[SPIRV] read kernel arg attributes from fuction/module metadata
ClosedPublic

Authored by iliya-diyachkov on Oct 3 2022, 2:37 PM.

Details

Summary

The patch introduces reading the attributes of kernel arguments from both function-attached and module-level metadata, during kernel arguments lowering. The test demonstrating the improvement will be attached later.

Diff Detail

Event Timeline

iliya-diyachkov created this revision.Oct 3 2022, 2:37 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 3 2022, 2:37 PM
iliya-diyachkov requested review of this revision.Oct 3 2022, 2:37 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 3 2022, 2:37 PM
zuban32 added inline comments.Oct 4 2022, 8:39 PM
llvm/lib/Target/SPIRV/SPIRVCallLowering.cpp
152

I don't think dyn_cast_or_null helps here, it wouldn't prevent segfault anyway. dyn_cast should work just as fine while keeping the code more uniform.

187

Why a vector here, do you plan to extend the list of possible decorations returned in the future?

mpaszkowski added inline comments.Oct 5 2022, 3:03 AM
llvm/lib/Target/SPIRV/SPIRVCallLowering.cpp
152

Right, good catch! Will change this.

187

Yes, in the future patch I will add a possibility of returning multiple decorations. For example there could be an argument decorated with both Decoration::Restrict and Decoration::Constant and there could be an argument not decorated with any qualifier. So I think vector works here best.

Use dyn_cast instead of dyn_cast_or_null.

iliya-diyachkov marked 4 inline comments as done.Oct 5 2022, 4:00 AM
This revision is now accepted and ready to land.Oct 5 2022, 4:38 AM