areusch commented on a change in pull request #8014:
URL: https://github.com/apache/tvm/pull/8014#discussion_r638360064



##########
File path: tests/python/relay/aot/aot_test_utils.py
##########
@@ -228,6 +287,65 @@ def compile_and_run(
     assert ret == 0
 
 
+def compile_and_run_multiple_models(mod_map, input_list_map, output_list_map, 
param_map):
+    """
+    This method verifies the generated source
+    """
+    target = "c -runtime=c --link-params --executor=aot"
+    tmp_path = utils.tempdir()
+    tmp_dir = tmp_path.temp_dir
+    tmp_dir = "."

Review comment:
       remove this or the line above

##########
File path: tests/python/relay/aot/aot_test_utils.py
##########
@@ -178,10 +232,11 @@ def compile_and_run(
         cflags += "-DTVM_CRT_STACK_ALLOCATOR_ENABLE_LIFO_CHECK "
 
     with tvm.transform.PassContext(opt_level=3, 
config={"tir.disable_vectorize": True}):
-        lib = tvm.relay.build(mod, target, target_host=target, params=params)
+        lib = tvm.relay.build(mod, target, target_host=target, params=params, 
mod_name=mod_name)
 
     tmp_path = utils.tempdir()
     tmp_dir = tmp_path.temp_dir
+    #     tmp_dir = "."

Review comment:
       remove

##########
File path: python/tvm/relay/transform/transform.py
##########
@@ -723,7 +724,20 @@ def PartitionGraph():
     ret: tvm.transform.Pass
         The registered pass that partitions the Relay program.
     """
-    return _ffi_api.PartitionGraph()
+    mod_name = mangle_module_name(mod_name)
+    return _ffi_api.PartitionGraph(mod_name)
+
+
+def MangleGraph(mod_name):
+    """Mangle the functions that are supposed to be externally compiled

Review comment:
       per numpydoc style, prefer one-liner for the first line in the docstring 

##########
File path: tests/python/contrib/test_vitis_ai/test_vitis_ai_codegen.py
##########
@@ -305,6 +304,7 @@ def expected():
         call0 = gv0(data, weight, bn_gamma, bn_beta, bn_mmean, bn_mvar)
         mod["main"] = relay.Function([data, weight, bn_gamma, bn_beta, 
bn_mmean, bn_mvar], call0)
         mod = relay.transform.InferType()(mod)
+        print(mod)

Review comment:
       rm

##########
File path: python/tvm/relay/backend/utils.py
##########
@@ -0,0 +1,39 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+"""Utility backend functions."""
+
+
+def _is_valid_modname(mod_name):
+    """Determine if mod_name is a valid string to use inside

Review comment:
       can prob not break this line

##########
File path: src/relay/transforms/partition_graph.cc
##########
@@ -480,11 +480,77 @@ IRModule FlattenTupleOutputs(IRModule module) {
   return module;
 }
 
+class Mangler : public MixedModeMutator {

Review comment:
       this one seems pretty easy to unit test--possible to write one?

##########
File path: python/tvm/relay/backend/utils.py
##########
@@ -0,0 +1,39 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+"""Utility backend functions."""
+
+
+def _is_valid_modname(mod_name):
+    """Determine if mod_name is a valid string to use inside
+    function names
+    """
+    if mod_name:
+        try:
+            mod_name.encode("ascii")
+            return True
+        except e:

Review comment:
       can you catch a more narrow exception?

##########
File path: python/tvm/relay/backend/utils.py
##########
@@ -0,0 +1,39 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+"""Utility backend functions."""
+
+
+def _is_valid_modname(mod_name):
+    """Determine if mod_name is a valid string to use inside
+    function names
+    """
+    if mod_name:
+        try:
+            mod_name.encode("ascii")
+            return True
+        except e:
+            return False
+
+    return True
+
+
+def mangle_module_name(mod_name):

Review comment:
       can you write unit tests for this function?

##########
File path: cmake/modules/contrib/VitisAI.cmake
##########
@@ -19,9 +19,9 @@ if(USE_VITIS_AI)
   set(PYXIR_SHARED_LIB libpyxir.so)
   find_package(PythonInterp 3.6 REQUIRED)
   if(NOT PYTHON)
-    find_program(PYTHON NAMES python3 python3.6)
+    find_program(PYTHON NAMES python3)
   endif()
-  execute_process(COMMAND "${PYTHON_EXECUTABLE}" "-c"
+  execute_process(COMMAND "python3" "-c"

Review comment:
       why this change?

##########
File path: python/tvm/relay/backend/utils.py
##########
@@ -0,0 +1,39 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+"""Utility backend functions."""
+
+
+def _is_valid_modname(mod_name):
+    """Determine if mod_name is a valid string to use inside
+    function names
+    """
+    if mod_name:
+        try:
+            mod_name.encode("ascii")
+            return True
+        except e:
+            return False
+
+    return True

Review comment:
       the empty string is valid?




-- 
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.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to