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

[Runtime][AOTExecutor] set_input does not show error if input name does not exist in the model #13013

Closed
mehrdadh opened this issue Oct 7, 2022 · 2 comments · Fixed by #14322
Labels
executor:aot runtime components of AOT flow. src/runtime/aot_executor, src/runtime/crt/aot_executor needs-triage PRs or issues that need to be investigated by maintainers to find the right assignees to address it type: bug

Comments

@mehrdadh
Copy link
Member

mehrdadh commented Oct 7, 2022

If we pass input dictionary with incorrect input name, aot executor would execute set_input function without actually setting the correct input or showing error that input name doesn't exist in the model. This will result in silently outputting the incorrect output from the model. I think it should show an error when the input name doesn't exist.

I found this error when I working on a model which had input name of input:0 which is not acceptable in Relay. However, when I tested it I realized it's not just this name, if you pass any name for the input the AOTExecutor would accept it.

cc @areusch @alanmacd

@mehrdadh mehrdadh added type: bug needs-triage PRs or issues that need to be investigated by maintainers to find the right assignees to address it labels Oct 7, 2022
@mehrdadh mehrdadh changed the title [Runtime][AOTExecutor] set_input does not show error if input name is incorrect [Runtime][AOTExecutor] set_input does not show error if input name does not exist in the model Oct 7, 2022
@alanmacd
Copy link
Contributor

alanmacd commented Oct 7, 2022

@mehrdadh which flavor of AoT executor is this, also can you post some example code that shows the issue?

@mehrdadh
Copy link
Member Author

@alanmacd I have tested this on AOT with C++ and it doesn't show any error. It might also be a problem with CRT.
To reproduce the error, you can use this test:

def test_conv2d(enable_usmp, target_kind):

If you apply this modification, then the test fails because the output is incorrect but you don't see any error regarding passing data to the wrong input name.

diff --git a/tests/python/relay/aot/test_cpp_aot.py b/tests/python/relay/aot/test_cpp_aot.py
index b67bc90d3..44d336d88 100644
--- a/tests/python/relay/aot/test_cpp_aot.py
+++ b/tests/python/relay/aot/test_cpp_aot.py
@@ -90,7 +90,7 @@ def test_conv2d(enable_usmp, target_kind):
     weight_data = np.random.randint(1, 255, shape_dict["weight"]).astype(type_dict["weight"])
     input_data = np.ones(shape_dict["data"]).astype(type_dict["data"])
     params = {"weight": weight_data}
-    inputs = {"data": input_data}
+    inputs = {"data1": input_data}
     ref_outputs = generate_ref_data(ir_mod, inputs, params)
 
     with tvm.transform.PassContext(

@areusch areusch added executor:aot runtime components of AOT flow. src/runtime/aot_executor, src/runtime/crt/aot_executor needs-triage PRs or issues that need to be investigated by maintainers to find the right assignees to address it and removed needs-triage PRs or issues that need to be investigated by maintainers to find the right assignees to address it labels Oct 17, 2022
mehrdadh added a commit that referenced this issue Mar 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
executor:aot runtime components of AOT flow. src/runtime/aot_executor, src/runtime/crt/aot_executor needs-triage PRs or issues that need to be investigated by maintainers to find the right assignees to address it type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants