已关闭
[Bug-Report|缺陷反馈]: aclblasCgemvBatched 接口签名不符合 BLAS 标准 #65
xutianze创建于  5月30日关闭于  7月30日
xutianze
xutianze成员
5月30日 创建

问题描述

aclblasCgemvBatched 的 A/x/y 参数设计与 BLAS 标准存在根本性差异。

当前签名:

aclblasStatus_t aclblasCgemvBatched(
    aclblasHandle_t handle, aclblasOperation trans,
    const int64_t m, const int64_t n, const std::complex<float>& alpha,
    uint8_t* A, const int64_t lda, uint8_t* x, const int64_t incx,
    const std::complex<float>& beta, uint8_t* y,
    const int64_t incy, const int64_t batchCount);

问题:

  1. A/x/y 参数设计错误:当前使用扁平指针(隐含 strided batched 语义),BLAS 标准使用指针数组(每个 batch 一个指针,支持非等间距)
  2. alpha/beta 按引用传递 std::complex<float>&,应为指针传递 const aclblasComplex*
  3. A/x/y 类型应为 aclblasComplex*,当前为 uint8_t*
  4. A/x 缺少 const 修饰

建议改成:

aclblasStatus_t aclblasCgemvBatched(
    aclblasHandle_t handle, aclblasOperation_t trans,
    int m, int n,
    const aclblasComplex* alpha,
    const aclblasComplex* const Aarray[], int lda,
    const aclblasComplex* const xarray[], int incx,
    const aclblasComplex* beta,
    aclblasComplex* const yarray[], int incy,
    int batchCount);

如需 strided batched 语义,建议提供独立接口 aclblasCgemvStridedBatched

参考: https://docs.nvidia.com/cuda/cublas/index.html#cublas-lt-t-gt-gemvbatched

环境信息

  • 芯片型号:N/A(接口设计问题)
  • CANN 版本:当前版本
  • 操作系统:N/A

重现步骤

  1. 查看 include/cann_ops_blas.haclblasCgemvBatched 的声明
  2. 对比 BLAS 标准中 cgemvBatched 的签名

预期结果

接口签名应符合 BLAS 标准,使用指针数组方式传递 A/x/y。

日志 / 截图

备注

当前的扁平指针设计实际等价于 StridedBatched 语义,建议重命名为 aclblasCgemvStridedBatched

likedislike
demoauguste成员
6月1日 评论:

您好,问题已收到,正在处理中。

likedislike
zhanghuazhanghua成员
7月3日 将 QK_25415 设为负责人
2301_821464832301_82146483
7月29日 关联了pull request:fix(complex): 统一复数 BLAS 算子接口对齐标准(issues #61-#75)
CANN-robotCANN-robot成员
7月30日 关闭了 issue
CANN-robotCANN-robot成员
7月30日 添加了label:resolved