Skip to content

Commit f6cc0a6

Browse files
committed
Fix amdclang version detection for src build
1 parent 4356986 commit f6cc0a6

2 files changed

Lines changed: 18 additions & 1 deletion

File tree

script/get-rocm/customize.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@ def preprocess(i):
1111

1212
recursion_spaces = i['recursion_spaces']
1313

14-
file_name = 'rocminfo.exe' if os_info['platform'] == 'windows' else 'rocminfo'
14+
# Source build: search for clang instead of rocminfo
15+
if env.get('MLC_ROCM_BUILD_FROM_SRC', '') == 'yes':
16+
file_name = 'clang'
17+
else:
18+
file_name = 'rocminfo.exe' if os_info['platform'] == 'windows' else 'rocminfo'
1519
env['FILE_NAME'] = file_name
1620

1721
# Build search paths: check /opt paths first, then custom install prefix
@@ -30,6 +34,10 @@ def preprocess(i):
3034
for p in [os.path.join(prefix_opt, 'rocm', 'bin')] + sorted(glob.glob(os.path.join(prefix_opt, 'rocm-*', 'bin')), reverse=True):
3135
if os.path.exists(p) and p not in rocm_paths:
3236
rocm_paths.append(p)
37+
# Source build: also check <prefix>/bin directly
38+
prefix_bin = os.path.join(install_prefix, 'bin')
39+
if os.path.exists(prefix_bin) and prefix_bin not in rocm_paths:
40+
rocm_paths.append(prefix_bin)
3341

3442
if rocm_paths:
3543
env['MLC_TMP_PATH'] = os.pathsep.join(rocm_paths)

script/get-rocm/run.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,15 @@ version_file="${dir}/.info/version"
66
if [ -f "${version_file}" ]; then
77
cat "${version_file}" > tmp-ver.out
88
test $? -eq 0 || exit 1
9+
elif [[ "${MLC_ROCM_BUILD_FROM_SRC}" == "yes" ]]; then
10+
# Source build: get version from clang --version output
11+
clang_bin="${MLC_ROMLC_BIN_WITH_PATH%/*}/clang"
12+
if [ -f "${clang_bin}" ]; then
13+
${clang_bin} --version 2>&1 | head -1 | sed 's/.*version[ ]*//' | sed 's/[^0-9.].*//' > tmp-ver.out
14+
else
15+
echo "${MLC_VERSION}" > tmp-ver.out
16+
fi
17+
test $? -eq 0 || exit 1
918
else
1019
# Fallback: try rocminfo output
1120
${MLC_ROMLC_BIN_WITH_PATH} 2>/dev/null | grep "Runtime Version" | head -1 | sed 's/.*: *//' > tmp-ver.out

0 commit comments

Comments
 (0)