-
Notifications
You must be signed in to change notification settings - Fork 1
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 test_mlir_execution.py #1
Add test_mlir_execution.py #1
Conversation
@@ -17,7 +17,8 @@ def transform(self, value: Value) -> ir.Module: | |||
with InsertionPoint(module.body): | |||
@func.func() | |||
def main(): | |||
return arith.fptosi(ir.IntegerType.get_signless(32), self.walk(value)) | |||
return self.walk(value) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
informational: originally i needed fptosi because i was returning it as the exit code.
transformed_mlir_module = transform(mlir_module) | ||
print(transformed_mlir_module) | ||
execution_engine = ExecutionEngine(transformed_mlir_module) | ||
c_float_p = ctypes.c_float * 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah pointer to an array of 1 float.
c_float_p = ctypes.c_float * 1 | ||
res = c_float_p(-1.0) | ||
execution_engine.invoke("main", res) | ||
print(res[0]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yay!
Cool! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think subsequent changes we can wrap the PassManager in a JIT Engine class
Test plan: python3 -m pytest -s test/test_mlir_execution.py