Question about RegMask::is_aligned_sets()
Corey Ashford
cjashfor at linux.ibm.com
Sat Feb 20 02:31:37 UTC 2021
Hello all,
First the question:
I'd like to understand the concept of "aligned sets" in RegMask. I
believe I understand the RegMask idea overall, but I don't understand
the idea of alignment of sets (actually the concept of sets in this
context is also fuzzy). I've looked at the code that implements
is_aligned_sets, and I just can't yet seem to grok what requirement it
is trying to verify. I read RegMask.hpp's comments on the method
protoype, and it didn't help me much, I'm afraid. If someone could give
a paragraph or two of explanation, I'd really appreciate it.
Any additional insights into porting the Vector API to other arches
would also be appreciated. For example, maybe we've started the port at
the wrong place.
Thanks for your consideration.
More background:
We have started working on adding support to the PPC64-LE hotspot code
for the Vector API. In order to support Vector Masks, it seems we need
to change our current support for fixed-length, 128-bit vectors to
something that can be as short as two booleans. To do that we have
changed the function min_vector_size in hotspot/cpu/ppc.ad to return 2
when the type is T_BOOLEAN, otherwise it still returns 16.
My first task was to add support for vector masks, and so I added a new
instruct to cpu/ppc/ppc.ad to match VectorLoadMask, which then
necessitated adding some instructs for LoadVector and StoreVector of the
appropriate lengths.
I have a test case that loads a vector mask for a vector of shorts:
import jdk.incubator.vector.ShortVector;
import jdk.incubator.vector.VectorSpecies;
import jdk.incubator.vector.VectorMask;
import java.util.Random;
class TestVectorMaskShort {
private static final VectorSpecies<Short> SPECIES =
ShortVector.SPECIES_128;
public static VectorMask<Short> test(boolean[] bary) {
VectorMask<Short> vmask = VectorMask.fromArray(SPECIES, bary, 0);
return vmask;
}
public static void main(String args[]) {
Random ran = new Random(100);
int counter = 0;
boolean[] bary = new boolean[8];
for (int i = 0; i < 20_000; i++) {
for (int j = 0; j < bary.length; j++) {
bary[j] = ran.nextBoolean();
}
VectorMask<Short> vmask = test(bary);
if (vmask.allTrue()) {
counter++;
}
}
System.out.printf("counter = %d\n", counter);
}
}
When I run this test case, I get a runtime error:
# Internal Error
(/home/cjashfor/git-trees/jdk/src/hotspot/share/opto/chaitin.cpp:951),
pid=1341588, tid=1341601
# assert(lrgmask.is_aligned_sets(RegMask::SlotsPerVecX)) failed: vector
should be aligned
- Corey
Corey Ashford
Software Engineer
IBM Systems, LTC OpenJDK team
IBM
More information about the hotspot-compiler-dev
mailing list