AArch64SchedKryo.td 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. //==- AArch64SchedKryo.td - Qualcomm Kryo Scheduling Defs ---*- tablegen -*-==//
  2. //
  3. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  4. // See https://llvm.org/LICENSE.txt for license information.
  5. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  6. //
  7. //===----------------------------------------------------------------------===//
  8. //
  9. // This file defines the machine model for Qualcomm Kryo to support
  10. // instruction scheduling and other instruction cost heuristics.
  11. //
  12. //===----------------------------------------------------------------------===//
  13. //===----------------------------------------------------------------------===//
  14. // The issue width is set to five, matching the five issue queues for expanded
  15. // uops. Now, the latency spreadsheet has information based on fragmented uops,
  16. // but these do not actually take up an issue queue.
  17. def KryoModel : SchedMachineModel {
  18. let IssueWidth = 5; // 5-wide issue for expanded uops
  19. let MicroOpBufferSize = 128; // Out-of-order with temporary unified issue buffer
  20. let LoadLatency = 4; // Optimistic load latency
  21. let MispredictPenalty = 14; // Fetch + Decode/Rename/Dispatch + Branch
  22. // Enable partial & runtime unrolling. The magic number is chosen based on
  23. // experiments and benchmarking data.
  24. let LoopMicroOpBufferSize = 16;
  25. let CompleteModel = 1;
  26. list<Predicate> UnsupportedFeatures = !listconcat(SVEUnsupported.F,
  27. PAUnsupported.F,
  28. SMEUnsupported.F,
  29. [HasMTE]);
  30. // FIXME: Remove when all errors have been fixed.
  31. let FullInstRWOverlapCheck = 0;
  32. }
  33. //===----------------------------------------------------------------------===//
  34. // Define each kind of processor resource and number available on Kryo.
  35. let SchedModel = KryoModel in {
  36. def KryoUnitXA : ProcResource<1>; // Type X(A) micro-ops
  37. def KryoUnitXB : ProcResource<1>; // Type X(B) micro-ops
  38. def KryoUnitYA : ProcResource<1>; // Type Y(A) micro-ops
  39. def KryoUnitYB : ProcResource<1>; // Type Y(B) micro-ops
  40. def KryoUnitX : ProcResGroup<[KryoUnitXA, // Type X micro-ops
  41. KryoUnitXB]>;
  42. def KryoUnitY : ProcResGroup<[KryoUnitYA, // Type Y micro-ops
  43. KryoUnitYB]>;
  44. def KryoUnitXY : ProcResGroup<[KryoUnitXA, // Type XY micro-ops
  45. KryoUnitXB,
  46. KryoUnitYA,
  47. KryoUnitYB]>;
  48. def KryoUnitLSA : ProcResource<1>; // Type LS(A) micro-ops
  49. def KryoUnitLSB : ProcResource<1>; // Type LS(B) micro-ops
  50. def KryoUnitLS : ProcResGroup<[KryoUnitLSA, // Type LS micro-ops
  51. KryoUnitLSB]>;
  52. }
  53. let SchedModel = KryoModel in {
  54. //===----------------------------------------------------------------------===//
  55. // Map the target-defined scheduler read/write resources and latency for
  56. // Kryo.
  57. def : WriteRes<WriteImm, [KryoUnitXY]> { let Latency = 1; }
  58. def : WriteRes<WriteI, [KryoUnitXY]> { let Latency = 1; }
  59. def : WriteRes<WriteISReg, [KryoUnitXY, KryoUnitXY]>
  60. { let Latency = 2; let NumMicroOps = 2; }
  61. def : WriteRes<WriteIEReg, [KryoUnitXY, KryoUnitXY]>
  62. { let Latency = 2; let NumMicroOps = 2; }
  63. def : WriteRes<WriteExtr, [KryoUnitXY, KryoUnitX]>
  64. { let Latency = 2; let NumMicroOps = 2; }
  65. def : WriteRes<WriteIS, [KryoUnitXY]> { let Latency = 2; }
  66. def : WriteRes<WriteID32, [KryoUnitXA, KryoUnitY]>
  67. { let Latency = 8; let NumMicroOps = 1; } // Fragent -1
  68. def : WriteRes<WriteID64, [KryoUnitXA, KryoUnitY]>
  69. { let Latency = 8; let NumMicroOps = 1; } // Fragent -1
  70. def : WriteRes<WriteIM32, [KryoUnitX]> { let Latency = 5; }
  71. def : WriteRes<WriteIM64, [KryoUnitX]> { let Latency = 5; }
  72. def : WriteRes<WriteBr, [KryoUnitXY]> { let Latency = 1; }
  73. def : WriteRes<WriteBrReg, [KryoUnitXY]> { let Latency = 1; }
  74. def : WriteRes<WriteLD, [KryoUnitLS]> { let Latency = 4; }
  75. def : WriteRes<WriteST, [KryoUnitLS]> { let Latency = 4; }
  76. def : WriteRes<WriteSTP, [KryoUnitLS]> { let Latency = 4; }
  77. def : WriteRes<WriteAdr, [KryoUnitXY]> { let Latency = 6; }
  78. def : WriteRes<WriteLDIdx, [KryoUnitLS]> { let Latency = 4; }
  79. def : WriteRes<WriteSTIdx, [KryoUnitLS]> { let Latency = 4; }
  80. def : WriteRes<WriteF, [KryoUnitXY, KryoUnitXY]>
  81. { let Latency = 3; let NumMicroOps = 2; }
  82. def : WriteRes<WriteFCmp, [KryoUnitXY]> { let Latency = 2; }
  83. def : WriteRes<WriteFCvt, [KryoUnitX]> { let Latency = 4; }
  84. def : WriteRes<WriteFCopy, [KryoUnitXY]> { let Latency = 6; }
  85. def : WriteRes<WriteFImm, [KryoUnitXY]> { let Latency = 6; }
  86. def : WriteRes<WriteFMul, [KryoUnitX, KryoUnitX]>
  87. { let Latency = 6; let NumMicroOps = 2; }
  88. def : WriteRes<WriteFDiv, [KryoUnitXA, KryoUnitY]>
  89. { let Latency = 12; let NumMicroOps = 2; } // Fragent -1 / NoRSV +1
  90. def : WriteRes<WriteVd, [KryoUnitXY]> { let Latency = 6; }
  91. def : WriteRes<WriteVq, [KryoUnitXY]> { let Latency = 6; }
  92. def : WriteRes<WriteVLD, [KryoUnitLS]> { let Latency = 4; }
  93. def : WriteRes<WriteVST, [KryoUnitLS]> { let Latency = 4; }
  94. def : WriteRes<WriteSys, []> { let Latency = 1; }
  95. def : WriteRes<WriteBarrier, []> { let Latency = 1; }
  96. def : WriteRes<WriteHint, []> { let Latency = 1; }
  97. def : WriteRes<WriteLDHi, []> { let Latency = 4; }
  98. def : WriteRes<WriteAtomic, []> { let Unsupported = 1; }
  99. // No forwarding logic is modelled yet.
  100. def : ReadAdvance<ReadI, 0>;
  101. def : ReadAdvance<ReadISReg, 0>;
  102. def : ReadAdvance<ReadIEReg, 0>;
  103. def : ReadAdvance<ReadIM, 0>;
  104. def : ReadAdvance<ReadIMA, 0>;
  105. def : ReadAdvance<ReadID, 0>;
  106. def : ReadAdvance<ReadExtrHi, 0>;
  107. def : ReadAdvance<ReadAdrBase, 0>;
  108. def : ReadAdvance<ReadVLD, 0>;
  109. def : ReadAdvance<ReadST, 0>;
  110. //===----------------------------------------------------------------------===//
  111. // Specialize the coarse model by associating instruction groups with the
  112. // subtarget-defined types. As the modeled is refined, this will override most
  113. // of the above SchedWriteRes and SchedAlias mappings.
  114. // Miscellaneous
  115. // -----------------------------------------------------------------------------
  116. def : InstRW<[WriteI], (instrs COPY)>;
  117. // Detailed Refinedments
  118. // -----------------------------------------------------------------------------
  119. include "AArch64SchedKryoDetails.td"
  120. } // SchedModel = KryoModel