ascendc-hardware-tiling

Guides AscendC kernel tiling design covering UB/L1/L0 capacity, DataCopy alignment, and block/tail computation.

6|1|Updated Apr 19, 2026
One-click install
npx skills add https://github.com/xchang1121/op-autoresearch --skill ascendc-hardware-tiling-xchang1121
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: ascendc-hardware-tiling
Source: https://github.com/xchang1121/op-autoresearch/tree/main/skills/ascendc/fundamentals/ascendc-hardware-tiling
Command: npx skills add https://github.com/xchang1121/op-autoresearch --skill ascendc-hardware-tiling-xchang1121

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Writing AscendC kernels that stay correct and performant across many shapes requires consistent tiling decisions, and ad-hoc hardcoded chip parameters, misaligned DataCopy lengths, or broken queue pairing cause subtle correctness and performance bugs. ## Core Features & Use Cases - Hardware capacity rules: Defines how to budget UB, L1, L0A/L0B, and L0C buffers and how to split work between Vector and Cube cores on Atlas A2/A3/A5 devices. - Tiling contract and formulas: Specifies a stable host/kernel TilingData struct, mode-based dispatch, and safe block/tail formulas including early return and zero-length tail handling. - Alignment and pipeline invariants: Documents 32B alignment rules, DataCopyPad tail paths, and AllocTensor/FreeTensor plus EnQue/DeQue pairing checks. - Use Case: When batch-developing multiple operators (elementwise, broadcast, reduction), reuse one tiling skeleton per operator class and only change semantic points like dtype branches, reduce axes, and tail strategy. ## Quick Start Ask the agent to design the host tiling struct and device-side block/tail partitioning for a new AscendC elementwise kernel that must handle both aligned and tail shapes.

Frequently Asked Questions about ascendc-hardware-tiling

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I design tiling for an AscendC kernel across multiple shapes?▼

Classify the operator (elementwise, broadcast, reduction, indexed, matmul-like, fused) and reuse one tiling skeleton per class. Add a mode field to TilingData chosen on the host from dtype, rank, stride, and broadcast semantics, then branch on mode at the outer level in device code.

How to compute block and tail sizes in AscendC kernels?▼

Use core_num = min(max_cores, ceil_div(total, min_work_per_core)), then work_per_core = ceil_div(total, core_num). Each core computes core_start and core_len = min(work_per_core, total - core_start), returns early if core_start >= total, and skips tail copy when tail_len is zero.

What alignment does DataCopy require on Ascend hardware?▼

GM/UB transfers should use 32B-aligned tile sizes. For non-32B-aligned data, use DataCopyPad or a dedicated tail path, and offset hot LocalTensors by at least 32B to avoid UB bank conflicts.

Why does my AscendC kernel hang or corrupt data with queues?▼

Queue bugs usually come from unbalanced pairing: every AllocTensor needs a FreeTensor and every EnQue a matching DeQue, including in tail branches. Also avoid excess PipeBarrier calls, which destroy overlap unless a real data dependency exists.

Should tiling parameters be hardcoded for Atlas A2/A3/A5 chips?▼

No. Query chip parameters through the SDK when available, or centralize constants in one helper if the seed provides them. Scattered hardcoded values make kernels fragile across hardware variants.

When should generic index mapping be used in AscendC kernels?▼

Generic index mapping with div/mod and multi-level stride computation should only be a fallback path. Prefer specialized modes like same-shape flattening or last-dim broadcast for performance, keeping generic mode for full semantic coverage.