Open tomeichlersmith opened 1 week ago
I think you will see a similar effect if you build with clang instead of GCC
I think you will see a similar effect if you build with clang instead of GCC
Yes, I can confirm that. But takes similarly long time.
I was able to create a very small repo reproducing the error: https://github.com/tomeichlersmith/ldmx-factory-test-bench much faster to compiler and play around with :smile:
Describe the bug The SimCore plugin factory is found unaware of declared plugins when LTO is enabled.
To Reproduce Steps to reproduce the behavior:
and then you see
Desired behavior It'd be cool to be able to enable LTO.
Additional context So, there are actually two different plugin factories in ldmx-sw.
__attribute(init_priority(500))
and__attribute__(constructor(1000))
)static
variables to force certain behaviors at library-load-time.The Framework/PluginFactory appears to be working when LTO is enabled since we get to attempting to create the TrackerSD. This implies that the Framework/PluginFactory was already used to declare and create the simulation processor. This causes me to focus attention on SimCore/Factory which works out since I originally designed it. I placed some printouts including the address of the Factory so we can observe the separate Factories being created for the different types. This is what I see.
So LTO does not prevent the declaration process from happening (which is what I assumed was going wrong), but - for some reason - a new Factory is created when attempting to create the TrackerSD instead of using the one that was already created during library-load for declaration. My guess is that I'll need to read-up on the actual meaning of
static
variable in the context of astatic
class member function. Oofdah.I'll probably try to create a separate testing area since it takes so long to recompile after changing the templated Factory.h header. See my gist about this Factory for more links and probably where I'll put results.