Skip to content

[DF] Fix jitted expressions with sub-branches of aliases#11216

Merged
eguiraud merged 2 commits intoroot-project:masterfrom
eguiraud:df-alias-and-subbranch
Aug 31, 2022
Merged

[DF] Fix jitted expressions with sub-branches of aliases#11216
eguiraud merged 2 commits intoroot-project:masterfrom
eguiraud:df-alias-and-subbranch

Conversation

@eguiraud
Copy link
Copy Markdown
Contributor

@eguiraud eguiraud commented Aug 18, 2022

Given a string expression such as "alias.subbranch" (where
subbranch is not also the name of a valid data member of
the type of the "alias" top-level branch), we used to transform
the expression to [](T &var0) { return var0.subbranch; },
which does not compile.

Now aliases in jitted expressions are resolved in a first step
and only then we try to match the expression against known branch
names, fixing the problem.

This PR fixes #11207 (and adds a test).

  • add a less weird test, e.g. based on std::vector<XYZVector>, for which we should have dictionaries

@eguiraud eguiraud self-assigned this Aug 18, 2022
@phsft-bot
Copy link
Copy Markdown

Starting build on ROOT-debian10-i386/soversion, ROOT-performance-centos8-multicore/cxx17, ROOT-ubuntu18.04/nortcxxmod, ROOT-ubuntu2004/python3, mac1015/cxx17, mac11/cxx14, windows10/cxx14
How to customize builds

@phsft-bot
Copy link
Copy Markdown

Starting build on ROOT-debian10-i386/soversion, ROOT-performance-centos8-multicore/cxx17, ROOT-ubuntu18.04/nortcxxmod, ROOT-ubuntu2004/python3, mac1015/cxx17, mac11/cxx14, windows10/cxx14
How to customize builds

@eguiraud
Copy link
Copy Markdown
Contributor Author

Force-pushed a new version of the last commit with the clang-format fixes applied.

Copy link
Copy Markdown
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.

Generally looks good, maybe just a comment for clarification

Given a string expression such as "alias.subbranch" (where
`subbranch` is _not_ also the name of a valid data member of
the type of the "alias" top-level branch), we used to transform
the expression to `[](T &var0) { return var0.subbranch; }`,
which does not compile.

Now aliases in jitted expressions are resolved in a first step
and only then we try to match the expression against known branch
names, fixing the problem.

This fixes root-project#11207 .
@eguiraud eguiraud force-pushed the df-alias-and-subbranch branch from 1d5ffc4 to 8fef266 Compare August 30, 2022 18:13
@eguiraud eguiraud requested a review from bellenot as a code owner August 30, 2022 18:13
@phsft-bot
Copy link
Copy Markdown

Starting build on ROOT-debian10-i386/soversion, ROOT-performance-centos8-multicore/cxx17, ROOT-ubuntu18.04/nortcxxmod, ROOT-ubuntu2004/python3, mac1015/cxx17, mac11/cxx14, windows10/cxx14
How to customize builds

@eguiraud
Copy link
Copy Markdown
Contributor Author

eguiraud commented Aug 30, 2022

The patch is exactly the same, I force-pushed a new version of the test that uses a vector<XYZTVector> instead of the previous hack with a std::pair.

However that causes a bunch of (seemingly harmless) I/O warnings that I don't understand -- I'll see with Philippe before merging. Understood, all good.

@phsft-bot
Copy link
Copy Markdown

Build failed on windows10/cxx14.
See console output.

@eguiraud eguiraud merged commit 915c6ba into root-project:master Aug 31, 2022
@eguiraud eguiraud deleted the df-alias-and-subbranch branch August 31, 2022 07:46
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.

[DF] Bad interaction between Alias and TTree sub-branches

4 participants