mehrdadh commented on a change in pull request #10311:
URL: https://github.com/apache/tvm/pull/10311#discussion_r819088919
##########
File path: python/tvm/contrib/hexagon/hexagon.py
##########
@@ -248,3 +265,44 @@ def transform(func, mod, ctx):
def ir_lower_vtcm_pass():
return [(3, ir_lower_vtcm())]
+
+
+def create_aot_shared(so_name: Union[str, pathlib.Path], files, hexagon_arch:
str, options=None):
+ """Export Hexagon AOT module."""
+ if not os.access(str(HEXAGON_CLANG_PLUS), os.X_OK):
+ raise Exception(
+ 'The Clang++ "' + str(HEXAGON_CLANG_PLUS) + '" does not exist or
is not executable.'
+ )
+ if not HEXAGON_TOOLCHAIN:
+ raise Exception(
+ " The environment variable HEXAGON_TOOLCHAIN is unset. Please
export "
+ + "HEXAGON_TOOLCHAIN in your environment."
+ )
+ if not HEXAGON_SDK_PATH:
+ raise Exception(
+ " The environment variable HEXAGON_SDK_PATH is unset. Please
export "
+ + "HEXAGON_SDK_PATH in your environment."
+ )
+
+ tvm_dir = pathlib.Path(os.path.dirname(os.path.realpath(__file__))) / ".."
/ ".." / ".." / ".."
+ compute_arch = f"compute{hexagon_arch}"
+ compile_options = [
+ f"-I{tvm_dir / 'include'}",
+ f"-I{tvm_dir / '3rdparty' / 'dlpack' / 'include'}",
+ f"-I{tvm_dir / '3rdparty' / 'dmlc-core' / 'include'}",
+ f"-I{pathlib.Path(HEXAGON_SDK_PATH) / 'rtos' / 'qurt' / compute_arch /
'include'/ 'posix'}",
+ f"-I{pathlib.Path(HEXAGON_SDK_PATH) / 'rtos' / 'qurt' / compute_arch /
'include' / 'qurt'}",
+ f"-DDMLC_USE_LOGGING_LIBRARY=<tvm/runtime/logging.h>",
+ f"-D_MACH_I32=int",
+ ]
+
+ # For debugging
+ for path in HEXAGON_SDK_INCLUDE_DIRS:
+ compile_options.append(f"-I{str(path)}")
+
+ cross_compile = cc.cross_compiler(
+
compile_func=tvm.get_global_func("tvm.contrib.hexagon.hexagon.hexagon_clang_plus")()
Review comment:
done.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]