Skip to content

Commit 204917e

Browse files
authored
[LoopVectorizer][AArch64] Add a -sve-vscale-for-tuning override option. (#156916)
It can be useful for debugging and tuning to be able to alter the VScaleForTuning. This adds a quick option to the aarch64 subtarget for altering it.
1 parent a1afe66 commit 204917e

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

llvm/lib/Target/AArch64/AArch64Subtarget.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,10 @@ static cl::opt<bool> EnableZPRPredicateSpills(
9191
cl::desc(
9292
"Enables spilling/reloading SVE predicates as data vectors (ZPRs)"));
9393

94+
static cl::opt<unsigned>
95+
VScaleForTuningOpt("sve-vscale-for-tuning", cl::Hidden,
96+
cl::desc("Force a vscale for tuning factor for SVE"));
97+
9498
// Subreg liveness tracking is disabled by default for now until all issues
9599
// are ironed out. This option allows the feature to be used in tests.
96100
static cl::opt<bool>
@@ -364,6 +368,8 @@ void AArch64Subtarget::initializeProperties(bool HasMinSize) {
364368

365369
if (AArch64MinimumJumpTableEntries.getNumOccurrences() > 0 || !HasMinSize)
366370
MinimumJumpTableEntries = AArch64MinimumJumpTableEntries;
371+
if (VScaleForTuningOpt.getNumOccurrences() > 0)
372+
VScaleForTuning = VScaleForTuningOpt;
367373
}
368374

369375
AArch64Subtarget::AArch64Subtarget(const Triple &TT, StringRef CPU,

llvm/test/Transforms/LoopVectorize/AArch64/scalable-vectorization-cost-tuning.ll

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
; RUN: -force-target-instruction-cost=1 -passes=loop-vectorize -S -debug-only=loop-vectorize --disable-output < %s 2>&1 \
88
; RUN: | FileCheck %s --check-prefixes=VSCALEFORTUNING1
99

10+
; RUN: opt -mtriple=aarch64 -mattr=+sve -mcpu=generic -sve-vscale-for-tuning=2 \
11+
; RUN: -force-target-instruction-cost=1 -passes=loop-vectorize -S -debug-only=loop-vectorize --disable-output < %s 2>&1 \
12+
; RUN: | FileCheck %s --check-prefixes=VSCALEFORTUNING2
13+
1014
; RUN: opt -mtriple=aarch64 -mcpu=neoverse-v1 \
1115
; RUN: -force-target-instruction-cost=1 -passes=loop-vectorize -S -debug-only=loop-vectorize --disable-output < %s 2>&1 \
1216
; RUN: | FileCheck %s --check-prefixes=VSCALEFORTUNING2

0 commit comments

Comments
 (0)