tilelang.contrib.ccΒΆ
Util to invoke C/C++ compilers in the system.
FunctionsΒΆ
|
Return the path to the default C/C++ compiler. |
Return the path to the default C/C++ compiler. |
|
|
Create shared library. |
|
Create static library. |
|
Create executable binary. |
|
Get global symbols from a library via nm -g |
|
Functor of get_target_triple that can get the target triple using compiler. |
|
Create a cross compiler function by specializing compile_func with options. |
Module ContentsΒΆ
- tilelang.contrib.cc.get_cc()ΒΆ
Return the path to the default C/C++ compiler.
- Returns:
out β The path to the default C/C++ compiler, or None if none was found.
- Return type:
Optional[str]
- tilelang.contrib.cc.get_cplus_compiler()ΒΆ
Return the path to the default C/C++ compiler.
- Returns:
out β The path to the default C/C++ compiler, or None if none was found.
- Return type:
Optional[str]
Create shared library.
- Parameters:
output (str) β The target shared library.
objects (List[str]) β List of object files.
options (List[str]) β The list of additional options string.
cc (Optional[str]) β The compiler command.
cwd (Optional[str]) β The current working directory.
ccache_env (Optional[Dict[str, str]]) β The environment variable for ccache. Set None to disable ccache by default.
- tilelang.contrib.cc.create_staticlib(output, inputs, ar=None)ΒΆ
Create static library.
- Parameters:
output (str) β The target shared library.
inputs (List[str]) β List of inputs files. Each input file can be a tarball of objects or an object file.
ar (Optional[str]) β Path to the ar command to be used
- tilelang.contrib.cc.create_executable(output, objects, options=None, cc=None, cwd=None, ccache_env=None)ΒΆ
Create executable binary.
- Parameters:
output (str) β The target executable.
objects (List[str]) β List of object files.
options (List[str]) β The list of additional options string.
cc (Optional[str]) β The compiler command.
cwd (Optional[str]) β The urrent working directory.
ccache_env (Optional[Dict[str, str]]) β The environment variable for ccache. Set None to disable ccache by default.
- tilelang.contrib.cc.get_global_symbol_section_map(path, *, nm=None)ΒΆ
Get global symbols from a library via nm -g
- Parameters:
path (str) β The library path
nm (str) β The path to nm command
- Returns:
symbol_section_map β A map from defined global symbol to their sections
- Return type:
Dict[str, str]
- tilelang.contrib.cc.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 β A function that can get target triple according to dumpmachine option of compiler.
- Return type:
Callable
- tilelang.contrib.cc.cross_compiler(compile_func, options=None, output_format=None, get_target_triple=None, add_files=None)ΒΆ
Create a cross compiler function by specializing compile_func with options.
This function can be used to construct compile functions that can be passed to AutoTVM measure or export_library.
- Parameters:
compile_func (Union[str, Callable[[str, str, Optional[str]], None]]) β Function that performs the actual compilation
options (Optional[List[str]]) β List of additional optional string.
output_format (Optional[str]) β Library output format.
get_target_triple (Optional[Callable]) β Function that can target triple according to dumpmachine option of compiler.
add_files (Optional[List[str]]) β List of paths to additional object, source, library files to pass as part of the compilation.
- Returns:
fcompile β A compilation function that can be passed to export_library.
- Return type:
Callable[[str, str, Optional[str]], None]
Examples
from tvm.contrib import cc, ndk # export using arm gcc mod = build_runtime_module() mod.export_library(path_dso, fcompile=cc.cross_compiler("arm-linux-gnueabihf-gcc")) # specialize ndk compilation options. specialized_ndk = cc.cross_compiler( ndk.create_shared, ["--sysroot=/path/to/sysroot", "-shared", "-fPIC", "-lm"]) mod.export_library(path_dso, fcompile=specialized_ndk)