已关闭
[Requirement|需求建议]: 新增 aclsparseLtMatmulDescriptorInit 接口及 aclsparseLt 描述符类型体系 #113
zhengyifei创建于  7月24日关闭于  25 天前
zhengyifei成员
7月24日 创建

Thanks for sending an requirement! Please fill in the following template to help quickly solve your problem.

Backgroud(背景信息)

ops-sparse 仓已实现 aclsparseLt 库管理接口(Init/Destroy/GetErrorName/GetErrorString)和 aclsparseLtHandle_t opaque 类型,为 sparseLt 子库提供了上下文管理基础设施。但当前 sparseLt 尚无描述符类型体系,无法描述结构化稀疏矩阵乘法运算所需的矩阵元信息(形状、布局、数据类型、操作类型、计算精度、稀疏模式等)。
需要从零搭建 aclsparseLt 描述符类型体系,为后续 sparseLt matmul 规划/执行接口(Matmul / GetAlgo / Plan 等)提供描述符基础设施。

Origin(信息来源)

CANN 生态开发者

Benefit / Necessity (价值/作用)

  1. API 完整性:补齐 aclsparseLt 描述符管理接口族,使 sparseLt 子库具备描述结构化稀疏矩阵乘法运算的能力,为后续 matmul 计算接口奠定基础。
  2. 数据类型覆盖广:支持 7 种数据类型(FP32/FP16/BF16/INT8/FP8_E4M3/FP8_E5M2/FP4_E2M1)与 3 种计算精度(16F/32F/32I),覆盖主流结构化稀疏训练与推理场景。

Design(设计方案)

新增接口(5 个)

接口 功能
aclsparseLtDenseDescriptorInit 稠密矩阵描述符初始化
aclsparseLtStructuredDescriptorInit 结构化稀疏矩阵描述符初始化
aclsparseLtMatmulDescriptorInit Matmul 描述符初始化(主接口)
aclsparseLtMatDescriptorDestroy 矩阵描述符销毁
aclsparseLtMatmulDescriptorDestroy Matmul 描述符销毁

新增类型

  • aclsparseLtMatDescriptor_t / aclsparseLtMatmulDescriptor_t(opaque pointer,对外仅前向声明,内部结构体定义在 sparseLt/common/*_internal.h
  • aclsparseLtSparsity_t(50_PERCENT 2:4 结构化稀疏)
  • aclsparseComputeType_t(独立计算精度枚举,与 aclDataType 解耦,对标 cusparseComputeType_t)

接口原型

aclsparseStatus_t aclsparseLtDenseDescriptorInit(
    const aclsparseLtHandle_t *handle, aclsparseLtMatDescriptor_t *matDescr,
    int64_t rows, int64_t cols, int64_t ld, uint32_t alignment,
    aclDataType valueType, aclsparseOrder_t order);
aclsparseStatus_t aclsparseLtStructuredDescriptorInit(
    const aclsparseLtHandle_t *handle, aclsparseLtMatDescriptor_t *matDescr,
    int64_t rows, int64_t cols, int64_t ld, uint32_t alignment,
    aclDataType valueType, aclsparseOrder_t order,
    aclsparseLtSparsity_t sparsity);
aclsparseStatus_t aclsparseLtMatmulDescriptorInit(
    const aclsparseLtHandle_t *handle, aclsparseLtMatmulDescriptor_t *matmulDescr,
    aclsparseOperation_t opA, aclsparseOperation_t opB,
    const aclsparseLtMatDescriptor_t matA,
    const aclsparseLtMatDescriptor_t matB,
    const aclsparseLtMatDescriptor_t matC,
    const aclsparseLtMatDescriptor_t matD,
    aclsparseComputeType_t computeType);
aclsparseStatus_t aclsparseLtMatDescriptorDestroy(
    const aclsparseLtMatDescriptor_t *matDescr);
aclsparseStatus_t aclsparseLtMatmulDescriptorDestroy(
    const aclsparseLtMatmulDescriptor_t *matmulDescr);
likedislike
zhengyifei成员
7月24日 评论:

/assign @zhengyifei

likedislike
CANN-robotCANN-robot成员
7月24日 将 zhengyifei 设为负责人
Zzhengyifei成员
7月24日 关联了pull request:feat: 新增 aclsparseLtMatmulDescriptorInit 接口及 aclsparseLt 描述符类型体系
CANN-robotCANN-robot成员
25 天前 关闭了 issue
CANN-robotCANN-robot成员
25 天前 添加了label:resolved