| Files | Last commit | Last update |
|---|---|---|
fix(operation): Conv3D adds a new tileCin check item Co-authored-by: luyakun<luyakun@h-partners.com> # message auto-generated for no-merge-commit merge: !6594 merge conv3d_tile_cin_92 into 9.2.0 fix(operation): Conv3D adds a new tileCin check item Created-by: luyakun_hw Commit-by: luyakun Merged-by: cann-robot Description: 1、新增Conv3D约束,tileCinFmap和tileCinWeight需要是cin的因子 2、docs/zh/api/tensor_api/config/pypto-set_conv_tile_shapes.md文档增加约束描述 https://gitcode.com/cann/pypto/issues/3407 See merge request: cann/pypto!6594 | 2 months ago | |
refactor(interface): Remove UpdateTensorDataUsage() Co-authored-by: tsungl4<lidongsheng4@huawei.com> # message auto-generated for no-merge-commit merge: !5451 merge test_data/1 into master refactor(interface): Remove UpdateTensorDataUsage() Created-by: tsungl4 Commit-by: tsungl4 Merged-by: cann-robot Description: Remove per function importDict Related Issue: #2559 See merge request: cann/pypto!5451 | 3 months ago | |
fix(operation): Fix Div operation using int64 dtype Co-authored-by: junnyleo<lijun580@huawei.com> # message auto-generated for no-merge-commit merge: !6611 merge fix/div920 into 9.2.0 fix(operation): Fix Div operation using int64 dtype Created-by: junnyleo Commit-by: junnyleo Merged-by: cann-robot Description: 本次变更主要围绕 Div/Divs 算子对 int64 数据类型的支持进行修复。核心思路是将 int64 纳入整数除法的支持范围,并统一整数路径的处理逻辑:改为将输入 Cast 到 FP32 进行除法运算后再按 self 的数据类型回退转换;同时从平台支持的数据类型配置中移除 uint64,并同步调整了对应的 golden 生成逻辑。 Related Issue: [#3416](https://gitcode.com/cann/pypto/issues/3416) See merge request: cann/pypto!6611 | 2 months ago | |
fix(ir): Dump attr support map Co-authored-by: zhaojunhan<zhaojunhan1@huawei.com> # message auto-generated for no-merge-commit merge: !4577 merge fix_ir_dump into master fix(ir): Dump attr support map Created-by: zhaojunhan Commit-by: zhaojunhan Merged-by: cann-robot Description: Dump operation attributes with support for map-type data. See merge request: cann/pypto!4577 | 4 months ago | |
style(all): Apply additional clang-format corrections across codebase Co-authored-by: junjieHuang<huangjunjie38@h-partners.com> # message auto-generated for no-merge-commit merge: !4883 merge style-cpp into master style(all): Apply additional clang-format corrections across codebase Created-by: junjieHuang Commit-by: junjieHuang Merged-by: cann-robot Description: Apply additional clang-format corrections across codebase See merge request: cann/pypto!4883 | 4 months ago | |
fix(ir): Fix missing replace of scalar vars Co-authored-by: tsungl4<lidongsheng4@huawei.com> # message auto-generated for no-merge-commit merge: !5308 merge shape into master fix(ir): Fix missing replace of scalar vars Created-by: tsungl4 Commit-by: tsungl4 Merged-by: cann-robot Description: Related Issue: #2559 See merge request: cann/pypto!5308 | 3 months ago | |
fix(opration): Repair Alerts Co-authored-by: chen_zhang<zju_zhangchen@zju.edu.cn> # message auto-generated for no-merge-commit merge: !6371 merge FIX_WARNINGS into 9.2.0 fix(opration): Repair Alerts Created-by: chen_zhang Commit-by: chen_zhang Merged-by: cann-robot Description: fix(opration): Repair Alerts issue:https://gitcode.com/cann/pypto/issues/3314 See merge request: cann/pypto!6371 | 2 months ago | |
fix(interface): Fix ConvBackwardInput tileKL1 tiling validation Co-authored-by: hongyiliu111<liuhongyi1@huawei.com> # message auto-generated for no-merge-commit merge: !5887 merge dev_lhy into master fix(interface): Fix ConvBackwardInput tileKL1 tiling validation Created-by: hongyiliu111 Commit-by: hongyiliu111 Merged-by: cann-robot Description: fix(interface): Fix ConvBackwardInput tileKL1 tiling validation Changes: - Add check that tileKL1 is divisible by Cout0 * Hk * Wk - Fix kAlignL1 to ConvAlignB(tileKL1, K0) in BpCheckL0TileTiling See merge request: cann/pypto!5887 | 2 months ago | |
fix(operation): Clamp GM accumulation K view shape to remaining K [9.2.0] Co-authored-by: li_qingyan<liqingyan10@h-partners.com> # message auto-generated for no-merge-commit merge: !6447 merge fix/operation/gm-acc-view-shape-9.2.0 into 9.2.0 fix(operation): Clamp GM accumulation K view shape to remaining K [9.2.0] Created-by: li_qingyan Commit-by: li_qingyan Merged-by: cann-robot Description: > 同步自 master 分支(基线 upstream/9.2.0,涉及文件两分支无差异,干净落位)。 ## 问题 GM 累加(splitK)路径 ComputeGmAccumulationKernel 中,当 K 不是 L1 tile 整数倍时,K 尾块 A/B tensor 的 View **shape 仍声明整块 kL1Size**,超出实际剩余 K 数据(仅 validShape 裁剪),块尺寸与真实数据范围不匹配,存在越界读取/构图语义错误风险。 ## 方案 新增 kViewShape = min(kSize2D - kL1Size * kIdx, kL1Size),A/B tensor View shape 由 kL1Size 改为 kViewShape(transA/transB 4 处布局同步);partialKValidShape 裁剪上限同步改为 kViewShape。 总计 1 个文件,+6/-5。 ## 校验 UT:DynamicMatmulUTest.mm_A_B_ND_KSplit_bf16(GM 累加路径)单跑通过;Matmul 相关 UT 套件结果与未改动基线一致(既有用例间污染失败非本改动引入)。 Related Issue: #3364 See merge request: cann/pypto!6447 | 2 months ago | |
fix(Operation): modify cleancode Co-authored-by: chenbl<chenbinglin7@huawei.com> # message auto-generated for no-merge-commit merge: !5748 merge fix/docs into master fix(Operation): modify cleancode Created-by: chenbl Commit-by: chenbl Merged-by: cann-robot Description: cleancode修改: - 拆分过长的 Operation 和 TileOp 文件 - 重构过长函数并提取重复代码 - 使用公共常量替换 Magic Number - 修复报错日志的拼写和语法问题 - 补充报错日志中的实际参数值 - 删除自定义调试打印 - 清理无用变量和重复实现 - 迁移并补充 Vector Operation 单元测试 See merge request: cann/pypto!5748 | 2 months ago | |
style(all): Apply additional clang-format corrections across codebase Co-authored-by: junjieHuang<huangjunjie38@h-partners.com> # message auto-generated for no-merge-commit merge: !4883 merge style-cpp into master style(all): Apply additional clang-format corrections across codebase Created-by: junjieHuang Commit-by: junjieHuang Merged-by: cann-robot Description: Apply additional clang-format corrections across codebase See merge request: cann/pypto!4883 | 4 months ago | |
fix(Operation): clean up implementation and magic numbers Co-authored-by: chenbl<chenbinglin7@huawei.com> # message auto-generated for no-merge-commit merge: !5852 merge fix/docs into master fix(Operation): clean up implementation and magic numbers Created-by: chenbl Commit-by: chenbl Merged-by: cann-robot Description: cleancode整改: - 替换 Vector Operation 和 TileOp 内的Magic Number - 合并拆分部分内聚性较差的Vector Operation Cpp 文件 See merge request: cann/pypto!5852 | 2 months ago | |
fix(operation): Force update dynValidShape for OP_CONTRACT output Co-authored-by: zhaosenqiu<zhaosenqiu@huawei.com> # message auto-generated for no-merge-commit merge: !6205 merge dts5033-920 into 9.2.0 fix(operation): Force update dynValidShape for OP_CONTRACT output Created-by: zhaosenqiu Commit-by: zhaosenqiu Merged-by: cann-robot Description: fix(operation): Force update dynValidShape for OP_CONTRACT output Original OP_ASSEMBLE carried both view and transport semantics, and the transport semantics is now split into OP_CONTRACT. The dynValidShape force-update whitelist in InferShapeRegistry::CallInferShapeFunc only covered OP_COPY_OUT and OP_ASSEMBLE, so an OP_CONTRACT whose output tensor already holds a stale dynValidShape inherited from its input is never refreshed against the real output shape. With enable_slice enabled, the stale dynValidShape on the L0C-to-L1 contract output blocks RemoveRedundantOp from eliminating the identity L1-to-L1 view. The surviving view becomes the direct consumer of the contract, which defeats the cube-local-load skip in the partitioner's L1CopyInCombine rule and transitively merges the whole tile chain into a few oversized subgraphs, producing 14k-line CCE files and extremely long codegen time. Changes: Add OP_CONTRACT to the dynValidShape force-update condition in CallInferShapeFunc, so CONTRACT outputs are handled exactly like ASSEMBLE outputs Verified: subgraph count is restored from 4 to 90, CCE file size shrinks from 14391 lines to about 936 lines, codegen finishes in seconds instead of timing out, and all fp16/fp32 combinations with enable_slice on/off pass precision checks Related Issues: #3267 pr6162合入商分 See merge request: cann/pypto!6205 | 2 months ago | |
feat(indexing): Support A5 SIMT gather and index put Co-authored-by: bynshard<zhangbingshuai@huawei.com> # message auto-generated for no-merge-commit merge: !5404 merge feat/a5-simt-mixed into master feat(indexing): Support A5 SIMT gather and index put Created-by: bynshard Commit-by: bynshard Merged-by: cann-robot Description: gather indexput 支持的simt 实现,在离散场景下提升性能 当 Gather 的 source 位于 GM、indices 位于 UB 时,A5 Codegen 会选择 SIMT MGATHER 实现: 1. 使用 SIMD 批量计算 Gather 的元素偏移。 2. 使用 SIMT MGATHER 根据偏移直接从 GM source 读取数据。 3. source 位于 UB 时继续使用原有实现。 4. int64 indices 暂不使用 SIMT,回退到原有 Scalar 实现。 同时补充了 SIMT Kernel 的端到端识别与下发机制: 1. Pass 识别需要 SIMT 的 Gather,并设置 requiresSimt 属性。 2. 将 requiresSimt 信息传递到 Device Program 和编译流程。 3. 为包含 SIMT 的 A5 Kernel 生成相应的 ELF metadata。 4. Runtime 根据 Kernel 是否包含 SIMT,选择对应的 UB 配置。 5. SIMT Kernel 配置 216 KB 动态 UB,并为 DCache 预留 32 KB。 6. 纯 SIMD Kernel 保持原有 Runtime 下发方式和 UB 配置。 此外,完善了 GM GatherElement 在内存类型推导、动态参数注册、动态 valid shape 处理和 OoO 调度中的支持。 Related Issue: #3162 ``` 更多描述信息见:[Commit Message 规范](../docs/zh/contribute/pull-request.md#commit-message) See merge request: cann/pypto!5404 | 2 months ago | |
fix(function): Fix copy attr of inner copyin/out not normalized Co-authored-by: tsungl4<lidongsheng4@huawei.com> Co-authored-by: zhaojunhan<zhaojunhan1@huawei.com> # message auto-generated for no-merge-commit merge: !6587 merge fix_distribute_920 into 9.2.0 fix(function): Fix copy attr of inner copyin/out not normalized Created-by: zhaojunhan Commit-by: zhaojunhan;tsungl4 Merged-by: cann-robot Description: #### 问题背景 子图中的内部 COPY_IN/COPY_OUT 属性未正确进行 COA Normalize,导致无法子图同构。 补充 Normalize 后,又暴露出 operand COA 索引和 shape 参数化引起的精度问题。 #### 修改内容 本 PR 包含以下三部分修改: 1. 支持内部 Copy Normalize 在 NormalizeCoaForNormalOperands 中处理内部 COPY_IN/COPY_OUT 及 L1 Copy,将动态属性加入 COA 参数列表。 2. 修正内部 Copy 的 operand 属性索引 普通内部 Copy 的 COA 仅用于 Copy 属性,不再设置 IOpAtt/OOpAtt,避免 InferParamIndex 将其错误解释为 Tensor COA;仅保留 outcast raw 场景的索引设置。 3. 保持 Copy shape 为编译期常量 Normalize 时不再将 shape 回写为 COA Parameter,只对 offset 等动态属性进行参数化。避免 codegen 通过 GetSpecifiedShape(1) 读取参数化 shape 时回退成 1×1,导致内部 GM spill 搬运数据不完整。 See merge request: cann/pypto!6587 | 2 months ago | |
fix(Conv): Skip split reshape for group conv1d with group_reshape_no_split flag Co-authored-by: xinweiliu<liuxinwei12@huawei.com> # message auto-generated for no-merge-commit merge: !6348 merge group_reshape_no_split_9.2.0 into 9.2.0 fix(Conv): Skip split reshape for group conv1d with group_reshape_no_split flag Created-by: xinweiliu Commit-by: xinweiliu Merged-by: cann-robot Description: A2A3 Conv1d group场景,reshape算子感知不到group属性,与Transdata算子处理如果split会无法推导正确的shape关系 See merge request: cann/pypto!6348 | 2 months ago | |
fix(Conv): Skip split reshape for group conv1d with group_reshape_no_split flag Co-authored-by: xinweiliu<liuxinwei12@huawei.com> # message auto-generated for no-merge-commit merge: !6348 merge group_reshape_no_split_9.2.0 into 9.2.0 fix(Conv): Skip split reshape for group conv1d with group_reshape_no_split flag Created-by: xinweiliu Commit-by: xinweiliu Merged-by: cann-robot Description: A2A3 Conv1d group场景,reshape算子感知不到group属性,与Transdata算子处理如果split会无法推导正确的shape关系 See merge request: cann/pypto!6348 | 2 months ago | |
feat(operation): Support int64/uint64 for vector operations Co-authored-by: junnyleo<lijun580@huawei.com> # message auto-generated for no-merge-commit merge: !5572 merge feat/dtype into master feat(operation): Support int64/uint64 for vector operations Created-by: junnyleo Commit-by: junnyleo Merged-by: cann-robot Description: 本 PR 旨在为向量(vector)算子补充 int64/uint64 数据类型支持。改动主要为: 1. 通过 GetSupportedDataTypesByArch 在 A5 架构(DAV_3510)的算子支持类型集合中加入 DT_INT64/DT_UINT64; 2. 新增 CheckInt64Broadcast 校验以禁止 int64/uint64 输入的 broadcast;同时修正标量 Element 的构造/转换路径(int64 不经 float、uint64 不经 int64 中转),避免大数值精度丢失或符号翻转; 3. 在 tile-op 内核层为 int64 补齐 FloorDiv、compare、logicalnot、unary 等实现; 4. 配套更新了 Python 侧与测试用例及md文档。 Related Issue: #3141 See merge request: cann/pypto!5572 | 2 months ago | |
fix(operation): Fix TopK RadixSelect Temp Workspace Co-authored-by: Creeeeper<liuyizhe6@huawei.com> # message auto-generated for no-merge-commit merge: !6342 merge topk-tmp-fix-9.2.0 into 9.2.0 fix(operation): Fix TopK RadixSelect Temp Workspace Created-by: Creeeeper Commit-by: Creeeeper Merged-by: cann-robot Description: ## 描述 1. 调整TopK RadixSelect算法使用的临时空间大小避免内存踩踏 2. 修复cbrt文档渲染问题 ## 测试 完成自测以及冒烟测试 ## 关联Issue [#3333](https://gitcode.com/cann/pypto/issues/3333) ## 类型标签 - [x] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [ ] 其他,请描述: See merge request: cann/pypto!6342 | 2 months ago | |
refactor(operation): Replace GatherInUB magic numbers with named constants Co-authored-by: bynshard<zhangbingshuai@huawei.com> # message auto-generated for no-merge-commit merge: !6590 merge codex/gather-in-ub-remove-magic-number-9.2.0 into 9.2.0 refactor(operation): Replace GatherInUB magic numbers with named constants Created-by: bynshard Commit-by: bynshard Merged-by: cann-robot Description: gatherinub 代码中魔鬼数字整改 Related Issue: https://gitcode.com/cann/pypto/issues/3413 See merge request: cann/pypto!6590 | 2 months ago | |
feat(pass): Attach tile-graph tokens from source op during ExpandFunction Co-authored-by: Immutable01<gaoqiancheng@huawei.com> # message auto-generated for no-merge-commit merge: !5755 merge 0828_tokenfinal into master feat(pass): Attach tile-graph tokens from source op during ExpandFunction Created-by: Immutable01 Commit-by: Immutable01 Merged-by: cann-robot Description: token expandfunction代码重构,泛化实现方式 See merge request: cann/pypto!5755 | 2 months ago | |
feat(Operation): Add pypto.conv_backward_input and its 2D implementation on A2/A3 Co-authored-by: hongyiliu111<liuhongyi1@huawei.com> Co-authored-by: xutianlong1<xutianlong1@huawei.com> Co-authored-by: wangshenhao<wangshenhao1@huawei.com> # message auto-generated for no-merge-commit merge: !5528 merge dev into master feat(Operation): Add pypto.conv_backward_input and its 2D implementation on A2/A3 Created-by: hongyiliu111 Commit-by: wangshenhao;hongyiliu111;xutianlong1 Merged-by: cann-robot Description: feat(Operation): Add pypto.conv_backward_input and its 2D implementation on A2/A3 Add pypto.conv_backward_input interface to compute the gradient of convolution with respect to the input tensor, and implement its 2D support spanning the frontend interface, backend operation implementation and MTE codegen Changes: - Add pypto.conv_backward_input frontend interface with parameter validation - Implement ConvBackwardInput 2D backend operation and codegen - Add UT/ST test cases for the 2D implementation See merge request: cann/pypto!5528 | 3 months ago | |
fix(Operation): modify cleancode Co-authored-by: chenbl<chenbinglin7@huawei.com> # message auto-generated for no-merge-commit merge: !5748 merge fix/docs into master fix(Operation): modify cleancode Created-by: chenbl Commit-by: chenbl Merged-by: cann-robot Description: cleancode修改: - 拆分过长的 Operation 和 TileOp 文件 - 重构过长函数并提取重复代码 - 使用公共常量替换 Magic Number - 修复报错日志的拼写和语法问题 - 补充报错日志中的实际参数值 - 删除自定义调试打印 - 清理无用变量和重复实现 - 迁移并补充 Vector Operation 单元测试 See merge request: cann/pypto!5748 | 2 months ago | |
feat(Operation): Add input tile shape resolver. Co-authored-by: Immutable01<gaoqiancheng@huawei.com> # message auto-generated for no-merge-commit merge: !5126 merge 0727_viewtile into master feat(Operation): Add input tile shape resolver. Created-by: Immutable01 Commit-by: Immutable01 Merged-by: cann-robot Description: # TileShapeResolver:算子输入/输出 Tile 形状解析器 ## 1. 背景与目标 PyPTO 的 tensor-graph 算子在展开( ExpandFunction)前只携带一个 **op 级 TileShape**(描述"输出怎么切")。但算子的**每个输入/输出 tensor 实际被切成的第一刀 tile 形状**并不等于 op 级 TileShape: - 广播算子的输入要按自身 shape 做 min clamp; - reduce 算子的 reduce 轴保持 full、非 reduce 轴按 vecTile 切; - gather/scatter/sort/topk/matmul/transdata 等各有专属切法; - 输出侧 cube 算子按 CubeTile 切、transdata 输出维度与输入不同…… 下游(内存估算、调度、合轴等)需要在不真正展开的前提下,**直接从一个 Operation 推断其每个输入/输出的真实 tile 形状**。TileShapeResolver 就是提供这个能力的单例工具类。 ## 2. 整体设计 framework/src/interface/operation/tile_shape_resolver.h cpp class TileShapeResolver { public: static TileShapeResolver& Instance(); // 由 op 的 opcode + op 级 TileShape + 各 operand 自身 shape,推算第 index 个输入的真实 tile 形状 TileShape GetInputTileShape(const Operation& op, int index) const; // 由 op 的 opcode + op 级 TileShape + 各 operand 自身 shape,推算第 index 个输出的真实 tile 形状 TileShape GetOutputTileShape(const Operation& op, int index) const; private: TileShapeResolver() = default; TileShapeResolver(const TileShapeResolver&) = delete; TileShapeResolver& operator=(const TileShapeResolver&) = delete; }; - **单例 + 无状态**:所有信息从 Operation 现取,线程安全。 - **只覆盖 tensor op**:只对有 REGISTER_OPERATION_TILED_FUNC(即有 tile 展开的 tensor op)的 opcode 给出语义;tile op 不在本解析器职责内。 - **返回 TileShape**:当前只填 VecTile(cube 算子填 CubeTile),其余 sub-tile 保持默认。 ## 3. 实现侧:GetInputTileShape framework/src/interface/operation/tile_shape_resolver.cpp ### 3.1 公共辅助 | 辅助 | 作用 | |---|---| | ElementwiseInputVecTile(inShape, opVecTile) | 逐轴 min(inShape, vecTile),超出 vecTile 维数的轴保持 full。elementwise 默认。 | | VecTileAxisFull(inShape, clampShape, opVecTile, fullAxis) | 指定轴保持 full,其余轴 min(clampShape, vecTile)。用于 reduce/gather/scatter 的"轴 full"语义。 | | TransDataInputVecTile(inShape, opVecTile, group, groupAxis) | groupAxis 按 inShape/group 切,其余 elementwise。用于 TransData 系列。 | | MakeTileShapeFromVec(vec) | 把 vector<int64_t> 包成 TileShape(只设 VecTile)。 | ### 3.2 分支策略 按 opcode switch,**默认分支**为 ElementwiseInputVecTile(覆盖所有 elementwise 算子:Add/Div/Cast/Expand/Axpy/Where/OneHot/PReLU…)。特殊分支: | 类别 | opcode | 输入 tile 规则 | |---|---|---| | **轴 full 类** | OP_ROW*_SINGLE(Sum/Amax/Amin/Prod/ArgMax/ArgMin) | reduce 轴 full,其余 min。axis 取 OP_ATTR_PREFIX+"AXIS"(缺失回退 0)。 | | | OP_ROWEXPMAX / OP_ROWEXPSUM | 2-D 专用,axis=1 full,axis0 min。 | | | OP_BITSORT / OP_MRGSORT | sort 轴(OP_ATTR_PREFIX+"axis")full,其余 min。 | | | OP_ARGSORT | sort 轴 full;axis 取**裸键 "axis"**(与 ArgSortOperationTileFunc 实际读取一致,非注册声明的带前缀键)。 | | | OP_EXTRACT | 末轴 full,其余 min。 | | | OP_SORT_UB | sort 轴 full。 | | | OP_INDEX_ADD / OP_INDEX_ADD_UB | self(index 0)轴 full;src(index 1)elementwise;indices full。 | | **gather/scatter 类** | OP_GATHER | params:axis full,其余按输出轴映射 min;indices:按 axis+j 映射 min。 | | | OP_GATHER_ELEMENT | params 轴 full;indices elementwise。 | | | OP_SCATTER / OP_SCATTER_ELEMENT | self 与 idx 都按 idx.shape 在 axis full、其余 min。 | | | OP_INDEX_OUTCAST | [src, index, dst]:src/dst 轴 full、非轴 min;index(2-D)axis full,**字面 axis 0 仅当 axis!=0 时按 vecTile[0] 切**,其余非轴 full(对齐 TiledScatterUpdate)。axis 取**裸键 "axis"**。 | | | OP_INDEX_PUT | self 前导轴 full、尾部按 values 轴 min;values elementwise;其余输入按 {min(in[0], vecTile[0])}。 | | **topk** | OP_TOPK | 非轴 elementwise;axis 按 32 对齐 chunk(复刻 TopkOperationTileFunc 的 align 逻辑:maxNumValue=8192、kBlockSize=32 阈值)。 | | **where** | OP_WHERE_TT/TS/ST/SS | cond(index 0)若为 DT_UINT8 末轴按 vecTile/8 切(mask 位宽);其余 elementwise。 | | **transdata** | OP_NCHW2NC1HWC0 等 6 个 | TransDataInputVecTile,groupAxis 按输入 layout 定(NCHW 系列为 1,NCDHW 系列为 2)。 | | **pack** | OP_PACK | 输出 1-D,输入 tile = {min(in[0], ∏vecTile)}。 | | **prelu** | OP_PRELU | input elementwise;weight 取 {min(weight[0], vecTile[1])}(channel 轴)。 | | **cube matmul** | OP_A_MUL_B / A_MUL_BT / A_MULACC_B / A_MULACC_BT | A={m[0],k[0]}(transA 反转),B={k[0],n[0]}(transB 反转);MX/bias/scale 等附加输入按 Matrix::CopyInMode::DN2NZ 等属性决定 scale 的 NZ 排布与 ceil(k/64)。属性键统一用 Matrix:: 限定。 | | 其它 | OP_RANGE / OP_UNIFORM / OP_VEC_DUP / OP_CUBE_CONV_D2S / OP_CUBE_CONCAT_C | 无 tensor 输入或非 vec 切,直接返回 op 级 TileShape。 | > **属性键一致性**:解析器严格对齐各 TileFunc 实际读取的键。OP_INDEX_OUTCAST/OP_ARGSORT 用裸 "axis"(与 TileFunc 一致),OP_BITSORT/OP_MRGSORT/OP_GATHER/... 用 OP_ATTR_PREFIX+"axis",reduce 单算子用 OP_ATTR_PREFIX+"AXIS"。 ## 4. 实现侧:GetOutputTileShape 与输入侧对称,按 opcode switch,**默认分支**为 ElementwiseInputVecTile(outShape, opVecTile)(逐轴 min(outShape, vecTile))。默认分支正确的前提:① op 级 VecTile 维数 == 输出维数;② 输出按 VecTile 逐轴 elementwise 切("必须 full 的轴"在合法展开下 vecTile[fullAxis] >= shape[fullAxis],min 自然得 full,故 scatter/sort/indexadd/inplace 等无需专门分支)。 需要专门分支的输出: | opcode | 输出 tile 规则 | |---|---| | OP_A_MUL_B / A_MUL_BT / A_MULACC_B / A_MULACC_BT | 输出 C 按 CubeTile 的 L0 {m[0], n[0]} 切,clamp 到真实 {M, N}(参考 SetVecTileBasedOnUbSize)。 | | TransData 6 个 | 输出是变换后 layout(C0/N0/group),输出维数 ≠ 输入维数,op 级 VecTile 维数跟输入走,逐轴 min 对不上。Handle*Format 把**整张 dstTensor** 作为 tile op 的 oOperand(非切片 View),即每个 tile op 写整份输出,故 first-cut 输出 tile = **完整 outShape**。 | | OP_PACK | 输出 1-D 字节流:outShape[0] = inShape[0]*byte。PackOperationTileFunc 产 outputShape{ min(inShape[0], tile)*byte }(tile = ∏vecTile),故 first-cut 输出 tile = {min(outShape[0], tile*byte)},byte = BytesOf(input[0])。 | | OP_PERMUTE / OP_PERMUTE_ELEMENT | 输出轴 i ← 输入轴 perm[i],op 级 VecTile 跟输入轴序,故输出 tile = **VecTile 按 perm 重排**后逐轴 clamp 到 outShape(TiledPermuteOperation:resultTileShape = PermuteTileVector(inputTile.shape, perm))。 | | OP_TRANSPOSE_MOVEOUT / MOVEIN / VNCHWCONV | 二轴转置:输出 tile = op 级 VecTile 的 shape[0]/shape[1] 两轴**互换**后 clamp 到 outShape(TiledInnerTranspose:resultTileShape = inputTile.shape 交换 shape[0]/shape[1])。 | | OP_UNPACK | 输出 1-D:outShape[0] = inShape[0]/dstByte。UnPackOperationTileFunc 产 outputShape{ min(inShape[0], vecTile[0]) / dstByte },dstByte = BytesOf(output)。 | | OP_DEINTERLEAVE_SINGLE | 末轴减半:outShape[last] = inShape[last]/2,末轴 tile = min(outShape[last], vecTile[last]/2),其余 min(两输出同形)。 | | OP_EXTRACT | 末轴不切(full),其余 min(TiledExtract 跳过末轴)——与输入侧一致。 | | OP_BITSORT / OP_MRGSORT | sort 轴(OP_ATTR_PREFIX+"axis")不切(full),其余 min(TiledBitSort/TiledMrgSort 跳过 sort 轴)——与输入侧一致。 | | OP_GATHER_MASK_BUILDIN | 末轴按 patternMode 缩:mode 1/2 → vecTile/2,mode 3-6 → vecTile/4,其余 vecTile;其它轴 min。 | | OP_CUBE_CONV_D2S / OP_CUBE_CONCAT_C | OpCalcType::CONV 且无注册 TileFunc,不被 ExpandFunction 展开,tiling 由 ConvTile 驱动——**不在本解析器职责内**,返回 op 级 TileShape 作安全占位(tensor-graph 路径不会调到)。 | **走默认分支的代表性类目**(已逐一核对 TileFunc 源码): - **elementwise**:Add/Div/Cast/Expand/Axpy/Where/OneHot/PReLU … - **reduction**:tensor-graph reduce 算子恒把 reduce 轴置为 dim 1(ProcessResultShape 把 keepDim=false 的 squeeze 放到**独立的 OP_RESHAPE** 里做,而 OP_RESHAPE 不是 tensor op),故 min(1, vecTile[axis]) = 1,默认分支正确——**keepDim=false 不是缺口**。 - **gather/scatter/topk**:op 级 VecTile 维数已与输出维数对齐,默认 min 即可。 - **cumsum/cumprod/interleave/pad/fillpad/quantize/dequantize/expand_exp_dif**:输出按 min(outShape, vecTile) 逐轴切,默认即可。 - **生成型 1-D 算子 OP_RANGE / OP_UNIFORM / OP_VEC_DUP**:TiledRange/TiledUniformBuildIn/TiledFull 各自按 vecTile[0] 切 1-D 输出,正是 min(outShape[0], vecTile[0])——**归入默认分支**(原先误放到"返回 op 级"分支,已修正)。 ## 5. 测试方案 framework/tests/ut/interface/src/operation/test_tile_shape_resolver.cpp **核心思想**:用 DSL 在 FUNCTION{} 里建**单算子** tensor graph,让算子吃 TileShape::Current();展开前用 resolver 算"期望"的 per-input/per-output tile,展开后扫 tile op 找首个消费/产出对应 RawTensor 的 View 取"实际"first-cut tile,逐 operand 比对。 **harness 关键点**: 1. **输出 Tensor 提到 FUNCTION{} 外持有**——其底层 LogicalTensor 因此存活,可被 harness 捕获身份。 2. **oOperand 补挂**:本 harness 语境下 tensor-graph 算子的 oOperand 在展开前还是空的(输出要等展开流水线里才挂上)。harness 在 op->GetOOperands() 为空时把 fixture 提供的输出 LogicalTensor 挂上去——这正是 ExpandFunction/TileFunc 实际消费的输出;inplace 算子(oOperand 已非空 {self})则不动。 3. **展开失败显式断言**:ASSERT_NE(expandFunction.RunOnFunction(*fn), Status::FAILED),避免展开失败被后续扫描误判为 tile 形状不匹配。 4. **RawTensor 身份匹配**:LogicalTensor::View 共享底层 RawTensor,故输入/输出身份用 GetRawTensor().get() 唯一标识。 **覆盖 26 个 representative fixture**:elementwise(Div/Where/OneHot/Cast/Expand/Axpy)、permute(Permute_AxisSwap,**判别性** fixture:默认分支会产 {2,4,8},正确分支产 {4,2,8})、gather/scatter(Gather/Scatter/GatherElements/ScatterElement)、index(IndexAdd/IndexAddUb)、reduce 单算子(Sum/Amax/Amin/Prod/ArgMax/ArgMin 6 个)、rowexp(RowExpMax/RowExpSum,手动构建)、sort(MrgSort/BitSort/Extract)、topk(TopK 双输出)、prelu。多输出用 std::tie,inplace 用 self 作输出,手动构建用外部 Tensor out。 See merge request: cann/pypto!5126 | 4 months ago | |
fix(machine): fix log level mismatch, magic number and grammar errors Co-authored-by: chai-hw<chaizhengtong@huawei.com> # message auto-generated for no-merge-commit merge: !5720 merge pyptolog_fix2 into master fix(machine): fix log level mismatch, magic number and grammar errors Created-by: chai-hw Commit-by: chai-hw Merged-by: cann-robot Description: 日志规范性整改 See merge request: cann/pypto!5720 | 3 months ago |
| Files | Last commit | Last update |
|---|---|---|
| 2 months ago | ||
| 3 months ago | ||
| 2 months ago | ||
| 4 months ago | ||
| 4 months ago | ||
| 3 months ago | ||
| 2 months ago | ||
| 2 months ago | ||
| 2 months ago | ||
| 2 months ago | ||
| 4 months ago | ||
| 2 months ago | ||
| 2 months ago | ||
| 2 months ago | ||
| 2 months ago | ||
| 2 months ago | ||
| 2 months ago | ||
| 2 months ago | ||
| 2 months ago | ||
| 2 months ago | ||
| 2 months ago | ||
| 3 months ago | ||
| 2 months ago | ||
| 4 months ago | ||
| 3 months ago |