Fix #363: AttributeError: module 'cupy' has no attribute '_cupyx'#371
Open
JiwaniZakir wants to merge 1 commit intoKernelTuner:masterfrom
Open
Conversation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Closes #363
Motivation
cupy._cupyxis a private internal attribute that was removed in CuPy 14.x, causing anAttributeErroron initialization whenCupyFunctions.__init__calledcp._cupyx.get_runtime_info()atkernel_tuner/backends/cupy.py:71.Changes
kernel_tuner/backends/cupy.pyimport cupyxalongsideimport cupy as cpin the guardedtry/except ImportErrorblock (withcupyx = Noneas the fallback), makingcupyxa proper top-level dependency rather than accessing it through CuPy's private namespace.cp._cupyx.get_runtime_info()withcupyx.get_runtime_info()on line 71.test/test_cupy_functions.pytest_cupy_init_uses_cupyx_not_private_attr: patches bothkernel_tuner.backends.cupy.cpandkernel_tuner.backends.cupy.cupyx, constructs aCupyFunctions(device=0)instance, and asserts thatcupyx.get_runtime_info()was called exactly once and thatdev.nameis correctly parsed from the mocked runtime info string. This serves as a regression test to prevent re-introduction of the_cupyxprivate attribute access.Testing
The new unit test runs without a physical GPU by mocking both
cp.cuda.Deviceandcupyx.get_runtime_info. Run it with:Manually verified on Google Colab with CuPy 14.0.1:
CupyFunctionsinitializes without error anddev.envis populated correctly.