Skip to content

Commit 6e1ea7e

Browse files
authored
[AArch64] Set the default streaming hazard size to 1024 for +sme,+sve (#123753)
The default for all other feature combinations remains at zero (i.e. no streaming hazards). This value may be adjusted in the future (e.g. based on the processor family), for now, it is set conservatively.
1 parent 4df6d3d commit 6e1ea7e

18 files changed

+90
-27
lines changed

llvm/lib/Target/AArch64/AArch64Subtarget.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,10 @@ AArch64Subtarget::AArch64Subtarget(const Triple &TT, StringRef CPU,
358358
CustomCallSavedXRegs(AArch64::GPR64commonRegClass.getNumRegs()),
359359
IsLittle(LittleEndian), IsStreaming(IsStreaming),
360360
IsStreamingCompatible(IsStreamingCompatible),
361-
StreamingHazardSize(AArch64StreamingHazardSize),
361+
StreamingHazardSize(
362+
AArch64StreamingHazardSize.getNumOccurrences() > 0
363+
? std::optional<unsigned>(AArch64StreamingHazardSize)
364+
: std::nullopt),
362365
MinSVEVectorSizeInBits(MinSVEVectorSizeInBitsOverride),
363366
MaxSVEVectorSizeInBits(MaxSVEVectorSizeInBitsOverride), TargetTriple(TT),
364367
InstrInfo(initializeSubtargetDependencies(FS, CPU, TuneCPU, HasMinSize)),

llvm/lib/Target/AArch64/AArch64Subtarget.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ class AArch64Subtarget final : public AArch64GenSubtargetInfo {
8585

8686
bool IsStreaming;
8787
bool IsStreamingCompatible;
88-
unsigned StreamingHazardSize;
88+
std::optional<unsigned> StreamingHazardSize;
8989
unsigned MinSVEVectorSizeInBits;
9090
unsigned MaxSVEVectorSizeInBits;
9191
unsigned VScaleForTuning = 1;
@@ -179,7 +179,10 @@ class AArch64Subtarget final : public AArch64GenSubtargetInfo {
179179

180180
/// Returns the size of memory region that if accessed by both the CPU and
181181
/// the SME unit could result in a hazard. 0 = disabled.
182-
unsigned getStreamingHazardSize() const { return StreamingHazardSize; }
182+
unsigned getStreamingHazardSize() const {
183+
return StreamingHazardSize.value_or(
184+
!hasSMEFA64() && hasSME() && hasSVE() ? 1024 : 0);
185+
}
183186

184187
/// Returns true if the target has NEON and the function at runtime is known
185188
/// to have NEON enabled (e.g. the function is known not to be in streaming-SVE

llvm/test/CodeGen/AArch64/outlining-with-streaming-mode-changes.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
; RUN: llc -mtriple=aarch64-linux-gnu -mattr=+sve -mattr=+sme2 -enable-machine-outliner -verify-machineinstrs < %s | FileCheck %s
2-
; RUN: llc -mtriple=aarch64-linux-gnu -mattr=+sve -mattr=+sme2 -enable-machine-outliner -verify-machineinstrs < %s | FileCheck %s -check-prefix=OUTLINER
1+
; RUN: llc -mtriple=aarch64-linux-gnu -mattr=+sve -mattr=+sme2 -enable-machine-outliner -aarch64-streaming-hazard-size=0 -verify-machineinstrs < %s | FileCheck %s
2+
; RUN: llc -mtriple=aarch64-linux-gnu -mattr=+sve -mattr=+sme2 -enable-machine-outliner -aarch64-streaming-hazard-size=0 -verify-machineinstrs < %s | FileCheck %s -check-prefix=OUTLINER
33

44
declare void @callee();
55

llvm/test/CodeGen/AArch64/sme-callee-save-restore-pairs.ll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2-
; RUN: llc -mtriple=aarch64-linux-gnu -mattr=+sme2 -mattr=+sve -aarch64-disable-multivector-spill-fill -verify-machineinstrs < %s | FileCheck %s --check-prefixes=NOPAIR
3-
; RUN: llc -mtriple=aarch64-linux-gnu -mattr=+sme -mattr=+sve -verify-machineinstrs < %s | FileCheck %s --check-prefixes=NOPAIR
4-
; RUN: llc -mtriple=aarch64-linux-gnu -mattr=+sme2 -mattr=+sve -verify-machineinstrs < %s | FileCheck %s --check-prefixes=PAIR
2+
; RUN: llc -mtriple=aarch64-linux-gnu -aarch64-streaming-hazard-size=0 -mattr=+sme2 -mattr=+sve -aarch64-disable-multivector-spill-fill -verify-machineinstrs < %s | FileCheck %s --check-prefixes=NOPAIR
3+
; RUN: llc -mtriple=aarch64-linux-gnu -aarch64-streaming-hazard-size=0 -mattr=+sme -mattr=+sve -verify-machineinstrs < %s | FileCheck %s --check-prefixes=NOPAIR
4+
; RUN: llc -mtriple=aarch64-linux-gnu -aarch64-streaming-hazard-size=0 -mattr=+sme2 -mattr=+sve -verify-machineinstrs < %s | FileCheck %s --check-prefixes=PAIR
55

66
declare void @my_func()
77
declare void @my_func2(<vscale x 16 x i8> %v)

llvm/test/CodeGen/AArch64/sme-darwin-sve-vg.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
; RUN: llc -mtriple=aarch64-darwin -mattr=+sve -mattr=+sme -enable-aarch64-sme-peephole-opt=false -verify-machineinstrs < %s | FileCheck %s
1+
; RUN: llc -mtriple=aarch64-darwin -aarch64-streaming-hazard-size=0 -mattr=+sve -mattr=+sme -enable-aarch64-sme-peephole-opt=false -verify-machineinstrs < %s | FileCheck %s
22

33
declare void @normal_callee();
44

llvm/test/CodeGen/AArch64/sme-disable-gisel-fisel.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2-
; RUN: llc -fast-isel=true -global-isel=false -fast-isel-abort=0 -mtriple=aarch64-linux-gnu -mattr=+sve -mattr=+sme2 < %s \
2+
; RUN: llc -fast-isel=true -aarch64-streaming-hazard-size=0 -global-isel=false -fast-isel-abort=0 -mtriple=aarch64-linux-gnu -mattr=+sve -mattr=+sme2 < %s \
33
; RUN: | FileCheck %s --check-prefixes=CHECK-COMMON,CHECK-FISEL
4-
; RUN: llc -fast-isel=false -global-isel=true -global-isel-abort=0 -mtriple=aarch64-linux-gnu -mattr=+sve -mattr=+sme2 < %s \
4+
; RUN: llc -fast-isel=false -aarch64-streaming-hazard-size=0 -global-isel=true -global-isel-abort=0 -mtriple=aarch64-linux-gnu -mattr=+sve -mattr=+sme2 < %s \
55
; RUN: | FileCheck %s --check-prefixes=CHECK-COMMON,CHECK-GISEL
66

77

llvm/test/CodeGen/AArch64/sme-lazy-save-call.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2-
; RUN: llc -mtriple=aarch64 -mattr=+sve -mattr=+sme < %s | FileCheck %s
2+
; RUN: llc -mtriple=aarch64 -aarch64-streaming-hazard-size=0 -mattr=+sve -mattr=+sme < %s | FileCheck %s
33

44
declare void @private_za_callee()
55
declare float @llvm.cos.f32(float)

llvm/test/CodeGen/AArch64/sme-peephole-opts.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
2-
; RUN: llc -mtriple=aarch64-linux-gnu -mattr=+sve,+sme2 < %s | FileCheck %s
2+
; RUN: llc -mtriple=aarch64-linux-gnu -aarch64-streaming-hazard-size=0 -mattr=+sve,+sme2 < %s | FileCheck %s
33

44
declare void @callee()
55
declare void @callee_farg(float)

llvm/test/CodeGen/AArch64/sme-pstate-sm-changing-call-disable-coalescing.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 2
2-
; RUN: llc < %s | FileCheck %s
2+
; RUN: llc -aarch64-streaming-hazard-size=0 < %s | FileCheck %s
33

44
target triple = "aarch64-unknown-unknown-eabi-elf"
55

llvm/test/CodeGen/AArch64/sme-streaming-body-streaming-compatible-interface.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2-
; RUN: llc -mtriple=aarch64-linux-gnu -mattr=+sve -mattr=+sme -start-after=simplifycfg -enable-tail-merge=false -verify-machineinstrs < %s | FileCheck %s
2+
; RUN: llc -mtriple=aarch64-linux-gnu -aarch64-streaming-hazard-size=0 -mattr=+sve -mattr=+sme -start-after=simplifycfg -enable-tail-merge=false -verify-machineinstrs < %s | FileCheck %s
33

44
declare void @normal_callee();
55
declare void @streaming_callee() "aarch64_pstate_sm_enabled";

0 commit comments

Comments
 (0)