Skip to content

There is a crash when I try to use a large 2D array over 2GB in GPU #177

@KNEMinecraftLauncher

Description

@KNEMinecraftLauncher

import java.lang.foreign.Arena;
import java.lang.foreign.MemorySegment;
import java.lang.foreign.ValueLayout.OfInt;

import com.aparapi.Kernel;

public class VectorMulKernel extends Kernel {
private float[] a;
private float[] b;
private float[] c;
private byte[][]d;
public VectorMulKernel(float[]a,float []b) {
this.a=a;
this.b=b;
this.c=new float[a.length];
d=new byte[3][Integer.MAX_VALUE/2];
}
@OverRide
public void run() {
int id=getGlobalId();
//for(int i=0;i<100;i++) {
c[id]=a[id]*b[id];
d[0][id]=0;
//}
}
public float[] getC() {
return c;
}
public void putAll() {
put(a);
put(b);
put(d);
}
public void getAll() {
get(c);
get(d);
}

}

A fatal error has been detected by the Java Runtime Environment:

Internal Error (0x20474343), pid=23672, tid=24944

JRE version: Java(TM) SE Runtime Environment Oracle GraalVM 24+36.1 (24.0+36) (build 24+36-jvmci-b01)

Java VM: Java HotSpot(TM) 64-Bit Server VM Oracle GraalVM 24+36.1 (24+36-jvmci-b01, mixed mode, sharing, tiered, jvmci, jvmci compiler, compressed oops, compressed class ptrs, g1 gc, windows-amd64)

Problematic frame:

C [KERNELBASE.dll+0x3f47c]

Core dump will be written. Default location: D:\KNE�����\coding\java\JOCLdemo\hs_err_pid23672.mdmp

An error report file with more information is saved as:

D:\KNE�����\coding\java\JOCLdemo\hs_err_pid23672.log

If you would like to submit a bug report, please visit:

https://bugreport.java.com/bugreport/crash.jsp

The crash happened outside the Java Virtual Machine in native code.

See problematic frame for where to report the bug.

--------------- S U M M A R Y ------------

Command Line: -XX:ThreadPriorityPolicy=1 -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCIProduct -XX:-UnlockExperimentalVMOptions -Dcom.aparapi.enableShowGeneratedOpenCL=true -Dfile.encoding=UTF-8 -XX:+ShowCodeDetailsInExceptionMessages AparApiLearn

Host: Intel(R) Xeon(R) CPU E7-8891 v4 @ 2.80GHz, 40 cores, 191G, Windows Server 2022 , 64 bit Build 20348 (10.0.20348.3692)
Time: Wed Jun 25 18:26:37 2025 Windows Server 2022 , 64 bit Build 20348 (10.0.20348.3692) elapsed time: 3.255726 seconds (0d 0h 0m 3s)

--------------- T H R E A D ---------------

Current thread (0x00000000005f4f50): JavaThread "main" [_thread_in_native, id=24944, stack(0x0000000002460000,0x0000000002560000) (1024K)]

Stack: [0x0000000002460000,0x0000000002560000], sp=0x000000000255ee90, free space=1019k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C [KERNELBASE.dll+0x3f47c] (no source info available)
C [libgcc_s_seh-1.dll+0xda21] (no source info available)
C [libstdc++-6.dll+0x106423] (no source info available)
C [libstdc++-6.dll+0x105a10] (no source info available)
C [libaparapi.dll+0x9a20] (no source info available)
C [libaparapi.dll+0x735e] (no source info available)
C [libaparapi.dll+0x78ee] (no source info available)
C [libaparapi.dll+0x7b2e] (no source info available)
C 0x00000000144fc960 (no source info available)

The last pc belongs to native method entry point (kind = native) (printed below).
Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j com.aparapi.internal.jni.KernelRunnerJNI.runKernelJNI(JLcom/aparapi/Range;ZILjava/nio/ByteBuffer;Ljava/nio/ByteBuffer;)I+0
j com.aparapi.internal.kernel.KernelRunner.executeOpenCL(Lcom/aparapi/device/Device;Lcom/aparapi/internal/kernel/KernelRunner$ExecutionSettings;)Lcom/aparapi/Kernel;+106
j com.aparapi.internal.kernel.KernelRunner.executeInternalInner(Lcom/aparapi/internal/kernel/KernelRunner$ExecutionSettings;Lcom/aparapi/device/Device;Z)Lcom/aparapi/Kernel;+3706
j com.aparapi.internal.kernel.KernelRunner.executeInternalOuter(Lcom/aparapi/internal/kernel/KernelRunner$ExecutionSettings;)Lcom/aparapi/Kernel;+4
j com.aparapi.internal.kernel.KernelRunner.execute(Ljava/lang/String;Lcom/aparapi/Range;I)Lcom/aparapi/Kernel;+78
j com.aparapi.Kernel.execute(Ljava/lang/String;Lcom/aparapi/Range;I)Lcom/aparapi/Kernel;+7
j com.aparapi.Kernel.execute(Lcom/aparapi/Range;I)Lcom/aparapi/Kernel;+6
j com.aparapi.Kernel.execute(Lcom/aparapi/Range;)Lcom/aparapi/Kernel;+3
J 305% c1 AparApiLearn.main([Ljava/lang/String;)V (271 bytes) @ 0x000000000d171f3c [0x000000000d1708a0+0x000000000000169c]
v ~StubRoutines::call_stub 0x00000000144f0fcd

siginfo: EXCEPTION_?? (0x20474343), ExceptionInformation=0x000000004e618a90

Registers:
RAX=0x000000004f950d00, RBX=0x000000004e618ad0, RCX=0x0000000000000007, RDX=0x0000000000000002
RSP=0x000000000255ee90, RBP=0x000000004e6180d0, RSI=0x000000006fd5b510, RDI=0x00000000bffffffd
R8 =0x0000000000000000, R9 =0x0000000000400000, R10=0x0000000000000000, R11=0x0000000000000001
R12=0x000000004e618a90, R13=0x00000000005f5318, R14=0x0000000064528050, R15=0x0000000064528088
RIP=0x00007ffc1952f47c, EFLAGS=0x0000000000000202

XMM[0]=0x0000000000000000 0x0000000000000000
XMM[1]=0x0000000000000000 0x0000000000000000
XMM[2]=0x0000000000000000 0x0000000000000000
XMM[3]=0x0000000000000001 0x0000000000000000
XMM[4]=0x0000000000000000 0x0000000000000000
XMM[5]=0x00000000500424f0 0x0000000000000000
XMM[6]=0x501512af1fce15f9 0xe14fd9ee7c97227f
XMM[7]=0xcee5ee4c0e1d77a5 0xb76c25743b68cd3d
XMM[8]=0x060e196ea586143f 0x5120ff6c12573cf1
XMM[9]=0x31d6c0c431d6c0c4 0x31d6c0c4abf9412a
XMM[10]=0x0000000000000000 0x000000007a228066
XMM[11]=0x0f3bf6a50f3bf6a5 0x0f3bf6a5bb3537cf
XMM[12]=0x0000000000000000 0x00000000abf9412a
XMM[13]=0x0000000000000000 0x0000000000000000
XMM[14]=0x0000000000000000 0x0000000000000000
XMM[15]=0x0000000000000000 0x0000000000000000
MXCSR=0x00001fa0

Register to memory mapping:

RAX=0x000000004f950d00 points into unknown readable memory: 0x0000000000000000 | 00 00 00 00 00 00 00 00
RBX=0x000000004e618ad0 points into unknown readable memory: 0x000000006fd63d40 | 40 3d d6 6f 00 00 00 00
RCX=0x0000000000000007 is an unknown value
RDX=0x0000000000000002 is an unknown value
RSP=0x000000000255ee90 is pointing into the stack for thread: 0x00000000005f4f50
RBP=0x000000004e6180d0 points into unknown readable memory: 0x000000004e616700 | 00 67 61 4e 00 00 00 00
RSI=0x000000006fd5b510 libstdc++-6.dll
RDI=
[error occurred during error reporting (printing register info), id 0xc0000005, EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00007ffb4712cb84]
R8 =0x0 is null
R9 =0x0000000000400000 points into unknown readable memory: 0x0000000000000000 | 00 00 00 00 00 00 00 00
R10=0x0 is null
R11=0x0000000000000001 is an unknown value
R12=0x000000004e618a90 points into unknown readable memory: 0x474e5543432b2b00 | 00 2b 2b 43 43 55 4e 47
R13=0x00000000005f5318 points into unknown readable memory: 0x00007ffb47a117b0 | b0 17 a1 47 fb 7f 00 00
R14=0x0000000064528050 libaparapi.dll
R15=0x0000000064528088 libaparapi.dll

Top of Stack: (sp=0x000000000255ee90)
0x000000000255ee90: 0000000000000003 000000004e618ad0 ..........aN....
0x000000000255eea0: 000000006fd5b510 0000000000000000 ...o............
0x000000000255eeb0: 0000008020474343 0000000000000000 CCG ............
0x000000000255eec0: 00007ffc1952f47c 00007ffb00000001 |.R.............
0x000000000255eed0: 000000004e618a90 00007ffc1bc32530 ..aN....0%......
0x000000000255eee0: 0000000046f05558 0000000064528088 XU.F......Rd....
0x000000000255eef0: 000000004e6180d0 00007ffc1bc32530 ..aN....0%......
0x000000000255ef00: 0000000064528088 0000000064528050 ..Rd....P.Rd....
0x000000000255ef10: 00000000005f5318 0000000000000000 .S_.............
0x000000000255ef20: 0000000000000010 000000006fd5b510 ...........o....
0x000000000255ef30: 00000000bffffffd 000000006fc4d07a ........z..o....
0x000000000255ef40: 000000004e618ad0 000000006fd5b510 ..aN.......o....
0x000000000255ef50: 00001127b5bd113e 000000006fd40000 >...'......o....
0x000000000255ef60: 00000000bffffffd 000000006144da21 ........!.Da....
0x000000000255ef70: 000000004e618ad0 000000006fd5b510 ..aN.......o....
0x000000000255ef80: ffffffffbffffffd 000000004e610000 ..........aN....
0x000000000255ef90: 000000006fd36da0 000000006fd46423 .m.o....#d.o....
0x000000000255efa0: 000000004e618a90 0000000046f05558 ..aN....XU.F....
0x000000000255efb0: ffffffffbffffffd ffffffffbffffffd ................
0x000000000255efc0: ffffffffbffffffd 0000000046f05558 ........XU.F....
0x000000000255efd0: 000000004e618920 000000006fd45a10 .aN.....Z.o....
0x000000000255efe0: ffffffffbffffffd 0000000046f05558 ........XU.F....
0x000000000255eff0: 0000000064528050 0000000064528050 P.Rd....P.Rd....
0x000000000255f000: 000000004e6180d0 0000000064509a20 ..aN.... .Pd....
0x000000000255f010: 000000004e6180d0 0000000046f05558 ..aN....XU.F....
0x000000000255f020: 0000000000000000 000000004e6180d0 ..........aN....
0x000000000255f030: 000000004f9d4840 000000004e6180d0 @H.O......aN....
0x000000000255f040: 00000000005f5318 00000000005f5318 .S_......S_.....
0x000000000255f050: 000000004e618920 3fffffff00000003 .aN...........?
0x000000000255f060: 0000000064528088 000000004e6180d0 ..Rd......aN....
0x000000000255f070: 00000000005f5318 0000000064528050 .S_.....P.Rd....
0x000000000255f080: 000000004e616700 00000000005f5318 .gaN.....S_.....

Instructions: (pc=0x00007ffc1952f47c)
0x00007ffc1952f37c: 39 00 00 e9 f8 fe ff ff 49 8b ce e8 04 39 00 00
0x00007ffc1952f38c: e9 f4 fe ff ff 48 8b ce e8 f7 38 00 00 e9 f0 fe
0x00007ffc1952f39c: ff ff cc cc cc cc cc cc cc cc cc cc 71 9a 5e 10
0x00007ffc1952f3ac: 36 06 e1 b2 48 83 ec 28 33 d2 48 ff 15 eb cb 1f
0x00007ffc1952f3bc: 00 0f 1f 44 00 00 85 c0 78 0b b8 01 00 00 00 48
0x00007ffc1952f3cc: 83 c4 28 c3 cc 8b c8 e8 e8 55 00 00 33 c0 eb ef
0x00007ffc1952f3dc: cc cc cc cc cc cc cc cc cc cc cc cc 71 e1 d3 32
0x00007ffc1952f3ec: 5b 07 d5 dd 65 48 8b 04 25 30 00 00 00 8b 40 68
0x00007ffc1952f3fc: c3 cc cc cc cc cc cc cc cc cc cc cc 71 18 d3 7a
0x00007ffc1952f40c: 1a 87 89 f9 48 81 ec d8 00 00 00 48 8b 05 92 4a
0x00007ffc1952f41c: 2e 00 48 33 c4 48 89 84 24 c0 00 00 00 48 83 64
0x00007ffc1952f42c: 24 28 00 48 8d 05 da ff ff ff 83 e2 01 89 4c 24
0x00007ffc1952f43c: 20 89 54 24 24 48 89 44 24 30 4d 85 c9 74 4f b8
0x00007ffc1952f44c: 0f 00 00 00 48 8d 4c 24 40 44 3b c0 49 8b d1 41
0x00007ffc1952f45c: 0f 46 c0 44 8b c0 44 89 44 24 38 49 c1 e0 03 e8
0x00007ffc1952f46c: 37 2b 08 00 48 8d 4c 24 20 48 ff 15 e4 d0 1f 00
=>0x00007ffc1952f47c: 0f 1f 44 00 00 48 8b 8c 24 c0 00 00 00 48 33 cc
0x00007ffc1952f48c: e8 9f 55 07 00 48 81 c4 d8 00 00 00 c3 cc 83 64
0x00007ffc1952f49c: 24 38 00 eb cf cc cc cc cc cc cc cc 71 a2 db 5e
0x00007ffc1952f4ac: 60 b6 41 82 48 8b c4 48 89 58 10 48 89 70 18 57
0x00007ffc1952f4bc: 48 83 ec 60 0f 57 c0 0f 11 40 b8 48 8d 35 6a 1d
0x00007ffc1952f4cc: 21 00 33 db 48 85 c9 48 0f 45 f1 48 8b d6 48 8d
0x00007ffc1952f4dc: 48 c8 48 ff 15 53 cf 1f 00 0f 1f 44 00 00 8b f8
0x00007ffc1952f4ec: 89 44 24 70 85 c0 78 1f 41 b0 01 48 8d 54 24 30
0x00007ffc1952f4fc: 48 8d 4c 24 20 48 ff 15 b0 c8 1f 00 0f 1f 44 00
0x00007ffc1952f50c: 00 8b f8 89 44 24 70 85 ff 0f 88 09 d9 09 00 48
0x00007ffc1952f51c: 83 c8 ff 48 8b c8 48 ff c1 66 39 1c 4e 75 f7 48
0x00007ffc1952f52c: ff c1 48 89 4c 24 40 48 89 74 24 48 48 8b 4c 24
0x00007ffc1952f53c: 28 48 ff c0 38 1c 01 75 f8 48 ff c0 48 89 44 24
0x00007ffc1952f54c: 50 48 89 4c 24 58 4c 8d 4c 24 40 33 d2 b9 0a 00
0x00007ffc1952f55c: 01 40 44 8d 42 04 e8 a9 fe ff ff eb 0e 48 8b 4c
0x00007ffc1952f56c: 24 28 e8 bd fa ff ff 8b 7c 24 70 85 ff 78 11 48

Stack slot to memory mapping:

stack at sp + 0 slots: 0x0000000000000003 is an unknown value
stack at sp + 1 slots: 0x000000004e618ad0 points into unknown readable memory: 0x000000006fd63d40 | 40 3d d6 6f 00 00 00 00
stack at sp + 2 slots: 0x000000006fd5b510 libstdc++-6.dll
stack at sp + 3 slots: 0x0 is null
stack at sp + 4 slots: 0x0000008020474343 is an unknown value
stack at sp + 5 slots: 0x0 is null
stack at sp + 6 slots: 0x00007ffc1952f47c KERNELBASE.dll
stack at sp + 7 slots: 0x00007ffb00000001 is an unknown value

Lock stack of current Java thread (top to bottom):
LockStack[0]: java.util.LinkedHashSet
{0x000000011d15ccb0} - klass: 'java/util/LinkedHashSet' - flags: is_cloneable_fast

  • ---- fields (total size 2 words):
  • transient 'map' 'Ljava/util/HashMap;' @12 a 'java/util/LinkedHashMap'{0x000000011d15ccc0} (0x23a2b998)

Compiled method (c1) 3356 305 % 3 AparApiLearn::main @ 17 (271 bytes)
total in heap [0x000000000d170508,0x000000000d172eb8] = 10672
relocation [0x000000000d1705e0,0x000000000d170888] = 680
main code [0x000000000d1708a0,0x000000000d172cd0] = 9264
stub code [0x000000000d172cd0,0x000000000d172e98] = 456
oops [0x000000000d172e98,0x000000000d172ea0] = 8
metadata [0x000000000d172ea0,0x000000000d172eb8] = 24
immutable data [0x0000000047191a60,0x00000000471922f8] = 2200
dependencies [0x0000000047191a60,0x0000000047191a68] = 8
nul chk table [0x0000000047191a68,0x0000000047191ac0] = 88
scopes pcs [0x0000000047191ac0,0x0000000047191ef0] = 1072
scopes data [0x0000000047191ef0,0x00000000471922f8] = 1032

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions