Closed
[Documentation|文档反馈]: aclnnQuantCompressor 资料把 stateBlockTableOptional 标为可选,实际传空指针返回 561002 #6824
liuhanwen8Add on 19 days agoClosed at 11 days ago
19 days ago Added label: documentation
周云飞
19 days ago Comments:
19 days ago Comments:
感谢您提供详细的环境、调用参数和对照分析。
您报告的结果表明,在 Ascend950PR、CANN 9.2.0-beta.2、源码基线 f3f3135a 的这组 cacheMode=1 输入下,stateBlockTableOptional 传入 nullptr 会导致 aclnnQuantCompressorGetWorkspaceSize 返回 561002,与参数表中未附条件的“可选输入”说明存在冲突。不过,这一结果还不能直接推广为所有模式下该参数都必选。
按您提供的两处检查逻辑,CheckSingleParaStateBlockTable 接受空描述符,并不代表完整的 tiling 流程允许缺省该参数:如果 CheckRequiredInOutExistence 仍将其作为必选张量检查,调用依然可能被拒绝。这可以解释两处判空口径为何会产生您描述的现象,但具体失败位置及其与公开返回码 561002 的对应关系仍需确认。现有调用示例创建并传入了非空的 stateBlockTable,未展示省略该参数的用法。
调整方向需要先明确缺省时的合法语义。如果相关模式依赖该映射表,应在文档中明确必选条件,以及 cacheMode=1 的 [B, ceil(Smax/block_size)]、cacheMode=2 的 [B] 形状要求,并统一两处检查的说明。如果确实需要支持不传,则不能只移除必选检查,还需确认后续缓存寻址如何处理缺省情况,避免将空指针直接解释为“不做页表映射”而导致错误访问。
当前使用时,建议先沿用示例显式传入与实际缓存布局匹配的映射表;这只是规避空参路径的建议,不代表已验证您这组输入的完整执行结果。我们会继续确认该参数的必选条件及文档与实现应如何对齐。


18 days ago Assign wangss21 as responsible person
11 days ago Close issue
11 days ago Added label: resolved
Document Link(文档链接)
https://gitcode.com/cann/ops-transformer/blob/master/attention/quant_compressor/docs/aclnnQuantCompressor.md
Issues Section(问题文档片段)
参数表(aclnnQuantCompressorGetWorkspaceSize):
Existing Issues(存在的问题)
资料把
stateBlockTableOptional标为可选输入,但实测在其余参数全部合法时传nullptr,aclnnQuantCompressorGetWorkspaceSize返回 561002(ACLNN_ERR_INNER_TILING_ERROR),调用无法进行。即该参数实际是必选。对照事实:同一份实现在
op_host/arch35/quant_compressor_tiling.cpp里有两套口径——CheckRequiredInOutExistence(约 872 行)把 stateBlockTable 列入 7 个必选张量,而CheckSingleParaStateBlockTable(约 696 行)又把desc == nullptr判为成功。资料没有说明这种差异。复现(自包含 C++,单文件):
// 关键调用:除 stateBlockTableOptional 传 nullptr 外,其余参数与合法基线一致 uint64_t wsz = 0; aclOpExecutor* ex = nullptr; int ret = (int)aclnnQuantCompressorGetWorkspaceSize( x, wkv, wgate, stateCacheRef, ape, xDescale, wkvDescale, wgateDescale, /*stateBlockTableOptional=*/nullptr, /*cuSeqlens=*/nullptr, /*seqused=*/nullptr, startPos, /*quantMode=*/1, /*cmpRatio=*/4, /*coff=*/2, /*cacheMode=*/1, /*stateCacheStrideDim0=*/262144, cmpKvOut, &wsz, &ex); printf("ret=%d\n", ret); // 实测 561002f3f3135a。stateBlockTableOptional=nullptr -> GetWorkspaceSize ret=561002。建议:要么在参数表把
stateBlockTableOptional改为必选(并说明 cacheMode 1/2 各自的 shape 约束),要么放开 tiling 侧必选检查并在资料写明"不传时不做 state_cache 页表映射"的语义。两种改法都需与CheckSingleParaStateBlockTable的现有判空口径对齐。