Skip to content

Commit

Permalink
[AArch64] Add scheduling model for Neoverse V1
Browse files Browse the repository at this point in the history
Add the scheduling model for Neoverse V1.

Differential revision: https://reviews.llvm.org/D154756
  • Loading branch information
ebahapo committed Jul 17, 2023
1 parent 6455882 commit ed08534
Show file tree
Hide file tree
Showing 7 changed files with 16,558 additions and 45 deletions.
33 changes: 25 additions & 8 deletions llvm/lib/Target/AArch64/AArch64.td
Original file line number Diff line number Diff line change
Expand Up @@ -716,20 +716,36 @@ def FeatureHardenSlsNoComdat : SubtargetFeature<"harden-sls-nocomdat",

class AArch64Unsupported { list<Predicate> F; }

let F = [HasSVE2p1, HasSVE2p1_or_HasSME2, HasSVE2p1_or_HasSME2p1] in
def SVE2p1Unsupported : AArch64Unsupported;

def SVE2Unsupported : AArch64Unsupported {
let F = !listconcat([HasSVE2, HasSVE2orSME,
HasSVE2AES, HasSVE2SHA3, HasSVE2SM4, HasSVE2BitPerm],
SVE2p1Unsupported.F);
}

def SVEUnsupported : AArch64Unsupported {
let F = [HasSVE, HasSVE2, HasSVE2AES, HasSVE2SM4, HasSVE2SHA3,
HasSVE2BitPerm, HasSVEorSME, HasSVE2p1, HasSVE2orSME, HasSVE2p1_or_HasSME2p1];
let F = !listconcat([HasSVE, HasSVEorSME],
SVE2Unsupported.F);
}

def PAUnsupported : AArch64Unsupported {
let F = [HasPAuth];
let F = [HasSME2p1, HasSVE2p1_or_HasSME2p1] in
def SME2p1Unsupported : AArch64Unsupported;

def SME2Unsupported : AArch64Unsupported {
let F = !listconcat([HasSME2, HasSVE2p1_or_HasSME2],
SME2p1Unsupported.F);
}

def SMEUnsupported : AArch64Unsupported {
let F = [HasSME, HasSMEF64F64, HasSMEI16I64, HasSME2, HasSVE2p1_or_HasSME2,
HasSVE2p1_or_HasSME2p1, HasSME2p1, HasSMEF16F16];
let F = !listconcat([HasSME, HasSMEI16I64, HasSMEF16F16, HasSMEF64F64],
SME2Unsupported.F);
}

let F = [HasPAuth] in
def PAUnsupported : AArch64Unsupported;

include "AArch64SchedA53.td"
include "AArch64SchedA55.td"
include "AArch64SchedA510.td"
Expand All @@ -748,6 +764,7 @@ include "AArch64SchedTSV110.td"
include "AArch64SchedAmpere1.td"
include "AArch64SchedNeoverseN1.td"
include "AArch64SchedNeoverseN2.td"
include "AArch64SchedNeoverseV1.td"
include "AArch64SchedNeoverseV2.td"

def TuneA35 : SubtargetFeature<"a35", "ARMProcFamily", "CortexA35",
Expand Down Expand Up @@ -1410,9 +1427,9 @@ def : ProcessorModel<"neoverse-n1", NeoverseN1Model,
ProcessorFeatures.NeoverseN1, [TuneNeoverseN1]>;
def : ProcessorModel<"neoverse-n2", NeoverseN2Model,
ProcessorFeatures.NeoverseN2, [TuneNeoverseN2]>;
def : ProcessorModel<"neoverse-512tvb", NeoverseN2Model,
def : ProcessorModel<"neoverse-512tvb", NeoverseV1Model,
ProcessorFeatures.Neoverse512TVB, [TuneNeoverse512TVB]>;
def : ProcessorModel<"neoverse-v1", NeoverseN2Model,
def : ProcessorModel<"neoverse-v1", NeoverseV1Model,
ProcessorFeatures.NeoverseV1, [TuneNeoverseV1]>;
def : ProcessorModel<"neoverse-v2", NeoverseV2Model,
ProcessorFeatures.NeoverseV2, [TuneNeoverseV2]>;
Expand Down
1,861 changes: 1,861 additions & 0 deletions llvm/lib/Target/AArch64/AArch64SchedNeoverseV1.td

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions llvm/lib/Target/AArch64/AArch64SchedPredNeoverse.td
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,12 @@ def NeoverseCheapIncDec : MCSchedPredicate<
CheckImmOperand<3, 1>,
CheckImmOperand<3, 2>,
CheckImmOperand<3, 4>]>]>>;

// Identify "[SU]?(MADD|MSUB)L?" as the alias for "[SU]?(MUL|MNEG)L?".
def NeoverseMULIdiomPred : MCSchedPredicate< // <op> Rd, Rs, Rv, ZR
CheckAll<[CheckOpcode<
[MADDWrrr, MADDXrrr,
MSUBWrrr, MSUBXrrr,
SMADDLrrr, UMADDLrrr,
SMSUBLrrr, UMSUBLrrr]>,
CheckIsReg3Zero]>>;
38 changes: 20 additions & 18 deletions llvm/test/tools/llvm-mca/AArch64/Neoverse/512tvb-sve-instructions.s
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# NOTE: Assertions have been autogenerated by utils/update_mca_test_checks.py
# RUN: llvm-mca -mtriple=aarch64 -mcpu=neoverse-512tvb -instruction-tables < %s | FileCheck %s

# Check the Neoverse N2 model is used.
# Check that the Neoverse V1 model is used.

abs z0.b, p0/m, z0.b

Expand All @@ -17,24 +17,26 @@ abs z0.b, p0/m, z0.b
# CHECK-NEXT: 1 2 0.50 abs z0.b, p0/m, z0.b

# CHECK: Resources:
# CHECK-NEXT: [0.0] - N2UnitB
# CHECK-NEXT: [0.1] - N2UnitB
# CHECK-NEXT: [1.0] - N2UnitD
# CHECK-NEXT: [1.1] - N2UnitD
# CHECK-NEXT: [2] - N2UnitL2
# CHECK-NEXT: [3.0] - N2UnitL01
# CHECK-NEXT: [3.1] - N2UnitL01
# CHECK-NEXT: [4] - N2UnitM0
# CHECK-NEXT: [5] - N2UnitM1
# CHECK-NEXT: [6.0] - N2UnitS
# CHECK-NEXT: [6.1] - N2UnitS
# CHECK-NEXT: [7] - N2UnitV0
# CHECK-NEXT: [8] - N2UnitV1
# CHECK-NEXT: [0.0] - V1UnitB
# CHECK-NEXT: [0.1] - V1UnitB
# CHECK-NEXT: [1.0] - V1UnitD
# CHECK-NEXT: [1.1] - V1UnitD
# CHECK-NEXT: [2] - V1UnitL2
# CHECK-NEXT: [3.0] - V1UnitL01
# CHECK-NEXT: [3.1] - V1UnitL01
# CHECK-NEXT: [4] - V1UnitM0
# CHECK-NEXT: [5] - V1UnitM1
# CHECK-NEXT: [6.0] - V1UnitS
# CHECK-NEXT: [6.1] - V1UnitS
# CHECK-NEXT: [7] - V1UnitV0
# CHECK-NEXT: [8] - V1UnitV1
# CHECK-NEXT: [9] - V1UnitV2
# CHECK-NEXT: [10] - V1UnitV3

# CHECK: Resource pressure per iteration:
# CHECK-NEXT: [0.0] [0.1] [1.0] [1.1] [2] [3.0] [3.1] [4] [5] [6.0] [6.1] [7] [8]
# CHECK-NEXT: - - - - - - - - - - - 0.50 0.50
# CHECK-NEXT: [0.0] [0.1] [1.0] [1.1] [2] [3.0] [3.1] [4] [5] [6.0] [6.1] [7] [8] [9] [10]
# CHECK-NEXT: - - - - - - - - - - - 0.50 0.50 - -

# CHECK: Resource pressure by instruction:
# CHECK-NEXT: [0.0] [0.1] [1.0] [1.1] [2] [3.0] [3.1] [4] [5] [6.0] [6.1] [7] [8] Instructions:
# CHECK-NEXT: - - - - - - - - - - - 0.50 0.50 abs z0.b, p0/m, z0.b
# CHECK-NEXT: [0.0] [0.1] [1.0] [1.1] [2] [3.0] [3.1] [4] [5] [6.0] [6.1] [7] [8] [9] [10] Instructions:
# CHECK-NEXT: - - - - - - - - - - - 0.50 0.50 - - abs z0.b, p0/m, z0.b
Loading

0 comments on commit ed08534

Please sign in to comment.