[llvm] [X86][CostModel] Add per-shape gather/scatter cost tables for AMD znver4+ (PR #199488)

Sumukh J Bharadwaj via llvm-commits llvm-commits at lists.llvm.org
Sat Jun 6 11:04:51 PDT 2026


================
@@ -721,6 +721,17 @@ def TuningFastGather
     : SubtargetFeature<"fast-gather", "HasFastGather", "true",
                        "Indicates if gather is reasonably fast (this is true for Skylake client and all AVX-512 CPUs)">;
 
+// Use AMD Zen-tuned cost tables for masked gather/scatter intrinsics in the
+// X86 TargetTransformInfo cost model. Refines the flat overhead used by other
+// AVX-512 targets with per-element-type/per-VL costs measured on znver4 and
+// znver5. Inherited automatically by every znver4+ CPU via ZN4Tuning; not
+// applied to pre-AVX-512 Zen parts (znver1..3), which take the scalarise
+// path for masked gather anyway.
+def TuningPreferAMDZenGSCost
----------------
amd-subharad wrote:

Hello @Andarwinux, thanks for raising this
The table values themselves stay Zen-measured and are only consulted by subtargets that explicitly carry the bit (today only via ZN4AdditionalTuning). If Intel parts need per-shape tuning of their own later, the addition is localized to the lookup site which is a new Intel-measured table, gated on an Intel-identifying feature, sitting in parallel with the existing Zen branch. The Zen path itself is unaffected.
Please let me know if this would still be a cause of confusion

https://github.com/llvm/llvm-project/pull/199488


More information about the llvm-commits mailing list