Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ See `src/torchada/_mappings/` for 400+ mapping rules grouped by API domain.

```
# pyproject.toml or requirements.txt
torchada>=0.1.83
torchada>=0.1.81
```

### Step 2: Conditional Import
Expand Down
2 changes: 1 addition & 1 deletion README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ if torchada.is_gpu_device(device): # 在 CUDA 和 MUSA 上都能工作

```
# pyproject.toml 或 requirements.txt
torchada>=0.1.83
torchada>=0.1.81
```

### 步骤 2:条件导入
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/benchmark_history.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "Historical benchmark results for torchada performance tracking",
"results": [
{
"version": "0.1.83",
"version": "0.1.81",
"date": "2026-01-29",
"platform": "MUSA",
"pytorch_version": "2.7.1",
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "torchada"
version = "0.1.83"
version = "0.1.81"
description = "Adapter package for torch_musa to act exactly like PyTorch CUDA"
readme = "README.md"
license = {text = "MIT"}
Expand Down
2 changes: 1 addition & 1 deletion src/torchada/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from torch.utils.cpp_extension import CUDAExtension, BuildExtension, CUDA_HOME
"""

__version__ = "0.1.83"
__version__ = "0.1.81"

from . import cuda, utils

Expand Down
32 changes: 24 additions & 8 deletions src/torchada/_patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,9 @@ def _configure_cuda_graph_debug_dump_dir() -> Optional[str]:
try:
os.makedirs(dump_dir, exist_ok=True)
except Exception as exc: # noqa: BLE001
warnings.warn(f"TORCHADA_CUDA_GRAPH_DEBUG_DUMP_PATH={path_setting!r} is unusable: {exc!r}")
warnings.warn(
f"TORCHADA_CUDA_GRAPH_DEBUG_DUMP_PATH={path_setting!r} is unusable: {exc!r}"
)
_cuda_graph_debug_dump_dir = None
return None

Expand Down Expand Up @@ -678,7 +680,9 @@ def _discover_factory_functions() -> List[str]:
if not names:
names.update(_FALLBACK_FACTORY_FUNCTIONS)
# ``*_like`` variants accept device= but are not device-injected by torch.
names |= {n + "_like" for n in tuple(names) if callable(getattr(torch, n + "_like", None))}
names |= {
n + "_like" for n in tuple(names) if callable(getattr(torch, n + "_like", None))
}
for extra in _EXTRA_FACTORY_FUNCTIONS:
if callable(getattr(torch, extra, None)):
names.add(extra)
Expand Down Expand Up @@ -1212,7 +1216,9 @@ class ProfileWrapper:

def __init__(self, *args, activities=None, **kwargs):
translated_activities = _translate_activities(activities)
self._profiler = original_profile(*args, activities=translated_activities, **kwargs)
self._profiler = original_profile(
*args, activities=translated_activities, **kwargs
)

def __enter__(self):
return self._profiler.__enter__()
Expand Down Expand Up @@ -1303,7 +1309,9 @@ def patched_impl(self, *args, **kwargs):
bound.apply_defaults()

if bound.arguments.get("dispatch_key") in cuda_dispatch_key_map:
bound.arguments["dispatch_key"] = cuda_dispatch_key_map[bound.arguments["dispatch_key"]]
bound.arguments["dispatch_key"] = cuda_dispatch_key_map[
bound.arguments["dispatch_key"]
]

return original_impl(*bound.args, **bound.kwargs)

Expand Down Expand Up @@ -1566,7 +1574,9 @@ def _accepts_only_qv(func: Callable) -> bool:
# module-level ``__getattr__`` (PEP 562), which would keep them out of
# ``dir()``. flash_attn_varlen_func and flash_attn_with_kvcache are the ones
# sglang's FA3 path forwards ``only_qv`` into.
candidate_names = {n for n in dir(flash_attn_interface) if n.startswith("flash_attn")}
candidate_names = {
n for n in dir(flash_attn_interface) if n.startswith("flash_attn")
}
candidate_names.update(
(
"flash_attn_func",
Expand Down Expand Up @@ -1874,7 +1884,9 @@ def __getattr__(self, name):
elif name in self._REMAP_ATTRS:
value = getattr(self._musa_module, self._REMAP_ATTRS[name])
else:
raise AttributeError(f"module 'torch.accelerator' has no attribute '{name}'")
raise AttributeError(
f"module 'torch.accelerator' has no attribute '{name}'"
)
object.__setattr__(self, name, value)
return value

Expand Down Expand Up @@ -2002,7 +2014,9 @@ def _patch_torch_accelerator():

wrapper = _AcceleratorModuleWrapper(_original_torch_accelerator, torch.musa)

wrapper._set_override("synchronize", _make_patched_accelerator_synchronize(torch.musa))
wrapper._set_override(
"synchronize", _make_patched_accelerator_synchronize(torch.musa)
)
device_index_cm, stream_cm = _make_accelerator_context_managers(wrapper)
if not hasattr(_original_torch_accelerator, "device_index"):
wrapper._set_override("device_index", device_index_cm)
Expand Down Expand Up @@ -2030,7 +2044,9 @@ def gdc_wait():
raise NotImplementedError("tl.extra.cuda.gdc_wait is not supported on MUSA")

def gdc_launch_dependents():
raise NotImplementedError("tl.extra.cuda.gdc_launch_dependents is not supported on MUSA")
raise NotImplementedError(
"tl.extra.cuda.gdc_launch_dependents is not supported on MUSA"
)

if not hasattr(tl.extra.cuda, "gdc_wait"):
tl.extra.cuda.gdc_wait = gdc_wait
Expand Down
Loading