diff --git a/README.md b/README.md index 8537efe..1a19a26 100644 --- a/README.md +++ b/README.md @@ -392,7 +392,7 @@ See `src/torchada/_mappings/` for 400+ mapping rules grouped by API domain. ``` # pyproject.toml or requirements.txt -torchada>=0.1.85 +torchada>=0.1.86 ``` ### Step 2: Conditional Import diff --git a/README_CN.md b/README_CN.md index 5d0362a..5ce05c9 100644 --- a/README_CN.md +++ b/README_CN.md @@ -376,7 +376,7 @@ if torchada.is_gpu_device(device): # 在 CUDA 和 MUSA 上都能工作 ``` # pyproject.toml 或 requirements.txt -torchada>=0.1.85 +torchada>=0.1.86 ``` ### 步骤 2:条件导入 diff --git a/benchmarks/benchmark_history.json b/benchmarks/benchmark_history.json index 78ac37f..84de6f7 100644 --- a/benchmarks/benchmark_history.json +++ b/benchmarks/benchmark_history.json @@ -3,7 +3,7 @@ "description": "Historical benchmark results for torchada performance tracking", "results": [ { - "version": "0.1.85", + "version": "0.1.86", "date": "2026-01-29", "platform": "MUSA", "pytorch_version": "2.7.1", diff --git a/pyproject.toml b/pyproject.toml index 0efc9aa..5dd53bf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "torchada" -version = "0.1.85" +version = "0.1.86" description = "Adapter package for torch_musa to act exactly like PyTorch CUDA" readme = "README.md" license = {text = "MIT"} diff --git a/src/torchada/__init__.py b/src/torchada/__init__.py index 6a89db3..738cc55 100644 --- a/src/torchada/__init__.py +++ b/src/torchada/__init__.py @@ -24,7 +24,7 @@ from torch.utils.cpp_extension import CUDAExtension, BuildExtension, CUDA_HOME """ -__version__ = "0.1.85" +__version__ = "0.1.86" from . import cuda, utils diff --git a/src/torchada/_patch.py b/src/torchada/_patch.py index b502969..732fa2b 100644 --- a/src/torchada/_patch.py +++ b/src/torchada/_patch.py @@ -827,6 +827,7 @@ class _CudaModuleWrapper(ModuleType): _SPECIAL_ATTRS = { "StreamContext": "core.stream.StreamContext", "streams": "core.stream", + "_get_device_index": "core._utils._get_musa_device_index", } # Attribute name remappings (CUDA name -> MUSA name) diff --git a/tests/test_cuda_patching.py b/tests/test_cuda_patching.py index defef84..af1557b 100644 --- a/tests/test_cuda_patching.py +++ b/tests/test_cuda_patching.py @@ -729,6 +729,17 @@ def test_streams_module(self): assert sys.modules["torch.cuda.streams"] is torch_musa.core.stream assert torch.cuda.streams.Stream is torch_musa.core.stream.Stream + def test_get_device_index_helper(self): + """Test the private CUDA device helper used by PyTorch Dynamo.""" + import torch + + import torchada + + if torchada.is_musa_platform(): + from torch_musa.core._utils import _get_musa_device_index + + assert torch.cuda._get_device_index is _get_musa_device_index + def test_stream_cuda_stream_property(self): """Test stream.cuda_stream returns same value as stream.musa_stream on MUSA.""" import torch diff --git a/tests/test_platform.py b/tests/test_platform.py index a01143d..9cdf60e 100644 --- a/tests/test_platform.py +++ b/tests/test_platform.py @@ -59,7 +59,7 @@ def test_get_version(self): version = torchada.get_version() assert version == torchada.__version__ - assert version == "0.1.85" + assert version == "0.1.86" assert isinstance(version, str) def test_project_version_matches_runtime_version(self):