Description
I have implemented a VarMeanOp in MLIR that computes variance and mean as outputs. I have successfully lowered this operation to LLVM and am now testing it using MLIR Python bindings as part of the numerical validation process.
Problem:
When dealing with single-output operations, I can correctly validate the results using Python bindings by creating a memref and invoking the operation using ExecutionEngine.invoke(). This works by leveraging APIs such as:
get_ranked_memref_descriptor()
make_nd_memref_descriptor(rank, type)
However, for multi-output operations, I am encountering issues.
What I Have Tried:
I created two separate memref descriptors for the two outputs (variance and mean).
I attempted to pass these memrefs to engine.invoke() to capture both results.
Unfortunately, I am unable to retrieve the correct outputs when invoking the operation.
Single output (works correctly)
res_memref = make_nd_memref_descriptor(rank, element_type)
engine.invoke("single_output_op", input_memref, res_memref)
Multiple outputs (not working)
var_memref = make_nd_memref_descriptor(rank, element_type)
mean_memref = make_nd_memref_descriptor(rank, element_type)
engine.invoke("multi_output_op", var_memref, mean_memref,input_memref)
Unable to get the correct results
How can I correctly handle multiple outputs in ExecutionEngine.invoke() when testing multi-output operations in Python?
Is there a recommended approach to create and pass multiple memrefs for capturing multiple outputs?
Activity
llvmbot commentedon Mar 25, 2025
@llvm/issue-subscribers-mlir
Author: Rocky Singh (rockysingh9431)
Problem:
When dealing with single-output operations, I can correctly validate the results using Python bindings by creating a memref and invoking the operation using ExecutionEngine.invoke(). This works by leveraging APIs such as:
However, for multi-output operations, I am encountering issues.
What I Have Tried:
I created two separate memref descriptors for the two outputs (variance and mean).
I attempted to pass these memrefs to engine.invoke() to capture both results.
Unfortunately, I am unable to retrieve the correct outputs when invoking the operation.
Single output (works correctly)
Multiple outputs (not working)
Unable to get the correct results
How can I correctly handle multiple outputs in ExecutionEngine.invoke() when testing multi-output operations in Python?
Is there a recommended approach to create and pass multiple memrefs for capturing multiple outputs?
llvmbot commentedon Mar 25, 2025
@llvm/issue-subscribers-mlir-python
Author: Rocky Singh (rockysingh9431)
Problem:
When dealing with single-output operations, I can correctly validate the results using Python bindings by creating a memref and invoking the operation using ExecutionEngine.invoke(). This works by leveraging APIs such as:
However, for multi-output operations, I am encountering issues.
What I Have Tried:
I created two separate memref descriptors for the two outputs (variance and mean).
I attempted to pass these memrefs to engine.invoke() to capture both results.
Unfortunately, I am unable to retrieve the correct outputs when invoking the operation.
Single output (works correctly)
Multiple outputs (not working)
Unable to get the correct results
How can I correctly handle multiple outputs in ExecutionEngine.invoke() when testing multi-output operations in Python?
Is there a recommended approach to create and pass multiple memrefs for capturing multiple outputs?
joker-eph commentedon Mar 25, 2025
I don't understand why you deleted the Discourse topic to create a bug? You' have better chance of having support on Discourse.
It's not clear to me that this is a clear bug report, and you don't provide a reproducer here which is gonna make it even harder.