JDK-8346954 : [JMH] jdk.incubator.vector.MaskedLogicOpts fails due to IndexOutOfBoundsException
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 21,24,25
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • CPU: generic
  • Submitted: 2025-01-03
  • Updated: 2025-03-20
  • Resolved: 2025-03-06
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 25
25 b14Fixed
Related Reports
Relates :  
Relates :  
Description
Suite MaskedLogicOpts.maskedLogicOperationsLong512() crashed on both x86 and AArch64 with the following error:

```
java.lang.IndexOutOfBoundsException: Index 252 out of bounds for length 249
```
Comments
Changeset: 107ee878 Branch: master Author: Nicole Xu <yuyangx@nvidia.com> Date: 2025-03-06 01:40:24 +0000 URL: https://git.openjdk.org/jdk/commit/107ee878d66f4006f102c1fd12af3bf156a25757
06-03-2025

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk/pull/22963 Date: 2025-01-08 09:04:47 +0000
05-02-2025

Here is a PR from my colleague to fix the test: https://github.com/openjdk/jdk/pull/22963
14-01-2025

Paging [~jbhateja] who's the author of this test.
13-01-2025

ILW = Microbenchmark fails with IOOBE (test bug), single microbenchmark, no known workaround = MLH = P4
13-01-2025

Thanks [~xgong]. I had a quick look and it's indeed easy reproduce and a test bug. The problem is that LongVector.fromArray throws an IndexOutOfBoundsException if offset+N < 0 or offset+N >= a.length for any lane N in the vector: https://github.com/openjdk/jdk/blob/82e2a791225a289ba32360bf415274c4b48b9e00/test/micro/org/openjdk/bench/jdk/incubator/vector/MaskedLogicOpts.java#L309 https://docs.oracle.com/en/java/javase/17/docs/api/jdk.incubator.vector/jdk/incubator/vector/LongVector.html#fromArray(jdk.incubator.vector.VectorSpecies,long%5B%5D,int) In this case, long256_arr_idx is 252 which out of bounds for length 249. The computation of long256_arr_idx (and probably others) needs to be fixed: https://github.com/openjdk/jdk/blob/82e2a791225a289ba32360bf415274c4b48b9e00/test/micro/org/openjdk/bench/jdk/incubator/vector/MaskedLogicOpts.java#L132
13-01-2025

[~thartmann] Thanks for looking at this ticket. // [~xgong] We don't see this failure in our testing. Could you please provide more // information about the environment? VM flags, architecture, jtreg/jmh log file with // stack trace etc. would be useful. Thanks! This issue exists on all kind of architecture like AArch64 and X86. The architecture we tested on includes ARM SVE 128-bit vector length, and X86 AVX-512 system. Following is the log details: ``` # JMH version: 1.37 # VM version: JDK 25-internal, OpenJDK 64-Bit Server VM, 25-internal-git-f1d85ab3e61 # VM invoker: jdk/bin/java # VM options: --add-modules=jdk.incubator.vector -Xms8g -Xmx8g -XX:+AlwaysPreTouch -XX:ObjectAlignmentInBytes=64 # Blackhole mode: compiler (auto-detected, use -Djmh.blackhole.autoDetect=false to disable) # Warmup: 1 iterations, 10 s each # Measurement: 1 iterations, 10 s each # Timeout: 10 min per iteration # Threads: 1 thread, will synchronize iterations # Benchmark mode: Throughput, ops/time # Benchmark: org.openjdk.bench.jdk.incubator.vector.MaskedLogicOpts.maskedLogicOperationsLong512 # Parameters: (ARRAYLEN = 256) # Run progress: 60.00% complete, ETA 00:06:10 # Fork: 1 of 1 WARNING: Using incubator modules: jdk.incubator.vector WARNING: A terminally deprecated method in sun.misc.Unsafe has been called WARNING: sun.misc.Unsafe::objectFieldOffset has been called by org.openjdk.jmh.util.Utils WARNING: Please consider reporting this to the maintainers of class org.openjdk.jmh.util.Utils WARNING: sun.misc.Unsafe::objectFieldOffset will be removed in a future release # Warmup Iteration 1: <failure> java.lang.IndexOutOfBoundsException: Index 252 out of bounds for length 249 at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:100) at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:106) at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:302) at java.base/java.util.Objects.checkIndex(Objects.java:365) at jdk.incubator.vector/jdk.incubator.vector.VectorIntrinsics.checkFromIndexSize(VectorIntrinsics.java:58) at jdk.incubator.vector/jdk.incubator.vector.LongVector.fromArray(LongVector.java:2866) at org.openjdk.bench.jdk.incubator.vector.MaskedLogicOpts.maskedLogicOperationsLongKernel(MaskedLogicOpts.java:246) at org.openjdk.bench.jdk.incubator.vector.MaskedLogicOpts.maskedLogicOperationsLong512(MaskedLogicOpts.java:266) at org.openjdk.bench.jdk.incubator.vector.jmh_generated.MaskedLogicOpts_maskedLogicOperationsLong512_jmhTest.maskedLogicOperationsLong512_thrpt_jmhStub(MaskedLogicOpts_maskedLogicOperationsLong512_jmhTest.java:125) at org.openjdk.bench.jdk.incubator.vector.jmh_generated.MaskedLogicOpts_maskedLogicOperationsLong512_jmhTest.maskedLogicOperationsLong512_Throughput(MaskedLogicOpts_maskedLogicOperationsLong512_jmhTest.java:85) at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104) at java.base/java.lang.reflect.Method.invoke(Method.java:565) at org.openjdk.jmh.runner.BenchmarkHandler$BenchmarkTask.call(BenchmarkHandler.java:527) at org.openjdk.jmh.runner.BenchmarkHandler$BenchmarkTask.call(BenchmarkHandler.java:504) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:328) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:545) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:328) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1095) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:619) at java.base/java.lang.Thread.run(Thread.java:1447) ``` Hope this could provide any help. Thanks! Xiaohong
13-01-2025

[~xgong] We don't see this failure in our testing. Could you please provide more information about the environment? VM flags, architecture, jtreg/jmh log file with stack trace etc. would be useful. Thanks! Update: Ah, it's a microbenchmark. We probably don't execute it very often.
13-01-2025

[~xgong]please update affects version indicating the JDK version impacted.
12-01-2025

The test bugs should filed against corresponding hotspot components.
10-01-2025