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

core: introduce param_def API for ParametrizedAttribute declaration #3444

Draft
wants to merge 63 commits into
base: sasha/misc/type-var-constr-merge
Choose a base branch
from

Conversation

superlopuh
Copy link
Member

This change introduces a new API, to bring attribute definition in line with operation definition. My proposal is to allow either API for the next release, in order not to break dependencies. I will open another PR on top of this one that will deprecate the old API, and migrate all of the dialects in xDSL to the new API. After we release a version with the deprecation warning, we can remove the old implementation entirely.

Note stacked PR

@superlopuh superlopuh added the core xDSL core (ir, textual format, ...) label Nov 13, 2024
@superlopuh superlopuh self-assigned this Nov 13, 2024
Copy link

codecov bot commented Nov 13, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.31%. Comparing base (55bd6aa) to head (827477f).

Additional details and impacted files
@@                        Coverage Diff                        @@
##           sasha/misc/type-var-constr-merge    #3444   +/-   ##
=================================================================
  Coverage                             90.31%   90.31%           
=================================================================
  Files                                   464      464           
  Lines                                 58215    58254   +39     
  Branches                               5555     5558    +3     
=================================================================
+ Hits                                  52577    52613   +36     
  Misses                                 4210     4210           
- Partials                               1428     1431    +3     

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


🚨 Try these New Features:

Copy link
Collaborator

@alexarice alexarice left a comment

Choose a reason for hiding this comment

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

I can't see anything particularly wrong but not having the typevar parameters actually use the typevar for their typing feels really bad to me. On the other hand I don't really have a solution

default: None = None,
resolver: None = None,
init: Literal[False] = False,
) -> Attribute: ...
Copy link
Collaborator

Choose a reason for hiding this comment

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

This doesn't feel ideal? We effectively lose the python typing for the field which was kind of the whole point of having the typevar

Copy link
Member Author

Choose a reason for hiding this comment

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

yep and it's currently breaking my code when I migrate xDSL to it. I'll probably change this soon.

@@ -649,7 +650,7 @@ def return_target_analysis(module: builtin.ModuleOp):


class StencilTypeConversion(TypeConversionPattern):
@attr_type_rewrite_pattern
@attr_constr_rewrite_pattern(StencilTypeConstr)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this a different change?

Copy link
Member Author

Choose a reason for hiding this comment

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

I guess it's more related to the previous change, let me revert this and see what happens

Copy link
Member Author

Choose a reason for hiding this comment

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

Nope it's related to this change, since we use the attr_def instead of the type hints to construct the constraint, we can't do it on the ABC that is StencilTypeConstr since it's not really an attribute. We have to construct the constraint manually instead.

Copy link
Member Author

Choose a reason for hiding this comment

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

Similarly in the change in riscv_snitch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core xDSL core (ir, textual format, ...)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants