[Mlir-commits] [mlir] [mlir][spirv] Support function argument decorations for ptr in the PhysicalStorageBuffer (PR #76353)
Lei Zhang
llvmlistbot at llvm.org
Sat Jan 6 11:05:04 PST 2024
================
@@ -369,6 +370,32 @@ LogicalResult spirv::Deserializer::processMemberName(ArrayRef<uint32_t> words) {
return success();
}
+void spirv::Deserializer::setArgAttrs(uint32_t argID) {
+ if (!decorations.contains(argID)) {
+ argAttrs.push_back(DictionaryAttr::get(context, {}));
+ return;
+ }
+
+ // Replace a decoration as UnitAttr with DecorationAttr for the physical
+ // buffer pointer in the function parameter.
+ // e.g. `aliased` -> `spirv.decoration = #spirv.decoration<Aliased>`.
+ for (NamedAttribute decAttr : decorations[argID]) {
+ for (auto decoration :
+ {spirv::Decoration::Aliased, spirv::Decoration::Restrict,
+ spirv::Decoration::AliasedPointer,
+ spirv::Decoration::RestrictPointer}) {
+ if (decAttr.getName() ==
+ getSymbolDecoration(stringifyDecoration(decoration))) {
----------------
antiagainst wrote:
I'm fine to do without a test for now, given that the possible error cases are unbound. Especially for the deserialization, right now it's meant to only cover the cases where we can serialize.
BTW we do have some deserialization test here: https://github.com/llvm/llvm-project/blob/main/mlir/unittests/Dialect/SPIRV/DeserializationTest.cpp but it's a bit painful to write those.
https://github.com/llvm/llvm-project/pull/76353
More information about the Mlir-commits
mailing list