alexcrichton opened PR #6412 from alexcrichton:x64-feature-names
to bytecodealliance:main
:
Many of the tests for lowering features use
extractor
s I think since when they were added that was the only option. Nowadays apure constructor
withif-let
feels more natural for this, so this commit updates all existing extractors used to test features to use apure constructor
instead. This additionally updates the names to match the cranelift codegen setting name to ensure that a consistent name is used.<!--
Please make sure you include the following information:
If this work has been discussed elsewhere, please include a link to that
conversation. If it was discussed in an issue, just mention "issue #...".Explain why this change is needed. If the details are in an issue already,
this can be brief.Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.htmlPlease ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->
alexcrichton has marked PR #6412 as ready for review.
alexcrichton requested jameysharp for a review on PR #6412.
alexcrichton requested wasmtime-compiler-reviewers for a review on PR #6412.
abrown submitted PR review.
fitzgen submitted PR review:
Nice, yes this stuff did indeed come before pure constructors and
if-let
.
jameysharp submitted PR review:
Excellent idea. Among other things, this gives ISLE a lot more freedom to schedule these feature tests with respect to other pattern matches, since it no longer believes there's a data dependency on the type. I like to
diff
the ISLE-generated source before and after changes like this just because I think it's interesting to see how the schedule changes.I'd love to see some Sightglass figures for the compile phase. It should be no worse, and possibly better, but ISLE uses a pretty simple greedy heuristic for match ordering so anything is possible.
jameysharp submitted PR review:
Excellent idea. Among other things, this gives ISLE a lot more freedom to schedule these feature tests with respect to other pattern matches, since it no longer believes there's a data dependency on the type. I like to
diff
the ISLE-generated source before and after changes like this just because I think it's interesting to see how the schedule changes.I'd love to see some Sightglass figures for the compile phase. It should be no worse, and possibly better, but ISLE uses a pretty simple greedy heuristic for match ordering so anything is possible.
jameysharp created PR review comment:
I have a preference for using pattern-matches rather than priorities whenever possible.
In this case I could be convinced the other way: do_ctz is more general and still works even if use_bmi1 is enabled, so semantically the priorities make sense; and it probably doesn't make much difference in terms of LLVM's output.
But in general, priorities are kinda weird action-at-a-distance, and they can impede ISLE optimizations.
fitzgen merged PR #6412.
alexcrichton created PR review comment:
Ah true! I did this as a drive-by fix since this was the only location (plus one other here in this PR) that explicitly matched
$false
where all other locations which have feature-specific lowerings only match on$true
. Do you know how hard it would be to remove the need for priorities here? For example something like auto-prioritizing "someif-let
" over "noif-let
" and then requiring an explicit priority if two rules haveif-let
? Basically some way to automatically handle this case with good codegen and no priorities.
jameysharp created PR review comment:
ISLE used to treat more "specific" rules as implicitly higher priority, but we've been moving away from this kind of implicit priority scheme because it was hard for rule authors to reason about. We have all the code needed to implement it in ISLE if we wanted to, though; it's just an application of the subset-overlap check.
If you use
if-let
in both rules, matching against$true
and$false
explicitly, you'll get good codegen without priorities, and the overlap check will understand that the two rules are mutually exclusive. But as I said that's a little unfortunate here where the$false
case would still be correct if the$true
case is removed. So maybe this is just fine as-is.
alexcrichton created PR review comment:
Yeah I realize the implicit priority scheme had its own issues but my hope was that "zero
if-let
" vs "one or moreif-let
" is pretty clear in terms of priority to not need an explicit disambiguation. So not the full "whichif-let
is more specific", just a zero-vs-nonzero check. My hope is that the idiom of "write a rule withif-let
" ideally wouldn't require explicit priorities and could be handled in the common case because it's nice to not have to update all other lowerings when a more explicit one is added.
Last updated: Nov 22 2024 at 17:03 UTC