Skip to content

perf(purejava): select row-accumulated Q8 kernel#57

Merged
bsbodden merged 1 commit into
mainfrom
perf/q8-row-accumulator
Jul 23, 2026
Merged

perf(purejava): select row-accumulated Q8 kernel#57
bsbodden merged 1 commit into
mainfrom
perf/q8-row-accumulator

Conversation

@bsbodden

Copy link
Copy Markdown
Member

What

  • add models.purejava.q8BlockMajorRowAccumulator to validated model/deployment settings
  • select the typed Vectors Q8 block-major kernel in pure-Java plan schema pure-java-v15
  • enable row accumulation only for requested Graal JVMCI staged block-major Q8 plans
  • pass the selected kernel through the transformer-owned staged layer schedule
  • verify exact logits, complete KV state, and the next autoregressive step
  • record the controlled kernel and full-model evidence

Why

The established Q8 block-major kernel updates a widely separated output cell after every weight block. The new Vectors strategy retains one batch-sized accumulator per active output row and scatters that row once. It is a strong win on the measured GraalVM/EPYC prefill profile but neutral on local HotSpot C2, so Models must own the runtime/topology policy rather than changing the generic Vectors default.

Selection

ROW_ACCUMULATED requires all of the following:

  • explicit recommendation or deployment request
  • Graal JVMCI
  • staged block-major Q8 prefill with an eligible Q8 consumer

Otherwise the immutable plan records the reason and selects SCATTERED.

Evidence

  • controlled EPYC/GraalVM 1024x2048 batch-32 JMH: 20.571 ms/op to 4.335 ms/op (-78.9%)
  • 30-trial exact SmolLM2 360M Q8_0 gate:
    • p50 TTFT: 898.794 ms to 878.801 ms (-2.22%)
    • p95 TTFT: 919.981 ms to 886.209 ms (-3.67%)
    • p50 prefill: 175.219 tok/s to 179.479 tok/s (+2.43%)
    • p50 CPU time: 6840 ms to 6680 ms (-2.34%)
    • every corresponding token count and output hash matched
  • local Java 25 HotSpot/C2 JMH was neutral, so it is not selected there

Checks

  • ./gradlew :models-backend-purejava:check
  • ./gradlew spotlessCheck

@bsbodden
bsbodden merged commit aea2f10 into main Jul 23, 2026
11 checks passed
@bsbodden
bsbodden deleted the perf/q8-row-accumulator branch July 23, 2026 19:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant