[rocm-libraries] ROCm/rocm-libraries#4430 (commit 3bcf68c)

[CK] Add project root marker for monorepo compatibility
 (#4430)

## Summary
- Add `.ck-project-root` marker file at the composablekernel project
root
- Update `find_project_root()` in `script/tools/common.sh` to look for
this marker instead of `.git`
- Fixes project root detection when CK is part of the rocm-libraries
monorepo

  ## Background
Since the project was moved into the monorepo, the `.git` directory is
at the monorepo root rather
than the CK project root. This caused `find_project_root()` to return
the wrong path, breaking tools
   in `script/tools/`.

  ## Test plan
- [x] Verify `find_project_root` returns correct path from any CK
subdirectory
  - [x] Verify `ck-build --help` works
  - [x] Verify `ck-configure --help` works

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Thomas Ning <Thomas.Ning@amd.com>
This commit is contained in:
Max Podkorytov
2026-02-24 21:00:34 +00:00
committed by assistant-librarian[bot]
parent cd12e8e31f
commit f3f4d7d842
2 changed files with 5 additions and 3 deletions

2
.ck-project-root Normal file
View File

@@ -0,0 +1,2 @@
# Composable Kernel project root marker
# Used by scripts in script/tools/ to locate the project root

View File

@@ -5,7 +5,7 @@
# Common utilities for CK Docker tools
# Shared configuration and helper functions
# Find project root (where .git directory is)
# Find project root using relative path (fallback)
get_project_root() {
local script_dir="$1"
cd "${script_dir}/../.." && pwd
@@ -149,11 +149,11 @@ is_build_configured() {
[ -f "${build_dir}/build.ninja" ]
}
# Find project root from any subdirectory (walks up to find .git)
# Find project root from any subdirectory (walks up to find .ck-project-root)
find_project_root() {
local dir="${1:-$(pwd)}"
while [ "$dir" != "/" ]; do
if [ -d "$dir/.git" ]; then
if [ -f "$dir/.ck-project-root" ]; then
echo "$dir"
return 0
fi