-
Notifications
You must be signed in to change notification settings - Fork 49
Replace compat features with breaking changes #403
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
base: main
Are you sure you want to change the base?
Replace compat features with breaking changes #403
Conversation
|
Remaining work:
|
py/dml/breaking_changes.py
Outdated
|
|
||
|
|
||
|
|
||
| compat_features = { |
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.
once we eliminate uses of dml.globals.enabled_compat, this should be moved to its only use in dmlc.py
|
PR Verification: ❌ failure |
3ccafbc to
85fff3c
Compare
deprecations_to_md.py
Outdated
| by_version = {} | ||
| for feature in compat.features.values(): | ||
| if (feature.last_api_version.str in api_versions() | ||
| for feature in breaking_changes.changes.values(): |
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.
Consider s/feature/change
py/dml/breaking_changes.py
Outdated
| ``` | ||
| > [!NOTE] | ||
| > When the change is disabled, proxy attributes are not created for all |
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.
ditto
| ''' | ||
| Up to Simics 7, DMLC's type checking was very lenient compared to GCC, | ||
| especially for method overrides and uses of `extern` macros. When this | ||
| change is enabled, type checking becomes strict and consistent with C. |
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.
More consistent with C. Dammit, I'm now realizing that I'll have to make another pass at this because you've made substantial changes to the documentation beyond just inverting the language used and saying "change" instead of "feature". That is going to tie up this PR, because you will be forced to defend the changes you've made to the documentation I've written. If you want to avoid that, please be less revisionist.
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.
More consistent with C.
What I wanted to say is that it's consistent with how C code is generated.
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.
Discussed verbally
| indices used when calling the method were within bounds. When this change is | ||
| enabled, indices are implicitly range checked. If enabling this change causes | ||
| crashes, it indicates a bug in your model that could lead to memory | ||
| corruption without the range check. |
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.
Like here, see! You remove entirely the emphasis both in the short and long doc about just how bad failing the assert is and the implication to how users should enable the change even if we can't force them to.
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 went through my changes, AFAICS I only removed significant chunks in two places. Moved removals to a separate commit.
The overall problem was that the docs were backward and headache-inducing, and flipping the polarity of some words did not help; it was better to rephrase everything.
py/dml/breaking_changes.py
Outdated
| typed parameters were inlined as constants, which had some | ||
| unintuitive semantic implications. In DML 1.4, constants are only | ||
| inlined in parameters declared using `inline` as quasi-type. When | ||
| this change is enabled, DML 1.2 only inlining constants in untyped |
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.
DML 1.2 only inlines constants
py/dml/breaking_changes.py
Outdated
| provisional feature is explicitly enabled. | ||
| where the [`simics_util_vect` provisional feature](provisional-auto.html#simics_util_vect) | ||
| is not 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.
stray artifact
py/dml/c_backend.py
Outdated
| and port.objtype in {'port', 'bank'} | ||
| and compat.port_proxy_ifaces in dml.globals.enabled_compat): | ||
| and breaking_changes.remove_port_proxy_ifaces | ||
| not in dml.globals.enabled_breaking): |
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 never liked how verbose these checks were with compat, and now we're making it worse. Consider adding an .enabled() helper function to the BreakingChange class.
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, maybe we can move enabled_breaking to a class member of breaking_changes.BreakingChange; this pattern is not without precedence.
Factor out major-specific stuff to separate test, and rename latest_api_version to default_api_version. The idea is that the default API version is compatible with all major versions we care about, therefore we use that to run most tests; tests that rely on something newer can annotate that explicitly by e.g. `/// DMLC-FLAG --breaking-change`.
This lets us use whatever hardcoded isolated one-time hacks to preserve their legacy behaviour
Done in separate commit to make rename detection happy
py/dml/c_backend.py
Outdated
| and (compat.dml12_misc not in dml.globals.enabled_compat | ||
| and (breaking_changes.remove_misc_quirks in dml.globals.enabled_breaking |
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 not sure it was right to auto-add the dml- prefix; maybe it's clearer and more greppable if we spell out the prefix. In this example, the 'dml12' part of dml12_misc_int effectively deemphasized the condition as extra uninteresting dml 1.2 junk.
85fff3c to
a808cba
Compare
py/dml/breaking_changes.py
Outdated
| then that **definitely signifies a bug in your model; a bug that would | ||
| very likely result in memory corruption if the assertion were not to | ||
| be made.**''' | ||
| then that signifies a bug in your model that could | ||
| lead to memory corruption without the range check.''' |
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.
Changed to neutral language that says the same thing. The feature is important for those who spend much time on problems root-caused to memory corruptions, it's not up to us to decide. People are running sanitation tools that probably catch most such memory corruptions. IIRC, some of the overflows detected in the wild by the range check were not real corruptions (because it just logged something without accessing state). I.e., the code is inherently dangerous and unsafe but can't actually cause problems yet.
I agree it's a sane check that everyone should enable as soon as possible, but the same goes for most breaking changes. If we care, the best we can do is to actively push people to enable the check.
| Passing `--no-compat=suppress_WLOGMIXUP` to DMLC has almost the same effect | ||
| as passing `--warn=WLOGMIXUP`; either will cause DMLC to report the warning | ||
| even when the Simics API version in use is below 7. The only difference | ||
| between these two options is that if `--no-compat=suppress_WLOGMIXUP` is | ||
| used (and `--warn=WLOGMIXUP` is not), then `WLOGMIXUP` may still be | ||
| explicitly suppressed via `--no-warn=WLOGMIXUP`. In contrast, | ||
| `--warn=WLOGMIXUP` doesn't allow for `WLOGMIXUP` to be suppressed at | ||
| all.''' |
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.
Removed this because it's a lot of text and I don't understand why a user needs it. If they get the warning somewhere, then they will fix it. If that's impossible somewhere (which is unlikely), then they can use --no-warn as usual, no need to remind them.
| to avoid overwhelming users with warnings, as the faulty pattern that | ||
| `WLOGMIXUP` reports is very prevalent within existing code. Addressing | ||
| applications of the faulty pattern should be done before or as part of | ||
| migration to Simics API version 7. |
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.
Removed some text that felt redundant. It follows from how breaking changes work that WLOGMIXUP will be enabled during migration to API 7, and it follows from the previous mention of "overwhelming" that you want to fix those violations if you care about not getting overwhelmed.
|
PR Verification: ❌ failure |
a808cba to
a56fb0b
Compare
This reverses polarity and makes things easier to explain
a56fb0b to
23d8793
Compare
|
PR Verification: ❌ failure |
| def enabled(self): | ||
| # `None` happens in unit tests; assume everything is enabled | ||
| return (True if BreakingChange.enabled_breaking_changes is None | ||
| else self in BreakingChange.enabled_breaking_changes) |
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.
(BreakingChange.enabled_breaking_changes is None
|| self in BreakingChange.enabled_breaking_changes)
|
|
||
|
|
||
| @change | ||
| class dml_remove_legacy_attributes(BreakingChange): |
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's replacement, not pure removal. Use no_legacy_attributes or modern_attributes.
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 is pure removal. Before the change you get both the normal attr and a proxy pseudo-attr; the only change is that the proxy is no longer added.
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 not the proxy attributes removal breaking change. This is the SIM_register_attribute breaking change.
|
|
||
|
|
||
| @change | ||
| class dml_remove_port_obj_param(BreakingChange): |
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 a rather terrible name which when read could be understood as the exact opposite of what the feature does
| <tt>uint<i>NN</i></tt> types; this can sometimes have unexpected | ||
| consequences. The most immediate effect of disabling this feature | ||
| @change | ||
| class dml12_fix_int_quirks(BreakingChange): |
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.
Fix int quirks? That's a strange way of putting it, when the intent is rather to strip away strange legacy behaviors. Not blocking, but I encourage you to give naming another think.
| `experimental_vect` is disabled, DMLC forbids the `vect` | ||
| syntax. | ||
| @change | ||
| class dml_forbid_experimental_vect(BreakingChange): |
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.
ban_ or no_. In general, I'm sensitive to the length of these names, especially now we slap on the dml prefix on everything...
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.
maybe vect_requires_provisional?
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 like that. Or rather, vect_needs_provisional.
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 wait that won't make sense once we get RAII. Uhh... legacy_vect_needs_provisional? but augh now it's long again
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_implicit_simics_util_vect?????
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 dammit just pick no_experimental_vect
| ''' | ||
| Up to Simics 7, DMLC's type checking was very lenient compared to GCC, | ||
| especially for method overrides and uses of `extern` macros. When this | ||
| change is enabled, type checking becomes strict and consistent with C. |
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.
Discussed verbally
No description provided.