[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 10:59:20 PDT 2026
amd-subharad wrote:
Hello @ganeshgit Thank you for your review and apologies for the delay in the response
I have addressed the issues mentioned by you in the latest commits
1. Renamed TuningPreferAMDZenGSCost -> TuningPreferGSCostTable (accessor hasPreferGSCostTable(), mattr prefer-gs-cost-table).
2. Asserts for omitted shapes: added inside both getGatherOverhead and getScatterOverhead, just before the table lookup. VF<4 is force-scalarised on AVX-512+VLX (forceScalarizeMaskedGather/Scatter) and v16f64 is split by type legalisation in getGSVectorCost, so neither shape can reach these functions today. If either path is relaxed upstream, the assert fires in asserts-builds (and CI) naming the exact row to add, instead of silently falling through to the generic flat overhead.
3. i64 comment: reworded to spell out that the i64 break-even is HIGHER than f64 because the i64 scalar fallback runs on the
cheaper integer pipeline, so the integer scalar baseline is harder to beat. Removed the ambiguous "gather has to be cheaper to win" phrasing.
4. x86-64-v4 test path: added -mcpu=x86-64-v4 with the X8664V4 check prefix to masked-gather-scatter-amd-zen.ll. Values match SKX (generic AVX-512 fallthrough), pinning that this change cannot affect distros shipping glibc-hwcap/x86-64-v4-tier binaries.
Please let me know if anything still needs addressing.
https://github.com/llvm/llvm-project/pull/199488
More information about the llvm-commits
mailing list