Skip to content

Conversation

hageboeck
Copy link
Member

@hageboeck hageboeck commented Aug 22, 2025

Next to cleaning up a few white spaces and moving a docstring to the right place, two changes are necessary to implement snapshot with variations. These affect column readers for systematic variations:
Previously, each variation got its own column reader, even if the underlying Define was the same (because a column isn't affected by variations). In this case, SnapshotWithVariations would write the column again and again, since it doesn't have a way to check if the column is affected by variations.

Here, column readers are reused if a column is identical to nominal, and this will be detected by snapshot to write the column only once. This goes both for Jitted as well as compiled defines.

Lastly, an exception for variations of snapshot could be removed and replaced with a static_assert, since snapshot will be activated in RSnapshotOptions. This will go into a later PR as per Vincenzo's comment.

This is part 2 of the work in #19725.

Copy link

github-actions bot commented Aug 22, 2025

Test Results

    20 files      20 suites   3d 17h 8m 6s ⏱️
 3 648 tests  3 647 ✅ 0 💤 1 ❌
71 278 runs  71 277 ✅ 0 💤 1 ❌

For more details on these failures, see this check.

Results for commit 7893f1f.

♻️ This comment has been updated with latest results.

Copy link
Member

@vepadulano vepadulano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM overall but I'm hesitant in mentioning that there will be an implementation that can be activated via RSnapshotOptions in this PR since the implementation is not given at the same time

hageboeck and others added 4 commits September 1, 2025 09:15
Co-authored-by: Vincenzo Eduardo Padulano <v.e.padulano@gmail.com>
Due to the deprecation marker, the snapshot documentation is parsed
incorrectly in doxygen. Here, the main documentation is moved to the
non-template overload, and the other overloads are referring to this one
using the full argument list.
"See above" typically doesn't work, since doxygen sorts the functions.
When a Define is added to a branch that gets varied, a new column reader
was created for every variation and for every slot, irrespective of
whether the column gets varied or not.
For snapshot with variations, this column would be written for every
variation, although it always evaluates to the same value. To prevent this
duplication, the column readers that point to the same Define are shared
after this commit. The readers are still cloned per slot though, so the
Define's value caches remain thread safe. This allows
SnapshotWithVariations to detect that columns are identical, so they are
not written multiple times.
The memory savings amount to 24 bytes per suppressed column reader,so
they won't have a notable impact.
In order to not write a column multiple times in a snapshot with
variations, the RDefineBase pointer needs to stay invariant when a
variation is generated.
However, the RJittedDefine was returning the pointer to its member, so
it looked like the column was affected by variations. Here, this is
changed to returning "this" when no variations are in effect.
@hageboeck hageboeck force-pushed the snapshot_vary_prologue branch from 2a39f69 to 7893f1f Compare September 1, 2025 07:15
@hageboeck hageboeck requested a review from vepadulano September 1, 2025 07:16
Copy link
Member

@vepadulano vepadulano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@hageboeck hageboeck merged commit f956573 into root-project:master Sep 1, 2025
23 of 25 checks passed
@hageboeck hageboeck deleted the snapshot_vary_prologue branch September 1, 2025 12:29
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.

2 participants