21 llvm::StringRef name) {
23 llvm::StringRef moduleName =
28 if (
auto gpuMod = symTab.
lookup<gpu::GPUModuleOp>(moduleName))
35 auto *ctx = mod.getContext();
36 mod->setAttr(gpu::GPUDialect::getContainerModuleAttrName(),
40 auto gpuMod = gpu::GPUModuleOp::create(builder, mod.getLoc(), moduleName);
42 symTab.
insert(gpuMod, insertPt);
47 gpu::Processor processor) {
51 case gpu::Processor::ThreadX:
53 case gpu::Processor::ThreadY:
55 case gpu::Processor::ThreadZ:
57 case gpu::Processor::BlockX:
59 case gpu::Processor::BlockY:
61 case gpu::Processor::BlockZ:
72 assert(!dimensionOps.empty() &&
"dimension map is empty");
73 return dimensionOps.lookup(processor);
77 gpu::Processor processor) {
81 case gpu::Processor::ThreadX:
83 case gpu::Processor::ThreadY:
85 case gpu::Processor::ThreadZ:
87 case gpu::Processor::BlockX:
89 case gpu::Processor::BlockY:
91 case gpu::Processor::BlockZ:
102 assert(!indexOps.empty() &&
"index map is empty");
103 return indexOps.lookup(processor);
OpListType::iterator iterator
This class helps build Operations.
This class allows for representing and managing the symbol table used by operations with the 'SymbolT...
Operation * lookup(StringRef name) const
Look up a symbol with the specified name, returning null if no such name exists.
StringAttr insert(Operation *symbol, Block::iterator insertPt={})
Insert a new symbol into the table, and rename it as necessary to avoid collisions.
This class represents an instance of an SSA value in the MLIR system, representing a computable value...
Value getGPUSize(gpu::Processor processor, gpu::LaunchOp launch, const llvm::DenseMap< gpu::Processor, Value > &dimensionOps)
Return the launch dimension for processor from launch, or from dimensionOps when launch is null.
std::optional< gpu::GPUModuleOp > getOrCreateGPUModule(ModuleOp mod, bool create=true, llvm::StringRef name=kDefaultGPUModuleName)
Get or create a GPU module in the given module.
static Value getGPUSizeFromLaunch(gpu::LaunchOp launch, gpu::Processor processor)
Value getGPUThreadId(gpu::Processor processor, gpu::LaunchOp launch, const llvm::DenseMap< gpu::Processor, Value > &indexOps)
Return the thread/block index for processor from launch, or from indexOps when launch is null.
static Value getGPUThreadIdFromLaunch(gpu::LaunchOp launch, gpu::Processor processor)
constexpr llvm::StringLiteral kDefaultGPUModuleName
Default GPU module name used by OpenACC.
Include the generated interface declarations.
Utility class for the GPU dialect to represent triples of Values accessible through ....