-
Bug
-
Resolution: Fixed
-
P2
-
16, 17
-
b32
-
Verified
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8259744 | 17 | Xiaohong Gong | P2 | Resolved | Fixed | b06 |
JDK-8260132 | 16.0.1 | Xiaohong Gong | P2 | Resolved | Fixed | b03 |
For the following Vector API case:
static byte[] a = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
static byte[] b = new byte[16];
static byte[] c = new byte[16];
private static void func(boolean print) {
ByteVector av = ByteVector.fromArray(SPECIES_128, a, 0);
ByteVector bv = (ByteVector)av.reinterpretShape(SPECIES_64, 0);
bv.intoArray(b, 0);
ByteVector cv = (ByteVector)bv.reinterpretShape(SPECIES_128, 0);
cv.intoArray(c, 0);
}
It first reinterprets vector from "SPECIES_128" to "SPECIES_64" and then reinterprets back to "SPECIES_128"; The final results in array "b" and "c" are expected to be:
b = [ 0, 1, 2, 3, 4, 5, 6, 7, 0, 0, 0, 0, 0, 0, 0, 0]
c = [ 0, 1, 2, 3, 4, 5, 6, 7, 0, 0, 0, 0, 0, 0, 0, 0]
However, the current results with C2 is:
b = [ 0, 1, 2, 3, 4, 5, 6, 7, 0, 0, 0, 0, 0, 0, 0, 0]
c = [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]
The results in array "c" is not right which should be zeros for the higher parts. This issue happens both on x86 and aarch64 platform.
The root cause is the incorrect optimization for "VectorReinterpretNode". See the codes below:
Node* VectorReinterpretNode::Identity(PhaseGVN *phase) {
Node* n = in(1);
if (n->Opcode() == Op_VectorReinterpret) {
if (Type::cmp(bottom_type(), n->in(1)->bottom_type()) == 0) {
return n->in(1);
}
}
return this;
}
The node will be optimized out if the bottom_type is equal to it's input's input's bottom_type. This is right if there is no truncation happens during the whole process. Otherwise, the above issue happens if there is truncation.
static byte[] a = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
static byte[] b = new byte[16];
static byte[] c = new byte[16];
private static void func(boolean print) {
ByteVector av = ByteVector.fromArray(SPECIES_128, a, 0);
ByteVector bv = (ByteVector)av.reinterpretShape(SPECIES_64, 0);
bv.intoArray(b, 0);
ByteVector cv = (ByteVector)bv.reinterpretShape(SPECIES_128, 0);
cv.intoArray(c, 0);
}
It first reinterprets vector from "SPECIES_128" to "SPECIES_64" and then reinterprets back to "SPECIES_128"; The final results in array "b" and "c" are expected to be:
b = [ 0, 1, 2, 3, 4, 5, 6, 7, 0, 0, 0, 0, 0, 0, 0, 0]
c = [ 0, 1, 2, 3, 4, 5, 6, 7, 0, 0, 0, 0, 0, 0, 0, 0]
However, the current results with C2 is:
b = [ 0, 1, 2, 3, 4, 5, 6, 7, 0, 0, 0, 0, 0, 0, 0, 0]
c = [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]
The results in array "c" is not right which should be zeros for the higher parts. This issue happens both on x86 and aarch64 platform.
The root cause is the incorrect optimization for "VectorReinterpretNode". See the codes below:
Node* VectorReinterpretNode::Identity(PhaseGVN *phase) {
Node* n = in(1);
if (n->Opcode() == Op_VectorReinterpret) {
if (Type::cmp(bottom_type(), n->in(1)->bottom_type()) == 0) {
return n->in(1);
}
}
return this;
}
The node will be optimized out if the bottom_type is equal to it's input's input's bottom_type. This is right if there is no truncation happens during the whole process. Otherwise, the above issue happens if there is truncation.
- backported by
-
JDK-8259744 VectorReinterpretNode is incorrectly optimized out
-
- Resolved
-
-
JDK-8260132 VectorReinterpretNode is incorrectly optimized out
-
- Resolved
-
- relates to
-
JDK-8259601 AArch64: Fix reinterpretX2D match rule issue
-
- Closed
-
-
JDK-8259757 add a regression test for 8259353 and 8259601
-
- Resolved
-
(1 links to)