Skip to content

Commit 25cf2c5

Browse files
michalharakalclaude
andcommitted
Fix OOM in DEQUANTIZE_TO_FP32 E2E benchmark test
Use MemorySegmentTensorDataFactory for off-heap FP32 weight storage and increase MaxDirectMemorySize to 12g so multiple large-model tests can run in the same JVM without exhausting direct buffer memory. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 3941d7e commit 25cf2c5

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

skainet-apps/skainet-kllama/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ kotlin {
113113
}
114114

115115
tasks.withType<Test>().configureEach {
116-
jvmArgs("--enable-preview", "--add-modules", "jdk.incubator.vector")
116+
jvmArgs("--enable-preview", "--add-modules", "jdk.incubator.vector", "-XX:MaxDirectMemorySize=12g")
117117
maxHeapSize = "6g"
118118
}
119119

skainet-apps/skainet-kllama/src/jvmTest/kotlin/sk/ainet/apps/kllama/E2EQuantizedInferenceTest.kt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,8 +205,10 @@ class E2EQuantizedInferenceTest {
205205
fun `benchmark DEQUANTIZE_TO_FP32 baseline inference`() {
206206
if (skipIfNoModel()) return
207207
runBlocking {
208-
// Use default heap-based factory for dequantized FP32 weights
209-
val ctx = DirectCpuExecutionContext()
208+
// Use MemorySegment factory so dequantized FP32 weights live off-heap
209+
val arena = Arena.ofShared()
210+
val memSegFactory = MemorySegmentTensorDataFactory()
211+
val ctx = DirectCpuExecutionContext(tensorDataFactory = memSegFactory)
210212

211213
val ingestion = LlamaIngestion<FP32>(
212214
ctx = ctx,
@@ -259,6 +261,9 @@ class E2EQuantizedInferenceTest {
259261
println("==============================================")
260262

261263
assertTrue(tokPerSec > 0, "Should produce positive throughput")
264+
265+
arena.close()
266+
memSegFactory.close()
262267
}
263268
}
264269
}

0 commit comments

Comments
 (0)