|
MLIR
22.0.0git
|
#include "mlir/Dialect/SPIRV/Linking/ModuleCombiner.h"#include "mlir/Dialect/SPIRV/IR/SPIRVOps.h"#include "mlir/IR/Attributes.h"#include "mlir/IR/Builders.h"#include "mlir/IR/SymbolTable.h"#include "llvm/ADT/Hashing.h"#include "llvm/ADT/STLExtras.h"#include "llvm/ADT/StringMap.h"Go to the source code of this file.
Namespaces | |
| mlir | |
| Include the generated interface declarations. | |
| mlir::spirv | |
Functions | |
| static StringAttr | renameSymbol (StringRef oldSymName, unsigned &lastUsedID, spirv::ModuleOp module) |
Returns an unused symbol in module for oldSymbolName by trying numeric suffix in lastUsedID. More... | |
| static LogicalResult | updateSymbolAndAllUses (SymbolOpInterface op, spirv::ModuleOp target, spirv::ModuleOp source, unsigned &lastUsedID) |
Checks if a symbol with the same name as op already exists in source. More... | |
| static llvm::hash_code | computeHash (SymbolOpInterface symbolOp) |
Computes a hash code to represent symbolOp based on all its attributes except for the symbol name. More... | |
| OwningOpRef< spirv::ModuleOp > | mlir::spirv::combine (ArrayRef< spirv::ModuleOp > inputModules, OpBuilder &combinedModuleBuilder, SymbolRenameListener symRenameListener) |
Combines a list of SPIR-V inputModules into one. More... | |
Variables | |
| static constexpr unsigned | maxFreeID = 1 << 20 |
|
static |
Computes a hash code to represent symbolOp based on all its attributes except for the symbol name.
Note: We use the operation's name (not the symbol name) as part of the hash computation. This prevents, for example, mistakenly considering a global variable and a spec constant as duplicates because their descriptor set + binding and spec_id, respectively, happen to hash to the same value.
Definition at line 72 of file ModuleCombiner.cpp.
Referenced by mlir::spirv::combine(), and mlir::Op< ConcreteType, Traits >::computePropertiesHash().
|
static |
Returns an unused symbol in module for oldSymbolName by trying numeric suffix in lastUsedID.
Definition at line 29 of file ModuleCombiner.cpp.
References mlir::get(), mlir::SymbolTable::lookupSymbolIn(), and maxFreeID.
Referenced by updateSymbolAndAllUses().
|
static |
Checks if a symbol with the same name as op already exists in source.
If so, renames op and updates all its references in target.
Definition at line 47 of file ModuleCombiner.cpp.
References mlir::remark::failed(), mlir::SymbolTable::lookupSymbolIn(), renameSymbol(), mlir::SymbolTable::replaceAllSymbolUses(), and mlir::SymbolTable::setSymbolName().
Referenced by mlir::spirv::combine().
|
staticconstexpr |
Definition at line 25 of file ModuleCombiner.cpp.
Referenced by renameSymbol().