edf-hpc/verrou

Adding call graph information to verrou_dd

HadrienG2 opened this issue · 2 comments

When using libraries such as Eigen, verrou_dd finds sources of numerical instabilities deep inside of their implementation. This means that, for example, I can learn that numerical instabilities can occur while performing matrix additions, but not much more, and this information is not terribly useful per se.

It would be nice if you could provide some call graph context around why/when a given line of code is called. Maybe this could be done by somehow combining the information provided by verrou_dd and callgrind in an intelligent way?

Here is something I recently got out of verrou_dd which illustrates this problem pretty well:

dd: done
ddmax:
  _ZN5Eigen8internal17abs2_impl_defaultIdLb0EE3runERKd  /root/acts-core/spack-build/Tests/Integration/PropagationTests
  _ZN5Eigen8internal4paddIDv2_dEET_RKS3_S5_     /root/acts-core/spack-build/Tests/Integration/PropagationTests
  _ZN5Eigen8internal4pdivIDv2_dEET_RKS3_S5_     /root/acts-core/spack-build/Tests/Integration/PropagationTests
  _ZN5Eigen8internal4pmulIDv2_dEET_RKS3_S5_     /root/acts-core/spack-build/Tests/Integration/PropagationTests
  _ZN5Eigen8internal4psubIDv2_dEET_RKS3_S5_     /root/acts-core/spack-build/Tests/Integration/PropagationTests
  _ZN5Eigen8internal6preduxIDv2_dEENS0_15unpacket_traitsIT_E4typeERKS4_ /root/acts-core/spack-build/Tests/Integration/PropagationTests
  _ZNK4Acts12AtlasStepperINS_14ConstantBFieldEE4stepERNS2_5StateE       /root/acts-core/spack-build/Tests/Integration/PropagationTests
  _ZNK4Acts15IntegrationTest29covariance_validation_fixtureINS_10PropagatorINS_12AtlasStepperINS_14ConstantBFieldEEENS_13VoidNavigatorEEEE19calculateCovarianceINS_26SingleBoundTrackParametersINS_13ChargedPolicyEEESC_NS7_7OptionsINS_10ActionListIJEEENS_9AbortListIJEEEEEEEN5Eigen6MatrixIdLi5ELi5ELi0ELi5ELi5EEERKT_RKSL_RKT0_RKT1_     /root/acts-core/spack-build/Tests/Integration/PropagationTests
  _ZNK4Acts15IntegrationTest29covariance_validation_fixtureINS_10PropagatorINS_12AtlasStepperINS_14ConstantBFieldEEENS_13VoidNavigatorEEEE19calculateCovarianceINS_32SingleCurvilinearTrackParametersINS_13ChargedPolicyEEESC_NS7_7OptionsINS_10ActionListIJEEENS_9AbortListIJEEEEEEEN5Eigen6MatrixIdLi5ELi5ELi0ELi5ELi5EEERKT_RKSL_RKT0_RKT1_       /root/acts-core/spack-build/Tests/Integration/PropagationTests
  _ZNK4Acts15IntegrationTest29covariance_validation_fixtureINS_10PropagatorINS_12EigenStepperINS_14ConstantBFieldENS_13VoidCorrectorEEENS_13VoidNavigatorEEEE19calculateCovarianceINS_26SingleBoundTrackParametersINS_13ChargedPolicyEEESD_NS8_7OptionsINS_10ActionListIJEEENS_9AbortListIJEEEEEEEN5Eigen6MatrixIdLi5ELi5ELi0ELi5ELi5EEERKT_RKSM_RKT0_RKT1_  /root/acts-core/spack-build/Tests/Integration/PropagationTests
  _ZNK4Acts15IntegrationTest29covariance_validation_fixtureINS_10PropagatorINS_12EigenStepperINS_14ConstantBFieldENS_13VoidCorrectorEEENS_13VoidNavigatorEEEE19calculateCovarianceINS_32SingleCurvilinearTrackParametersINS_13ChargedPolicyEEESD_NS8_7OptionsINS_10ActionListIJEEENS_9AbortListIJEEEEEEEN5Eigen6MatrixIdLi5ELi5ELi0ELi5ELi5EEERKT_RKSM_RKT0_RKT1_    /root/acts-core/spack-build/Tests/Integration/PropagationTests
  _ZNK4Acts15IntegrationTest29covariance_validation_fixtureINS_17PropagatorWrapperISt10shared_ptrINS_16RungeKuttaEngineINS_14ConstantBFieldEEEEEEE19calculateCovarianceINS_26SingleBoundTrackParametersINS_13ChargedPolicyEEENS_21SingleTrackParametersISC_EENS8_7OptionsINS_10ActionListIJEEENS_9AbortListIJEEEEEEEN5Eigen6MatrixIdLi5ELi5ELi0ELi5ELi5EEERKT_RKSO_RKT0_RKT1_        /root/acts-core/spack-build/Tests/Integration/PropagationTests
  _ZNK4Acts15IntegrationTest29covariance_validation_fixtureINS_17PropagatorWrapperISt10shared_ptrINS_16RungeKuttaEngineINS_14ConstantBFieldEEEEEEE19calculateCovarianceINS_32SingleCurvilinearTrackParametersINS_13ChargedPolicyEEESD_NS8_7OptionsINS_10ActionListIJEEENS_9AbortListIJEEEEEEEN5Eigen6MatrixIdLi5ELi5ELi0ELi5ELi5EEERKT_RKSM_RKT0_RKT1_       /root/acts-core/spack-build/Tests/Integration/PropagationTests
  _ZNK4Acts16RungeKuttaEngineINS_14ConstantBFieldEE14rungeKuttaStepEiRNS_16PropagationCacheEdRb /root/acts-core/spack-build/Tests/Integration/PropagationTests
  _ZNK5Eigen8internal13add_assign_opIddE11assignCoeffERdRKd     /root/acts-core/spack-build/Tests/Integration/PropagationTests
  _ZNK5Eigen8internal13div_assign_opIddE11assignCoeffERdRKd     /root/acts-core/spack-build/Tests/Integration/PropagationTests
  _ZNK5Eigen8internal13scalar_sum_opIddEclERKdS4_       /root/acts-core/spack-build/Tests/Integration/PropagationTests
  _ZNK5Eigen8internal17scalar_product_opIddEclERKdS4_   /root/acts-core/spack-build/Tests/Integration/PropagationTests
  _ZNK5Eigen8internal18scalar_quotient_opIddEclERKdS4_  /root/acts-core/spack-build/Tests/Integration/PropagationTests

While there are some interesting symbols in there, knowing that an unstability occurs when some part of the code performs vectorized additions ("padd") is not particularly helpful. What would help here would be to know in which context additions must fail before the computation becomes unstable. That is something else which DD could study besides source line - level unstability localization.

A rough algorithm for that would be...

  • Run "coarse-grained DD" to find interesting symbols or sets of symbols.
  • Run callgrind in a failing configuration to get a call graph
  • Trim the call graph to only keep the stack traces that include the problematic symbols
  • Do delta-debugging on stack traces, rather than symbols

That would be a very useful feature, but could also require significant changes to verrou if the current architecture is heavily based on looking at only one symbol at a time.

Another application of adding call graph sensitivity to verrou would be an "exclude everything below this symbol" feature, which I have regularly found myself longing for when using verrou. I'll open a separate ticket for that.

I think the delta-debug complexity is good enough to directly apply it on stack traces. Indeed we will be able to filter stack which contains fp operation (like for symbols).