root icon indicating copy to clipboard operation
root copied to clipboard

[RDF] Some tutorials fail to run when compiled due to jitting issues

Open silverweed opened this issue 1 year ago • 0 comments

Check duplicate issues.

  • [x] Checked for duplicates

Description

df106_HiggsToFourLeptons.C crashes when it is compiled and run (it runs fine if interpreted). This is due to jitted code in some filters that call user-defined functions whose signature is unknown to Cling.

This is a general problem with functions that evaluate code at runtime and, while it might not be possible to fix in all cases, it should at least be better documented. The tutorials themselves should be written to work both when compiled and when interpreted, or specify why they cannot be run as-is if compiled.

There is also a more general discussion to be made about RDF and the kind of guarantees that it should provide to its users. Ideally there should be a way to use RDF such that it will be guaranteed to run correctly regardless of being compiled or interpreted.

Finally, the documentation of RDF should be updated to better clarify the caveats and limitations of passing C++ expressions as strings, both in terms of performance and, especially, in terms of compatibility with compiled code (i.e. it should be clear to a user that a filter using an interpreted string containing a user-defined function may not work when AOT-compiled without additional efforts on the user side - like manually passing the signatures to cling beforehand).

Bullet point recap

  • [ ] fix the tutorials so they run properly when compiled AOT
  • [ ] update the doc of RDF to include caveats and limitations of using jitted expressions
  • [ ] (to be discussed) introduce an opt-in "strict mode" for RDF (C++ only) that checks and rejects all cases when jitting is required. This would allow a user to catch code that may incur in performance penalties and may not work properly when AOT-compiled.

Reproducer

  1. download the source code of this tutorial
  2. compile it
  3. run it

ROOT version

6.33.01

Installation method

from source

Operating system

Debian GNU/Linux trixie

Additional context

No response

silverweed avatar May 24 '24 13:05 silverweed