Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add type conversion to convert data types to supported data types in ttnn #1277

Open
mtopalovicTT opened this issue Nov 15, 2024 · 3 comments
Assignees
Labels
MLIR Ops Issues related to MLIR dialect ops and their implementations

Comments

@mtopalovicTT
Copy link
Contributor

mtopalovicTT commented Nov 15, 2024

ttnn doesn't support all data types which come from forge. One example is is int32 is mapped to Uint32
This can lead to some strange IR like this

to_layout(%arg1) { dtype = Uint32 }(tensor<10x10xi32) -> tensor<10x10xi32)

what happens is that during lowering to ttnn when creating dtype attribute for to_layout we convert outputTensor data type to ttnn supported data type. More over IR doesn't correctly represents what is happening in runtime since we would either way convert all types from IR into ttnn supported types during translation to flatbuffer....

One approach to do this is to do type conversion on input graph from forge. This would update all types to ttnn supported types.
Maybe this is okay from forge perspective since they don't do anything on MLIR graph so if we change type in IR it wouldn't make difference on them.
Different approach is to change forge to do type conversion to dtypes which are supported in ttnn. This would make more sense since both input IR and output IR from mlir would have identical data types.

@mtopalovicTT mtopalovicTT added the MLIR Ops Issues related to MLIR dialect ops and their implementations label Nov 15, 2024
@mtopalovicTT mtopalovicTT self-assigned this Nov 15, 2024
@mtopalovicTT
Copy link
Contributor Author

cc @svuckovicTT @nsmithtt @pilkicTT

@nsmithtt
Copy link
Contributor

@mtopalovicTT, I think TTIR should be flexible and accept non-hw types like ints and bools and complex types etc. We should handle this kind of data format conversion during a TTIR->TTIR pass.

@mrakitaTT, @AleksKnezevic, any input from the stablehlo side? There have been many similar df conversion situations there.

@AleksKnezevic
Copy link

Yeah, there were a few cases where we've had to convert unsupported types. @mmanzoorTT did the conversion, so he can comment more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
MLIR Ops Issues related to MLIR dialect ops and their implementations
Projects
None yet
Development

No branches or pull requests

3 participants