ROCm / AMDMIGraphX

AMD's graph optimization engine.
https://rocm.docs.amd.com/projects/AMDMIGraphX/en/latest/
MIT License
183 stars 84 forks source link

Rocm-cmake: move unstable libraries to $ROCM_PATH/lib/migraphx #3029

Open ahsan-ca opened 5 months ago

ahsan-ca commented 5 months ago

Changes need to be made in rocm-cmake to support installation of libraries at $ROCM_PATH/lib/migraphx.

First, a PRIVATE flag should be added to the rocm_install_targets that will install the binaries and headers under lib/${PROJECT_NAME}. So instead of installing in $<INSTALL_PREFIX>/lib or $<INSTALL_PREFIX>/include it will install into $<INSTALL_PREFIX>/lib/${PROJECT_NAME}/lib and $<INSTALL_PREFIX>/lib/${PROJECT_NAME}/include respectively. For ASAN build we will need to install into lib/asan/${PROJECT_NAME} instead.

Secondly, we will need to update the RPATH of every library to have this private path. This can be done by updating the RPATH property on non-private targets, something like this:

if(POLICY CMP0095)
    set_property(TARGET ${TARGET} APPEND PROPERTY INSTALL_RPATH "\${ORIGIN}/${PROJECT_NAME}/lib")
else()
    set_property(TARGET ${TARGET} APPEND PROPERTY INSTALL_RPATH "\\\${ORIGIN}/${PROJECT_NAME}/lib")
endif()
This RPATH should work for asan and non-asan builds.

Finally, we will need to update migraphx to use the PRIVATE flag to install the libraries and headers.

ahsan-ca commented 4 months ago

Draft PR: https://github.com/ROCm/rocm-cmake/pull/188 Testing changes...

ahsan-ca commented 4 months ago

PR ready for review: https://github.com/ROCm/rocm-cmake/pull/188

ahsan-ca commented 4 months ago

PR for MIGraphX changes: https://github.com/ROCm/AMDMIGraphX/pull/3108