Skip to content

Add SSA compiler pipeline and unified backends#164

Open
whjthu wants to merge 7 commits into
masterfrom
ssa-compiler-with-multibackend
Open

Add SSA compiler pipeline and unified backends#164
whjthu wants to merge 7 commits into
masterfrom
ssa-compiler-with-multibackend

Conversation

@whjthu

@whjthu whjthu commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

pytest output:

./ninetoothed$ pytest -n 16        
========================================================= test session starts =========================================================
platform linux -- Python 3.12.3, pytest-9.0.3, pluggy-1.6.0        
rootdir: /home/haojie/ntbackend/ninetoothed           
configfile: pyproject.toml                                         
plugins: xdist-3.8.0, anyio-4.13.0, cov-7.1.0                                                                                          
16 workers [311 items]                                                                                                                 
............................................................................................................................... [ 40%] 
............................................................................................................................... [ 81%] 
..........................s..............................                                                                       [100%]
============================================= 310 passed, 1 skipped in 483.50s (0:08:03) ==============================================

@whjthu whjthu force-pushed the ssa-compiler-with-multibackend branch 4 times, most recently from ad873c2 to a8249a9 Compare June 28, 2026 08:21
@whjthu whjthu force-pushed the ssa-compiler-with-multibackend branch from a8249a9 to 9a4ba7a Compare June 28, 2026 09:12
@voltjia voltjia force-pushed the ssa-compiler-with-multibackend branch from 437f718 to 9a4ba7a Compare June 29, 2026 05:18
@voltjia

voltjia commented Jun 29, 2026

Copy link
Copy Markdown
Collaborator

我看 docs/design 下面放了很多 agent 写的文档,但是看上去都是过程文档,并不是结论性的文档,如果希望有地方保留的话,可以放到 PR 描述里。需要的话可以让 agent 总结出英文的结论性文档或者教程出来。

@voltjia

voltjia commented Jun 29, 2026

Copy link
Copy Markdown
Collaborator

我看新添加的测试都是用的 unittest,但是咱们此前用的一直都是 pytest,所以尽量都切换到用 pytest,不然后面仓库里就会依赖两个不同的测试框架,看起来不太对劲的样子。

Comment thread src/ninetoothed/backends/base.py Outdated
Comment on lines +20 to +32
_BACKEND_ALIASES = {
None: BackendName.TRITON,
"triton": BackendName.TRITON,
"tl": BackendName.TRITON,
"tilelang": BackendName.TILELANG,
"tile-lang": BackendName.TILELANG,
"tile_lang": BackendName.TILELANG,
"cuda": BackendName.CUDA,
"cu": BackendName.CUDA,
"tvm": BackendName.TVM,
"tvm-script": BackendName.TVM,
"tvmscript": BackendName.TVM,
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

暂时不应该引入 aliases,Python 其中一个哲学就是最好一件事就一个显式的方式去做,自由度大未必是好事,建议每个后端就一个名字,至少现在没有 alias 存在的必要应该。

Comment thread docs/design/ir_design_zh.md Outdated
Comment thread docs/design/multi_backend_ir.md Outdated
Comment thread docs/design/README.md Outdated
Comment thread docs/design/ssa_ir_lowering_pipeline_zh.md Outdated
Comment thread tests/test_ssa_pass_pipeline.py

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这些是不是不应该暴露给用户,因为这次重构我理解是编译部分的重构,用户使用的接口应该还是 makejitbuild 这些,我理解这里可能是想要暴露给 pass 开发者,不过我们可以先稳定一段时间,这段时间可以通过 ninetoothed.lowering 之类的 namespace 来调用,先不加到 __init__.py 了比较好。

Comment thread src/ninetoothed/aot.py

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

看上去这个文件里的更改是在尝试解决什么环境问题,而不是跟这个 PR 强相关的,不适宜放到一个 PR 里,如果真的有需要的话可以单独提个 PR。

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

看上去这个文件里的更改是在尝试解决什么环境问题,而不是跟这个 PR 强相关的,不适宜放到一个 PR 里,如果真的有需要的话可以单独提个 PR。

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

感觉是不是这部分里面各个后端的部分比较耦合。我原本的想象是,各个后端 pass 是可以注册进来的,这个文件里是一个通用的各种 pass,然后具体后端由 backends 里面的注册。但是现在看来,这个文件里面有大量的具体后端相关的内容,但是 backends 下面的对应文件却反而内容很少。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants