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

[IR] Creation-time constant fold for constant expressions #209

Merged
merged 5 commits into from May 5, 2023

Conversation

yaoyaoding
Copy link
Member

Previously, when we do some arhtimatic operations for constant, we will keep them in our IR:

from hidet.ir.expr import convert
a = convert(1)
b = convert(2)
c = a + b
print(c)  # would be Add(Constant(1), Constant(2))

With this PR, we will do the computation when we create the Add expression, and replace it with hidet.ir.Constant:

from hidet.ir.expr import convert
a = convert(1)
b = convert(2)
c = a + b
print(c)  # would be Constant(3)

This PR also clean the hidet.ir.dialects.pattern.py. We do not many fancy pattern matching any more.

@yaoyaoding yaoyaoding merged commit daae22e into hidet-org:main May 5, 2023
2 checks passed
@yaoyaoding yaoyaoding deleted the const-fold branch May 5, 2023 04:40
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.

None yet

1 participant