[Mlir-commits] [mlir] [mlir][spirv] Support function argument decorations for ptr in the PhysicalStorageBuffer (PR #76353)
Kohei Yamaguchi
llvmlistbot at llvm.org
Fri Jan 5 00:26:15 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, {}));
----------------
sott0n wrote:
> Also as it's implemented right now, we have argAttrs in the class directly.
I move `argAttrs` into the `processFunction` as local variable.
> Hmm, this assumes we always process argID in increasing order, which is the case for now. But not guaranteed. It's better to use resize if argID >= argAttrs.size().
I understand that `argID` represents the ID for each variable's mapping, and it doesn't compare the length of `argAttrs`, correct? So my assumption is that the length of argAttrs matches the length of `getNumInputs`. In that case, why not reserve it as follows?
```cpp
LogicalResult
spirv::Deserializer::processFunction(ArrayRef<uint32_t> operands) {
...
SmallVector<Attribute> argAttrs;
argAttrs.reserve(functionType.getNumInputs());
...
```
https://github.com/llvm/llvm-project/pull/76353
More information about the Mlir-commits
mailing list