-
Notifications
You must be signed in to change notification settings - Fork 70
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
(dialect+transform): stencil to new csl_stencil dialect and transform #2766
Conversation
Co-authored-by: Sasha Lopoukhine <superlopuh@gmail.com>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2766 +/- ##
==========================================
- Coverage 89.81% 89.79% -0.03%
==========================================
Files 372 375 +3
Lines 47817 48012 +195
Branches 7331 7362 +31
==========================================
+ Hits 42945 43110 +165
- Misses 3736 3752 +16
- Partials 1136 1150 +14 ☔ View full report in Codecov by Sentry. |
I'd welcome suggestions on file structure/layout. As for the dialect, riscv takes the approach of having several As for the transform, it is currently placed in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor comment but LGTM generally!
On the file layout situation, I would be in favor of a csl
directory containing a nested dialect file. Nothing enforces it to be directly in xdsl/dialects
.
If you're concerned about the module path, i.e from xdsl.dialects.csl.csl import CSL
, you could, in xdsl/dialects/csl/__init__.py
import the dialect to expose it from there, enabling from xdsl.dialects.csl import CSL
event if it is nested.
Note: I would personally not like xdsl/dialects/csl/__init__.py
to contain the dialect definition itself though.
All of this being in answer to your mention of the topic; I wouldn't be against merging for any file layout point myself!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I have conceptual questions on both the csl_stencil
dialect and the rewrite, maybe it makes sense to split the two off?
Also, this PR is severely lacking comments and docstrings. A lot of things are difficult to review for me, as I have to reconstruct what the method/op/rewrite/pass does from the code. This makes the review error prone as well, as I am never sure if you intended something or if it's a bug...
@PapyChacal I believe having an
will unfortunately result in an F405 error. Not entirely sure how to go about it. |
We do this in a few places already, you could just add Or list explicitly what you want to expose |
Hmm, I think it might instead be the relative part not the star part of the import that's the problem here, no?
On June 24, 2024 12:28:38 PM GMT+01:00, Emilien Bauer ***@***.***> wrote:
> > Minor comment but LGTM generally!
> > On the file layout situation, I would be in favor of a `csl` directory containing a nested dialect file. Nothing enforces it to be directly in `xdsl/dialects`. If you're concerned about the module path, i.e `from xdsl.dialects.csl.csl import CSL`, you could, in `xdsl/dialects/csl/__init__.py` import the dialect to expose it from there, enabling `from xdsl.dialects.csl import CSL` event if it is nested. Note: I would personally not _like_ `xdsl/dialects/csl/__init__.py` to contain the dialect definition itself though. All of this being in answer to your mention of the topic; I wouldn't be against merging for any file layout point myself!
>
> @PapyChacal I believe having an `__init__.py` with something like
>
> ```
> from .csl import *
>
> __all__ = ["csl"]
> ```
>
> will unfortunately result in an [F405](https://docs.astral.sh/ruff/rules/undefined-local-with-import-star-usage/) error. Not entirely sure how to go about it.
We do this in a few places already, you could just add `# noqa: TID251` on that line
Or list explicitly what you want to expose
--
Reply to this email directly or view it on GitHub:
#2766 (comment)
You are receiving this because your review was requested.
Message ID: ***@***.***>
--
Sent from my Android device with K-9 Mail. Please excuse my brevity.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added more code-level comments to the rewrite itself
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀
Follow-up from #2766 The original plan was to lower `stencil.access` to `csl_stencil.access` if and only if the access is to neighbour data (i.e. prefetched), while accesses to own data were supposed to remain `stencil.access` without being lowered. This runs into the very practical problem, that `stencil.access` can only exist within a `stencil.apply` op - which we also want to lower, but this cannot be done with `stencil.access` ops. --------- Co-authored-by: n-io <n-io@users.noreply.github.com>
Introduces an intermediate dialect with ops:
csl_stencil.prefetch
to indicate prefetched buffer transferscsl_stencil.access
performs astencil.access
to a prefetched bufferThe
stencil-to-csl-stencil
transform:dmp.swap
tocsl_stencil.prefetch
stencil.apply
stencil.access
tocsl_stencil.access
iff they are accesses to prefetched buffersFor a more detailed description see the document in #2747. This PR implements Step 1 outlined there.