RFR: 8256973: Intrinsic creation for VectorMask query (lastTrue, firstTrue, trueCount) APIs [v2]

Vladimir Ivanov vlivanov at openjdk.java.net
Fri May 14 21:26:40 UTC 2021


On Fri, 14 May 2021 19:27:22 GMT, Jatin Bhateja <jbhateja at openjdk.org> wrote:

>> src/hotspot/cpu/x86/x86.ad line 8085:
>> 
>>> 8083: 
>>> 8084: instruct vmask_true_count_avx(rRegI dst, vec mask, rRegL tmp, vec xtmp, vec xtmp1) %{
>>> 8085:   predicate(!VM_Version::supports_avx512bw());
>> 
>> `VM_Version::supports_avx512vlbw()`
>
> Handled in match_rule_supported_vector.

I think you still need to adjust the predicate to be able to correctly split between AVX512BW+VL and AVX512F/AVX/AVX2 configurations.

>> src/java.base/share/classes/jdk/internal/vm/vector/VectorSupport.java line 469:
>> 
>>> 467:     public static
>>> 468:     <M>
>>> 469:     int maskOp(int oper, Class<?> maskClass, Class<?> elemClass, int length, M m,
>> 
>> I second Paul here: `maskOp` case is already covered by `reductionCoerced`.
>
> As discussed above mixing it with reduction coerced will require changes in original entry point (type parameter have Vector as the lower bound) , also we may need to bypass some irrelevant portions in inline_vector_reduction() , for the time being to keep the things clean added a different entry point for all masked operations.

Ok, fair enough. We can revisit that later and merge them if needed.
Some suggestions to consider to align it with `reductionCoerced`:
* reflect in the name that it's effectively a reduction, but on masks (`maskReductionCoerced`?);
* return type can be generalized to `long`;
* bound on M: `<M extends VectorMask>`;
* no need to introduce a special interface, `Function<T,R>` just works: `VectorMaskOp<M>` -> `Function<M, Long>`;

-------------

PR: https://git.openjdk.java.net/jdk/pull/3916


More information about the hotspot-compiler-dev mailing list