Skip to content

[Docs] 对2026-03-31-tile-to-vector-template-design.md的修改建议 #1

@WenboCodes

Description

@WenboCodes

Documentation location

docs/designs/2026-03-31-tile-to-vector-template-design.md

What's wrong or missing?

修改建议

1. 建议补一节“值模型 / staging 语义”

当前文档默认模板函数里 shapevalid_shapeelement_typerange(...) 都可以直接使用,但没有明确这些值分别属于:

  • 编译期静态值(constexpr),
  • 运行时 SSA 值,
  • 还是 DSL 复合对象。

建议显式引入模板执行时的值模型。

2. 建议显式引入 specialization key / cache

模板展开本质上是一个特化过程,但当前文档还没有把缓存模型说清楚。

建议在设计中明确:实例化结果应基于 specialization key 进行缓存,以避免同类 Tile op 的重复展开。

这个 key 至少应包含:

  • 模板标识,
  • Tile op 类型,
  • target,
  • dtype,
  • shape,
  • layout/config,
  • lowering version。

否则后续实现中很容易出现重复实例化,或者缓存粒度不稳定的问题。

3. 建议把 shapevalid_shape 的规则写成正式约束

当前文档默认 shape 用于静态展开、valid_shape 可能是动态也可能是静态,但这个规则目前更多是通过示例传达出来的。

建议把它明确写成约束:

  • shape 必须是编译期静态值,并参与模板实例化,
  • valid_shape 可以是静态也可以是动态,
  • valid_shape 为静态值时,应在 Python Codegen 侧增加相应检查。

Suggested improvement

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions