원클릭으로
ascendc-precision-debug
AscendC direct-invoke 精度失败修复索引:输出全 0/随机值、DataCopy 对齐、EnQue/DeQue 同步、FP16/FP32 精度、Cast RoundMode、DumpTensor 分段定位。
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
AscendC direct-invoke 精度失败修复索引:输出全 0/随机值、DataCopy 对齐、EnQue/DeQue 同步、FP16/FP32 精度、Cast RoundMode、DumpTensor 分段定位。
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
AscendC direct-invoke 崩溃/挂起修复索引:Kernel timeout、hang、Segmentation Fault、aic error、buffer 死锁、plog/memcheck 调试。
AscendC direct-invoke 工程契约:WA 使用 kernel.py + ascendc_op/,ModelNew 调用 torch.ops.npu.*,adapter 负责复制工程、CMake 构建和 npu-arch patch。适用于 dsl=ascendc 的 autoresearch 任务。
把注册式 AscendC 算子迁移为 direct-invoke 工程的保真原则:kernel 算法和 tiling 公式不乱改,只替换注册框架胶水、入口 ABI、host launch 与 PyTorch extension。
CATLASS TileShape 与 on-chip 缓存容量约束:L1/L0A/L0B/L0C 预算公式、fp16/fp32 Pingpong 双缓冲、512B 对齐与排布对 Tile 选型的影响。调参前必读。
CATLASS Gemm 性能调优:DispatchPolicy、Tile 与分核负载均衡、Swizzle、何时用 padding/Split-K/Preload。面向 AR 修改 catlass_kernel.asc 中的类型别名。
CPU C++ 算子核心概念、标准结构模式、KernelBench 代码规范和内嵌扩展方法
| name | ascendc-precision-debug |
| description | AscendC direct-invoke 精度失败修复索引:输出全 0/随机值、DataCopy 对齐、EnQue/DeQue 同步、FP16/FP32 精度、Cast RoundMode、DumpTensor 分段定位。 |
Use this when WA reports correctness failure for dsl=ascendc.
rm -rf ascendc_op/build
In WA, the adapter also cleans per-iteration build directories, but stale local manual runs can still confuse inspection.
| Symptom | Likely Cause | Check |
|---|---|---|
| output all zeros | output never written, wrong queue, stale binary | CopyOut, VECOUT queue, rebuild |
| random output | missing DMA sync or uninitialized UB | EnQue/DeQue, PipeBarrier, buffer init |
| small shapes fail | non-32B aligned copy | use DataCopyPad or explicit tail handling |
| tail case fails | tile/tail math mismatch | tailNum, last-core length, mask |
| FP32 passes, FP16/BF16 fails | half precision intermediate | cast to FP32 for sensitive math |
| Cast output wrong | wrong round mode | half->float CAST_NONE; float->half CAST_ROUND |
| BF16 passes but FP16 fails | range/precision or API fallback difference | inspect dtype branches and thresholds |
| code change has no effect | .so not rebuilt or wrong .so loaded | remove build/, make _load() choose correct library |
DMA is asynchronous. Allocating a LocalTensor does not mean the data copy has
finished.
For queue-based MemBase code, the common shape is:
AscendC::DataCopy(local, gm, len);
queue.EnQue(local);
auto ready = queue.DeQue<T>();
// compute on ready
queue.FreeTensor(ready);
If code uses DataCopy without EnQue/DeQue, add the proper queue handoff or
a targeted PipeBarrier<PIPE_*> when queue structure is not appropriate.
DataCopyPad for non-aligned GM/UB movement.blockDim to the tiling struct and kernel's GetBlockIdx() logic.When ordinary inspection fails, insert temporary instrumentation at the stage boundaries:
CopyInComputeCopyOutUse unique tags or desc IDs per stage, then compare against a CPU/PyTorch golden for the same failing shape. Remove instrumentation before final submission.
framework_output is produced by reference.py; match shape and dtype exactly.ModelNew.forward() should return a tensor or tuple/list of tensors, not a
debug object..so, fix build/load first; do not
change math.