[PATCH] D124101: [RISCV] Add cost model for SK_Broadcast

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 28 21:35:04 PDT 2022


craig.topper accepted this revision.
craig.topper added a comment.
This revision is now accepted and ready to land.

LGTM



================
Comment at: llvm/test/Analysis/CostModel/RISCV/rvv-shuffle.ll:14
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %5 = shufflevector <vscale x 4 x i32> undef, <vscale x 4 x i32> undef, <vscale x 4 x i32> zeroinitializer
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %6 = shufflevector <vscale x 1 x i64> undef, <vscale x 1 x i64> undef, <vscale x 1 x i32> zeroinitializer
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %7 = shufflevector <vscale x 2 x i64> undef, <vscale x 2 x i64> undef, <vscale x 2 x i32> zeroinitializer
----------------
craig.topper wrote:
> liaolucy wrote:
> > rogfer01 wrote:
> > > I am curious with this one. I would expect this case to be 1 too. How is different to the other ones?
> > > I am curious with this one. I would expect this case to be 1 too. How is different to the other ones?
> > 
> > Actually, I just solved the crash problem. Cost is 1, it's ok for me
> I think it's being incorrectly identified as an identity shuffle because the **minimum** element count is 1 for the source and dest.  The mask is stored using the minimum element count and the checks against the number of source and destination elements are also made using minimum element count.
Let's commit this as is. And I'll work on a patch to fix identity shuffle detection.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D124101



More information about the llvm-commits mailing list