Skip to content

Refactoring of the limpet CMake and code generation to accommodate multiple versions of the same ionic model

Raphaël Colin requested to merge rewrite_limpet_build into master

This MR introduces the following:

  • Some refactoring of the CMakeLists.txt file in physics/limpet/, making it a bit more organized and readable;
  • Code generation and compilation of multiple versions of a given ionic model (original CPU version, MLIR vectorized CPU version, MLIR CUDA and ROCm GPU versions) in the same build, allowing us to chose and switch between versions at runtime (useful for StarPU integration);
  • A new way to specify which version(s) of each ionic model to build in physics/limpet/models/imp_list.txt (documented in docs/BUILD_WITH_MLIR.md);
  • For usability, the --target option has been added to bench (documented in docs/BUILD_WITH_MLIR.md);
  • A new GPU code generator that allows GPU models to access data correctly when -DENABLE_MLIR_CODEGEN=DATA_LAYOUT_OPTIMIZATION is enabled, which allows for switching at runtime between the vectorized MLIR-CPU implementation with data layout optimization and GPU implementations.

Things to note:

  • These changes shouldn't affect non-MLIR builds in any way (so if they do somehow, please tell me!);
  • These changes are necessary for the integration of StarPU, as it needs to be provided multiple implementations to schedule on different targets;
  • Models that use the Rosenbrock integration method cannot yet switch between implementations at runtime (we are planning to correct this as we integrate StarPU);
  • Similarly, GPU models that use the Rosenbrock integration method in a build with data layout optimization don't work correctly (we are also planning to correct this as we integrate StarPU).
  • The build-docker-image CI job fails. This seems to be because model source files (<model>.cc and <model>.h) are not re-generated and stick to their current version on the repository. Even if this MR doesn't affect non-MLIR builds, some function names have been changed so they need to be re-generated.

Please let me know if you have any question, suggestion, criticism, etc. about these changes. Thank you!

Merge request reports