Merged
fix: 修复TileLang-Ascend构建命令中不支持的-v参数及默认安装下CATLASS单元测试失败的问题 #166
xmzAdd on Sep 14
fix: 修复TileLang-Ascend构建命令中不支持的-v参数及默认安装下CATLASS单元测试失败的问题 #166
Merged
Total: 4 files changed+11-3
| @@ -138,7 +138,7 @@ cd tilelang-ascend | |||
| 138 | source /usr/local/Ascend/ascend-toolkit/latest/set_env.sh | 138 | source /usr/local/Ascend/ascend-toolkit/latest/set_env.sh |
| 139 | export ASCEND_HOME_PATH=/usr/local/Ascend/ascend-toolkit/latest | 139 | export ASCEND_HOME_PATH=/usr/local/Ascend/ascend-toolkit/latest |
| 140 | 140 | ||
| 141 | -./build_wheel_ascend.sh --enable-llvm -v | 141 | +./build_wheel_ascend.sh --enable-llvm |
| 142 | pip install -U dist/tilelang-*.whl | 142 | pip install -U dist/tilelang-*.whl |
| 143 | ``` | 143 | ``` |
| 144 | 144 | ||
| @@ -181,7 +181,7 @@ cd tilelang-ascend | |||
| 181 | source /usr/local/Ascend/ascend-toolkit/latest/set_env.sh | 181 | source /usr/local/Ascend/ascend-toolkit/latest/set_env.sh |
| 182 | export ASCEND_HOME_PATH=/usr/local/Ascend/ascend-toolkit/latest | 182 | export ASCEND_HOME_PATH=/usr/local/Ascend/ascend-toolkit/latest |
| 183 | 183 | ||
| 184 | -./build_wheel_ascend.sh --enable-llvm -v | 184 | +./build_wheel_ascend.sh --enable-llvm |
| 185 | pip install -U dist/tilelang-*.whl | 185 | pip install -U dist/tilelang-*.whl |
| 186 | ``` | 186 | ``` |
| 187 | 187 | ||
| @@ -154,6 +154,8 @@ pytest tests/unit_tests | |||
| 154 | > | 154 | > |
| 155 | > - 运行单个算子的测试可使用`pytest tests/unit_tests/triton/test_fused_cross_entropy_loss.py`。 | 155 | > - 运行单个算子的测试可使用`pytest tests/unit_tests/triton/test_fused_cross_entropy_loss.py`。 |
| 156 | > - 单元测试以CPU高精度实现与PyTorch小算子实现为双标杆进行精度校验。 | 156 | > - 单元测试以CPU高精度实现与PyTorch小算子实现为双标杆进行精度校验。 |
| 157 | +> - CATLASS算子的单元测试依赖可选的CATLASS组件:安装时需设置环境变量`MINDSPEED_BUILD_CATLASS=1`(详见[README](../../README.md)中"可选:编译并运行 CATLASS 算子"章节);未启用编译时,相关用例将自动跳过。 | ||
| 158 | +> - TileLang算子的单元测试依赖可选的TileLang-Ascend组件(详见[软件安装](install_guide.md#可选安装tilelang-ascend以使用tilelang算子));未安装时,相关用例将自动跳过。 | ||
| 157 | 159 | ||
| 158 | ## 更多算子 | 160 | ## 更多算子 |
| 159 | 161 | ||
| @@ -9,7 +9,13 @@ import torch.nn.functional as F | |||
| 9 | from mindspeed_ops.api.catlass import chunk_loss_forward | 9 | from mindspeed_ops.api.catlass import chunk_loss_forward |
| 10 | 10 | ||
| 11 | 11 | ||
| 12 | -pytestmark = pytest.mark.skipif(not hasattr(torch, "npu"), reason="torch_npu is required") | 12 | +pytestmark = [ |
| 13 | + pytest.mark.skipif(not hasattr(torch, "npu"), reason="torch_npu is required"), | ||
| 14 | + pytest.mark.skipif( | ||
| 15 | + not hasattr(torch.ops.mindspeed_ops, "catlass_chunk_loss"), | ||
| 16 | + reason="CATLASS ops not built; install with MINDSPEED_BUILD_CATLASS=1 (see README)", | ||
| 17 | + ), | ||
| 18 | +] | ||
| 13 | 19 | ||
| 14 | 20 | ||
| 15 | def _device(): | 21 | def _device(): |