Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions BUILD_TOPOLOGY.toml
Original file line number Diff line number Diff line change
Expand Up @@ -819,6 +819,13 @@ artifact_deps = []
feature_group = "EMULATION"
disable_platforms = ["windows"]

[artifacts.rocjitsu-hotswap]
artifact_group = "rocjitsu"
type = "target-neutral"
artifact_deps = ["rocjitsu"]
feature_group = "EMULATION"
disable_platforms = ["windows"]

[artifacts.mirage]
artifact_group = "rocjitsu"
type = "target-neutral"
Expand Down
3 changes: 2 additions & 1 deletion build_tools/build_python_packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -520,12 +520,13 @@ def core_artifact_filter(an: ArtifactName) -> bool:
"lib",
"run",
]
hotswap = an.name == "rocjitsu-hotswap" and an.component == "lib"
# hiprtc needs to be able to find HIP headers in its same tree.
hip_dev = an.name in [
"core-hip",
"core-ocl",
] and an.component in ["dev"]
return core or hip_dev
return core or hotswap or hip_dev


def libraries_artifact_filter(target_family: str, an: ArtifactName) -> bool:
Expand Down
1 change: 1 addition & 0 deletions build_tools/install_rocm_from_artifacts.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,7 @@ def retrieve_artifacts_by_run_id(args):
"core-hipinfo_run",
"core-runtime_run",
"core-runtime_lib",
"rocjitsu-hotswap_lib",
"sysdeps_lib",
"base_run",
"base_lib",
Expand Down
11 changes: 11 additions & 0 deletions build_tools/packaging/linux/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,17 @@
}
]
},
{
"Artifact": "rocjitsu-hotswap",
"Artifact_Subdir": [
{
"Name": "rocjitsu-hotswap",
"Components": [
"lib"
]
}
]
},
{
"Artifact": "core-hip",
"Artifact_Subdir": [
Expand Down
4 changes: 4 additions & 0 deletions build_tools/tests/install_rocm_from_artifacts_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ def test_mirage_flag_includes_mirage_run(self):
argv = self._run_main(["--mirage"])
self.assertIn("mirage_run", argv)

def test_base_only_includes_rocjitsu_hotswap(self):
argv = self._run_main(["--base-only"])
self.assertIn("rocjitsu-hotswap_lib", argv)


class TestReleaseDiscovery(unittest.TestCase):
def test_extract_version_ignores_test_tarball(self) -> None:
Expand Down
17 changes: 17 additions & 0 deletions build_tools/tests/py_packaging_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -657,6 +657,23 @@ def test_device_artifact_filter(self):
an_core = ArtifactName("core-hip", "lib", "gfx942")
self.assertFalse(device_artifact_filter("gfx942", an_core))

def test_core_artifact_filter_includes_only_rocjitsu_hotswap(self):
"""The core wheel ships the HSA hotswap hook without the rocjitsu library."""
sys.path.insert(0, os.fspath(Path(__file__).parent.parent))
from build_python_packages import core_artifact_filter

from _therock_utils.artifacts import ArtifactName

self.assertTrue(
core_artifact_filter(ArtifactName("rocjitsu-hotswap", "lib", "generic"))
)
self.assertFalse(
core_artifact_filter(ArtifactName("rocjitsu", "lib", "generic"))
)
self.assertFalse(
core_artifact_filter(ArtifactName("rocjitsu", "run", "generic"))
)

def test_device_dist_info_has_libraries_py_package_name(self):
"""Device package _dist_info.py must contain LIBRARIES_PY_PACKAGE_NAME."""
artifact_dir = self._setup_kpack_split_artifacts()
Expand Down
31 changes: 31 additions & 0 deletions emulation/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ if(THEROCK_ENABLE_ROCJITSU)
LIB_NAMES
librocjitsu.so
)
therock_test_validate_shared_lib(PATH rocjitsu/dist/lib
LIB_NAMES
libhsa_hotswap_rocjitsu.so
)

therock_provide_artifact(rocjitsu
TARGET_NEUTRAL
Expand All @@ -54,6 +58,33 @@ if(THEROCK_ENABLE_ROCJITSU)
)
endif()

if(THEROCK_ENABLE_ROCJITSU_HOTSWAP)
# Artifact descriptors must own distinct stage directories. Re-stage the
# already-built hook without rebuilding rocjitsu so it can remain a
# separately selectable artifact.
therock_cmake_subproject_declare(rocjitsu-hotswap
DISABLE_AMDGPU_TARGETS
NO_MERGE_COMPILE_COMMANDS
EXTERNAL_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/rocjitsu-hotswap"
BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/rocjitsu-hotswap"
CMAKE_ARGS
-DROCJITSU_HOTSWAP_LIBRARY=${CMAKE_CURRENT_BINARY_DIR}/rocjitsu/dist/lib/libhsa_hotswap_rocjitsu.so
BUILD_DEPS
rocjitsu
)

therock_cmake_subproject_activate(rocjitsu-hotswap)

therock_provide_artifact(rocjitsu-hotswap
TARGET_NEUTRAL
DESCRIPTOR artifact-rocjitsu-hotswap.toml
COMPONENTS
lib
SUBPROJECT_DEPS
rocjitsu-hotswap
)
endif()

if(THEROCK_ENABLE_MIRAGE)
##############################################################################
# mirage
Expand Down
6 changes: 6 additions & 0 deletions emulation/artifact-rocjitsu-hotswap.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# rocjitsu HSA hotswap hook
[components.lib."emulation/rocjitsu-hotswap/stage"]
default_patterns = false
include = [
"lib/libhsa_hotswap_rocjitsu.so",
]
15 changes: 15 additions & 0 deletions emulation/rocjitsu-hotswap/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright Advanced Micro Devices, Inc.
# SPDX-License-Identifier: MIT

# Artifact descriptors cannot share a stage directory. This packaging-only
# subproject gives the hotswap hook its own stage without rebuilding rocjitsu.
cmake_minimum_required(VERSION 3.25)
project(rocjitsu_hotswap_package LANGUAGES NONE)

if(NOT EXISTS "${ROCJITSU_HOTSWAP_LIBRARY}")
message(FATAL_ERROR
"ROCJITSU_HOTSWAP_LIBRARY does not exist: ${ROCJITSU_HOTSWAP_LIBRARY}"
)
endif()

install(FILES "${ROCJITSU_HOTSWAP_LIBRARY}" DESTINATION lib)
Loading