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

[Capture] higher order primitives store slices instead of integers #6521

Merged
merged 12 commits into from
Nov 8, 2024

Conversation

albi3ro
Copy link
Contributor

@albi3ro albi3ro commented Nov 5, 2024

Context:

As the higher order primitives for, while, and cond get more feature-rich, especially with the incoming changes for dynamically shaped arrays, it can be hard to keep track of what order the arguments come in. This will get harder when we have to add in more positional arguments for the dynamically shaped array dimensions.

Description of the Change:

Updates for, while and cond to store slices into the positionally arguments instead of numbers of the different types of arguments. Now we can simply consume:

args[provided_slice]

instead of having to do:

args[some_calcualtion_for_start: some_calculation_for_end]

I also rewrote some of the logic in the for conditional to make it easier to construct all the relevant data.

Benefits:

Possible Drawbacks:

For the for loop, the slices into the arguments start after the start, stop, step instead of including the offset by three. I wasn't quite sure which one made more sense.

Related GitHub Issues:

[sc-77579]

Copy link
Contributor

github-actions bot commented Nov 5, 2024

Hello. You may have forgotten to update the changelog!
Please edit doc/releases/changelog-dev.md with:

  • A one-to-two sentence description of the change. You may include a small working example for new features.
  • A link back to this PR.
  • Your name (or GitHub username) in the contributors section.

albi3ro and others added 2 commits November 5, 2024 13:00
Copy link
Contributor

@dwierichs dwierichs left a comment

Choose a reason for hiding this comment

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

Nice internal upgrade, I really like the changes! 🎉
Just had a few small comments, and wondered about the branches other than true_fn not being flattened for cond.

@albi3ro albi3ro requested a review from mudit2812 November 6, 2024 21:15
albi3ro and others added 2 commits November 7, 2024 15:24
Co-authored-by: David Wierichs <david.wierichs@xanadu.ai>
@albi3ro albi3ro added the merge-ready ✔️ All tests pass and the PR is ready to be merged. label Nov 7, 2024
@albi3ro albi3ro enabled auto-merge (squash) November 7, 2024 20:24
albi3ro and others added 3 commits November 8, 2024 09:40
Copy link

codecov bot commented Nov 8, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.34%. Comparing base (403c7a3) to head (b8085ae).
Report is 331 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #6521   +/-   ##
=======================================
  Coverage   99.34%   99.34%           
=======================================
  Files         455      456    +1     
  Lines       43193    43265   +72     
=======================================
+ Hits        42909    42981   +72     
  Misses        284      284           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@albi3ro albi3ro added the urgent Mark a pull request as high priority label Nov 8, 2024
@albi3ro albi3ro merged commit 0d497ec into master Nov 8, 2024
45 checks passed
@albi3ro albi3ro deleted the hop-use-slices branch November 8, 2024 20:28
mudit2812 pushed a commit that referenced this pull request Nov 11, 2024
…6521)

**Context:**

As the higher order primitives `for`, `while`, and `cond` get more
feature-rich, especially with the incoming changes for dynamically
shaped arrays, it can be hard to keep track of what order the arguments
come in. This will get harder when we have to add in more positional
arguments for the dynamically shaped array dimensions.

**Description of the Change:**

Updates `for`, `while` and `cond` to store slices into the positionally
arguments instead of numbers of the different types of arguments. Now we
can simply consume:
```
args[provided_slice]
```
instead of having to do:
```
args[some_calcualtion_for_start: some_calculation_for_end]
```

I also rewrote some of the logic in the for conditional to make it
easier to construct all the relevant data.

**Benefits:**

**Possible Drawbacks:**

For the for loop, the slices into the arguments start after the `start,
stop, step` instead of including the offset by three. I wasn't quite
sure which one made more sense.

**Related GitHub Issues:**

[sc-77579]

---------

Co-authored-by: David Wierichs <david.wierichs@xanadu.ai>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merge-ready ✔️ All tests pass and the PR is ready to be merged. urgent Mark a pull request as high priority
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants