[PATCH] D122714: [X86][AMX] Materialize undef or zero value to tilezero

Xiang Zhang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 30 22:14:34 PDT 2022


xiangzhangllvm added inline comments.


================
Comment at: llvm/lib/Target/X86/X86LowerAMXType.cpp:81
+    return false;
+  switch (II->getIntrinsicID()) {
+  default:
----------------
LuoYuanke wrote:
> xiangzhangllvm wrote:
> > Can we implement this with "Reverse thinking".
> > for example:
> > use x86_amx tile and exclude non-amx-instrinsics instruction (cast, copy, ..).
> > In this way we may no need to care about here when we add new AMXs.
> Most of intrinsic return x86_amx, an exception is tilestored64_internal which return void. Maybe add llvm.x86.amx prefix name for each AMX intrinsic, so that we can distinguish amx intrinsics by its name? 
re-add prefix is ok but is big job.
tilestored64_internal also use x86_amx operand.
Because mainly amx intrinsics use/def x86_amx data.
We can both check return's and operands' type, then exclude a few non-amx-instrinsics instructions.


================
Comment at: llvm/lib/Target/X86/X86LowerAMXType.cpp:186
+static std::pair<Value *, Value *> getShape(PHINode *Phi) {
+  Use &U = *(Phi->use_begin());
+  unsigned OpNo = U.getOperandNo();
----------------
LuoYuanke wrote:
> xiangzhangllvm wrote:
> > a1: Here only fetch the first use. 
> > a2: line 191 if its user "V->use_empty()" will fail ?
> > a3: how about a1 second use can get shape but 1st not.
> We don't traverse all node, that is more complex. Here we just traverse the first user. If we can find shape, then return the shape, otherwise just return nullptr and abandon the optimization.
> Mostly an value should have an user, so it mostly can get shape. But if it is not, we just abandon the optimization. I think we can enhance it when there is user case that need to be optimized. How about add TODO for it?
I think no problem.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D122714



More information about the llvm-commits mailing list