Skip to content

Fix fused PQ and graph retained-memory accounting - #781

Open
tlwillke wants to merge 8 commits into
mainfrom
fused-pq-memory-accounting
Open

tlwillke wants to merge 8 commits into
mainfrom
fused-pq-memory-accounting

Conversation

@tlwillke

@tlwillke tlwillke commented Nov 2, 2026 •

Copy link
Copy Markdown
Collaborator

Correct fused-PQ retained-memory estimates, including source/buffer wrappers, native heap scopes, cache capacity, adjacency arrays, and JVM layout/alignment. Shared storage is counted once.

Graph totals are accumulated during loading, with only bounded header metadata sizing. Built-in PQ totals update under the existing chunk-allocation lock. Reporting is a cached field read; native buffer reporting also avoids temporary Optional objects. Loaded feature metadata is read-only, and internal source caches are read-only by contract. Model/workspace ownership boundaries are documented.

Validation: 74 regression tests pass per scalar/Panama/native configuration on JDK 22 and 25; independent measurements cover 60 provider/layout combinations. Final lifecycle/scoring/allocation checks also pass on JDK 11, 22, and 25. Repeated native exercises on fixed CPU/NUMA placement measured zero steady-state allocation and low single-digit-nanosecond reporting. Cold loading and one-time metadata sizing are measured separately. Includes the standard 4.0.3 bug-fix release note.

Count each cached fused-PQ source object and its code-buffer storage.
Sum InlineSource byte estimates directly instead of multiplying them by
the integer element width. Keep compressor ownership separate.

Add PQ-only regression tests for source storage overhead and byte units
through an actual serialized/loaded fused graph. Both tests fail on the
unmodified main branch and pass with this fix.

Validation: JDK 22, 65 tests each under scalar and Panama profiles;
new tests also pass with compressed and uncompressed object references.
@github-actions

github-actions Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Before you submit for review:

  • Does your PR follow guidelines from CONTRIBUTIONS.md?
  • Did you summarize what this PR does clearly and concisely?
  • Did you include performance data for changes which may be performance impacting?
  • Did you include useful docs for any user-facing changes or features?
  • Did you include useful javadocs for developer oriented changes, explaining new concepts or key changes?
  • Did you rebase your branch onto the latest main for regression testing and PR submission?
  • Did you trigger regression testing via Run Bench Main and review results?
  • Did you adhere to the code formatting guidelines (TBD)
  • Did you group your changes for easy review, providing meaningful descriptions for each commit?
  • Did you ensure that all files contain the correct copyright header?
  • Did you add documentation for this feature to the release notes directory?

If you did not complete any of these, then please explain below.

@tlwillke tlwillke self-assigned this Nov 2, 2026
@tlwillke tlwillke added 4.1.0 Release Label bug Something isn't working labels Nov 2, 2026
Handle independent reference/class-pointer settings and compact headers. Use VM field and array offsets; include full byte-sequence, segment, scope, and backing-array storage.
Count graph metadata, allocated cache capacity, adjacency arrays, and fused source storage once. Exclude separately owned models, worker scratch, and shared JVM metadata. Add independent instrumentation checks across JDK 22 and 25 layouts and document the reporting cost.
@tlwillke tlwillke changed the title Fix fused PQ retained-memory accounting Fix fused PQ and graph retained-memory accounting Nov 2, 2026
Skip the compressed-class-pointer/wide-reference combination unavailable before JDK 15. Preserve all eight JDK 22 and twelve JDK 25 layouts; verify the six supported JDK 11 layouts.
@tlwillke

tlwillke commented Nov 2, 2026 •

Copy link
Copy Markdown
Collaborator Author

Replaced repeated object walks with cached totals. Graph payloads are counted while loading; PQ totals update only when chunk storage grows. Reporting performs a field read, and native buffer reporting creates no temporary Optional objects.

Validation: 74 tests pass per provider on JDK 22/25, with 60 independent JVM-layout checks; final JDK 11/22/25 checks also pass. Repeated native exercises measured zero allocation across 180 million steady-state reads and low single-digit-nanosecond medians. The warmed metadata-sizing exercise used about 1 KB of temporary storage; cold loading was measured separately. Extra retained state is per graph/collection, not per vector.

The documentation and standard release note now describe cached reporting and read-only loaded feature metadata. Fresh CI is running on the pushed revision.

Count on-disk cache payloads while loading and size only bounded header metadata. Cache built-in PQ totals at chunk/reference-array growth, preserve shared immutable backing storage, and reuse native buffer fields for allocation-free size reporting.
Check independent JVM footprints, concurrent chunk growth, capacity reuse, and zero-allocation reporting. Add a reproducible timing/allocation exercise and document immutable cache ownership and initialization cost. Update the 4.0.3 bug-fix release note.
tlwillke added a commit that referenced this pull request Nov 3, 2026
Count retained ASH objects, backing arrays, headers, model matrices, and initialized packed/query/symmetric representations. Cache immutable totals and account lazy block storage at allocation; polling does not scan vectors or allocate. Align individual BlockRealMatrix tail arrays. Keep common graph, PQ, and buffer accounting changes in PR #781.

Validated 90 ASH/fused tests per provider on JDK 22 and JDK 25 (native, Panama, scalar), plus 34 native module tests per JDK. Four native layout checks pass at 8/16-byte alignment; allocation regression checks verify zero-allocation polling. Tests and documentation describe ownership boundaries and conservative caller-alias/map estimates.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

4.1.0 Release Label bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant