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
6 changes: 5 additions & 1 deletion build_tools/github_actions/detect_external_repo_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,11 @@
"cmake_source_var": "THEROCK_ROCM_LIBRARIES_SOURCE_DIR",
"submodule_path": "rocm-libraries",
"skip_submodules": ["rocm-libraries"],
"dvc_projects": ["external-rocm-libraries"],
# "rocm-systems" pulls TheRock's own rocm-systems submodule DVC data
# (e.g. the amdgpu-windows-interop/wkmi libs CLR links against).
# --dvc-projects replaces fetch_sources.py's default project list
# rather than extending it, so both entries are listed explicitly.
"dvc_projects": ["external-rocm-libraries", "rocm-systems"],
},
"rocm-systems": {
"cmake_source_var": "THEROCK_ROCM_SYSTEMS_SOURCE_DIR",
Expand Down
18 changes: 14 additions & 4 deletions build_tools/github_actions/tests/dvc_external_repo_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,22 @@ def test_rocm_libraries_has_dvc_projects(self):
)

# Verify it contains external-rocm-libraries
self.assertEqual(
self.assertIn(
"external-rocm-libraries",
config["dvc_projects"],
["external-rocm-libraries"],
"dvc_projects should contain external-rocm-libraries path",
)

def test_rocm_libraries_also_pulls_rocm_systems_dvc(self):
"""Test that rocm-libraries dvc_projects also includes rocm-systems (wkmi)."""
config = get_repo_config("rocm-libraries")

self.assertIn(
"rocm-systems",
config["dvc_projects"],
"dvc_projects should contain rocm-systems for wkmi",
)


class TestFetchSourcesArgsGeneration(unittest.TestCase):
"""Tests for fetch_sources_args generation with DVC support."""
Expand Down Expand Up @@ -168,9 +178,9 @@ def test_rocm_libraries_generates_dvc_args(self):
# rocm-libraries should have both skip-submodules and dvc-projects
self.assertIn("--skip-submodules rocm-libraries", output)
self.assertIn(
"--dvc-projects external-rocm-libraries",
"--dvc-projects external-rocm-libraries rocm-systems",
output,
"Should include --dvc-projects external-rocm-libraries",
"Should include --dvc-projects external-rocm-libraries rocm-systems",
)


Expand Down
57 changes: 57 additions & 0 deletions build_tools/tests/fetch_sources_dvc_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,63 @@ def test_wsl_rocdxg_scenario(
if Path(temp_dir).exists():
shutil.rmtree(temp_dir)

@patch("fetch_sources.THEROCK_DIR")
@patch("fetch_sources.get_submodule_path")
@patch("fetch_dvc_artifacts.pull")
def test_rocm_libraries_scenario_pulls_rocm_systems_wkmi(
self, mock_dvc_pull, mock_get_submodule_path, mock_therock_dir
):
"""Test that a rocm-libraries-triggered build also pulls rocm-systems DVC data (wkmi)."""
temp_dir = tempfile.mkdtemp()
try:
therock_dir = Path(temp_dir)
fetch_sources.THEROCK_DIR = therock_dir

# External checkout, with its own DVC-tracked hipdnn golden data.
external_repo = therock_dir / "external-rocm-libraries"
external_repo.mkdir()
ext_dvc_dir = external_repo / ".dvc"
ext_dvc_dir.mkdir()
(ext_dvc_dir / "config").write_text("[core]\n remote = origin\n")

# TheRock's own rocm-systems submodule, hosting the DVC-tracked
# wkmi libs that CLR/rocdxg link against.
rocm_systems_submodule = therock_dir / "rocm-systems"
rocm_systems_submodule.mkdir()
sub_dvc_dir = rocm_systems_submodule / ".dvc"
sub_dvc_dir.mkdir()
(sub_dvc_dir / "config").write_text("[core]\n remote = origin\n")
wkmi_dir = (
rocm_systems_submodule
/ "shared"
/ "amdgpu-windows-interop"
/ "wkmi"
/ "win"
/ "lib"
)
wkmi_dir.mkdir(parents=True)
(wkmi_dir / "wkmi.lib.dvc").write_text(
"md5: 049e4861d0a50c6e33c24f2ebc25c3ba\nsize: 444338\n"
)

mock_get_submodule_path.return_value = "rocm-systems"
mock_dvc_pull.return_value = MockPullResult()

dvc_projects = ["external-rocm-libraries", "rocm-systems"]
projects = ["rocm-systems"]

fetch_sources.pull_large_files(dvc_projects, projects)

self.assertEqual(mock_dvc_pull.call_count, 2)
call_paths = [c[0][0] for c in mock_dvc_pull.call_args_list]
self.assertIn(external_repo, call_paths)
self.assertIn(rocm_systems_submodule, call_paths)
finally:
import shutil

if Path(temp_dir).exists():
shutil.rmtree(temp_dir)


if __name__ == "__main__":
unittest.main()
Loading