You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2022/12/24 14:43:14 UTC

[GitHub] [tvm] Mousius commented on a diff in pull request #13655: [AOT] Added a test for detecting output size post MLF export

Mousius commented on code in PR #13655:
URL: https://github.com/apache/tvm/pull/13655#discussion_r1056828877


##########
python/tvm/micro/model_library_format.py:
##########
@@ -485,6 +485,12 @@ def _export_graph_model_library_format(
                     "functions"
                 ]["main"][0]["outputs"][key]
 
+            input_name_to_size_map = {}
+            output_name_to_size_map = {}
+            for name, property_map in inputs_sizes.items():
+                input_name_to_size_map.update({name: property_map["size"]})
+            for name, property_map in output_sizes.items():
+                output_name_to_size_map.update({name: property_map["size"]})

Review Comment:
   ```suggestion
               input_name_to_size_map = {
                  name: property_map["size"]
                  for name, property_map in inputs_sizes.items()
               }
               output_name_to_size_map = {
                 name: property_map["size"]
                 for name, property_map in output_sizes.items()
               }
   ```



##########
python/tvm/micro/model_library_format.py:
##########
@@ -494,8 +500,10 @@ def _export_graph_model_library_format(
                 devices,
                 workspace_size,
                 include_path,
-                inputs_sizes,
-                output_sizes,
+                # inputs_sizes,
+                # output_sizes,

Review Comment:
   ```suggestion
   ```
   
   (Just delete these, no need to leave them here)



##########
python/tvm/testing/aot.py:
##########
@@ -415,24 +415,23 @@ def _emit_main_compare(main_file, outputs, output_tolerance, mod_name, use_inter
             comparison_function = "fabs"
             tolerance = output_tolerance or 0.001
 
-        data_length_var_name = (
-            _mangle_name(mod_name, f"output_data_{sanitized_tensor_name}") + "_len"
+        actual_data_name = _mangle_name(mod_name, f"output_data_{sanitized_tensor_name}")
+        data_len_var = actual_data_name + "_len"
+        main_file.write(
+            f"const size_t {data_len_var}"
+            f"= sizeof({actual_data_name})/sizeof({actual_data_name}[0]);\n"

Review Comment:
   We generate `actual_data_name` and `data_length_var_name` in the inputs/outputs already, why are we recalculating it here based on types we've defined within the AOT test harness?
   
   We probably need to add a `_LEN` macro to the MLF header?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org