Comments (4)
I believe here the problem to be that your matcher looks for a 2d store but what you really want is to math a 4d store. Try with: m_Op<AffineStore>(m_Any(), m_Any(), m_Any(), m_Any())
from plaidml.
I believe here the problem to be that your matcher looks for a 2d store but what you really want is to math a 4d store. Try with:
m_Op<AffineStore>(m_Any(), m_Any(), m_Any(), m_Any())
It works. I matched the affine.store op with the following:
matchPattern(store, m_Op<AffineStoreOp>(m_Any(), m_Any(), m_Any(), m_Any(), m_Any(), m_Any()))
Here, since the definingOp of operand of affine.yield is from another affine.parallel op, affine.store can not be located with m_Op
so I have to choose to directly capture affine.store op.
In this situation, can I use m_Capture
to capture the affine.store op?
from plaidml.
Can you please share the IR you want to match? I am not sure I understood
from plaidml.
The following is part of MLIR code generated from plaidml/edsl/examples/conv_2d_dilated.cc. What I actually want to match I is the affine.parallel block of %3.
stdx.closure(%arg0: memref<1x244x244x1xi64>, %arg1: memref<3x3x1x32xi64>, %arg2: memref<1x240x238x32xi64>) -> memref<1x240x238x32xi64>{
%2 = affine.parallel (%arg3, %arg4, %arg5, %arg6) = (0, 0, 0, 0) to (1, 240, 238, 32) reduce ("assign") -> (memref<1x240x238x32xi64>) {
%4 = pxa.load %1[%arg3, %arg4, %arg5, %arg6] : memref<1x240x238x32xi64>
%5 = pxa.reduce assign %4, %arg2[%arg3, %arg4, %arg5, %arg6] : memref<1x240x238x32xi64>
affine.yield %5 : memref<1x240x238x32xi64>
}
%3 = affine.parallel (%arg3, %arg4, %arg5, %arg6, %arg7, %arg8, %arg9) = (0, 0, 0, 0, 0, 0, 0) to (1, 240, 238, 32, 3, 3, 1) reduce ("assign") -> (memref<1x240x238x32xi64>) {
%4 = affine.load %arg0[%arg3, %arg4 + %arg7 * 2, %arg5 + %arg8 * 3, %arg9] : memref<1x244x244x1xi64>
%5 = affine.load %arg1[%arg7, %arg8, %arg9, %arg6] : memref<3x3x1x32xi64>
%6 = arith.muli %4, %5 : i64
%7 = affine.load %2[%arg3, %arg4, %arg5, %arg6] : memref<1x240x238x32xi64>
%8 = arith.addi %7, %6 : i64
affine.store %8, %2[%arg3, %arg4, %arg5, %arg6] : memref<1x240x238x32xi64>
affine.yield %2 : memref<1x240x238x32xi64>
}
stdx.yield %3 : memref<1x240x238x32xi64>
}
The following code is my capture()
function. Now it can match this parallel block and output "Matched". But I don't know how to capture affine.store op and pack it with other affine.load ops into StencilCapture
struct.
Optional<StencilCapture> capture() {
using matchers::m_Any;
// Looking for load..load..mul..load..add..store
Value load1, load2, load3, store;
if (!isa<AffineStoreOp>(*std::prev(op.getLoopBody().front().end(), 2))) {
return llvm::None;
}
auto yield = llvm::dyn_cast<mlir::AffineStoreOp>(std::prev(op.getLoopBody().front().end(), 2));
if (matchPattern(yield, m_Op<AffineStoreOp>(
m_Op<arith::AddIOp>(
m_Capture(&load3, m_Op<AffineLoadOp>()),
m_Op<arith::MulIOp>(
m_Capture(&load1, m_Op<AffineLoadOp>()),
m_Capture(&load2, m_Op<AffineLoadOp>())
)
),
m_Any(),
m_Any(),
m_Any(),
m_Any(),
m_Any()))
) {
IVLOG(2, "Matched");
// return StencilCapture{{store}, {load1, load2, load3}};
return llvm::None;
}
return llvm::None;
}
from plaidml.
Related Issues (20)
- switching between cpu and gpu HOT 1
- plaidml-setup doesnt work anymore
- plaidml.exceptions.PlaidMLError: Could not find PlaidML configuration file: "experimental.json" HOT 1
- PlaidML Poor Performance on (My?) RX 6800 HOT 5
- Unable to run pmlc-opt output MLIR example via pmlc-jit HOT 2
- Printing memrefs HOT 1
- ModuleNotFoundError: No module named 'plaidml.bridge' HOT 1
- The fetching of dependencies should only be used as fallback
- neural network doesn't output the results HOT 3
- The Keras backend function 'local_conv2d' is not yet implemented in Plaid.
- build errors HOT 1
- how to fix "cannot import name 'Iterable' from 'collections' when running test code from main page HOT 3
- Feedback on build documentation HOT 2
- Tile language vs EDSL HOT 10
- Not able to select GPU with plaidml-v1 HOT 6
- Support using system-installed llvm HOT 4
- cannot figure out how to load premade model in python
- Getting error runing build. HOT 2
- Evaluate Profile-Guided Optimization (PGO) HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from plaidml.