Closed
[Documentation|文档反馈]: 《aclnnMaxPool》A2/A3 约束说明未写明 4 维 ND 入参的实际限制(实测 561103) #7881
liuhanwen8Add on 21 days agoClosed at 4 days ago
21 days ago Added label: bug-report
20 days ago Assign gitee-duhuiping as responsible person
yuning_chen
20 days ago Comments:
20 days ago Comments:
yuning_chen
20 days ago Comments:
20 days ago Comments:
您好,该问题已收到,当前问题 @gitee-duhuiping 正在处理中


20 days ago Removed responsible person gitee-duhuiping
20 days ago Assign gitee-duhuiping as responsible person
20 days ago Removed responsible person gitee-duhuiping
20 days ago Assign yuhao_ as responsible person
yuning_chen
20 days ago Comments:
20 days ago Comments:
您好,该问题已收到,当前问题 @yuhao_ 正在处理中


19 days ago Removed responsible person yuhao_
19 days ago Assign cjz_ as responsible person
11 days ago Assign yu-xinjie62 as responsible person, remove original responsible person: cjz_
11 days ago Assign yu-xinjie62 as responsible person, remove original responsible person: cjz_
11 days ago Removed responsible person yu-xinjie62
11 days ago Assign cjz_ as responsible person
陈俊卓
4 days ago Comments:
4 days ago Comments:
已修改


4 days ago changed custom state from 进行中 to 已完成
4 days ago Close issue
3 days ago Added label: resolved
现象
aclnnMaxPool在 4 维 + ND 格式 入参下第一段返回561103(实测GetWorkspaceSize = 561103),plog 的拒绝点固定为
TransData not support: ND -> NC1HWC0;同一 4 维 shape 改用NCHW描述符则正常返回 0,3 维 ND 也正常。
[2,8,8]fp32[2,2,8,8]fp32[2,2,8,8]fp32期望
《aclnnMaxPool》参数表中
self的格式列为ND、维度列为3-4;而 A2/A3 的「约束说明」分组段目前只写了数据类型例外(不支持 BFLOAT16/整型),没有说明
4 维 ND 的实际约束。
希望在该分组段补一句可执行的限制说明,二选一:
ND:修复ExecMaxPoolV3的 4 维路径(先ReFormat到 NCHW 再Selfto5HDProcess);ND:在 A2/A3 约束说明写明「4 维入参需使用 NCHW 描述符」。不论哪种,当前资料让调用方无法预知 4 维 ND 会失败。
环境
npu-smi26.1.1cann/ops-nna61e016a71f422cb280af0c024975f13629ca100(master)复现步骤
repro.cppg++ -std=c++17 -O2 repro.cpp -o repro -I$ASCEND_HOME_PATH/include -L$ASCEND_HOME_PATH/lib64 -lascendcl -lopapi -lnnopbase./repro对照组均为GetWorkspaceSize = 0,缺陷组 4D ND行为561103复现脚本
// aclnnMaxPool 4 维 ND 输入最小复现 // g++ -std=c++17 -O2 repro.cpp -o repro -I$ASCEND_HOME_PATH/include \ // -L$ASCEND_HOME_PATH/lib64 -lascendcl -lopapi -lnnopbase #include <aclnnop/aclnn_max_pool.h> #include <acl/acl.h> #include <cstdio> #include <vector> static aclTensor* mkT(void* p, std::vector<int64_t> sh, aclFormat fmt) { std::vector<int64_t> st(sh.size()); int64_t acc = 1; for (int i = (int)sh.size() - 1; i >= 0; --i) { st[i] = acc; acc *= sh[i]; } return aclCreateTensor(sh.data(), sh.size(), ACL_FLOAT, st.data(), 0, fmt, sh.data(), sh.size(), p); } static int run(const char* tag, std::vector<int64_t> inShape, aclFormat fmt) { std::vector<int64_t> outShape = inShape; outShape[outShape.size() - 1] /= 2; outShape[outShape.size() - 2] /= 2; aclrtStream s; aclrtCreateStream(&s); size_t inB = 4, outB = 4; for (auto v : inShape) inB *= (size_t)v; for (auto v : outShape) outB *= (size_t)v; void* dIn = nullptr; void* dOut = nullptr; aclrtMalloc(&dIn, inB, ACL_MEM_MALLOC_HUGE_FIRST); aclrtMalloc(&dOut, outB, ACL_MEM_MALLOC_HUGE_FIRST); aclTensor* in = mkT(dIn, inShape, fmt); aclTensor* out = mkT(dOut, outShape, fmt); std::vector<int64_t> k{2, 2}, st{2, 2}, pd{0, 0}, dl{1, 1}; aclIntArray* ak = aclCreateIntArray(k.data(), 2); aclIntArray* as = aclCreateIntArray(st.data(), 2); aclIntArray* ap = aclCreateIntArray(pd.data(), 2); aclIntArray* ad = aclCreateIntArray(dl.data(), 2); uint64_t ws = 0; aclOpExecutor* ex = nullptr; int r1 = (int)aclnnMaxPoolGetWorkspaceSize(in, ak, as, 0, ap, ad, 0, out, &ws, &ex); int r2 = -1; if (r1 == 0) { aclnnMaxPool(nullptr, 0, ex, s); r2 = 0; aclrtSynchronizeStream(s); } printf("[%s] GetWorkspaceSize = %d execute = %d\n", tag, r1, r2); return r1; } int main() { aclInit(nullptr); aclrtSetDevice(0); run("对照组 3D ND 2x8x8", {2, 8, 8}, ACL_FORMAT_ND); run("缺陷组 4D ND 2x2x8x8", {2, 2, 8, 8}, ACL_FORMAT_ND); run("对照组 4D NCHW 2x2x8x8", {2, 2, 8, 8}, ACL_FORMAT_NCHW); aclrtResetDevice(0); aclFinalize(); return 0; }实测输出:
影响
按资料以
ND传 4 维(含 batch,最常见形态)时调用方会在第一段接口失败,且资料未给出NCHW规避方式,只能靠读实现源码或试错定位。建议
修改
pooling/max_pool_v3/docs/aclnnMaxPool.md的 A2/A3 约束说明分组段;若判断属实现缺口,则改
pooling/max_pool_v3/op_api/aclnn_max_pool.cpp的ExecMaxPoolV3(实测第 480 行)。