From fb6ddecc32f2e0531c10cc0f45c88add9a3bf324 Mon Sep 17 00:00:00 2001 From: Christophe Guillon Date: Fri, 4 Sep 2026 23:52:42 +0200 Subject: [PATCH 1/2] tvm: fix issue when building in non current directory --- src/xtc/backends/tvm/TVMCompiler.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/xtc/backends/tvm/TVMCompiler.py b/src/xtc/backends/tvm/TVMCompiler.py index 59b2c40a..0d41379c 100644 --- a/src/xtc/backends/tvm/TVMCompiler.py +++ b/src/xtc/backends/tvm/TVMCompiler.py @@ -467,18 +467,18 @@ def build( cmd = ( f"{cc_command(self._arch)} {sh_opts} {opts} " f"{' '.join(object_fnames)} " - f"{packed_lib_fname}.a " + f"{relative_to(packed_lib_fname, output_dir)}.a " f"-o {unpacked_lib_base}{ext}" ) p = subprocess.run( shlex.split(cmd), text=True, capture_output=True, - cwd=unpacked_lib_dir, + cwd=output_dir, ) if p.returncode != 0: raise RuntimeError( - f"Failed command {cmd} (cwd: {unpacked_lib_dir}:\n" + f"Failed command {cmd} (cwd: {output_dir}:\n" f"{p.stdout}\n" f"{p.stderr}\n" ) From 290f348d006e702a6d43b79f66fd85370148b87e Mon Sep 17 00:00:00 2001 From: Christophe Guillon Date: Fri, 4 Sep 2026 23:54:05 +0200 Subject: [PATCH 2/2] explore: add --module-type option --- src/xtc/cli/explore.py | 7 +++++++ src/xtc/search/explore.py | 9 ++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/xtc/cli/explore.py b/src/xtc/cli/explore.py index 6c9ecbe2..55d7fa7e 100644 --- a/src/xtc/cli/explore.py +++ b/src/xtc/cli/explore.py @@ -280,6 +280,13 @@ def main(): parser.add_argument( "--batch", type=int, default=defaults.batch, help="batch size for optimizer" ) + parser.add_argument( + "--module-type", + type=str, + choices=["shlib", "arlib", "csrc"], + default=defaults.module_type, + help="type of module", + ) parser.add_argument( "--debug", action=argparse.BooleanOptionalAction, diff --git a/src/xtc/search/explore.py b/src/xtc/search/explore.py index e0cb9c57..b000a6bc 100644 --- a/src/xtc/search/explore.py +++ b/src/xtc/search/explore.py @@ -112,6 +112,7 @@ class ExplorationConfig: descript: str | None = None use_tensors: bool = False progress_cls: str = "tqdm" + module_type: str = "shlib" def __post_init__(self): if self.graph_file is not None: @@ -366,11 +367,17 @@ def compile_one( if dump_file is None: dump_file = f"{args.explore_dir}/payload_{ident}" compile_args = dict( - shared_lib=True, dump_file=dump_file, bare_ptr=args.bare_ptr, debug=args.debug_compile, ) + if args.module_type == "shlib": + compile_args.update(dict(shared_lib=True)) + elif args.module_type == "arlib": + compile_args.update(dict(ar_lib=True)) + else: + assert args.module_type == "csrc" + compile_args.update(dict(emit_c=True)) if args.dump: compile_args.update( dict(