Comments (3)
I would like to start a discussion on how to develop this lower_to
pragma properly. I did some experiments in the directions highlighted by this RFC (see #57), applying the pragma to generate operations from the linalg dialect. To do so, I had to extend the pragma with "input" and "output" fields, which represent the input and output operands of the linalg operation. We need these fields to explicitly indicated input and output, as we cannot understand this simply by looking at the function operands. Here is an example of generating a named copy op from the linalg dialect.
#pragma lower_to(copy_op, "linalg.copy") "input"(a), "output"(b)
void copy_op(int b[3][3], int a[3][3]) {
for (int i = 0; i < 3; i++)
for (int j = 0; j < 3; j++)
b[i][j] = a[i][j];
}
int main() {
int a[3][3];
int b[3][3];
// CHECK: linalg.copy({{.*}}, {{.*}}) : memref<3x3xi32>, memref<3x3xi32>
copy_op(a, b);
return 0;
}
After this extension is fairly easy to emit linalg named ops, but I hit a problem when generating linalg generic. Specifically, a linalg generic op requires index maps for each input and output view, but we do not have them at this point. Do you have any suggestions, on how to emit linalg generic op? Or should we restrict to linalg named op only?
from polygeist.
I wonder if perhaps the right place to do this is not as much on the call declaration, but to define a special pragma that results in an op execution itself.
Maybe something like
int a[3][3];
int b[3][3];
#pragma op linalg.generic "input"(a) "output"(b)
This way we could use various runtime parameters as part of the op?
from polygeist.
@wsmoses Hi Billy, not sure what you mention with "runtime parameters". Current problems I see when emitting linalg generic ops are: 1) linalg generic requires index maps to understand the mapping between loops and input/output buffers, how can we get this if we do not bind the pragma to a given function? Still after binding to a function how we can get the access maps at this point in our codegen?. 2) Linalg generic requires you to define the computation. Again this means that we need to bind the pragma to some functions or nested loop. From the example you made above I am not so sure how we can get this information.
from polygeist.
Related Issues (20)
- Cgeist outputs something strange HOT 6
- How to run PolyBench/C benchmarks with polyhedral pluto optimization using Polygeist? HOT 3
- [Bug] Incorrect scf.for code is generated
- Sign extension not properly propagated to users HOT 2
- declared char constants emit higher bit-width MLIR constants HOT 3
- linker error with cgeist on C++ code HOT 2
- make[1]: *** No rule to make target 'install'. Stop. make: *** [Makefile:555: install-recursive] Error 1 CMake Error at tools/polymer/CMakeLists.txt:28 (execute_process): execute_process failed command indexes: 1: "Child return code: 2" HOT 1
- support for Cuda 12.1 HOT 11
- Incorrect execution result of running CUDA to OpenMP compilation? HOT 1
- Error compiling code with Polygeist: 'affine.for' op operand cannot be used as a symbol
- [bug] Operations such as "|=", "&=" and "^=" lack necessary implicit type conversions
- opaque attribute handling issues
- error when trying to lower .cu file, should I report this here or on LLVM repo issues?
- Problems about fp_16 in CUDA, as half, __hmul.......etc HOT 1
- Is it possible to take MLIR generated by CUDA-to-CPU flow to the cpu-openmp executable? HOT 1
- Add Support for Additional Math Operations in Polygeist
- gitignore bug
- Polymer with -reg2mem -pluto-opt generates IR with out-of-bounds accesses for imperfectly nested loops
- When a class is deleted, the user-defined destructor is not invoked. HOT 3
- Runtime error after compiling CUDA programs using cgeist HOT 2
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 polygeist.