[PATCH] D107651: [AArch64][SVE] Teach cost model that masked loads/stores are cheap

Matt Devereau via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 6 09:09:01 PDT 2021


MattDevereau added inline comments.


================
Comment at: llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp:1516
 
-  return LT.first * 2;
+  return isa<ScalableVectorType>(Src) ? LT.first * 2 : LT.first * 2 + LT.first;
 }
----------------
david-arm wrote:
> bsmith wrote:
> > What's the rationale behind this cost for fixed types?
> Is this due to the extra predicate we have to create? If so, that's also true for SVE since we'll need a ptrue and it's highly likely to get reused anyway or hoisted out of a loop.
A cost of 3*vscale was suggested as a suitable cost for VLS compared to the current VLA cost of 2*vscale. Rather than edit TLI->getTypeLegalizationCost(DL, Src); directly, this seemed like the simplest way of achieving it.


================
Comment at: llvm/test/Analysis/CostModel/AArch64/masked_ldst.ll:2
 ; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
 ; RUN: opt < %s -cost-model -analyze -mtriple=aarch64-linux-gnu -mattr=+sve | FileCheck %s
 
----------------
bsmith wrote:
> This test is for scalable types, hence the changes in here are testing the cost of scalable masked loads/stores rather than fixed ones. You'll need to add functions (probably in another test file) that use the vscale_range attribute to specify various different fixed vector lengths)
What is the difference between this test called "fixed" and the test called "scalable" further down then?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D107651



More information about the llvm-commits mailing list