[all-commits] [llvm/llvm-project] 670259: [LoopCacheAnalysis] Fix loop cache cost to always ...

Rouzbeh via All-commits all-commits at lists.llvm.org
Mon May 27 06:55:00 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 670259466b238176ac302c8dedf806d2b2be7e0c
      https://github.com/llvm/llvm-project/commit/670259466b238176ac302c8dedf806d2b2be7e0c
  Author: Rouzbeh <rouzbeh.paktinat1 at huawei.com>
  Date:   2024-05-27 (Mon, 27 May 2024)

  Changed paths:
    M llvm/lib/Analysis/LoopCacheAnalysis.cpp
    M llvm/test/Analysis/LoopCacheAnalysis/PowerPC/LoopnestFixedSize.ll
    M llvm/test/Analysis/LoopCacheAnalysis/PowerPC/compute-cost.ll
    M llvm/test/Analysis/LoopCacheAnalysis/PowerPC/loads-store.ll
    M llvm/test/Analysis/LoopCacheAnalysis/PowerPC/matmul.ll
    M llvm/test/Analysis/LoopCacheAnalysis/PowerPC/matvecmul.ll
    M llvm/test/Analysis/LoopCacheAnalysis/PowerPC/multi-store.ll
    M llvm/test/Analysis/LoopCacheAnalysis/PowerPC/single-store.ll
    M llvm/test/Analysis/LoopCacheAnalysis/PowerPC/stencil.ll
    M llvm/test/Analysis/LoopCacheAnalysis/compute-cost.ll
    A llvm/test/Analysis/LoopCacheAnalysis/interchange-cost-beneficial.ll
    M llvm/test/Transforms/LoopInterchange/pr43176-move-to-new-latch.ll

  Log Message:
  -----------
  [LoopCacheAnalysis] Fix loop cache cost to always round the cost up to the nearest integer number (#88915)

Currently loop cache analysis uses following formula to evaluate cost of
an RefGroup for a consecutive memory access:

`RefCost=(TripCount*Stride)/CLS`

This cost evaluates to zero when `TripCount*Stride` is smaller than
cache-line-size. This results in wrong cost value for a loop and
misleads loopInterchange decisions as shown in [this
case](https://llvm.godbolt.org/z/jTz1vn4hn).

This patch fixes the problem by rounding the cost to 1 once this problem
happens.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list