MLIR  19.0.0git
Macros | Functions
GPUHeuristics.cpp File Reference
#include "mlir/Dialect/Linalg/TransformOps/GPUHeuristics.h"
#include "mlir/Dialect/GPU/IR/GPUDialect.h"
#include "mlir/Support/MathExtras.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
#include <cmath>
#include <numeric>

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "linalg-transforms"
 
#define DBGS()   (llvm::dbgs() << "[" DEBUG_TYPE "]: ")
 
#define LDBG(X)   LLVM_DEBUG(DBGS() << X << "\n")
 

Functions

static Attribute linearId0 (MLIRContext *ctx)
 
static Attribute linearId1 (MLIRContext *ctx)
 
static Attribute linearId2 (MLIRContext *ctx)
 
static SmallVector< int64_t > getFactors (int64_t val)
 Get the list of all factors that divide val, not just the prime factors. More...
 
static int64_t product (ArrayRef< int64_t > vals)
 
static SmallVector< int64_t > maximizeNumThreads (ArrayRef< int64_t > sizes, int64_t currentIndex, int64_t maxNumThreads)
 Extract result from sizes with the following constraints: More...
 

Macro Definition Documentation

◆ DBGS

#define DBGS ( )    (llvm::dbgs() << "[" DEBUG_TYPE "]: ")

Definition at line 24 of file GPUHeuristics.cpp.

◆ DEBUG_TYPE

#define DEBUG_TYPE   "linalg-transforms"

Definition at line 23 of file GPUHeuristics.cpp.

◆ LDBG

#define LDBG (   X)    LLVM_DEBUG(DBGS() << X << "\n")

Definition at line 25 of file GPUHeuristics.cpp.

Function Documentation

◆ getFactors()

static SmallVector<int64_t> getFactors ( int64_t  val)
static

Get the list of all factors that divide val, not just the prime factors.

Definition at line 104 of file GPUHeuristics.cpp.

Referenced by maximizeNumThreads().

◆ linearId0()

static Attribute linearId0 ( MLIRContext ctx)
static

Definition at line 27 of file GPUHeuristics.cpp.

References mlir::get().

Referenced by mlir::transform::gpu::CopyMappingInfo::CopyMappingInfo().

◆ linearId1()

static Attribute linearId1 ( MLIRContext ctx)
static

Definition at line 30 of file GPUHeuristics.cpp.

References mlir::get().

Referenced by mlir::transform::gpu::CopyMappingInfo::CopyMappingInfo().

◆ linearId2()

static Attribute linearId2 ( MLIRContext ctx)
static

Definition at line 33 of file GPUHeuristics.cpp.

References mlir::get().

Referenced by mlir::transform::gpu::CopyMappingInfo::CopyMappingInfo().

◆ maximizeNumThreads()

static SmallVector<int64_t> maximizeNumThreads ( ArrayRef< int64_t >  sizes,
int64_t  currentIndex,
int64_t  maxNumThreads 
)
static

Extract result from sizes with the following constraints:

  1. sizes[i] % result[i] for all i
  2. product_of_threadsPerDim <= maxNumThreads
  3. if currentIndex is sizes.size() - 1, then threadsPerDim[currentIndex] must be sizes[currentIndex]. This is used to greedily extract the maximum number of threads usable for mapping a copy of size sizes, while being bounded by totalNumThreads and ensuring coalesced access along the most minor dimension. Return the number of threads used in the range: threadsPerDim[currentIndex .. sizes.end()]

Definition at line 137 of file GPUHeuristics.cpp.

References DBGS, getFactors(), LDBG, and product().

◆ product()

static int64_t product ( ArrayRef< int64_t >  vals)
static