已合并
fix(cv-ubfuse): align UB physical layout for mixed-dtype vector tensors #2177
tianbaolin创建于 9月18日
fix(cv-ubfuse): align UB physical layout for mixed-dtype vector tensors #2177
已合并
Pull Request已成功合入, 合并人@CANN-robot
(感谢 tianbaolin 的贡献)9月18日 添加了label:enhancement
9月18日 创建了 pull request,commit 0b11fa18
9月18日 添加了label:stat/needs-squash
9月18日 添加了label:cann-cla/yes
CANN-robot
9月18日 评论:
9月18日 评论:
Thanks for your pull-request.
The full list of commands accepted by me can be found at here.
You can get sig-info at here.
You can self-configure the PR merge rules for this repository. For more details, please refer to Here.
For more, you also can visit HICANN.
PR Approval Progress
✅ Congratulations! All modules have met the lgtm and approve requirements.
Module Approval Details
| module | lgtm status | approve status |
|---|---|---|
| repo-cann/graph-autofusion | ✅ yangyongqiang0606, xuyafei, wangxiaotian995 (3/2) | ✅ yangyongqiang0606 (1/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
tianbaolin, thanks for your pull request. All authors of the commits have signed the CLA. 👍


此处折叠了132条消息 查看更多
wangxiaotian995
28 天前 评论:
28 天前 评论:
/lgtm


28 天前 添加了label:lgtm
yangyongqiang
28 天前 评论:
28 天前 评论:
/approve


28 天前 添加了label:approved
28 天前 合入了pull request
Problem
In CV UBFuse kernels the epilogue consumes the cube output by rows (
stageM * blockShapeNAlign) while queue tensors were still sized by the flat element budget (a0a1t), and 1D flat APIs were used for mixed-dtype vector stages. When tensor row strides differ by dtype (e.g. bool rows are 32B-aligned while float rows are not), the flat interpretation reads/writes wrong addresses and the queue allocation can be smaller than the real per-stage footprint, which corrupts results (scattered mismatches) or overflows UB (aicore exception).Fix
Keeps the three-size contract (UB allocation >= UB compute size >= valid data size):
Tiling
basen_alignaligns to 32 elements, so it is the supremum of every dtype 32B-aligned row width;cube_ub_stage_sizekeeps cube-dtype element semanticscube_m_stage_size(max stage rows); after the solver picksSTAGE_SIZE_NAMEit is overwritten withSTAGE_SIZE_NAME / basen_align, sorows * any-dtype-row-widthnever exceeds the solver per-dtype element budgetKernel init
stage_sizeunified to element count (solver budget a0a1t, falling back to cube fragment capacity for tiny stages)stage_size_type(rows) comes fromcube_m_stage_sizeon all four flows: inductor const (kConstTilingData), inductor dynamic (params), non-inductor static (kConstTilingData baked by ascbc) and non-inductor dynamic (params.cv_tiling_data)TensorSizeAssignemitslocal_size = stage_sizefor every UB tensor, so each dtype byte size equals its solver budget exactlybuf_cubesized by the pure C-fragment capacitystage_sizeswitched to element count as wellReg APIs
CvApi2DParamsgainsvalid_size/output_compute_size/input_compute_size{curAivM, curAivN}dims plus per-dtype physical row strides under CV UBFuseWhereRegApiCall::GenerateNoLoopCaseemits the 2DWhereExtendform with an independent mask stride, fixing bool-mask rows (e.g.align(N,32) != float row width) that previously went through a flat 1D callVerification
(torch.compile, forced CV fusion, Ascend950PR):
stage_sizeelement semanticsTF non-inductor static-flow fixes (follow-up commit 5a48b96e)
The rework broke TF static-shape kernel compilation (and exposed two latent
misalignments):
params.cv_tiling_data->cube_m_stage_size, but TF/GE online-compiled staticgraphs have neither
INDUCTOR_CONST_TILING_DATAnor thecv_tiling_dataParams member (
is_dynamic=false), failing withno member named 'cv_tiling_data' in 'AutoFusionVector::Params'.Now reads the baked solver budget (
AutofuseTilingData::STAGE_SIZE_NAME)and derives stage rows as
stage_size_name / basen_align(conv2d-branchpattern).
ub_align_value = 32 / cube_output_type_size; aligned to 32 elements tomatch the kernel-side supremum row width.
TF E2E (GE AutoFuse,
--autofuse_enable_pass=matmul, Ascend950PR):matmul+abs now compiles and runs; 128x128x128 completes with results within
half-cast precision. Note: 28-block (large-shape) MIX launches still
deadlock in the GE/fftsplus dispatch (block group 13 never scheduled) —
tracked separately, not addressed by this PR.
TF non-inductor static-flow fixes (follow-up commit 5a48b96e)
TF E2E (GE AutoFuse, --autofuse_enable_pass=matmul, Ascend950PR): matmul+abs now compiles and runs; 128x128x128 completes within half-cast precision. Note: 28-block (large-shape) MIX launches still deadlock in the GE/fftsplus dispatch (block group 13 never scheduled) - tracked separately, not addressed by this PR.