-
Notifications
You must be signed in to change notification settings - Fork 73
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: Add further csl name hints #3399
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3399 +/- ##
==========================================
- Coverage 90.15% 90.15% -0.01%
==========================================
Files 453 455 +2
Lines 57220 57373 +153
Branches 5502 5524 +22
==========================================
+ Hits 51588 51724 +136
- Misses 4176 4193 +17
Partials 1456 1456 ☔ View full report in Codecov by Sentry. |
xdsl/transforms/lower_csl_wrapper.py
Outdated
import_.result.name_hint = self._get_name_hint(op) | ||
|
||
rewriter.insert_op(ops, InsertPoint.at_start(csl_mod.body.block)) | ||
rewriter.replace_matched_op([*structs, import_]) | ||
rewriter.insert_op(structs, InsertPoint.before(op)) | ||
rewriter.replace_matched_op(import_) |
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.
This is to prevent the structs from having the same name as the buffer, and the buffer turning into buf_8
for instance, which may be confusing.
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've got a comment, but I'm not 100% it's correct
xdsl/transforms/lower_csl_wrapper.py
Outdated
@@ -303,6 +306,12 @@ def _make_import_struct(self, import_op: csl_wrapper.ImportOp): | |||
out_structs.append(csl.ConcatStructOp(out_structs[-1], s)) | |||
return out_structs | |||
|
|||
def _get_name_hint(self, import_op: csl_wrapper.ImportOp) -> str | None: |
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.
Could this be Path(import_op.module.data.strip("<>" )).stem
?
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.
Yes!
No description provided.