RFR: 8310308: IR Framework: check for type and size of vector nodes [v20]
Emanuel Peter
epeter at openjdk.org
Tue Jul 4 15:13:03 UTC 2023
On Tue, 4 Jul 2023 11:44:47 GMT, Emanuel Peter <epeter at openjdk.org> wrote:
>> For some changes to `SuperWord`, and maybe auto-vectorization in general, I want to strengthen the IR Framework.
>>
>> **Motivation**
>> I want to not just find the relevant IR nodes, but also assert that they have the maximal length that they could have on the respective platform (given the CPU features and `MaxVectorSize`). Without this verification it is possible that a future change leads to a regression where we still vectorize but at shorter vector widths as before - leading to performance loss.
>>
>> **How to use it**
>>
>> All `IRNode`s in `test/hotspot/jtreg/compiler/lib/ir_framework/IRNode.java` that are created with `vectorNode` are now all matched with their `type` and `size`. The regex might now look something like this:
>>
>> `"(\d+(\s){2}(VectorCastF2X.*)+(\s){2}===.*vector[A-Za-z][8]:{int})"`
>> which would match with IR nodes dumped like that:
>> `1150 VectorCastF2X === _ 1151 [[ 1146 ]] #vectory[8]:{int} ...`
>>
>> The goal was to keep it simple and straight forward. In most cases, you can just use the nodes as before, and implicitly we now check for maximal size automatically. However, in some cases we want to ensure there is no or only a limited number of nodes (`failOn` or comparison `<` or `<=` or `=0`) - in those cases we usually want to make sure there is not any node of any size, so we match with any size by default. The size can also explicitly be constrained using `IRNode.VECTOR_SIZE`.
>>
>> Some examples:
>> 1. `@IR(counts = {IRNode.LOAD_VECTOR_I, " >0 "})` -> search for a `LoadVector` node with `type` `int`, and maximal `size` possible on the machine (limited by CPU features and `MaxVectorSize`). This is the most common use case.
>> 2. `@IR(failOn = { IRNode.LOAD_VECTOR_L, IRNode.STORE_VECTOR })` -> fail if there is a `LoadVector` with type `long`, of `any` size.
>> 3. `@IR(counts = { IRNode.XOR_VI, IRNode.VECTOR_SIZE_4, " > 0 "})` -> find at least one `XorV` node with type `int` and exactly `4` elements. Useful for VectorAPI when the vector species is fixed.
>> 4. `@IR(counts = { IRNode.LOAD_VECTOR_D, IRNode.VECTOR_SIZE + "min(4, max_double)", " >0 " })` -> search for a `LoadVector` node with `type` `double`, and `size` exactly equals to `min(4, max_double)` (so 4 elements, or if the hardware allows fewer `doubles`, then that number).
>> 5. `@IR(counts = { IRNode.ABS_VF, IRNode.VECTOR_SIZE + "min(LoopMaxUnroll, max_float)", ">= 1" })` -> find at least one `AbsV` nodes with type `float`, and the `size` exactly equals to the smaller of...
>
> Emanuel Peter has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 63 commits:
>
> - merge from master, manual merge for VectorLogicalOpIdentityTest.java
> - Response to Tobias' review
> - more for Christian's reviews
> - Apply suggestions from code review
>
> Co-authored-by: Christian Hagedorn <christian.hagedorn at oracle.com>
> - fix TestUnorderedReductionPartialVectorization.java
> - Fix 2 IR framework tests
> - fix merged tests
> - Merge branch 'master' into JDK-8310308
> - whitespace fix
> - more refactoring for review
> - ... and 53 more: https://git.openjdk.org/jdk/compare/711cddd8...a86de32d
Ah, it turns out on our testing infrastructure it looks all green, but on GitHub actions I have 36 failing tests. And I think they are almost all related. Will need to investigate.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/14539#issuecomment-1620423281
More information about the hotspot-compiler-dev
mailing list