| Files | Last commit | Last update |
|---|---|---|
fix(operation): Change EVENT_ID7 to EVENT_ID0 in tileop Co-authored-by: junnyleo<lijun580@huawei.com> # message auto-generated for no-merge-commit merge: !4840 merge fix/eventid into master fix(operation): Change EVENT_ID7 to EVENT_ID0 in tileop Created-by: junnyleo Commit-by: junnyleo Merged-by: cann-robot Description: 统一tileop核内event_id为event_id0 Related Issue: [#2626](https://gitcode.com/cann/pypto/issues/2626) See merge request: cann/pypto!4840 | 4 months ago | |
style(all): Simplify pre-commit config and update release scope | 4 months ago | |
style(all): Remove trailing whitespace and add missing EOF newlines | 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 | |
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 | |
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 | |
feat(machine): Remove tile_fwk_runtime_stub and all BUILD_WITH_CANN branch from tile_fwk_runtime Co-authored-by: arthur_morgan_hw<lipeijie@huawei.com> # message auto-generated for no-merge-commit merge: !1724 merge br_compiler into master feat(machine): Remove tile_fwk_runtime_stub and all BUILD_WITH_CANN branch from tile_fwk_runtime Created-by: arthur_morgan_hw Commit-by: arthur_morgan_hw Merged-by: cann-robot Description: PR 应该避免没有描述信息, 描述信息的最重要的作用是描述修改意图,应该清晰明了. 例如: 标题中包含了 fix 标签, 如果没有描述信息,就需要Review人员猜测PR具体修复了哪些内容,或者怀疑修改的必要性. 如果PR和特定的Issue相关,可以单独包含一行 Related Issue: 放到描述信息最后. 下面是一个典型的PR描述信息: The origin issue template brings too many noise, it's not suitable for git message. eg: comments are not removed, labels are redundant as the PR tile already contains the tag. The guide gives a clear suggestion on how to write the PR body. Related Issue: #1234,#5678 更多描述信息见:[Commit Message 规范](https://gitcode.com/cann/pypto/blob/master/docs/contribute/pull-request.md#commit-message) See merge request: cann/pypto!1724 | 7 months ago | |
feat(machine): Stitch enhanced Co-authored-by: gaoxingwang<camuel.gao@huawei.com> # message auto-generated for no-merge-commit merge: !3602 merge refactor_stitch into master feat(machine): Stitch enhanced Created-by: gaoxingwang Commit-by: gaoxingwang Merged-by: cann-robot Description: # SRS设计文档:Cell Match Stitch Enhanced(简洁版) ## 1. 概述 ### 1.1 文档目的 基于commit 0f284fe的Cell Match机制增强设计,涵盖: - encode编译阶段的Cell内存评估 - dev运行时的Cell Update逻辑 - 基于Cell的Stitch依赖建立逻辑 ### 1.2 核心概念 - **Cell Match Table**: 按空间区域划分的依赖追踪表 - **Operation Type**: NORMAL_WRITE(互斥写)、ATOMIC_WRITE(原子写)、READ(读) - **Mutex关系**: 异类型互斥;同类型仅NORMAL_WRITE互斥 - **TagID**: 生命周期验证机制 --- ## 2. Cell内存布局 ### 2.1 内存结构 mermaid graph TB subgraph CellMemory["Cell Memory Layout"] Meta["Metadata Control Word<br/>uint64[0]<br/>bit[0-3]: CurOpType<br/>bit[4-7]: PrevMutexType<br/>bit[8-15]: CurOpCount<br/>bit[16-23]: PrevMutexCount<br/>bit[32-63]: TagID"] NormalWrite["Normal-Write Op-ID<br/>uint64[1]<br/>Capacity: 1"] AtomicWrite["Atomic-Write Op-ID List<br/>uint64[2-129]<br/>Capacity:0 ~ 128"] Read["Read Op-ID List<br/>uint64[130-255]<br/>Capacity: 0 ~ 128"] end Meta --> NormalWrite --> AtomicWrite --> Read style Meta fill:#f9f,stroke:#333 style NormalWrite fill:#9ff,stroke:#333 style AtomicWrite fill:#ff9,stroke:#333 style Read fill:#9f9,stroke:#333 ### 2.2 Operation Type定义 | OpType | 容量 | Mutex规则 | |--------|------|-----------| | NORMAL_WRITE | 1 | 同类型互斥,异类型互斥 | | ATOMIC_WRITE | 128 | 同类型非互斥,异类型互斥 | | READ | 128 | 同类型非互斥,异类型互斥 | --- ## 3. Encode编译阶段:Cell内存评估 ### 3.1 评估流程 mermaid flowchart TD Start["开始 Encode"] AnalyzeOutcast["分析 Outcast Producer<br/>识别 Atomic Write"] CalcCellShape["计算 Cell Shape<br/>tensor shape GCD"] CheckAtomic["检查 Atomic Write"] SetCacheConfig["设置容量<br/>[NORMAL=1, ATOMIC=0/128, READ=count]"] CalcTableSize["计算 Table Size<br/>cellNum × cellUint64Size"] CheckDynShape{"动态Shape?"} DynPath["运行时动态分配"] StaticPath["静态分配 Table"] End["完成"] Start --> AnalyzeOutcast --> CalcCellShape --> CheckAtomic --> SetCacheConfig --> CalcTableSize --> CheckDynShape CheckDynShape -->|Yes| DynPath --> End CheckDynShape -->|No| StaticPath --> End style Start fill:#9f9 style End fill:#9f9 style CheckDynShape fill:#ff9 ### 3.2 内存预算公式 TableSize = CellCount × cellUint64Size × 8 bytes cellUint64Size = 1 + NormalCount + AtomicCount + ReadCount --- ## 4. Dev运行时:Cell Update逻辑 ### 4.1 Update流程 mermaid flowchart TD Start["UpdateSlots 开始"] Prepare["准备 Dynamic Table"] Iterate["遍历 Producer/Consumer"] CalcCell["计算 Cell Index<br/>offset/cellShape"] Fill["Fill Cell<br/>写入 Op-ID"] CheckMutex{"是否互斥?"} Mutex["Mutex Update:<br/>CurOpType=新类型<br/>PrevMutex=旧类型<br/>Count=1"] Concurrent["Concurrent Update:<br/>Count+=1"] UpdateMeta["更新 Metadata"] End["完成"] Start --> Prepare --> Iterate --> CalcCell --> Fill --> CheckMutex CheckMutex -->|Yes| Mutex --> UpdateMeta --> End CheckMutex -->|No| Concurrent --> UpdateMeta --> End style Start fill:#9f9 style End fill:#9f9 style CheckMutex fill:#ff9 style Mutex fill:#f99 style Concurrent fill:#9ff --- ## 5. Dev运行时:Stitch逻辑 ### 5.1 Stitch流程 mermaid flowchart TD Start["Stitch 开始"] Iterate["遍历 Consumer/Producer"] CheckPartial{"Partial Update?"} Partial["PartialStitch<br/>CellMatchHandle"] Full["FullCoverStitch"] CheckTagID{"TagID匹配?"} CheckMutex{"CurOpType互斥?"} EstablishCur["建立依赖<br/>CurActiveOpType"] EstablishPrev["建立依赖<br/>PrevMutexType"] End["完成"] Start --> Iterate --> CheckPartial CheckPartial -->|Yes| Partial --> CheckTagID CheckPartial -->|No| Full --> End CheckTagID -->|No| End CheckTagID -->|Yes| CheckMutex CheckMutex -->|Yes| EstablishCur --> End CheckMutex -->|No| EstablishPrev --> End style Start fill:#9f9 style End fill:#9f9 style CheckPartial fill:#ff9 style CheckTagID fill:#ff9 style CheckMutex fill:#ff9 --- ## 6. 依赖场景示例 ### 6.1 场景定义 | 场景 | 描述 | Mutex关系 | |------|------|-----------| | **连续写后写(WAW)** | 多写操作连续写入 | W1→W2→W3 | | **写后多次读(RAW)** | 一写后多读 | W→R1,R2,R3 | | **多次读后再写(WAR)** | 多读后一写 | R1,R2,R3→W | | **写后多次atomic读** | 一写后多atomic读 | W→AR1,AR2 | ### 6.2 连续写后写(WAW) #### Update阶段 mermaid graph LR S0["Initial<br/>NONE"] -->|"W1"| S1["NORMAL<br/>Count=1<br/>[W1]"] S1 -->|"W2 Mutex"| S2["NORMAL<br/>Count=1<br/>Prev: W1<br/>[W2]"] S2 -->|"W3 Mutex"| S3["NORMAL<br/>Count=1<br/>Prev: W2<br/>[W3]"] style S0 fill:#fff style S1 fill:#9ff style S2 fill:#ff9 style S3 fill:#f9f #### Stitch依赖建立 mermaid graph LR W1 -->|"PrevMutex=W1"| W2 -->|"PrevMutex=W2"| W3 style W1 fill:#9ff style W2 fill:#ff9 style W3 fill:#f9f ### 6.3 写后多次读(RAW) #### Update阶段 mermaid graph LR S0["NONE"] -->|"W"| S1["NORMAL<br/>[W]"] S1 -->|"R1 Mutex"| S2["READ<br/>Prev: W<br/>[R1]"] S2 -->|"R2 Concurrent"| S3["READ<br/>Count=2<br/>[R1,R2]"] S3 -->|"R3 Concurrent"| S4["READ<br/>Count=3<br/>[R1,R2,R3]"] style S0 fill:#fff style S1 fill:#9ff style S2 fill:#ff9 style S3 fill:#9f9 style S4 fill:#f9f #### Stitch依赖建立 mermaid graph TB W -->|"PrevMutex=W"| R1 W -->|"PrevMutex=W"| R2 W -->|"PrevMutex=W"| R3 style W fill:#9ff style R1 fill:#9f9 style R2 fill:#9f9 style R3 fill:#9f9 ### 6.4 多次读后再写(WAR) #### Update阶段 mermaid graph LR S0["NONE"] -->|"R1"| S1["READ<br/>[R1]"] S1 -->|"R2 Concurrent"| S2["READ<br/>[R1,R2]"] S2 -->|"R3 Concurrent"| S3["READ<br/>[R1,R2,R3]"] S3 -->|"W Mutex"| S4["NORMAL<br/>Prev: R1,R2,R3<br/>[W]"] style S0 fill:#fff style S1 fill:#9f9 style S2 fill:#9f9 style S3 fill:#9f9 style S4 fill:#f99 #### Stitch依赖建立 mermaid graph TB R1 -->|"PrevMutex=R1,R2,R3"| W R2 --> W R3 --> W style R1 fill:#9f9 style R2 fill:#9f9 style R3 fill:#9f9 style W fill:#f99 ### 6.5 写后多次atomic读 #### Update阶段 mermaid graph LR S0["NONE"] -->|"W"| S1["NORMAL<br/>[W]"] S1 -->|"AR1 Mutex"| S2["ATOMIC<br/>Prev: W<br/>[AR1]"] S2 -->|"AR2 Concurrent"| S3["ATOMIC<br/>Count=2<br/>[AR1,AR2]"] S3 -->|"AR3 Concurrent"| S4["ATOMIC<br/>Count=3<br/>[AR1,AR2,AR3]"] style S0 fill:#fff style S1 fill:#9ff style S2 fill:#ff9 style S3 fill:#9f9 style S4 fill:#f9f #### Stitch依赖建立 mermaid graph TB W -->|"PrevMutex=W"| AR1 W -->|"PrevMutex=W"| AR2 W -->|"PrevMutex=W"| AR3 style W fill:#9ff style AR1 fill:#ff9 style AR2 fill:#ff9 style AR3 fill:#ff9 --- ## 7. 性能考量 ### 7.1 内存开销 - 典型配置:cellUint64Size = 258(支持128 atomic + 128 read) ### 7.2 计算开销 - Update:O(ProducerCount + ConsumerCount) - Stitch:O(MatchCount × AvgOpCount) ### 7.3 优化策略 - 动态shape按需分配 - 并发操作合并计数 - TagID生命周期隔离 --- ## 8. 测试覆盖 ### 8.1 单元测试 - CellMemLayOutCalculation:内存布局计算 - MetadataBitManipulation:位操作正确性 - MutexOperationDetection:mutex判断逻辑 - OpIdManagement:op-id读写 ### 8.2 集成测试 - WAW:5次连续写 - RAW:1写后2读 - WAR:3读后1写 --- ## 9. 核心设计原则 1. **Mutex规则明确**:NORMAL_WRITE自互斥,ATOMIC_WRITE/READ自并发 2. **状态跟踪完整**:CurOp + PrevMutex双状态记录 3. **生命周期隔离**:TagID机制确保依赖在同一slot生命周期内 --- **文档版本**: v1.0-simple **基于commit**: 0f284fe2 **生成时间**: 2026-05-30 See merge request: cann/pypto!3602 | 5 months ago |
| Files | Last commit | Last update |
|---|---|---|
| 4 months ago | ||
| 4 months ago | ||
| 4 months ago | ||
| 4 months ago | ||
| 4 months ago | ||
| 4 months ago | ||
| 7 months ago | ||
| 5 months ago |