Closed
[Requirement|需求建议]: PyPTO Pro FixPipe 随路量化统一scale参数接口 #2938
gravel1997Add on Aug 11Closed at Aug 21
Aug 11 Modify description of issue
Aug 11 Associated pull request
Aug 11 Assign gravel1997 as responsible person
Aug 11 Associated pull request
Aug 17 Associated pull request
Aug 21 changed custom state from 进行中 to 已解决
Aug 21 Close issue
Aug 24 Associated pull request
Aug 24 Associated pull request
Aug 24 Deleted associated pull request: feat(pypto_pro): support phase param in pl.move for Acc->Vec unit_flag sync
Aug 24 Deleted associated pull request: feat(pypto_pro): support phase param in pl.move for Acc->Vec unit_flag sync
Aug 24 Deleted associated pull request: refactor(mutex): Remove internal params from mutex_lock/unlock api
Aug 24 Deleted associated pull request: refactor(mutex): Remove internal params from mutex_lock/unlock api
Background(背景信息) (Mandatory / 必填)
PyPTO Pro 的 FixPipe 随路量化(在 L0C→GM / L0C→Vec 搬移时内联完成量化/反量化)现有接口使用门槛高:
struct.pack),再传pre_quant_scalar;move到 Scaling、再手动插入sync同步;[1, N]逐列)的前端校验。本需求提出统一
scale参数接口,按参数类型自动分发到 per-tensor / per-channel / 动态量化路径,隐藏位编码与内存管理细节。Origin(信息来源) (Mandatory / 必填)
Benefit / Necessity(价值/作用) (Optional / 选填)
scale=2.0一行;per-channel 由 15 行样板 →scale=scale_tensor一行[1, N]INT64 Tensor)、动态(运行时 scale)[1, N]逐列、N % 16 == 0、N <= 512解析期校验;[N, 1]逐行量化解析期拒绝并给出可操作提示Design(设计方案) (Optional / 选填)
# per-tensor(编译期 float) pl.store(out_int8, acc, [0, 0], scale=2.0) # 动态标量(运行时 INT 预编码位 / FP32 自动 bitcast) pl.store(out_int8, acc, [0, 0], scale=scale_bits) # per-channel(Tensor 自动走 deqTensor 路径) scale = torch_npu.npu_trans_quant_param(torch.full((1, 64), 2.0)) pl.store(out_int8, acc, [0, 0], scale=scale) # Acc→Vec 搬移时量化 pl.move(vec_int8, acc, scale=2.0, acc_to_vec_mode=pl.AccToVecMode.SingleModeVec0)实现要点:
store/store_tile/move统一scale参数,替换已废弃的pre_quant_scalar/fp_tilefloat→ 编译期标量;FP32运行时标量 → codegen__builtin_bit_cast自动重解释位模式;INT运行时标量 → 预编码位;Tensor [1, N] INT64→ per-channel(deqTensor)