rugnux: free the merge's GPU engine before model validation

The rotation merge's resident device engine (RotationScaleMerge's GPU
half) lived to the end of the scale-merge step, so model validation
reserved its own engines on a card the merge still held: on the F432
1.30 A set 8.8 GB of the 16.6 GB card was taken when the validation
started. Nothing after the validation reads the engine except the opt-in
finalist ledger's P1 merge, which runs on it beside the validation; so,
unless that merge is running, the engine is released just before the
validation call. Device memory in use when the validation starts:
8.8 GB -> 2.2 GB; the validation window's device-wide peak is now 6.5 GB
(structure factors 2.2 GB, ten rigid-body engines 2.5 GB). p.mtz
md5-identical.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SVmAWnzCmRKAXVUCdc4iNi
This commit is contained in:
leonarski_fandClaude Opus 5.5 committed 2026-10-09 12:47:04 +02:00
1 parent ed2d557bb7
commit e8584423c6
1 file changed
+5
+5
View File
@@ -3259,6 +3259,11 @@ bool Rugnux::ScaleMergeAndSymmetry(PipelineLocals &p) {
// The ledger's P1 merge (started above) is taken before anything below acts on what the
// validation decides: relabelling the outcomes and the group is what it must not see happen.
// Every such relabelling reaches the P1 merge afterwards, through merge_to_written.
// The merge is done with its engine - nothing below reads it but the finalist ledger's P1 merge,
// which runs on it beside the validation - so the device memory it holds goes back before the
// validation decides, from the card's total, whether its GPU path fits.
if (!ledger_ahead.valid())
rsm.reset();
ModelValidationResult validation = validate(logger);
take_ledger_p1();
// A model that was asked for and could not be used has to say so where anyone will see