[Mlir-commits] [mlir] [mlir][spirv] Support function argument decorations for ptr in the PhysicalStorageBuffer (PR #76353)

Kohei Yamaguchi llvmlistbot at llvm.org
Thu Jan 4 22:54:54 PST 2024


================
@@ -177,6 +177,31 @@ LogicalResult Serializer::processUndefOp(spirv::UndefOp op) {
   return success();
 }
 
+LogicalResult Serializer::processFuncParameter(spirv::FuncOp op) {
+  for (auto [idx, arg] : llvm::enumerate(op.getArguments())) {
+    uint32_t argTypeID = 0;
+    if (failed(processType(op.getLoc(), arg.getType(), argTypeID))) {
+      return failure();
+    }
+    auto argValueID = getNextID();
+
+    // Process decoration attributes of arguments.
+    auto funcOp = cast<FunctionOpInterface>(*op);
+    for (auto argAttr : funcOp.getArgAttrs(idx)) {
+      if (auto decAttr = dyn_cast<DecorationAttr>(argAttr.getValue())) {
----------------
sott0n wrote:

Ok, I agree with you. So I add checking the name `spirv.decoration` before `dyn_cast<DecorationAttr>` and a test for this case.

https://github.com/llvm/llvm-project/pull/76353


More information about the Mlir-commits mailing list