Skip to content

Commit

Permalink
Merge pull request #1003 from IntelPython/fix/cached_property_import
Browse files Browse the repository at this point in the history
Replace parent package for cached_property import
  • Loading branch information
Diptorup Deb authored Apr 15, 2023
2 parents 31ec311 + 8ce0b64 commit dd11099
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
10 changes: 6 additions & 4 deletions numba_dpex/core/descriptor.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
#
# SPDX-License-Identifier: Apache-2.0

from functools import cached_property

from numba.core import typing, utils
from numba.core.cpu import CPUTargetOptions
from numba.core.descriptors import TargetDescriptor
Expand All @@ -21,12 +23,12 @@ class DpexKernelTarget(TargetDescriptor):

options = CPUTargetOptions

@utils.cached_property
@cached_property
def _toplevel_target_context(self):
"""Lazily-initialized top-level target context, for all threads."""
return DpexKernelTargetContext(self.typing_context, self._target_name)

@utils.cached_property
@cached_property
def _toplevel_typing_context(self):
"""Lazily-initialized top-level typing context, for all threads."""
return DpexKernelTypingContext()
Expand All @@ -53,12 +55,12 @@ class DpexTarget(TargetDescriptor):

options = CPUTargetOptions

@utils.cached_property
@cached_property
def _toplevel_target_context(self):
# Lazily-initialized top-level target context, for all threads
return DpexTargetContext(self.typing_context, self._target_name)

@utils.cached_property
@cached_property
def _toplevel_typing_context(self):
# Lazily-initialized top-level typing context, for all threads
return typing.Context()
Expand Down
4 changes: 3 additions & 1 deletion numba_dpex/core/targets/dpjit_target.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
"""Defines the target and typing contexts for numba_dpex's dpjit decorator.
"""

from functools import cached_property

from numba.core import utils
from numba.core.codegen import JITCPUCodegen
from numba.core.compiler_lock import global_compiler_lock
Expand Down Expand Up @@ -40,7 +42,7 @@ def init(self):
# rtsys.initialize(self)
self.refresh()

@utils.cached_property
@cached_property
def dpexrt(self):
from numba_dpex.core.runtime.context import DpexRTContext

Expand Down
2 changes: 1 addition & 1 deletion numba_dpex/core/targets/kernel_target.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# SPDX-License-Identifier: Apache-2.0

import re
from functools import cached_property

import numpy as np
from llvmlite import binding as ll
Expand All @@ -13,7 +14,6 @@
from numba.core.callconv import MinimalCallConv
from numba.core.registry import cpu_target
from numba.core.target_extension import GPU, target_registry
from numba.core.utils import cached_property

from numba_dpex.core.datamodel.models import _init_data_model_manager
from numba_dpex.core.exceptions import UnsupportedKernelArgumentError
Expand Down

0 comments on commit dd11099

Please sign in to comment.