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 @@ -298,7 +298,7 @@ See `src/torchada/_mapping.py` for the complete mapping table (380+ mappings).

```
# pyproject.toml or requirements.txt
torchada>=0.1.69
torchada>=0.1.70
```

### 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 @@ -293,7 +293,7 @@ if torchada.is_gpu_device(device): # 在 CUDA 和 MUSA 上都能工作

```
# pyproject.toml 或 requirements.txt
torchada>=0.1.69
torchada>=0.1.70
```

### 步骤 2:条件导入
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.69"
version = "0.1.70"
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.69"
__version__ = "0.1.70"

from . import cuda, utils

Expand Down
11 changes: 7 additions & 4 deletions src/torchada/_mapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@

from ._mappings import MAPPING_RULE as _MAPPING_RULE # noqa: F401

# Extension file suffix mappings: convert .cu/.cuh to .mu/.muh so torch_musa's
# musa_compile rule (which only adds -x musa for .mu/.muh) treats them correctly.
# Keep source extensions unchanged during porting. Sources are ported in place
# (no <dir>_musa mirror), and .cu/.cuh compile as MUSA via the patched
# _is_musa_file (which selects the -x musa rule), so renaming to .mu/.muh is
# unnecessary -- and avoiding it removes any need for include/source-path
# rewriting.
EXT_REPLACED_MAPPING = {
'cuh': 'muh',
'cu': 'mu',
'cuh': 'cuh',
'cu': 'cu',
'cc': 'cc',
'cpp': 'cpp',
'cxx': 'cxx',
Expand Down
2 changes: 0 additions & 2 deletions src/torchada/_mappings/cuda_runtime.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
"""cuda_runtime CUDA->MUSA porting rules."""

MAPPING = {
'.cuh"': '.muh"',
'.cuh>': '.muh>',
'cudaMalloc': 'musaMalloc',
'cudaFree': 'musaFree',
'cudaMemcpy': 'musaMemcpy',
Expand Down
7 changes: 7 additions & 0 deletions src/torchada/_mappings/data_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,11 @@
'CUDA_R_8F_E5M2': 'MUSA_R_8F_E5M2',
'cuda_fp16.h': 'musa_fp16.h',
'cuda_bf16.h': 'musa_bf16.h',
# torch_musa's torch::headeronly snapshot omits these scalar-type headers;
# the c10 variants carry the same definitions. Only the dtype headers move
# (Exception.h / ScalarType.h under torch/headeronly resolve on torch_musa).
'#include <torch/headeronly/util/Float8_e4m3fn.h>': '#include <c10/util/Float8_e4m3fn.h>',
'#include <torch/headeronly/util/Float8_e4m3fnuz.h>': '#include <c10/util/Float8_e4m3fnuz.h>',
'#include <torch/headeronly/util/BFloat16.h>': '#include <c10/util/BFloat16.h>',
'#include <torch/headeronly/util/Half.h>': '#include <c10/util/Half.h>',
Comment thread
yeahdongcn marked this conversation as resolved.
}
Loading