当前位置: 首页 > news >正文

cann/cannbot-skills尾安全约束

Tail-Safety Constraints

【免费下载链接】cannbot-skillsCANNBot 是面向 CANN 开发的用于提升开发效率的系列智能体,本仓库为其提供可复用的 Skills 模块。项目地址: https://gitcode.com/cann/cannbot-skills

Read this file when a kernel has tile tails, odd row splits, or partial GM boundaries.

Goal

Keep tail handling correct without corrupting the stable local-tensor shape assumptions used by lowering and simulation.

1. Core rule

Applyvalid_m,valid_n, andvalid_kat GM read and write boundaries. Do not shrink local tensor shapes for every tail tile.

Repository expectation:

  • local buffers remain full tile-sized
  • only the GM boundary slices use the tail sizes

2. Why this rule exists

Stable local tensor shapes make lowering and simulator behavior predictable. If you start shrinking local buffers for tails, it becomes much easier to create shape drift between the intended logical tile and the actual staged buffer.

3. Standard cube -> vec half-row writeback pattern

For many cube -> vec kernels, use the standard half-row split:

  • half_rows = CeilDiv(valid_m, 2)
  • row_begin = GetSubBlockIdx() * half_rows
  • row_end = Min(row_begin + half_rows, valid_m)
  • row_count = row_end - row_begin

This keeps odd-row tails stable across the two vec subblocks.

4. Common symptoms of tail bugs

Tail issues often look like this:

  • aligned shapes pass but odd shapes fail
  • only the last tile is wrong
  • one vec subblock is correct and the other is garbage
  • output shape looks right but the boundary rows or columns are corrupted

When this happens, inspect the GM boundary slices first. Do not start by changing the local buffer shape.

Special case:

  • if the kernel is a normalized online softmax with runningrow_max/row_sum, GM-boundary slicing alone is not enough; invalid score columns must behave like-infbeforerowmax
  • readagent/references/constraints/online-softmax-tail.md

5. Quick checklist

Before accepting tail logic, verify:

  • valid_m,valid_n,valid_kcome from the current tile boundary
  • local buffers still use fullTILE_*shapes
  • GM load boundaries use the valid sizes
  • GM store boundaries use the valid sizes
  • vec half-row split usesCeilDivand clamps withMin
  • at least one odd-size case has been tested
  • for normalized online softmax, verify score-domain invalid columns are masked beforecmax

Files to study

  • agent/example/kernels/a5/basic_cube_vec_mix.py
  • agent/example/kernels/a5/matmul_half_splitn_bias10p2_vf.py
  • agent/example/kernels/a5/matmul_rowwise_norm.py
  • agent/example/kernels/a5/vec_cube_abs_sqrt_matmul.py
  • agent/example/kernels/a5/vec_unaligned_gm_to_ub_pad.py

【免费下载链接】cannbot-skillsCANNBot 是面向 CANN 开发的用于提升开发效率的系列智能体,本仓库为其提供可复用的 Skills 模块。项目地址: https://gitcode.com/cann/cannbot-skills

创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考

http://www.jsqmd.com/news/782860/

相关文章:

  • 11.9k Star!Claude Code PPT 神器:本机一行命令,AI 出真还能编辑!
  • 2026新疆财务凭证纸厂家对比:绿色认证资质如何影响政企采购决策 - 优质企业观察收录
  • 一个人,一台电脑,月入翻倍:她如何用AI重构“旅行路书”?
  • CANN高性能线性代数算子库
  • PathAsst:多模态生成式AI如何重塑病理诊断工作流
  • 通过curl命令诊断大模型API连接与返回问题
  • CANN/ops-solver算子列表
  • CANN/HCOMM内存导入关闭API
  • Hermes Agent 应用场景想象
  • CANN/community PR操作指南
  • CANN/tensorflow 后续版本废弃配置
  • 我在上海滩的奋斗
  • 口碑好的四川别墅电梯哪家专业
  • 笑不活了!兰州全城上门收金,旧金变现不用跑区县,在家躺着数钱! - 金掌柜黄金回收
  • AI时代知识工作转型:从生产到批判性整合的核心能力构建
  • AI赋能材料科学:从局域结构表征到分子相互作用预测的完整实践指南
  • 基于SHAP与XAI的3D打印工艺参数优化:从黑箱预测到可解释洞察
  • CANN/pypto eq运算API文档
  • 吉林钢结构厂家实测排行:资质与性能双维度对比 - 奔跑123
  • 2026年新疆热敏收银纸、票据印刷及办公用纸一站式采购指南 - 优质企业观察收录
  • 为内部知识库问答系统集成Taotoken多模型聚合能力
  • 吉林及周边工程总承包企业综合实力排行盘点 - 奔跑123
  • CANN/pyto gathermask函数API文档
  • CANN/runtime IPC进程间内存共享
  • 2026年新疆不干胶标签及办公用纸一站式采购指南:金阳印务官方联系与深度评测 - 优质企业观察收录
  • CANN预选赛算子测试
  • CANN/Ascend C Axpy API文档
  • CANN堆叠算子接口文档
  • CANN/metadef算子简化键生成
  • PowerShell命令获取电脑sn序列号