Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Codegen] Emit tir::Let as var assignment explicitly #17278

Merged
merged 1 commit into from
Aug 21, 2024

Conversation

MasterJH5574
Copy link
Contributor

Prior to this PR, the PrimExpr tir::Let is treated as inlining during codegen, which makes any common subexpression elimination (CSE) efforts using tir::Let at TIR level effectless.

This PR updates codegen so that the tir::Let will have an explicit var assignment and thus can effectively reflect the CSE efforts.

@MasterJH5574 MasterJH5574 force-pushed the tvm-dev/2024-08-16-codegen-let branch 2 times, most recently from cf3217f to 5457abb Compare August 19, 2024 14:06
Prior to this PR, the PrimExpr `tir::Let` is treated as inlining during
codegen, which makes any common subexpression elimination (CSE) efforts
using `tir::Let` at TIR level effectless.

This PR updates codegen so that the `tir::Let` will have an explicit
var assignment and thus can effectively reflect the CSE efforts.
@MasterJH5574 MasterJH5574 force-pushed the tvm-dev/2024-08-16-codegen-let branch from 5457abb to 8d7dad2 Compare August 19, 2024 19:00
@tqchen
Copy link
Member

tqchen commented Aug 20, 2024

@tvm-bot rerun

@tqchen tqchen merged commit b76ebad into apache:main Aug 21, 2024
17 of 18 checks passed
@Lunderberg
Copy link
Contributor

I'm a little bit late on the review, but I like the fix, thank you! I double-checked codegen_llvm.cc, and it tracks tir::Let expressions by their llvm::Value*, and wouldn't be susceptible to the same issue.

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.

3 participants