-
Notifications
You must be signed in to change notification settings - Fork 46
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
Add --deprecate option for proxy ports and interfaces #209
Add --deprecate option for proxy ports and interfaces #209
Conversation
mandolaerik
commented
Sep 22, 2023
- Shut up linter
- Remove the --illegal-attrs flag
- Remove --illegal-attrs flag
- Remove --version, which was ignored
- Migrate from optparse to argparse
- Rename function
- Refactor: Re-use common function
- Factor out params for API version ranges
- Add option for listing all warning tags
- Add --deprecate=PORT_PROXY_IFACES
- Add PORT_PROXY_ATTRS deprecation
TODO:
|
lib/1.4/dml-builtins.dml
Outdated
#if (!_DEPRECATE_PORT_PROXY_IFACES && !_api_6_or_older) { | ||
error "The PORT_PROXY_IFACES feature can only be enabled" | ||
+ " with API=6 or older"; | ||
} |
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'm unsure about this part -- explicit guards in DML code is one of the things that I liked with #205; it makes the logic easy to explore and understand; however, I don't think this error statement is reachable (there is no flag to disable deprecations, and the default setting doesn't trigger the error). So this code just serves as (statically) executable documentation; it validates that the feature is indeed deprecated in APIs newer than 6. Unfortunately it doesn't validate a tight bound; the #if
would not happen if 6 was the first deprecated version.
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.
If you remember my --compat
rant, I think we one day may trip into the situation where we will need to offer an option to revert a particular deprecation/semantic change. But those will be very particular situations, and the deprecation of proxy ports and interfaces certainly isn't one of them.
My opinion is that this only makes sense if we eventually plan to introduce a general --compat
flag (as opposed to ad-hoc flags where we are selective about what kind of changes that users can turn off) -- I'm not particularly fond of a general --compat
option, and I'm guessing you are even less so.
If we won't have a general --compat
flag), there's no point to this. Why bother with executable documentation if you can just put a comment (here, or elsewhere?)
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.
We do have a generic compat flag, namely --simics-api
.
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.
... where the meaning of --simics-api=7
is sealed the day 7 is released.
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.
By "general" in this context I mean "granular and at will", e.g. --compat=PORT_PROXY_IFACES
, like the opposite of --deprecate
/--no-compat
.
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.
And by "ad-hoc" I mean if we ever make a change that we discover "oops, people have legit reasons to want to reverse this change and keep using modern Simics, but we still want the reversal of the change to be 'opt-in' and lock out your model from certain features if necessary as to not shackle future development of DMLC" then instead of adding a full-fledged --compat
we instead let people say --enable-deprecated-[feature name]
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.
Right, we can later choose to allow opting out from certain deprecations in API versions where they are enabled by default. If the need should arise.
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.
Indeed; and the gist of my argument is that seeing how we're very unlikely to want --compat
in favor of ad-hoc compatibility flags, I don't think we want this executable documentaiton, especially if it incurs an unneeded auto param (unless we do want people to access it, but then it shouldn't be _
prefixed`.)
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 the auto params are nice to have; in particular, good for workarounds in common code. The reason for the _
prefix is that they will be removed when they are obsolete.
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.
No tests for 1.2. This is on purpose, the 1.2-specific code is just that auto params are declared, and if they wouldn't exist, then a minimal 1.2 file would fail.
Verification #12227482: fail |
lib/1.4/dml-builtins.dml
Outdated
error "The PORT_PROXY_IFACES feature can only be enabled" | ||
+ " with API=6 or older"; | ||
} | ||
param _DEPRECATE_PORT_PROXY_ATTRS auto; |
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.
The naming scheme can be debated -- we don't use UPPER_SNAKE_CASE for other params, the uppercase is inherited from the command-line tags, which are uppercase for consistency with warning and error tags. I'm not sure that consistency is important; we could just lowercase deprecation tags. We could also mix-case, as in _deprecate_PORT_PROXY_ATTRS
. Or just keep it uppercase; there is uncontroversial widespread use of uppercase param names, in particular for simulation-related constants or array size parameters.
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.
My vote is mixed case, but I agree that whatever choice we pick is likely to be uncontroversial.
d2688d9
to
631713b
Compare
Verification #12228488: pass |
631713b
to
37be595
Compare
Verification #12229149: pass |
Added first draft of documentation. Need to discuss terminology in more detail. |
Verification #12231545: fail |
05db6c6
to
78879d4
Compare
Verification #12231565: pass |
78879d4
to
769139e
Compare
Verification #12236973: fail |
769139e
to
4018e59
Compare
Verification #12236979: pass |
be9c393
to
a4143e1
Compare
The conversion of some dml12 features into compat tags also requires that the tests for these are rewritten with |
Verification #12250481: pass |
Also, one non-apparent change in this PR is that the |
Verification #12253365: fail |
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 quite like this. Some changes needed though.
DMLC provides a command-line flag `--api-version` to specify the API version to | ||
be used for a model. When building with the standard Simics build system, this is controlled by the `SIMICS_API_VERSION` variable in `make`, or the `SIMICS_API`/`MODULE_SIMICS_API` variable in `CMake`. | ||
|
||
DMLC also provides the <code>--no-compat=_tag_</code> flag, which disables the |
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.
Wait, <code>the last word is _italicized_</code>
works? Huh. In the ref manual we use <tt>the last work is <em>italicized</em></tt>
. We should pick one for consistency.
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 don't agree: I will not remember style at this level of detail so it will cost more than it gives. I can see two cases where markdown style matters:
- we need to avoid markdown that relyies on corners that have non-local effect, such as an unescaped _underscore that works fine as long as no other underscore appears later in the same paragraph.
- it's nice to ban other inconsistencies as long we can run a linter to enforce the rule.
@@ -58,14 +60,13 @@ | |||
# types.TypeSequence -> codegen.TypeSequenceInfo | |||
type_sequence_infos = {} | |||
|
|||
# 1.4 style integer operations in 1.2, --strict-dml12-int | |||
strict_int_flag = None | |||
enabled_compat = set() |
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.
set()
vs. Set()
? It certainly won't affect generated C, but may affect, say, if we want to ever print out what compatibility tags that are enabled.
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.
Then we should print sorted(enabled_compat)
2e3573e
to
9972dd0
Compare
Verification #12254809: fail |
9972dd0
to
5dbb5b4
Compare
This is nice because it allows comparisons like "simics_api < 7" to work also in Simics 10. We use the integer 4 to represent the API "4.8"
This also included some renames and change in polarities; in particular, all deprecated features are now disabled by default, as required by some unit tests.
Also flatten the compat.features dict and use string-only API representation in env.py
Triggered by `VPOP + VPOP` when compiling with --no-compat=dml12_int, or by 1.2/errors/EAPPLY when enabling --no-compat=dml12_int,dml12_misc
Passing --no-compat=dml12_misc triggers this in many tests.
8aed632
to
2b06464
Compare
Verification #12324952: fail |
Deprecating requires updating lots of tests and components; better to push that to a separate PR.
2b06464
to
0019327
Compare
Verification #12325435: pass |
Verification #12325946: fail |
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.
Looks good! Though I still don't like the _compat_
prefix of the autoparams.
# code from 1.2 with --no-compat=dml12_misc | ||
dml.globals.dml_version != (1, 2) | ||
or p.site.dml_version == (1, 2) | ||
or p.site != sym.site): |
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.
OW
By the way, should we have some standard way to annotate hacks and todos? I've always used # HACK:
and # TODO:
because my editor highlights them.
if version != (1, 2): | ||
for feature in [compat.dml12_inline, compat.dml12_not, | ||
compat.dml12_misc]: | ||
dml.globals.enabled_compat.discard(feature) | ||
|
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.
It feels weird this is done separately from all other compatibility enablement logic. Though we want to do such logic as early as possible, and we have no choice to place this part of it right here.
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.
Oh, and I notice that I forgot dml12_goto there! By sheer luck, this is not a problem since goto
is forbidden by the grammar.
Verification #12330620: pass |