Celeritas is a new Monte Carlo transport code designed to accelerate scientific discovery in high energy physics by improving detector simulation throughput and energy efficiency using GPUs.
This follow-on to https://github.com/celeritas-project/celeritas/pull/1436 is to fix another manifestation of the bug caused by https://github.com/llvm/llvm-project/commit/9d525bf94b255df89587db955b5fa2d3c03c2c3e : in optimized mode, llvm fails to dynamic_cast classes that are declared final but have weak vtables. The weird part of fixing this instance was that to make the vtable strong, I had to anchor the GeoParamsInterface virtual destructor because that was in a separate library. (The GeantGeoParams and VecgeomParams worked because the inline virtual destructor was in the same library, so the final class had a "strong" vtable symbol.)
Before:
$ ninja orange && nm lib/liborange.dylib | c++filt | grep 'vtable for celeritas::.*Orange.*' | cut -b 18- | sort
S vtable for celeritas::OrangeParamsOutput
S vtable for celeritas::RaytraceImager<celeritas::OrangeParams>
s vtable for celeritas::CollectionMirror<celeritas::OrangeParamsData>
s vtable for celeritas::OrangeParams
$ ninja geocel && nm lib/libgeocel.dylib | c++filt | grep 'vtable for celeritas::.*Params.*' | cut -b 18- | sort
S vtable for celeritas::GeantGeoParams
S vtable for celeritas::GeoParamsOutput
S vtable for celeritas::RaytraceImager<celeritas::GeantGeoParams>
S vtable for celeritas::RaytraceImager<celeritas::VecgeomParams>
S vtable for celeritas::VecgeomParams
S vtable for celeritas::VecgeomParamsOutput
s vtable for celeritas::CollectionMirror<celeritas::ImageParamsData>
s vtable for celeritas::ImageParams
After (note celeritas::OrangeParams changes from s to S:
$ ninja orange && nm lib/liborange.dylib | c++filt | grep 'vtable for celeritas::.*Orange.*' | cut -b 18- | sort
S vtable for celeritas::CollectionMirror<celeritas::OrangeParamsData>
S vtable for celeritas::OrangeParams
S vtable for celeritas::OrangeParamsOutput
S vtable for celeritas::ParamsDataInterface<celeritas::OrangeParamsData>
S vtable for celeritas::RaytraceImager<celeritas::OrangeParams>
$ ninja geocel && nm lib/libgeocel.dylib | c++filt | grep 'vtable for celeritas::.*Params.*' | cut -b 18- | sort
S vtable for celeritas::GeantGeoParams
S vtable for celeritas::GeoParamsOutput
S vtable for celeritas::RaytraceImager<celeritas::GeantGeoParams>
S vtable for celeritas::RaytraceImager<celeritas::VecgeomParams>
S vtable for celeritas::VecgeomParams
S vtable for celeritas::VecgeomParamsOutput
s vtable for celeritas::CollectionMirror<celeritas::ImageParamsData>
s vtable for celeritas::ImageParams
This follow-on to https://github.com/celeritas-project/celeritas/pull/1436 is to fix another manifestation of the bug caused by https://github.com/llvm/llvm-project/commit/9d525bf94b255df89587db955b5fa2d3c03c2c3e : in optimized mode, llvm fails to
dynamic_cast
classes that are declaredfinal
but have weak vtables. The weird part of fixing this instance was that to make the vtable strong, I had to anchor theGeoParamsInterface
virtual destructor because that was in a separate library. (The GeantGeoParams and VecgeomParams worked because the inline virtual destructor was in the same library, so the final class had a "strong" vtable symbol.)Before:
After (note
celeritas::OrangeParams
changes froms
toS
: