diff --git a/.github/workflows/test_component.yml b/.github/workflows/test_component.yml index e6867f67beb..5c725fdda95 100644 --- a/.github/workflows/test_component.yml +++ b/.github/workflows/test_component.yml @@ -154,6 +154,26 @@ jobs: echo "HSA_XNACK=1" >> $GITHUB_ENV echo "ASAN_SYMBOLIZER_PATH=${{ env.OUTPUT_ARTIFACTS_DIR }}/llvm/bin/llvm-symbolizer" >> $GITHUB_ENV + # Hotswap smoke test: hotswap is built by default (THEROCK_ENABLE_HOTSWAP=ON), so the + # tool must be present in the artifacts. Load it via HSA_TOOLS_LIB so ROCr/CLR exercise + # the tool-load path during hip-tests (which load code objects on the GPU). The entry + # trampoline rewrite is opt-in, so enable AMD_COMGR_HOTSWAP_ENTRY_TRAMPOLINES here to + # exercise gfx1250 same-stepping dispatch-entry redirection. The tool is inert on + # non-gfx1250 targets, so this is a regression guard that enabling it does not perturb + # existing results. A missing tool means a broken/misconfigured build, so fail loudly + # rather than silently skipping. + - name: Enable hotswap tool loading + if: ${{ runner.os == 'Linux' && fromJSON(inputs.component).job_name == 'hip-tests' }} + run: | + hotswap_tool="${{ env.OUTPUT_ARTIFACTS_DIR }}/lib/libhsa-hotswap.so" + if [ ! -f "$hotswap_tool" ]; then + echo "::error::Hotswap tool not found at $hotswap_tool. THEROCK_ENABLE_HOTSWAP is on by default, so it should be present in the artifacts." + exit 1 + fi + echo "Loading hotswap tool via HSA_TOOLS_LIB: $hotswap_tool" + echo "HSA_TOOLS_LIB=$hotswap_tool" >> $GITHUB_ENV + echo "AMD_COMGR_HOTSWAP_ENTRY_TRAMPOLINES=1" >> $GITHUB_ENV + - name: Test id: test timeout-minutes: ${{ fromJSON(inputs.component).timeout_minutes }} diff --git a/.gitmodules b/.gitmodules index ab3779c8d37..b50ba10873e 100644 --- a/.gitmodules +++ b/.gitmodules @@ -8,7 +8,7 @@ # Branch follows the weekly format: amd-compiler-YYYY-MM-DD [submodule "llvm-project"] path = compiler/amd-llvm - url = https://github.com/ROCm/llvm-project.git + url = https://github.com/harsh-amd/llvm-project.git # Branch follows the weekly format: amd-compiler-YYYY-MM-DD [submodule "rocm-cmake"] path = base/rocm-cmake @@ -20,7 +20,7 @@ branch = develop [submodule "rocm-systems"] path = rocm-systems - url = https://github.com/ROCm/rocm-systems.git + url = https://github.com/harsh-amd/rocm-systems.git branch = develop [submodule "spirv-llvm-translator"] path = compiler/spirv-llvm-translator diff --git a/CMakeLists.txt b/CMakeLists.txt index 7c6a3c42a93..8560e3852ed 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -124,6 +124,7 @@ option(THEROCK_COMPOSABLE_KERNEL_FOR_MIOPEN_ONLY option(THEROCK_BUILD_LLVM_TOOLS "Enables building all LLVM tools (not just minimum required)" OFF) option(THEROCK_BUILD_LLVM_TESTS "Enables building LLVM LIT tests" OFF) +option(THEROCK_ENABLE_HOTSWAP "Enables COMGR hotswap rewriting and the ROCR HSA hotswap tool" ON) set(THEROCK_SANITIZER "" CACHE STRING "Enable project wide sanitizer build ('ASAN' for host+device, 'HOST_ASAN' for host-only)") diff --git a/compiler/CMakeLists.txt b/compiler/CMakeLists.txt index f1da62fb0f4..ca7e3d48612 100644 --- a/compiler/CMakeLists.txt +++ b/compiler/CMakeLists.txt @@ -159,6 +159,11 @@ if(THEROCK_ENABLE_COMPILER) # version script, avoiding symbol interposition issues. ############################################################################## + set(_comgr_hotswap_cmake_args) + if(THEROCK_ENABLE_HOTSWAP) + list(APPEND _comgr_hotswap_cmake_args -DCOMGR_ENABLE_HOTSWAP_TRANSPILE=ON) + endif() + therock_cmake_subproject_declare(amd-comgr USE_DIST_AMDGPU_TARGETS NO_INSTALL_RPATH # See manual handling in the pre_hook. @@ -174,6 +179,7 @@ if(THEROCK_ENABLE_COMPILER) -DTHEROCK_BUILD_COMGR_TESTS=${THEROCK_BUILD_COMGR_TESTS} "-DLLVM_VERSION_SUFFIX=-rocm${ROCM_MAJOR_VERSION}" -DLLVM_ENABLE_SYMBOL_VERSIONING=ON + ${_comgr_hotswap_cmake_args} BUILD_DEPS rocm-cmake RUNTIME_DEPS diff --git a/compiler/amd-llvm b/compiler/amd-llvm index f0495acbfcf..6523fc65bc8 160000 --- a/compiler/amd-llvm +++ b/compiler/amd-llvm @@ -1 +1 @@ -Subproject commit f0495acbfcff357a55abe1c61a7e954f8574e702 +Subproject commit 6523fc65bc87bb35dc954ae4138f512c4126b09f diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt index 32c799a68cc..c0cd3fac0c8 100644 --- a/core/CMakeLists.txt +++ b/core/CMakeLists.txt @@ -143,6 +143,37 @@ if(THEROCK_ENABLE_CORE_RUNTIME) LIB_NAMES libhsa-runtime64.so ) + set(_core_runtime_hotswap_subproject_deps) + if(THEROCK_ENABLE_HOTSWAP AND NOT WIN32) + ############################################################################ + # HSA HotSwap tool + ############################################################################ + + therock_cmake_subproject_declare(hsa-hotswap + EXTERNAL_SOURCE_DIR "${THEROCK_ROCM_SYSTEMS_SOURCE_DIR}/projects/hotswap" + BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/hsa-hotswap" + BACKGROUND_BUILD + DISABLE_AMDGPU_TARGETS + COMPILER_TOOLCHAIN + "${_system_toolchain}" + RUNTIME_DEPS + ROCR-Runtime + amd-comgr + INTERFACE_LINK_DIRS + "lib" + INTERFACE_INSTALL_RPATH_DIRS + "lib" + ) + therock_cmake_subproject_glob_c_sources(hsa-hotswap SUBDIRS .) + therock_cmake_subproject_activate(hsa-hotswap) + list(APPEND _core_runtime_hotswap_subproject_deps hsa-hotswap) + + therock_test_validate_shared_lib( + PATH hsa-hotswap/dist/lib + LIB_NAMES libhsa-hotswap.so + ) + endif() + ############################################################################## # rocminfo ############################################################################## @@ -165,6 +196,7 @@ if(THEROCK_ENABLE_CORE_RUNTIME) set(_core_runtime_subproject_deps ROCR-Runtime rocminfo + ${_core_runtime_hotswap_subproject_deps} ) set(_core_runtime_artifact_components dbg diff --git a/rocm-systems b/rocm-systems index a0952b2b339..edd6590c50f 160000 --- a/rocm-systems +++ b/rocm-systems @@ -1 +1 @@ -Subproject commit a0952b2b339b4603050acee1672b0aa0d8abb702 +Subproject commit edd6590c50fe10331a71ae2da4039a56dab32c84