Skip to content

Commit 9576aa5

Browse files
author
Diptorup Deb
committed
Set extra compiler options inside KernelCompiler pipeline.
- We should not generate a cpython or a cfunc wrapper for a kernel decorated function. - The no_compile is also set to True as the kernel LLVM IR will not be compiled to an executable object code by Numba. Instead, numba-dpex will compile the LLVM IR to SPIR-V and generate a sycl::kernel_bundle.
1 parent d254ee4 commit 9576aa5

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

numba_dpex/core/pipelines/kernel_compiler.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,6 @@ def define_nopython_lowering_pipeline(state, name="dpex_kernel_lowering"):
140140
)
141141
pm.add_pass(IRLegalization, "ensure IR is legal prior to lowering")
142142

143-
# lower
144143
# NativeLowering has some issue with freevar ambiguity,
145144
# therefore, we are using QualNameDisambiguationLowering instead
146145
# numba-dpex github issue: https://github.com/IntelPython/numba-dpex/issues/898
@@ -173,12 +172,22 @@ def define_nopython_pipeline(state, name="dpex_kernel_nopython"):
173172

174173

175174
class KernelCompiler(CompilerBase):
176-
"""Dpex's kernel compilation pipeline."""
175+
"""Dpex's kernel compilation pipeline."""
177176

178177
def define_pipelines(self):
179178
pms = []
180179
if not self.state.flags.force_pyobject:
181180
pms.append(_KernelPassBuilder.define_nopython_pipeline(self.state))
182181
if self.state.status.can_fallback or self.state.flags.force_pyobject:
183182
raise UnsupportedCompilationModeError()
183+
184+
# Compile the kernel without generating a cpython or a cfunc wrapper
185+
self.state.flags.no_cpython_wrapper = True
186+
self.state.flags.no_cfunc_wrapper = True
187+
# The pass pipeline does not generate an executable when compiling a
188+
# kernel function. Instead, the
189+
# kernel_dispatcher._KernelCompiler.compile generates the executable in
190+
# the form of a host callable launcher function
191+
self.state.flags.no_compile = True
192+
184193
return pms

0 commit comments

Comments
 (0)