Skip to content

Commit 8d410e7

Browse files
committed
Add dpjit specific typing context
1 parent c3dbf90 commit 8d410e7

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

numba_dpex/core/descriptor.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@
1010

1111
from numba_dpex.core import config
1212

13-
from .targets.dpjit_target import DPEX_TARGET_NAME, DpexTargetContext
13+
from .targets.dpjit_target import (
14+
DPEX_TARGET_NAME,
15+
DpexTargetContext,
16+
DpexTypingContext,
17+
)
1418
from .targets.kernel_target import (
1519
DPEX_KERNEL_TARGET_NAME,
1620
CompilationMode,
@@ -110,7 +114,7 @@ def _toplevel_target_context(self):
110114
@cached_property
111115
def _toplevel_typing_context(self):
112116
# Lazily-initialized top-level typing context, for all threads
113-
return typing.Context()
117+
return DpexTypingContext()
114118

115119
@property
116120
def target_context(self):

numba_dpex/core/targets/dpjit_target.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
from functools import cached_property
99

10+
from numba.core import typing
1011
from numba.core.compiler_lock import global_compiler_lock
1112
from numba.core.cpu import CPUContext
1213
from numba.core.imputils import Registry
@@ -28,6 +29,10 @@ class Dpex(CPU):
2829
dpex_function_registry = Registry()
2930

3031

32+
class DpexTypingContext(typing.Context):
33+
"""Custom typing context to support dpjit compilation."""
34+
35+
3136
class DpexTargetContext(CPUContext):
3237
def __init__(self, typingctx, target=DPEX_TARGET_NAME):
3338
super().__init__(typingctx, target)

0 commit comments

Comments
 (0)