Skip to content

编译器崩溃:fa_2d_unroll 算子在 X=1,Y=1 和 X=2,Y=1 配置下触发 LinxV5 CallingConv 断言失败 #6

Description

@ly-ict

问题描述

在编译 fa_2d_unroll Flash Attention 算子时,当设置 Xdim=1, Ydim=1Xdim=2, Ydim=1 时,编译器崩溃并触发断言失败。

环境信息

  • 编译器: linx_blockisa_llvm_musl (clang-15, linx64v5-musl)
  • 编译命令:
    make TESTCASE=fa_2d_unroll Sq=256 Skv=512 Tm=128 Tk=128 X=1 Y=1

错误信息

Assertion failed: (Reg != 0 && "LinxV5 CallingConv Fail!"), 
function CC_LinxV5_SIMT, 
file LinxV5ISelLowering.cpp, line 2834.

clang-15: error: clang frontend command failed with exit code 134

复现步骤

  1. 编译 fa_2d_unroll 算子,设置以下参数组合会触发崩溃:

    • X=1, Y=1 ❌ 崩溃
    • X=2, Y=1 ❌ 崩溃
  2. 以下参数组合可以正常编译:

    • X=1, Y=2 ✓ 成功
    • X=1, Y=4 ✓ 成功
    • X=2, Y=2 ✓ 成功
    • X=2, Y=4 ✓ 成功

相关代码

  • 算子实现: kernels/fa/fa_2d_unroll.h
  • 测试文件: test/kernel/fa/src/fa_2d_unroll.cpp
  • 编译脚本: test/kernel/fa/compile.all

可能的原因

从错误信息来看,这是 LinxV5 后端在 SIMT 调用约定处理中的问题。当 Ydim=1 时,某些寄存器分配或调用约定处理出现异常。

临时解决方案

目前避免使用 Ydim=1 的配置,只使用 Ydim >= 2 的组合。

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions