numba_dpex.spirv_generator module

A wrapper to connect to the SPIR-V binaries (Tools, Translator).

class numba_dpex.spirv_generator.CmdLine

Bases: object

disassemble(ipath, opath)

Disassemble a spirv module.

Args:

ipath: Input file path of the spirv module. opath: Output file path of the disassembled spirv module.

generate(llvm_spirv_args, ipath, opath)

Generate a spirv module from llvm bitcode.

We use llvm-spirv tool to translate a llvm bitcode into spirv.

Args:

llvm_spirv_args: Args to be provided to llvm-spirv tool. ipath: Input file path of the llvm bitcode. opath: Output file path of the generated spirv.

Link spirv modules.

Args:

opath: Output file path of the linked final spirv. binaries: Spirv modules to be linked.

optimize(ipath, opath)

Optimize a spirv module.

Args:

ipath: Input file path of the spirv module. opath: Output file path of the optimized spirv module.

validate(ipath)

Validate a spirv module.

Args:

ipath: Input file path of the spirv module.

class numba_dpex.spirv_generator.Module(context, llvmir, llvmbc)

Bases: object

finalize()

Finalize module and return the SPIR-V code

load_llvm()

Load LLVM with “SPIR-V friendly” SPIR 2.0 spec

numba_dpex.spirv_generator.check_call(*args, **kwargs)
numba_dpex.spirv_generator.llvm_to_spirv(context, llvmir, llvmbc)

Generate SPIR-V from LLVM Bitcode.

Args:

context: Numba target context. llvmir: LLVM IR. llvmbc: LLVM Bitcode.

Returns:

spirv: SPIR-V binary.