From 8ce0b643397cd99c4a0830de70b1f39cecd58f47 Mon Sep 17 00:00:00 2001 From: Yevhenii Havrylko Date: Fri, 14 Apr 2023 18:14:13 -0400 Subject: [PATCH] Replace parent package for cached_property import --- numba_dpex/core/descriptor.py | 10 ++++++---- numba_dpex/core/targets/dpjit_target.py | 4 +++- numba_dpex/core/targets/kernel_target.py | 2 +- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/numba_dpex/core/descriptor.py b/numba_dpex/core/descriptor.py index bdafff81ed..571a16a6f0 100644 --- a/numba_dpex/core/descriptor.py +++ b/numba_dpex/core/descriptor.py @@ -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 @@ -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() @@ -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() diff --git a/numba_dpex/core/targets/dpjit_target.py b/numba_dpex/core/targets/dpjit_target.py index eb390732c6..2d3d42edd0 100644 --- a/numba_dpex/core/targets/dpjit_target.py +++ b/numba_dpex/core/targets/dpjit_target.py @@ -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 @@ -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 diff --git a/numba_dpex/core/targets/kernel_target.py b/numba_dpex/core/targets/kernel_target.py index 8dfef2b904..c0ee52e916 100644 --- a/numba_dpex/core/targets/kernel_target.py +++ b/numba_dpex/core/targets/kernel_target.py @@ -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 @@ -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