Skip to content

Conversation

jblomer
Copy link
Contributor

@jblomer jblomer commented Sep 22, 2025

Allow for std::atomic --> T (or compatible) automatic conversion and vice versa.

@jblomer jblomer self-assigned this Sep 22, 2025
@jblomer jblomer force-pushed the ntuple-evolution-atomic branch from 9ce4dd5 to ac97cad Compare September 22, 2025 14:48
Copy link

github-actions bot commented Sep 22, 2025

Test Results

     7 files       7 suites   1d 9h 39m 9s ⏱️
 3 654 tests  3 654 ✅ 0 💤 0 ❌
25 330 runs  25 330 ✅ 0 💤 0 ❌

Results for commit 1aec090.

♻️ This comment has been updated with latest results.

Copy link
Member

@hahnjo hahnjo left a comment

Choose a reason for hiding this comment

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

In principle, the changes look neat and small. I'm wondering about the error case: When reconciling an RAtomicField with something on-disk that is not std::atomic, we unconditionally delegate to the item field. Is that maybe confusing for the error message? (I don't have an immediate idea how to do it better)

Allow for std::atomic<T> --> T (or compatible) automatic conversion and
vice versa.
@jblomer jblomer force-pushed the ntuple-evolution-atomic branch from ef0feec to 1aec090 Compare October 6, 2025 14:08
@jblomer jblomer requested a review from bellenot as a code owner October 6, 2025 14:08
@jblomer jblomer requested review from hahnjo and silverweed October 6, 2025 14:08
@@ -37,7 +37,7 @@ ROOT_GENERATE_DICTIONARY(RNTupleDescriptorDict ${CMAKE_CURRENT_SOURCE_DIR}/RNTup
DEPENDENCIES RIO)

ROOT_ADD_GTEST(ntuple_endian ntuple_endian.cxx LIBRARIES ROOTNTuple)
ROOT_ADD_GTEST(ntuple_evolution_type ntuple_evolution_type.cxx LIBRARIES ROOTNTuple)
ROOT_ADD_GTEST(ntuple_evolution_type ntuple_evolution_type.cxx LIBRARIES ROOTNTuple atomic)
Copy link
Member

Choose a reason for hiding this comment

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

Should this use ROOT_ATOMIC_LIBS? Not sure...

Copy link
Contributor Author

@jblomer jblomer Oct 6, 2025

Choose a reason for hiding this comment

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

I think it shouldn't. ROOT_ATOMIC_LIBS contains atomic when it is needed even for the normally lock-free cases, AFAICS.

Copy link
Member

Choose a reason for hiding this comment

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

That is not my reading. It seems to be literally that ROOT_ATOMIC_LIBS is the result of a test that checks whether std::atomic linking require an 'atomic' library or not.

if (fieldDesc.GetTypeName().rfind("std::atomic<", 0) == 0) {
EnsureMatchingOnDiskField(fieldDesc, kDiffTypeName).ThrowOnError();
} else {
fSubfields[0]->SetOnDiskId(GetOnDiskId());
Copy link
Member

Choose a reason for hiding this comment

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

I am missing (not seeing) the part of the code that make sure that the non-atomic value is compatible with the in memory type. For example:

auto v10 = reader->GetView<CustomAtomicNotLockFree>("atomicInt");

in the new test should still throw.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants