Skip to content
8 changes: 0 additions & 8 deletions cuda_core/cuda/core/utils.py

This file was deleted.

43 changes: 43 additions & 0 deletions cuda_core/cuda/core/utils/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# SPDX-License-Identifier: Apache-2.0

from cuda.core._memoryview import (
StridedMemoryView,
args_viewable_as_strided_memory,
)

__all__ = [
"FileStreamProgramCache",
"ProgramCacheResource",
"SQLiteProgramCache",
"StridedMemoryView",
"args_viewable_as_strided_memory",
"make_program_cache_key",
]

# Lazily expose the program-cache APIs so ``from cuda.core.utils import
# StridedMemoryView`` stays lightweight -- the cache backends pull in driver,
# NVRTC, and module-load machinery that memoryview-only consumers do not need.
_LAZY_CACHE_ATTRS = frozenset(
{
"FileStreamProgramCache",
"ProgramCacheResource",
"SQLiteProgramCache",
"make_program_cache_key",
}
)


def __getattr__(name):
if name in _LAZY_CACHE_ATTRS:
from cuda.core.utils import _program_cache

value = getattr(_program_cache, name)
globals()[name] = value # cache for subsequent accesses
return value
raise AttributeError(f"module 'cuda.core.utils' has no attribute {name!r}")


def __dir__():
return sorted(__all__)
Loading
Loading