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

interpreter: (cf) add cf interpreter functions and extend arith #1217

Merged
merged 3 commits into from Jul 3, 2023

Conversation

superlopuh
Copy link
Member

No description provided.

@codecov
Copy link

codecov bot commented Jun 30, 2023

Codecov Report

Patch coverage: 97.54% and project coverage change: +0.23 🎉

Comparison is base (fba9b00) 88.66% compared to head (2946a48) 88.90%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1217      +/-   ##
==========================================
+ Coverage   88.66%   88.90%   +0.23%     
==========================================
  Files         167      169       +2     
  Lines       22873    22976     +103     
  Branches     3478     3498      +20     
==========================================
+ Hits        20280    20426     +146     
+ Misses       2038     1993      -45     
- Partials      555      557       +2     
Impacted Files Coverage Δ
xdsl/interpreter.py 86.11% <93.10%> (+17.24%) ⬆️
xdsl/interpreters/arith.py 94.73% <94.44%> (+2.42%) ⬆️
tests/interpreters/test_arith_interpreter.py 100.00% <100.00%> (ø)
tests/interpreters/test_cf_interpreter.py 100.00% <100.00%> (ø)
xdsl/interpreters/cf.py 100.00% <100.00%> (ø)

... and 3 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

tests/interpreters/test_cf_interpreter.py Outdated Show resolved Hide resolved
tests/interpreters/test_cf_interpreter.py Outdated Show resolved Hide resolved
xdsl/interpreter.py Outdated Show resolved Hide resolved
Copy link
Collaborator

Choose a reason for hiding this comment

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

I guess we see here one of the limitations of the Pyhton-based interpreter: Modellling fixed-size integers is nasty in Python. That's also why signed an unsigned are not distinguished in Python...

But I guess as long as we stay within reasonable boundaries, this should not matter.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeah, I guess the problem here is that our interpreter should also take into account bitwidth, which it doesn't now!

xdsl/interpreters/cf.py Show resolved Hide resolved
Copy link
Collaborator

@math-fehr math-fehr left a comment

Choose a reason for hiding this comment

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

Nice!

def triangle_fn(n: int) -> int:
result = 0
i = 0
while i <= n:
Copy link
Contributor

Choose a reason for hiding this comment

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

This can be done better?

Copy link
Member Author

Choose a reason for hiding this comment

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

Is that a question or an assertion? the whole function is n * (n-1) // 2 so can be done better indeed :)

@superlopuh superlopuh merged commit 6a7ea3e into main Jul 3, 2023
11 of 12 checks passed
@superlopuh superlopuh deleted the sasha/interpreter/cf branch July 3, 2023 09:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
interpreter xDSL Interpreter
Projects
Development

Successfully merging this pull request may close these issues.

None yet

6 participants