tqchen commented on a change in pull request #4657: [CodeGen] Generate blob use 
LLVM directly
URL: https://github.com/apache/incubator-tvm/pull/4657#discussion_r365091130
 
 

 ##########
 File path: python/tvm/contrib/cc.py
 ##########
 @@ -51,10 +51,41 @@ def create_shared(output,
     else:
         raise ValueError("Unsupported platform")
 
+def get_target_by_dump_machine(compiler):
+    """ Functor of get_target_triple that can get the target triple using 
compiler.
+
+    Parameters
+    ----------
+    compiler : Optional[str]
+        The compiler.
+
+    Returns
+    -------
+    out: Callable
+        A function that can get target triple according to dumpmachine option 
of compiler.
+    """
+    def get_target_triple():
+        """ Get target triple according to dumpmachine option of compiler."""
+        if compiler:
+            cmd = [compiler, "-dumpmachine"]
+            proc = subprocess.Popen(
+                cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
+            (out, _) = proc.communicate()
+            if proc.returncode != 0:
+                msg = "dumpmachine error:\n"
+                msg += py_str(out)
+                raise None
 
 Review comment:
   Raise None seems to be wrong, either raise an error or return None

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


With regards,
Apache Git Services

Reply via email to