Closed
[Requirement|需求建议]: 【FIA】tiling 重构 #1524
zuoywAdd on  Mar 28Closed at  Mar 28
zuoywCollaborators
Mar 28 Create

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

Backgroud(背景信息)

整理tiling侧代码,让结构更加清晰,便于维护和继承

Benefit / Necessity (价值/作用)

1、消除FIA tiling对IFA、PFA依赖,提高算子代码可读性和可拓展性
2、按阶段拆分tiling,分为 parser、checker 和 tiling impl阶段,模块功能更内聚
3、按参数组+分层校验+量化类型+场景+代际实现校验,校验更清晰

Design(设计方案)

tiling阶段拆分

分为 parser、checker 和 tiling impl阶段
1、其中parser完成基础校验和解析输入信息,平台信息
2、checker 根据特性组,按4层分层完成校验
3、tiling impl 根据场景完成分核逻辑计算,生成tilingdata、tilingkey、输出workspaceSize、配置context

FIA 算子约束层次拆分

分为4个档位,按约束复杂程度递增分为 单参数约束、存在性约束、一致性约束和特性交叉约束,各档位约束内容和示例如下:
1、单参数约束:对于单个接口参数的约束,包含FusedInferAttentionScore算子接口中的 Tensor、TensorList、Array 和 Attributes

  • 对于Tensor、TensorList、Array,单参数约束中包含如下校验
    • 校验 shape,包括shape维度dim、每一维度 dim value
    • 校验 dtype
    • 校验 format
  • 对于属性 Attribute
    • 校验属性取值
      2、存在性约束:约束特定场景下,特性参数组内,必须传入某参数,或不支持传入某参数(待讨论,考虑和一致性合并)
      3、一致性约束:特性参数组内,各个参数间约束。
  • Example 1:属性sparseMode和输入tensor attenMask均属于Attention Mask参数组,sparseMode取值为2/3/4时,attenMask shape必须为(2048,2048),此类约束即为参数组内的一致性约束
    4、特性交叉约束:涉及多个参数组,不同参数组间交叉约束
  • Example 1:输入tensor blockTable 和 属性 blockSize 属于Paged Attention(同PA)参数组,输入tensor attenMask属于 Mask参数组;在PA场景下,attenMask输入最后一维(attenMaskS2)需要大于等于maxBlockNumPerSeq * blockSize,此类约束即为多参数组间的交叉约束;且为保证风格统一,此约束会放在入参顺序靠后的 Paged Attention参数组中
likedislike
ZzuoywCollaborators
Mar 28 Added label: requirement
Ttang-hao-hw-gitcodeCollaborators
Mar 28 Modify description of issue
Ttang-hao-hw-gitcodeCollaborators
Mar 28 Modify description of issue
Ttang-hao-hw-gitcodeCollaborators
Mar 28 Modify description of issue
Ttang-hao-hw-gitcodeCollaborators
Mar 28 Modify description of issue
CANN-robotCANN-robotCollaborators
Mar 28 Close issue
CANN-robotCANN-robotCollaborators
Mar 28 Added label: resolved