RFR: 8310130: C2: assert(false) failed: scalar_input is neither phi nor a matchin reduction
Christian Hagedorn
chagedorn at openjdk.org
Wed Jun 21 07:12:04 UTC 2023
On Thu, 15 Jun 2023 14:42:14 GMT, Emanuel Peter <epeter at openjdk.org> wrote:
> Removed a spurious assert before optimization bailout.
>
> I assumed that the "scalar input" of a Reduction node must always be either a Phi or another Reduction node. But that is incorrect, partial vectorization can lead to a reduction node chain where we have vector reductions and scalar reductions at the same time. In those cases, we cannot move the UnorderedReductions out of the loop, so a optimization bailout is appropriate.
>
> I assessed the other asserts in `PhaseIdealLoop::move_unordered_reduction_out_of_loop`, and I think they are all justified. However, one assert would have lead to a `continue` in production, which would not break out of the nested loop correctly. I changed it to a `return`, so that would be a bailout from the optimization. This assert should not be triggered because in `SuperWord::mark_reductions` we forbid that a reduction node has any uses inside the loop except for the successor node in the reduction chain.
>
> I have one regression test delivered by the fuzzer, and one that I constructed myself after understanding the issue.
> Testing up to tier6 and stress testing. **Running, passing except for some IR rules I had to fix, rerunning...**
Looks good!
test/hotspot/jtreg/compiler/loopopts/superword/TestUnorderedReductionPartialVectorization.java line 43:
> 41: public static void main(String[] args) {
> 42: TestFramework.runWithFlags("-Xbatch", "-XX:-TieredCompilation",
> 43: "-XX:CompileCommand=compileonly,compiler.loopopts.superword.TestUnorderedReductionPartialVectorization::test*");
It should probably also trigger without the flags by just specifying `TestFramework.run()` as `test1()` is not using other methods and the IR framework will implicitly use `-Xbatch` and wait for the compilation of `test1()` to be finished.
-------------
Marked as reviewed by chagedorn (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/14494#pullrequestreview-1489912364
PR Review Comment: https://git.openjdk.org/jdk/pull/14494#discussion_r1236475698
More information about the hotspot-compiler-dev
mailing list