[PATCH] D79508: [mlir][gpu] Refactor functions for workgroup and private buffer attributions.

Stephan Herhut via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 20 09:48:57 PDT 2020


herhut added inline comments.


================
Comment at: mlir/lib/Dialect/GPU/IR/GPUDialect.cpp:478
+  return getBody().front().insertArgument(
+      getType().getNumInputs() + workgroupAttrCount, type);
 }
----------------
whchung wrote:
> herhut wrote:
> > I would prefer if new private attributions would also be added at the end of the existing private attributes, rather than at the front. You could just use `addArgument` for this.
> @herhut `addArgument` might not guard the case `addPrivateAttribution` is used prior to `addWorkgroupAttribution`. Now I have revised the patch to re-introduce `getNumPrivateAttribution` we can leverage it here.
I don't understand this. Private attributions are always at the end. So using `getBody().front().addArgument(...)` would insert them at the end, where they belong. If you then use `addWorkgroupAttribution`, it will insert in front of the private one, as `getNumWorkgroupAttributions` would return 0, so it inserts directly after the function arguments.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D79508/new/

https://reviews.llvm.org/D79508





More information about the llvm-commits mailing list