Skip to content

Commit e112e88

Browse files
committed
Add DPEX_OPT config and do not use numba's OPT
1 parent 39b5a5c commit e112e88

File tree

4 files changed

+14
-5
lines changed

4 files changed

+14
-5
lines changed

numba_dpex/config.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,3 +87,11 @@ def __getattr__(name):
8787
# Flag to turn on the ConstantSizeStaticLocalMemoryPass in the kernel pipeline.
8888
# The pass is turned off by default.
8989
STATIC_LOCAL_MEM_PASS = _readenv("NUMBA_DPEX_STATIC_LOCAL_MEM_PASS", int, 0)
90+
91+
DPEX_OPT = _readenv("NUMBA_DPEX_OPT", int, 2)
92+
93+
if DPEX_OPT:
94+
logging.warning(
95+
"Setting NUMBA_DPEX_OPT greater than 2 known to cause issues related "
96+
+ "to very aggressive optimizations that leads to broken code"
97+
)

numba_dpex/core/codegen.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,12 @@ def _optimize_final_module(self):
3131
# Run some lightweight optimization to simplify the module.
3232
pmb = ll.PassManagerBuilder()
3333

34-
# Make optimization level depending on config.OPT variable
35-
pmb.opt_level = config.OPT
34+
# Make optimization level depending on config.DPEX_OPT variable
35+
pmb.opt_level = config.DPEX_OPT
3636

3737
pmb.disable_unit_at_a_time = False
38-
pmb.inlining_threshold = 2
38+
# TODO: investigate why it causes issues
39+
# pmb.inlining_threshold = 2
3940
pmb.disable_unroll_loops = True
4041
pmb.loop_vectorize = False
4142
pmb.slp_vectorize = False

numba_dpex/core/kernel_interface/dispatcher.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ def __init__(
9494
self._kernel_bundle_cache = NullCache()
9595
self._cache_hits = 0
9696

97-
if debug_flags or config.OPT == 0:
97+
if debug_flags or config.DPEX_OPT == 0:
9898
# if debug is ON we need to pass additional
9999
# flags to igc.
100100
self._create_sycl_kernel_bundle_flags = ["-g", "-cl-opt-disable"]

numba_dpex/core/parfors/kernel_builder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def _compile_kernel_parfor(
8080
)
8181

8282
dpctl_create_program_from_spirv_flags = []
83-
if debug or config.OPT == 0:
83+
if debug or config.DPEX_OPT == 0:
8484
# if debug is ON we need to pass additional flags to igc.
8585
dpctl_create_program_from_spirv_flags = ["-g", "-cl-opt-disable"]
8686

0 commit comments

Comments
 (0)