Skip to content

How to do data conversion between Mojo data types and MLIR data types? #408

Closed Locked Answered by lattner
zhwa asked this question in Q&A
Discussion options

You must be logged in to vote

You can't add methods to MLIR types, and Python doesn't have a way of doing conversions like this. C++ has a way to do this with the "operator T()" sorts of methods, which we could add, but we haven't explored that part of the design space yet.

For now, the best way to go is to add a "to_i1()" sort of method to a type if you can, or define a to_i1(x) global function

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@zhwa
Comment options

@lattner
Comment options

Answer selected by zhwa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants