mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-01-15 12:39:19 +00:00
[mlir][linalg] Cleanup LinalgOp usage in dependence analysis (NFC).
Replace the uses of deprecated Structured Op Interface methods in DependenceAnalysis.cpp and DependenceAnalysis.h. This patch is based on https://reviews.llvm.org/D103394. Differential Revision: https://reviews.llvm.org/D103411
This commit is contained in:
parent
7594f5028a
commit
94643fda13
@ -80,9 +80,9 @@ public:
|
||||
if (!owner)
|
||||
return llvm::None;
|
||||
if (OpOperand *operand = opView.dyn_cast<OpOperand *>())
|
||||
return owner.getIndexingMap(operand->getOperandNumber());
|
||||
return owner.getOutputIndexingMap(
|
||||
opView.get<Value>().cast<OpResult>().getResultNumber());
|
||||
return owner.getTiedIndexingMap(operand);
|
||||
return owner.getTiedIndexingMap(owner.getOutputOperand(
|
||||
opView.get<Value>().cast<OpResult>().getResultNumber()));
|
||||
}
|
||||
// Return the operand number if the `opView` is an OpOperand *. Otherwise
|
||||
// return llvm::None.
|
||||
|
@ -165,46 +165,46 @@ void LinalgDependenceGraph::addDependencesBetween(LinalgOp src, LinalgOp dst) {
|
||||
LLVM_DEBUG(dbgs() << "addDependencesBetween " << *src.getOperation()
|
||||
<< " and " << *dst.getOperation() << "\n");
|
||||
if (src.hasTensorSemantics() && dst.hasTensorSemantics()) {
|
||||
for (OpOperand &dstOpOperand : dst.getInputOpOperands()) {
|
||||
for (OpOperand *dstOpOperand : dst.getInputOperands()) {
|
||||
// Check if the operand is defined by the src.
|
||||
auto definingOp = dstOpOperand.get().getDefiningOp<LinalgOp>();
|
||||
auto definingOp = dstOpOperand->get().getDefiningOp<LinalgOp>();
|
||||
if (definingOp && definingOp == src)
|
||||
addDependenceElem(DependenceType::RAW, dstOpOperand.get(),
|
||||
&dstOpOperand);
|
||||
addDependenceElem(DependenceType::RAW, dstOpOperand->get(),
|
||||
dstOpOperand);
|
||||
}
|
||||
for (OpOperand &dstOpOperand : dst.getOutputOpOperands()) {
|
||||
for (OpOperand *dstOpOperand : dst.getOutputOperands()) {
|
||||
// Check if the operand is defined by the src.
|
||||
auto definingOp = dstOpOperand.get().getDefiningOp<LinalgOp>();
|
||||
auto definingOp = dstOpOperand->get().getDefiningOp<LinalgOp>();
|
||||
if (definingOp && definingOp == src) {
|
||||
if (dst.isInitTensor(&dstOpOperand)) {
|
||||
addDependenceElem(DependenceType::RAW, dstOpOperand.get(),
|
||||
&dstOpOperand);
|
||||
if (dst.isInitTensor(dstOpOperand)) {
|
||||
addDependenceElem(DependenceType::RAW, dstOpOperand->get(),
|
||||
dstOpOperand);
|
||||
}
|
||||
addDependenceElem(DependenceType::WAW, dstOpOperand.get(),
|
||||
&dstOpOperand);
|
||||
addDependenceElem(DependenceType::WAW, dstOpOperand->get(),
|
||||
dstOpOperand);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
assert(src.hasBufferSemantics() && dst.hasBufferSemantics() &&
|
||||
"unhandled dependence tracking for mixed buffer/tensor operations");
|
||||
for (OpOperand *srcOpOperand : src.getOutputBuffersOpOperands()) { // W
|
||||
for (OpOperand *srcOpOperand : src.getOutputBufferOperands()) { // W
|
||||
// RAW graph
|
||||
for (OpOperand *dstOpOperand : dst.getInputBuffersOpOperands()) // R
|
||||
if (aliases.alias(srcOpOperand->get(), dstOpOperand->get())) // RAW alias
|
||||
for (OpOperand *dstOpOperand : dst.getInputBufferOperands()) // R
|
||||
if (aliases.alias(srcOpOperand->get(), dstOpOperand->get())) // RAW alias
|
||||
addDependenceElem(DependenceType::RAW, srcOpOperand, dstOpOperand);
|
||||
// WAW graph
|
||||
for (OpOperand *dstOpOperand : dst.getOutputBuffersOpOperands()) // W
|
||||
for (OpOperand *dstOpOperand : dst.getOutputBufferOperands()) // W
|
||||
if (aliases.alias(srcOpOperand->get(), dstOpOperand->get())) // WAW alias
|
||||
addDependenceElem(DependenceType::WAW, srcOpOperand, dstOpOperand);
|
||||
}
|
||||
for (OpOperand *srcOpOperand : src.getInputBuffersOpOperands()) { // R
|
||||
for (OpOperand *srcOpOperand : src.getInputBufferOperands()) { // R
|
||||
// RAR graph
|
||||
for (OpOperand *dstOpOperand : dst.getInputBuffersOpOperands()) // R
|
||||
if (aliases.alias(srcOpOperand->get(), dstOpOperand->get())) // RAR alias
|
||||
for (OpOperand *dstOpOperand : dst.getInputBufferOperands()) // R
|
||||
if (aliases.alias(srcOpOperand->get(), dstOpOperand->get())) // RAR alias
|
||||
addDependenceElem(DependenceType::RAR, srcOpOperand, dstOpOperand);
|
||||
// WAR graph
|
||||
for (OpOperand *dstOpOperand : dst.getOutputBuffersOpOperands()) // W
|
||||
for (OpOperand *dstOpOperand : dst.getOutputBufferOperands()) // W
|
||||
if (aliases.alias(srcOpOperand->get(), dstOpOperand->get())) // WAR alias
|
||||
addDependenceElem(DependenceType::WAR, srcOpOperand, dstOpOperand);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user