[PATCH] D84180: [Matrix] Add LowerMatrixIntrinsics to the NPM

Sjoerd Meijer via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 21 09:21:15 PDT 2020


SjoerdMeijer marked 3 inline comments as done.
SjoerdMeijer added inline comments.


================
Comment at: clang/lib/CodeGen/BackendUtil.cpp:1381
+      // should run in the backend pipeline on demand.
+      if (EnableMatrix)
+        MPM.addPass(
----------------
fhahn wrote:
> IIUC this references the LLVM option. Does this actually work? Shouldn't that use `LangOpts.MatrixTypes`, which is set when passing `-fenable-matrix` to Clang.
It does actually :) But must indeed be a layering violation...will fix.



================
Comment at: clang/test/CodeGen/matrix-lowering-opt-levels.c:7
+// RUN: %clang -Os -fenable-matrix -S -emit-llvm %s -o - | FileCheck  %s
+// RUN: %clang -Oz -fenable-matrix -S -emit-llvm %s -o - | FileCheck  %s
+
----------------
fhahn wrote:
> Might be good to add new-pm run-lines as well.
The many mysteries of the NPM..... Now looking I guess you mean adding -fexperimental-new-pass-manager (I was working with a build with the NPM enabled/built).   


================
Comment at: llvm/lib/Passes/PassBuilder.cpp:933
+
+  EarlyFPM.addPass(LowerMatrixIntrinsicsPass());
   EarlyFPM.addPass(SimplifyCFGPass());
----------------
fhahn wrote:
> SjoerdMeijer wrote:
> > fhahn wrote:
> > > I think we should keep this under the same enable-matrix flag like in the old pass manager for now and remove the flag for both when the pass only gets run on functions that contain matrix intrinsics.
> > Ah yeah, cheers, forgot about that! Will add that.
> Is there reason this is run at a different position to the legacy pass manager? If not, I think we should run them at roughly the same location, to minimize differences between new and old PM. In the old pass manager, we run before the VectorizerStart callbacks. Here this would be around line 1102 I think.
Since the intrinsics are generated by Clang I thought lowering them the earlier the better. And in the old PM, EarlyCSE was run after it, so that's why I put it right here just before EarlyCSE, but wouldn't mind moving it to where you suggested.


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

https://reviews.llvm.org/D84180





More information about the llvm-commits mailing list