Skip to content

Overload all existing built-in functions #250

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

Merged
merged 7 commits into from
Mar 18, 2022

Conversation

namannimmo10
Copy link
Collaborator

@namannimmo10 namannimmo10 commented Mar 18, 2022

  • overload abs
  • overload round
  • overload pow

Copy link
Contributor

@certik certik left a comment

Choose a reason for hiding this comment

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

I think this looks good! Very helpful, this makes the intrinsic functions pretty much usable now.

Copy link
Contributor

@certik certik left a comment

Choose a reason for hiding this comment

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

I think that looks good.

I wonder what the purpose of the pow function is, when we have ** in Python.

@namannimmo10
Copy link
Collaborator Author

Perhaps once we add support for the third (optional) argument in pow, it can more efficiently compute a to the power b modulo c, than pow(a, b)%c

Have you heard about aliasing and chunking? This Pytalk by Raymond is really good: https://www.youtube.com/watch?v=UANN2Eu6ZnM (start from 8:50)

@namannimmo10 namannimmo10 marked this pull request as ready for review March 18, 2022 18:51
@namannimmo10 namannimmo10 merged commit af8ecca into lcompilers:main Mar 18, 2022
@namannimmo10 namannimmo10 deleted the overload branch March 18, 2022 18:52
@certik
Copy link
Contributor

certik commented Mar 18, 2022

Have you heard about aliasing and chunking?

Not using this name. How does it apply here in your opinion?

@namannimmo10
Copy link
Collaborator Author

namannimmo10 commented Mar 18, 2022

Chunking refers to the process of taking individual pieces of information and grouping them into larger units

I think what Raymond wants to convey is that instead of doing computationally-expensive tasks repeatedly, we can have functions (that would do it efficiently), thereby reducing the "registers" and maintaining our cognitive capacity. I am sure he can explain it much better!

@certik
Copy link
Contributor

certik commented Mar 18, 2022

Yes, you don't want to have too large loop body, otherwise you run out of registers. The compiler's unrolling facility must unroll in order to vectorize well, but not too much to run our of registers. Regarding using functions to structure your code, that seems obvious. I don't now how it applies to this PR though. :)

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