Comments (6)
This is indeed not possible with the passes we have right now. Is this relevant for the work on your side?
from mlir-emitc.
This would allow using the argmax from TOSA with a primarily MHLO model.
Is it a requirement that the lowering to EmitC be a one-shot?
from mlir-emitc.
I see. This is not a strict requirement, it just how we currently have implemented this. So far there wasn't a use case for mixed models on our side. Anyway, if it is helping we can think about refactoring this.
from mlir-emitc.
This is indeed not possible with the passes we have right now. Is this relevant for the work on your side?
I must correct my statement. The conversion passes are implemented as partial conversions and it is indeed possible to pass mixed input files. For example
func @mixed_dialects(%arg0: tensor<2xi32>) -> i32 {
%0 = "mhlo.constant"() {value = dense<1> : tensor<2xi32>} : () -> tensor<2xi32>
%1 = "tosa.const"() {value = dense<[3, 0, 1, 2]> : tensor<4xi32>} : () -> tensor<4xi32>
%2 = emitc.call "func_a" (%0, %1) : (tensor<2xi32>, tensor<4xi32>) -> i32
return %2 : i32
}
can be converted by passing --convert-tosa-to-emitc --convert-mhlo-to-emit
to emitc-opt
to
func @mixed_dialects(%arg0: tensor<2xi32>) -> i32 {
%0 = "emitc.constant"() {value = dense<1> : tensor<2xi32>} : () -> tensor<2xi32>
%1 = "emitc.constant"() {value = dense<[3, 0, 1, 2]> : tensor<4xi32>} : () -> tensor<4xi32>
%2 = emitc.call "func_a"(%0, %1) : (tensor<2xi32>, tensor<4xi32>) -> i32
return %2 : i32
}
Using emitc-translate
or mlir-translate
(from MLIR upstream) this can be translated to
int32_t mixed_dialects(Tensor<int32_t, 2> v1) {
Tensor<int32_t, 2> v2 = {1, 1};
Tensor<int32_t, 4> v3 = {3, 0, 1, 2};
int32_t v4 = func_a(v2, v3);
return v4;
}
from mlir-emitc.
This would allow using the argmax from TOSA with a primarily MHLO model.
The problem you were facing is that there is no conversion for tosa.argmax
. I've created #279 to track this. Please re-open or fill a new issue if I got things wrong.
from mlir-emitc.
Ah I hadn't checked argmax support there. Thanks!
from mlir-emitc.
Related Issues (20)
- Translating model from tf_saved_model to mhlo fails HOT 4
- C/C++ generated code sample HOT 2
- Readme references a missing file HOT 1
- cmake error HOT 2
- Question about test file HOT 1
- Invalid Pass Pipeline HOT 1
- Variadic MHLO reduce support HOT 6
- Add support for `tosa.argmax` HOT 1
- MHLO select scalar pred support HOT 1
- Target MLIREmitCAllTests does not link with Debug configuration HOT 3
- Reenable `tosa.rescale` test
- Plan to handle quantization for tosa-to-emitc? HOT 3
- hi,where I can find InsertEmitCTosaIncludeBase definition? thx! HOT 1
- Refactor types of attributes passed in TOSA reference implementation
- Missing Operations in emitC MHLO HOT 1
- Extend mhlo::slice for Tensor3D HOT 1
- Extend mhlo::concatenate
- Make SliceOp implementation dimension agnostic HOT 1
- Support missing operations to enable running some standard models
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 mlir-emitc.