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

Pretty cursors #281

Merged
merged 15 commits into from
Nov 7, 2022
Merged

Pretty cursors #281

merged 15 commits into from
Nov 7, 2022

Conversation

alexreinking
Copy link
Contributor

@alexreinking alexreinking commented Nov 7, 2022

After #279 and #280 are merged, this should be rebased onto master.

Implements pretty printing for (internal) cursors. This will be useful for writing tests regarding cursors and cursor forwarding more accurately, as well as for interactive debugging.

Cursor types implemented:

  • Nodes
  • Gaps
  • Blocks

Ultimately, this will be transformed such that cursors can be rendered like so. Consider this proc:

@proc
def bar(n: size, m: size):
    x: f32
    for i in seq(0, n):
        for j in seq(0, m):
            x = 0.0
            x = 1.0
            x = 2.0
            x = 3.0
            x = 4.0
            x = 5.0

A cursor to for i in seq(0, n) would look like:

def bar(n: size, m: size):
    ...
    for i in seq(0, n):  # <-- NODE
        ...

Or to the gap before it:

def bar(n: size, m: size):
    x: f32 @ DRAM
    [GAP]
    for i in seq(0, n):
        ...

The block containing x = 1.0; _ ; x = 3.0 looks like:

def bar(n: size, m: size):
    ...
    for i in seq(0, n):
        for j in seq(0, m):
            ...
            # BLOCK START
            x = 1.0
            x = 2.0
            x = 3.0
            # BLOCK END
            ...

This way we can use golden outputs to very quickly check that cursors are correct.

@codecov-commenter
Copy link

codecov-commenter commented Nov 7, 2022

Codecov Report

Merging #281 (60578f0) into pretty-print (e44103f) will decrease coverage by 0.02%.
The diff coverage is 89.68%.

@@               Coverage Diff                @@
##           pretty-print     #281      +/-   ##
================================================
- Coverage         87.90%   87.87%   -0.03%     
================================================
  Files                72       72              
  Lines             15509    15632     +123     
================================================
+ Hits              13633    13737     +104     
- Misses             1876     1895      +19     
Impacted Files Coverage Δ
src/exo/LoopIR_pprint.py 80.26% <83.07%> (+0.37%) ⬆️
src/exo/internal_cursors.py 95.62% <88.88%> (-0.38%) ⬇️
tests/test_internal_cursors.py 100.00% <100.00%> (ø)
tests/test_x86.py 98.36% <0.00%> (-1.64%) ⬇️
src/exo/LoopIR_compiler.py 94.31% <0.00%> (-0.57%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@alexreinking alexreinking enabled auto-merge (squash) November 7, 2022 21:28
@alexreinking alexreinking merged commit 474e55e into master Nov 7, 2022
@alexreinking alexreinking deleted the pretty-cursors branch November 7, 2022 21:49
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.

3 participants