Skip to content

Commit 08400c0

Browse files
committed
Added custom-flags variation for install-llvm
1 parent f745495 commit 08400c0

4 files changed

Lines changed: 18 additions & 36 deletions

File tree

script/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# MLCommons Automation Scripts
22

3-
*Last updated: 2026-04-24 01:01:02*
3+
*Last updated: 2026-04-24 01:24:52*
44

55
This directory contains automation scripts for MLPerf benchmarks, AI/ML workflows, and development operations.
66

script/get-llvm/meta.yaml

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ alias: get-llvm
22
uid: 99832a103ed04eb8
33
automation_alias: script
44
automation_uid: 5b4e0237da074764
5-
6-
# Metadata
75
name: Detect or install LLVM compiler
86
category: Compiler automation
97
tags:
@@ -13,12 +11,8 @@ tags:
1311
- c-compiler
1412
- cpp-compiler
1513
- get-llvm
16-
17-
# Cache
1814
cache: true
1915
clean_files: []
20-
21-
# Environment
2216
env:
2317
MLC_REQUIRE_INSTALL: 'no'
2418
new_env_keys:
@@ -33,8 +27,6 @@ new_env_keys:
3327
- + LDFLAGS
3428
- +MLC_HOST_OS_DEFAULT_INCLUDE_PATH
3529
- +PATH
36-
37-
# Dependencies
3830
prehook_deps:
3931
- enable_if_env:
4032
MLC_REQUIRE_INSTALL:
@@ -47,8 +39,6 @@ prehook_deps:
4739
tags: install,llvm
4840
post_deps:
4941
- tags: get,compiler-flags
50-
51-
# Variations
5242
variations:
5343
from-prebuilt:
5444
group: install-src
@@ -72,6 +62,7 @@ variations:
7262
sha.#: {}
7363
tag.#: {}
7464
version.#: {}
75-
76-
# Output / debugging
65+
custom-flags.#:
66+
env:
67+
MLC_LLVM_CUSTOM_FLAGS: '#'
7768
sort: 100

script/install-llvm-src/customize.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,12 @@ def preprocess(i):
8989

9090
cmake_cmd = f"""cmake {os.path.join(env["MLC_LLVM_SRC_REPO_PATH"], "llvm")} -GNinja -DCMAKE_BUILD_TYPE={llvm_build_type} -DLLVM_ENABLE_PROJECTS={q}{enable_projects}{q} -DLLVM_ENABLE_RUNTIMES={q}{enable_runtimes}{q} -DCMAKE_INSTALL_PREFIX={q}{install_prefix}{q} -DLLVM_ENABLE_RTTI=ON -DLLVM_INSTALL_UTILS=ON -DLLVM_TARGETS_TO_BUILD={targets_to_build} {cross_compile_options} {target_triple_string} {compiler_rt_target_triple_string} {extra_cmake_options}"""
9191

92+
# Append custom C/CXX flags if specified via _custom-flags.# variation
93+
custom_flags = env.get('MLC_LLVM_CUSTOM_FLAGS', '').strip()
94+
if custom_flags:
95+
cmake_cmd += f' -DCMAKE_C_FLAGS={q}{custom_flags}{q}'
96+
cmake_cmd += f' -DCMAKE_CXX_FLAGS={q}{custom_flags}{q}'
97+
9298
env['MLC_LLVM_CMAKE_CMD'] = cmake_cmd
9399

94100
need_version = env.get('MLC_VERSION', '')

script/install-llvm-src/meta.yaml

Lines changed: 8 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ alias: install-llvm-src
22
uid: 2af16e9a6c5f4702
33
automation_alias: script
44
automation_uid: 5b4e0237da074764
5-
6-
# Metadata
75
name: Build LLVM compiler from sources (can take >30 min)
86
category: Compiler automation
97
tags:
@@ -12,20 +10,14 @@ tags:
1210
- llvm
1311
- from.src
1412
- src-llvm
15-
16-
# Cache
1713
cache: true
18-
19-
# Environment
2014
env:
2115
MLC_GIT_URL: https://github.com/llvm/llvm-project
2216
new_env_keys:
2317
- MLC_LLVM_*
2418
- MLC_GET_DEPENDENT_CACHED_PATH
2519
- +PATH
2620
- +C_INCLUDE_PATH
27-
28-
# Input mapping
2921
input_mapping:
3022
clean: MLC_CLEAN
3123
extra_options: MLC_LLVM_EXTRA_CMAKE_OPTIONS
@@ -34,8 +26,6 @@ input_mapping:
3426
target_triple: MLC_LLVM_TARGET_TRIPLE
3527
targets: MLC_LLVM_TARGETS_TO_BUILD
3628
src_path: MLC_LLVM_SRC_REPO_PATH
37-
38-
# Dependencies
3929
deps:
4030
- tags: detect,os
4131
- tags: detect,cpu
@@ -59,7 +49,7 @@ deps:
5949
MLC_LLVM_INSTALLED_PATH:
6050
- true
6151
MLC_LLVM_SRC_REPO_PATH:
62-
- on
52+
- true
6353
update_tags_from_env_with_prefix:
6454
_branch.:
6555
- MLC_GIT_CHECKOUT
@@ -86,8 +76,6 @@ post_deps:
8676
update_tags_from_env_with_prefix:
8777
_path.:
8878
- MLC_LLVM_INSTALLED_PATH
89-
90-
# Variations
9179
variations:
9280
debug:
9381
env:
@@ -196,7 +184,9 @@ variations:
196184
default_env:
197185
MLC_LLVM_TARGETS_TO_BUILD: AArch64
198186
env:
199-
MLC_LLVM_CROSS_COMPILE_FLAGS: -DCMAKE_SYSTEM_NAME=Linux -DCMAKE_SYSTEM_PROCESSOR=aarch64 -DLLVM_DEFAULT_TARGET_TRIPLE=aarch64-linux-gnu -DCMAKE_Fortran_COMPILER=aarch64-linux-gnu-gfortran-12 -DCMAKE_C_COMPILER=aarch64-linux-gnu-gcc -DCMAKE_CXX_COMPILER=aarch64-linux-gnu-g++
187+
MLC_LLVM_CROSS_COMPILE_FLAGS: -DCMAKE_SYSTEM_NAME=Linux -DCMAKE_SYSTEM_PROCESSOR=aarch64
188+
-DLLVM_DEFAULT_TARGET_TRIPLE=aarch64-linux-gnu -DCMAKE_Fortran_COMPILER=aarch64-linux-gnu-gfortran-12
189+
-DCMAKE_C_COMPILER=aarch64-linux-gnu-gcc -DCMAKE_CXX_COMPILER=aarch64-linux-gnu-g++
200190
cross-compile-x86-aarch64,flang:
201191
deps:
202192
- tags: get,generic-sys-util,_gfortran-12-aarch64-linux-gnu
@@ -335,22 +325,17 @@ variations:
335325
- full-history
336326
env:
337327
MLC_GIT_CHECKOUT_TAG: '#'
338-
339-
# Versions
328+
custom-flags.#:
329+
env:
330+
MLC_LLVM_CUSTOM_FLAGS: '#'
340331
versions: {}
341-
342-
# Docker / container
343332
docker:
344333
skip_run_cmd: true
345334
pre_run_cmds:
346335
- mlc pull repo
347336
mounts:
348-
- ${{ MLC_LLVM_SRC_REPO_PATH }}:${{ MLC_LLVM_SRC_REPO_PATH }}
349-
350-
# Output / debugging
337+
- ${{ MLC_LLVM_SRC_REPO_PATH }}:${{ MLC_LLVM_SRC_REPO_PATH }}
351338
sort: 1000
352-
353-
# Tests
354339
tests:
355340
run_inputs:
356341
- version: 20.1.1

0 commit comments

Comments
 (0)