| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
fix(pre-commit): 全仓代码规范整改——attention 3/4 Co-authored-by: gitcode_lijd<lijiandong20@huawei.com> # message auto-generated for no-merge-commit merge: !13596 merge common into master fix(pre-commit): 全仓代码规范整改——attention 3/4 Created-by: gitcode_lijd Commit-by: gitcode_lijd Merged-by: cann-robot Description: 关联Issue https://gitcode.com/cann/ops-transformer/issues/5939 ## 描述 全仓代码规范整改系列——attention 拆分 **3/4**(第 3 批 26 个算子目录:mixed_quant_sparse_flash_mla_metadata ~ quant_lightning_indexer_v2_metadata,按目录字母序均分)。基于仓库 pre-commit 门禁对存量代码做一次性规范收敛: - clang-format 按 .clang-format 统一格式(列宽 120、指针左对齐 T* p、引用对齐 T& r 等) - 行尾空白、文件末尾换行修复 - 规模:513 个文件,+16217/-14903 行,纯格式化改动语义等价,无逻辑变更 - op_graph/*_proto.h、op_host/*_def.cpp、op_api/aclnn*.h 等接口文件及 OWNERS 不在本 PR 改动范围 ## 关联的Issue https://gitcode.com/cann/ops-transformer/issues/5939(全仓整改总跟踪) ## 测试 - pre-commit 全部钩子本地通过 - CI 流水线(compile/UT)验证 See merge request: cann/ops-transformer!13596 | 1 个月前 | |
torch extension整改成分布式 Co-authored-by: hblnb<huangbolin3@huawei.com> # message auto-generated for no-merge-commit merge: !9712 merge torch_extension_split into master torch extension整改成分布式 Created-by: hblnb Commit-by: hblnb Merged-by: cann-robot Description: ## 描述 ops-transformer仓支持各个算子独立编译torch_extention,并将torch_extension从集中式改成分布式(算子的文件分布到算子源码目录下新建的torch_extension文件夹) ## 关联的Issue https://gitcode.com/cann/ops-transformer/issues/4502 ## 测试 <!--描述进行了哪些测试来验证你的改动。包括但不限于二级冒烟、算子泛化等。--> ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> ## 类型标签 <!-- [x] 表示选中 --> - [ ] 🐛 Bug修复 - [ ] ✨ 新特性 - [ ] ⚡ 性能优化 - [x] ♻️ 重构 - [ ] 🧪 测试 - [ ] 📦 构建/CI - [ ] 🔧 配置变更 - [ ] 📝 文档更新 - [ ] ⬆️ 依赖升级 - [ ] 🔒 安全修复 - [ ] 🧹 代码清理 - [ ] ❓ 其他,请描述: See merge request: cann/ops-transformer!9712 | 2 个月前 | |
refactor(compressor,compressor_grad,quant_compressor): cleancode 整改与重复代码消除 Co-authored-by: myy268<moyunyang@huawei.com> # message auto-generated for no-merge-commit merge: !12106 merge cpcleancode3 into master refactor(compressor,compressor_grad,quant_compressor): cleancode 整改与重复代码消除 Created-by: myy268 Commit-by: myy268 Merged-by: cann-robot Description: ## 描述 本 PR 对 compressor / compressor_grad / quant_compressor 三个算子做 cleancode 整改与重复代码消除,共 11 个提交: 1. fix:去掉 cmp_ratio 默认值,补齐取值范围校验 [2,128] 2. 拆分 tiling 超大函数(IteratorSlice / ComputeVec1,每函数 ≤50 行) 3. 抽取 tiling 魔鬼数字为语义化常量(compressor / quant_compressor / compressor_grad) 4. tiling 成员函数按 const 正确性补 const;to_string 模板分支改 if constexpr 5. 修复 cleancode 告警:TilingParse 回调形参加 const(*const)、删除未使用的 kernel_tiling.h、条件显式 ge::GRAPH_SUCCESS 比较、统一 Convert* 形参名 6. PyPTO kernel(compressor_grad.py)用 pl.make_tuple 聚合上下文,消除 49 组 >10 行重复块(文件 3502 → 3076 行) 7. 重排 DATATYPE_TO_STRING_MAP,消除跨算子重复代码 8. 拆分 infershape 超大函数(>50 行) 仅重构与清理,算子逻辑、计算顺序与数值结果不变。 ## 关联的Issue 关联 Issue #5328 ## 测试 ## 文档更新 无 ## 类型标签 - [x] 🐛 Bug修复 - [ ] ✨ 新特性 - [ ] ⚡ 性能优化 - [x] ♻️ 重构 - [ ] 🧪 测试 - [ ] 📦 构建/CI - [ ] 🔧 配置变更 - [ ] 📝 文档更新 - [ ] ⬆️ 依赖升级 - [ ] 🔒 安全修复 - [x] 🧹 代码清理 - [ ] ❓ 其他,请描述: See merge request: cann/ops-transformer!12106 | 1 个月前 | |
fix(compressor): 用 torch.sym_min 替代 Python min 以支持 unbacked SymInt Co-authored-by: myy268<moyunyang@huawei.com> # message auto-generated for no-merge-commit merge: !14841 merge fix/compressor-torch-sym-min into master fix(compressor): 用 torch.sym_min 替代 Python min 以支持 unbacked SymInt Created-by: myy268 Commit-by: myy268 Merged-by: cann-robot Description: ## 描述 修复 compressor / quant_compressor 的 torch_extension Meta(fake) 实现:varlen(x.dim() == 2)分支把 Python 内建 min 换成 torch.sym_min。 **问题**:_compressor_forward_fake / quant_compressor 的 meta 实现在 varlen 分支用 python cmp_size = min(t, t // cmp_ratio + b_size) 计算输出长度。Python min 会对 SymInt 的比较结果(SymBool)取 bool(),即向 ShapeEnv 求一条布尔 guard。当尺寸是 **unbacked SymInt**(无 hint,例如来自数据依赖的长度)时 guard 无法求值,直接抛: torch.fx.experimental.symbolic_shapes.GuardOnDataDependentSymNode: Could not guard on data-dependent expression u1 + ((u0//4)) - 1 < u0 即 fake/meta 形状推导失败,torch.compile / npugraph_ex 的图捕获在该算子处中断。 **改法**:改用 torch.sym_min,不再产生 guard: - 纯 int 输入行为不变(torch.sym_min 内部走 builtins.min,返回 int); - hinted SymInt 取值不变,且少产生一条 guard(降低 recompile 概率); - unbacked SymInt 可正常返回符号 shape(Min(a, b) 表达式)。 **影响面**:仅 shape 推导(Meta/Fake)路径。eager 执行不经过该实现(输出 tensor 由 PTA csrc / aclnn 调用方预分配),因此精度、性能、用例行为均无变化;torchair 的 GE converter 对本算子直接 raise("not supported in GE graph mode"),不受影响。 改动文件(各 1 行): - attention/compressor/torch_extension/compressor.py - attention/quant_compressor/torch_extension/quant_compressor.py ## 关联的Issue 关联 Issue:#6961 ## 测试 本地用 FakeTensorMode + ShapeEnv 构造三组尺寸来源,经公开算子入口(cann_ops_transformer.ops.compressor 与 torch.ops.cann_ops_transformer.compressor)验证: | 尺寸来源 | 分支 | 修复前 | 修复后 | |---|---|---|---| | unbacked SymInt | varlen(dim=2) | GuardOnDataDependentSymNode(栈指向 _compressor_forward_fake 的 min) | 正常返回 Min(...) 符号 shape | | hinted SymInt | varlen(dim=2) | 正常(带 1 条 guard) | 正常(0 条 guard,取值一致) | | 具体 int | varlen(dim=2) | 正常 | 正常(行为完全一致) | | unbacked SymInt | prefill(dim=3) | 正常(不经过 min) | 正常 | 合计 9 个用例全部通过。eager 真机路径实测不调用该 fake 实现(调用计数为 0),故单算子 / ttk 用例结果不受影响。 ## 文档更新 无。 ## 类型标签 - [x] 🐛 Bug修复 - [ ] ✨ 新特性 - [ ] ⚡ 性能优化 - [ ] ♻️ 重构 - [ ] 🧪 测试 - [ ] 📦 构建/CI - [ ] 🔧 配置变更 - [ ] 📝 文档更新 - [ ] ⬆️ 依赖升级 - [ ] 🔒 安全修复 - [ ] 🧹 代码清理 - [ ] ❓ 其他,请描述: See merge request: cann/ops-transformer!14841 | 16 天前 |
| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
| 1 个月前 | ||
| 2 个月前 | ||
| 1 个月前 | ||
| 16 天前 |