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

[stdlib] Cleanup polynomial.mojo, improve docstring #3066

Closed
wants to merge 1 commit into from

Conversation

soraros
Copy link
Contributor

@soraros soraros commented Jun 17, 2024

  • Small simplification to the function _horner_evaluate.
  • Improve its docstring to match the argument names.
  • Finish off removing unroll by cleaning up the imports.

@soraros soraros marked this pull request as ready for review June 18, 2024 16:47
@soraros soraros requested a review from a team as a code owner June 18, 2024 16:47
@JoeLoser JoeLoser requested a review from abduld June 18, 2024 16:50
Copy link
Collaborator

@JoeLoser JoeLoser left a comment

Choose a reason for hiding this comment

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

Looks good, thank you! Do you mind fixing up the merge conflicts and then I'm happy to merge this?

@soraros soraros force-pushed the remove-unroll-polynomial branch 3 times, most recently from b8f83ba to 15322f7 Compare June 20, 2024 23:49
@soraros
Copy link
Contributor Author

soraros commented Jun 20, 2024

@JoeLoser It seems that Abdul already removed the unroll in a1cba9d. I think the cleanup is still worthwhile, but I will let you decide if we still want to merge this.

@JoeLoser
Copy link
Collaborator

@JoeLoser It seems that Abdul already removed the unroll in a1cba9d. I think the cleanup is still worthwhile, but I will let you decide if we still want to merge this.

+1 to the cleanup. Mind retitling the PR/description to match the current cleanup then? Thanks!

@soraros soraros changed the title [stdlib] Move polynomial.mojo off unroll [stdlib] Cleanup polynomial.mojo, improve docstring Jun 21, 2024
@JoeLoser
Copy link
Collaborator

!sync

@modularbot modularbot added the imported-internally Signals that a given pull request has been imported internally. label Jun 21, 2024
- Small simplification to the function `_horner_evaluate`.
- Improve its docstring to match the argument names.
- Finish off removing `unroll` by cleaning up the imports.

Signed-off-by: Yiwu Chen <210at85@gmail.com>
@soraros
Copy link
Contributor Author

soraros commented Jul 11, 2024

This should be a trivial cleanup, however, inlining c_second_from_last seems to be causing the problem. As can be seen in this CI run, coefficients[-2] is somehow changed after the first access.

This is the output of the following code:

print("alias", c_second_from_last, coefficients[num_coefficients - 2])
...
alias -0.11514610052108765 1.7441815041421925e+28
alias 0.0013888889225199819 8.5597826238818937e-39
alias -0.11514610052108765 1.7441815041421925e+28
alias 0.0013888889225199819 8.5597826238818937e-39
alias -0.11514610052108765 1.7441815041421925e+28
alias 0.0013888889225199819 8.5597826238818937e-39
alias -0.11514610052108765 1.7441815041421925e+28
alias 0.0013888889225199819 8.5597826238818937e-39
...

soraros added a commit to soraros/mojo that referenced this pull request Jul 11, 2024
Signed-off-by: Yiwu Chen <210at85@gmail.com>
@soraros soraros requested a review from JoeLoser July 12, 2024 01:01
@JoeLoser
Copy link
Collaborator

This should be a trivial cleanup, however, inlining c_second_from_last seems to be causing the problem. As can be seen in this CI run, coefficients[-2] is somehow changed after the first access.

This is the output of the following code:

print("alias", c_second_from_last, coefficients[num_coefficients - 2])
...
alias -0.11514610052108765 1.7441815041421925e+28
alias 0.0013888889225199819 8.5597826238818937e-39
alias -0.11514610052108765 1.7441815041421925e+28
alias 0.0013888889225199819 8.5597826238818937e-39
alias -0.11514610052108765 1.7441815041421925e+28
alias 0.0013888889225199819 8.5597826238818937e-39
alias -0.11514610052108765 1.7441815041421925e+28
alias 0.0013888889225199819 8.5597826238818937e-39
...

Can you file a compiler bug for this, please?

Copy link
Collaborator

@JoeLoser JoeLoser left a comment

Choose a reason for hiding this comment

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

In order to not have this be blocked by the compiler bug, I'm going to to merge the docstring cleanups here and leave the body as-is.

@JoeLoser
Copy link
Collaborator

!sync

@soraros
Copy link
Contributor Author

soraros commented Jul 18, 2024

@JoeLoser I think the bug is also caused by compile time usage of List, tracked in #3126.

@JoeLoser
Copy link
Collaborator

@JoeLoser I think the bug is also caused by compile time usage of List, tracked in #3126.

Makes sense, yeah. Chris is looking at that bug.

@modularbot
Copy link
Collaborator

✅🟣 This contribution has been merged 🟣✅

Your pull request has been merged to the internal upstream Mojo sources. It will be reflected here in the Mojo repository on the nightly branch during the next Mojo nightly release, typically within the next 24-48 hours.

We use Copybara to merge external contributions, click here to learn more.

@modularbot modularbot added the merged-internally Indicates that this pull request has been merged internally label Jul 18, 2024
@modularbot
Copy link
Collaborator

Landed in 7ed5407! Thank you for your contribution 🎉

@modularbot modularbot added the merged-externally Merged externally in public mojo repo label Jul 19, 2024
modularbot pushed a commit that referenced this pull request Jul 19, 2024
[External] [stdlib] Improve docstring in `polynomial.mojo`

Improve the `_horner_evaluate` docstring to match the argument names.

Co-authored-by: soraros <soraros@users.noreply.github.com>
Closes #3066
MODULAR_ORIG_COMMIT_REV_ID: 228e5b772e138765b9e2d73a8f5f1bead515661d
@modularbot modularbot closed this Jul 19, 2024
@soraros soraros deleted the remove-unroll-polynomial branch July 19, 2024 08:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
imported-internally Signals that a given pull request has been imported internally. merged-externally Merged externally in public mojo repo merged-internally Indicates that this pull request has been merged internally
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants