tilelang.contrib.bisheng¶
Utility to invoke bisheng compiler for Ascend NPU targets.
Functions¶
Find the bisheng compiler binary. |
|
Find the CCE-capable |
|
|
Normalize shell-like compiler options into individual argv tokens. |
|
Resolve the Bisheng NPU architecture option. |
|
Resolve the Bisheng NPU architecture from an Ascend target. |
|
Return common Bisheng options shared by tvm-ffi and Cython paths. |
Return options used to turn relocatable CCE code into executable ELF. |
|
|
Compile Ascend source code with the bisheng compiler. |
Module Contents¶
- tilelang.contrib.bisheng.find_bisheng_path()¶
Find the bisheng compiler binary.
Searches
BISHENG_HOME/bin/bisheng, thenPATH.- Returns:
path – Full path to the
bishengexecutable.- Return type:
str
- Raises:
RuntimeError – If the compiler cannot be found.
- tilelang.contrib.bisheng.find_ld_lld_path()¶
Find the CCE-capable
ld.lldshipped with the Ascend toolkit.- Return type:
str
- tilelang.contrib.bisheng.normalize_options(options)¶
Normalize shell-like compiler options into individual argv tokens.
- Parameters:
options (str | collections.abc.Sequence[str] | None)
- Return type:
list[str]
- tilelang.contrib.bisheng.get_npu_arch(npu_arch=None)¶
Resolve the Bisheng NPU architecture option.
- Parameters:
npu_arch (str | None)
- Return type:
str
- tilelang.contrib.bisheng.get_target_npu_arch(target)¶
Resolve the Bisheng NPU architecture from an Ascend target.
- Parameters:
target (tvm.target.Target)
- Return type:
str
- tilelang.contrib.bisheng.get_bisheng_compile_options(npu_arch=None, options=None)¶
Return common Bisheng options shared by tvm-ffi and Cython paths.
- Parameters:
npu_arch (str | None)
options (str | collections.abc.Sequence[str] | None)
- Return type:
list[str]
- tilelang.contrib.bisheng.get_aibin_linker_options()¶
Return options used to turn relocatable CCE code into executable ELF.
- Return type:
list[str]
- tilelang.contrib.bisheng.compile_ascend(code, target_format='o', npu_arch=None, options=None, path_target=None, verbose=False)¶
Compile Ascend source code with the bisheng compiler.
- Parameters:
code (str) – The Ascend kernel source code.
target_format (str) – Output format:
"o"for a relocatable host object,"so"for a host shared library, or"aibin"for an executable CCE ELF suitable foraclrtBinaryLoadFromData.npu_arch (str, optional) – NPU architecture string passed via
--npu-arch=<arch>(e.g."dav-3510"). If None,ASCEND_NPU_ARCHenv-var is used.options (str or list of str, optional) – Extra flags forwarded to bisheng.
path_target (str, optional) – Explicit output path. A temporary file is used when not given.
verbose (bool) – Print compiler output.
- Returns:
data – Contents of the compiled output file.
- Return type:
bytearray