[RFC][PATCH] Support for third-party memory allocation libraries


Right now, openmp supports only memkind and it is hard to extend it to support other memory allocation libraries.

The attached patch refactors the memory allocation code to make it easier to add other libraries, and adds support for SICM (https://github.com/lanl/SICM) as an example.

Any comments and suggestions on how to improve the patch are welcome.


openmp-sicm2.diff (39.9 KB)

Hi Lucho,

this is very interesting, thanks for sharing!

I think support for this is indeed something users would like to have.

For a more in-depth review of the patch, could you upload it to https://reviews.llvm.org/ please?

This page has some information about the process https://www.llvm.org/docs/Contributing.html.



Is it the style of LLVM to add a source file “kmp_no_” that contains an empty implementation?

It makes more sense to me to have one implementation file and conditionally compile the implementation according to need.


  • if(${LIBOMP_USE_SICM})
  • libomp_append(LIBOMP_CXXFILES thirdparty/sicm/kmp_sicm.cpp)
  • else()
  • libomp_append(LIBOMP_CXXFILES thirdparty/sicm/kmp_no_sicm.cpp)
  • endif()

diff --git a/openmp/runtime/src/thirdparty/sicm/kmp_no_sicm.cpp b/openmp/runtime/src/thirdparty/sicm/kmp_no_sicm.cpp
new file mode 100644
index 00000000000…6dc034582e6
— /dev/null
+++ b/openmp/runtime/src/thirdparty/sicm/kmp_no_sicm.cpp
@@ -0,0 +1,5 @@
+void __kmp_init_sicm() {

It is not, that is one of the things we have to address in the review :slight_smile: