LLVM 18.0.0git
Macros | Functions | Variables
AMDGPUAtomicOptimizer.cpp File Reference

This pass optimizes atomic operations by using a single lane of a wavefront to perform the atomic operation, thus reducing contention on that memory location. More...

#include "AMDGPU.h"
#include "GCNSubtarget.h"
#include "llvm/Analysis/DomTreeUpdater.h"
#include "llvm/Analysis/UniformityAnalysis.h"
#include "llvm/CodeGen/TargetPassConfig.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/InstVisitor.h"
#include "llvm/IR/IntrinsicsAMDGPU.h"
#include "llvm/InitializePasses.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Transforms/Utils/BasicBlockUtils.h"

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "amdgpu-atomic-optimizer"
 of Wavefront using llvm.cttz and performs scan using readlane & writelane intrinsics
 

Functions

static ValuebuildNonAtomicBinOp (IRBuilder<> &B, AtomicRMWInst::BinOp Op, Value *LHS, Value *RHS)
 
static ConstantgetIdentityValueForAtomicOp (Type *const Ty, AtomicRMWInst::BinOp Op)
 
static ValuebuildMul (IRBuilder<> &B, Value *LHS, Value *RHS)
 
 INITIALIZE_PASS_BEGIN (AMDGPUAtomicOptimizer, DEBUG_TYPE, "AMDGPU atomic optimizations", false, false) INITIALIZE_PASS_END(AMDGPUAtomicOptimizer
 

Variables

 DEBUG_TYPE
 
AMDGPU atomic optimizations
 
AMDGPU atomic false
 

Detailed Description

This pass optimizes atomic operations by using a single lane of a wavefront to perform the atomic operation, thus reducing contention on that memory location.

Atomic optimizer uses following strategies to compute scan and reduced values

  1. DPP - This is the most efficient implementation for scan. DPP uses Whole Wave Mode (WWM)
  2. Iterative -

Definition in file AMDGPUAtomicOptimizer.cpp.

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "amdgpu-atomic-optimizer"

of Wavefront using llvm.cttz and performs scan using readlane & writelane intrinsics

Definition at line 36 of file AMDGPUAtomicOptimizer.cpp.

Function Documentation

◆ buildMul()

static Value * buildMul ( IRBuilder<> &  B,
Value LHS,
Value RHS 
)
static

Definition at line 668 of file AMDGPUAtomicOptimizer.cpp.

References B, llvm::ConstantInt::isOne(), LHS, and RHS.

◆ buildNonAtomicBinOp()

static Value * buildNonAtomicBinOp ( IRBuilder<> &  B,
AtomicRMWInst::BinOp  Op,
Value LHS,
Value RHS 
)
static

◆ getIdentityValueForAtomicOp()

static Constant * getIdentityValueForAtomicOp ( Type *const  Ty,
AtomicRMWInst::BinOp  Op 
)
static

◆ INITIALIZE_PASS_BEGIN()

INITIALIZE_PASS_BEGIN ( AMDGPUAtomicOptimizer  ,
DEBUG_TYPE  ,
"AMDGPU atomic optimizations"  ,
false  ,
false   
)

Variable Documentation

◆ DEBUG_TYPE

DEBUG_TYPE

Definition at line 1012 of file AMDGPUAtomicOptimizer.cpp.

◆ false

AMDGPU atomic false

Definition at line 1013 of file AMDGPUAtomicOptimizer.cpp.

◆ optimizations

AMDGPU atomic optimizations

Definition at line 1013 of file AMDGPUAtomicOptimizer.cpp.