Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8333248

VectorGatherMaskFoldingTest.java failed when maximum vector bits is 64

XMLWordPrintable

    • b03
    • generic
    • generic

        VectorGatherMaskFoldingTest.java Test fails when max vector bits is 64, when max vector bits is 64, LongVector.SPECIES_MAX.length()/DoubleVector.SPECIES_MAX.length() is 1.
        For example, the following method will fail:
        ```
            @Test
            @IR(counts = { IRNode.STORE_VECTOR_MASKED, ">= 1", IRNode.LOAD_VECTOR_MASKED, ">= 1" }, applyIfCPUFeatureOr = {"avx512", "true", "sve", "true"})
            public static void testDoubleVectorStoreLoadMaskedVector() {
                double[] res = new double[D_SPECIES.length()];
                doubleVector.intoArray(res, 0, doubleVectorMask);
                DoubleVector res2 = DoubleVector.fromArray(D_SPECIES, res, 0, doubleVectorMask);
                Asserts.assertNotEquals(res2, doubleVector);
            }
        ```

        doubleVector data is:[1.0], doubleVectorMask:[true], res2 is:[1.0] So here `Asserts.assertNotEquals(res2, doubleVector);` will assert Error.

        By the way, the aarch64 client jvm mode, getMaxVectorBitSize will return the default 64 bit, or RISC-V will return the default 64 bit without rvv1.0.
        ```
            /**
             * Returns the maximum vector bit size for a given element type.
             *
             * @param etype the element type.
             * @return the maximum vector bit.
             */
             /*package-private*/
            static int getMaxVectorBitSize(Class<?> etype) {
                // VectorSupport.getMaxLaneCount may return -1 if C2 is not enabled,
                // or a value smaller than the S_64_BIT.vectorBitSize / elementSizeInBits if MaxVectorSize < 16
                // If so default to S_64_BIT
                int maxLaneCount = VectorSupport.getMaxLaneCount(etype);
                int elementSizeInBits = LaneType.of(etype).elementSize;
                return Math.max(maxLaneCount * elementSizeInBits, S_64_BIT.vectorBitSize);
            }
        ```

              gcao Gui Cao
              gcao Gui Cao
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: