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

transformations: (lower-csl-stencil) Optimise full-stencil access #3271

Merged
merged 5 commits into from
Oct 10, 2024

Conversation

n-io
Copy link
Collaborator

@n-io n-io commented Oct 9, 2024

For full-stencil accesses followed by an immediate reduction of a uniform reduction function, use the catch-all getRecvBufDsd API call instead of the neighbour-by-neighbour getRecvBufDsdByNeighbor function.

Iff this optimisation is applicable, the accumulator dsd might look like this:

  const accumulatorDsd = @get_dsd(mem4d_dsd, .{
    .tensor_access = |i,j,k|{directionCount, pattern, chunkSize} -> accumulator[k]
  });

This is currently implemented by setting the strides of i and j to 0, which might require a printer update (tbc).

@n-io n-io added the transformations Changes or adds a transformatio label Oct 9, 2024
@n-io n-io requested review from AntonLydike and dk949 October 9, 2024 19:59
@n-io n-io self-assigned this Oct 9, 2024
Copy link

codecov bot commented Oct 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.98%. Comparing base (4a02c8a) to head (367c52d).
Report is 17 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3271      +/-   ##
==========================================
+ Coverage   89.92%   89.98%   +0.05%     
==========================================
  Files         442      444       +2     
  Lines       55489    55688     +199     
  Branches     8656     5362    -3294     
==========================================
+ Hits        49899    50110     +211     
- Misses       4161     4172      +11     
+ Partials     1429     1406      -23     

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

n-io added a commit that referenced this pull request Oct 10, 2024
…3279)

Adds support for pre-existent `GetMemDsdOp`s in the `memref-to-dsd`
pass, which is needed for #3271

---------

Co-authored-by: n-io <n-io@users.noreply.github.com>
Copy link
Collaborator

@dk949 dk949 left a comment

Choose a reason for hiding this comment

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

How does this pass interact with the "Option 3" method that used to be emitted?

If the optimization is performed, does Option 3 still apply?

xdsl/transforms/lower_csl_stencil.py Outdated Show resolved Hide resolved
xdsl/transforms/lower_csl_stencil.py Outdated Show resolved Hide resolved
xdsl/transforms/lower_csl_stencil.py Outdated Show resolved Hide resolved
@n-io
Copy link
Collaborator Author

n-io commented Oct 10, 2024

How does this pass interact with the "Option 3" method that used to be emitted?

If the optimization is performed, does Option 3 still apply?

For csl_stencil.apply ops on which the optimisation is applied, I have extended the docstring to clarify this.

For csl_stencil.apply ops on which the optimisation is not applied, there is now a filecheck showing the lowering to individual per-neighbour @get_dsd ops, which is the known and trusted default behaviour. Commenting out the optimisation in the PatternRewriteWalker will also trigger the default behaviour, in case this is helpful for testing or running.

@n-io n-io requested a review from dk949 October 10, 2024 13:50
n-io added a commit that referenced this pull request Oct 10, 2024
Pretty printing for #3271

---------

Co-authored-by: n-io <n-io@users.noreply.github.com>
@n-io n-io merged commit 76cccc0 into main Oct 10, 2024
14 checks passed
@n-io n-io deleted the nicolai/csl-stencil-all-neighbour-access branch October 10, 2024 14:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
transformations Changes or adds a transformatio
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants