Skip to content

Commit 04e71f4

Browse files
authored
Merge pull request mlcommons#847 from amd/dev
Updated Script Automation, support default_variations in script meta
2 parents 08dd549 + 74d7832 commit 04e71f4

7 files changed

Lines changed: 982 additions & 57 deletions

File tree

automation/script/README.md

Lines changed: 909 additions & 52 deletions
Large diffs are not rendered by default.

automation/script/module.py

Lines changed: 56 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1231,6 +1231,7 @@ def _run(self, i):
12311231

12321232
if default_version in versions:
12331233
versions_meta = versions[default_version]
1234+
run_state['version_meta'] = versions_meta
12341235
r = self.update_state_from_meta(
12351236
versions_meta,
12361237
run_state,
@@ -1997,6 +1998,7 @@ def _update_state_from_version(self, meta, run_state, i):
19971998

19981999
if version != '' and version in versions:
19992000
versions_meta = versions[version]
2001+
run_state['version_meta'] = versions_meta
20002002
r = self.update_state_from_meta(
20012003
versions_meta,
20022004
run_state,
@@ -2091,20 +2093,58 @@ def _update_state_from_variations(
20912093
if not variation_tags and default_variation and default_variation not in excluded_variation_tags:
20922094
variation_tags = [default_variation]
20932095

2096+
# Process default_variations from all sources BEFORE per-variation defaults.
2097+
# Priority order (highest first):
2098+
# 1. update_meta_if_env conditional default_variations
2099+
# 2. Script-level default_variations (top-level meta)
2100+
# 3. Version-level default_variations (version meta)
2101+
# 4. Per-variation default_variations (handled in _update_variation_tags_from_variations below)
2102+
#
2103+
# Since _get_variation_tags_from_default_variations only fills groups
2104+
# not already covered, processing higher-priority sources first ensures
2105+
# they win for each group.
2106+
conditional_dv = run_state.get('conditional_default_variations', {})
2107+
extra_meta_sources = []
2108+
if conditional_dv:
2109+
extra_meta_sources.append({'default_variations': conditional_dv})
2110+
extra_meta_sources.append(meta)
2111+
version_meta = run_state.get('version_meta', {})
2112+
if version_meta:
2113+
extra_meta_sources.append(version_meta)
2114+
for extra_meta_source in extra_meta_sources:
2115+
if extra_meta_source and 'default_variations' in extra_meta_source:
2116+
tmp_vt_static = copy.deepcopy(variation_tags)
2117+
for vi in range(len(tmp_vt_static)):
2118+
if tmp_vt_static[vi] not in variations:
2119+
vs = self._get_name_for_dynamic_variation_tag(
2120+
tmp_vt_static[vi])
2121+
if vs:
2122+
tmp_vt_static[vi] = vs
2123+
r = self._get_variation_tags_from_default_variations(
2124+
extra_meta_source, variations, variation_groups,
2125+
tmp_vt_static, excluded_variation_tags)
2126+
if r['return'] > 0:
2127+
return r
2128+
for t in r['variations_to_add']:
2129+
if t not in variation_tags:
2130+
variation_tags.append(t)
2131+
2132+
# Now process per-variation base variations and default_variations
2133+
# (lowest priority — only fills groups not already covered by
2134+
# script-level or version-level defaults above).
20942135
r = self._update_variation_tags_from_variations(
20952136
variation_tags, variation_groups, excluded_variation_tags, variations)
20962137
if r['return'] > 0:
20972138
return r
20982139

2099-
# process group defaults
2140+
# Process group defaults (the 'default' key inside each group)
21002141
r = self._process_variation_tags_in_groups(
21012142
variation_tags, variation_groups, excluded_variation_tags, variations)
21022143
if r['return'] > 0:
21032144
return r
21042145
if variation_tags != r['variation_tags']:
21052146
variation_tags = r['variation_tags']
2106-
# we need to again process variation tags if any new default
2107-
# variation is added
2147+
# re-expand if any new group default was added
21082148
r = self._update_variation_tags_from_variations(
21092149
variation_tags, variation_groups, excluded_variation_tags, variations)
21102150
if r['return'] > 0:
@@ -5605,6 +5645,19 @@ def _apply_conditional_meta_updates(update_meta_if_env, default_env, env, const,
56055645
'append_lists': True,
56065646
'append_unique': True})
56075647

5648+
# Accumulate default_variations from conditional meta updates.
5649+
# These will be picked up in _update_state_from_variations with
5650+
# the highest priority (above script-level default_variations).
5651+
c_default_variations = c_meta.get('default_variations', {})
5652+
if c_default_variations:
5653+
if 'conditional_default_variations' not in run_state:
5654+
run_state['conditional_default_variations'] = {}
5655+
# Later entries don't overwrite earlier ones (first match wins per
5656+
# group)
5657+
for group, variation in c_default_variations.items():
5658+
run_state['conditional_default_variations'].setdefault(
5659+
group, variation)
5660+
56085661
return {'return': 0}
56095662

56105663

script/README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# MLCommons Automation Scripts
22

3-
*Last updated: 2026-02-21 18:41:18*
3+
*Last updated: 2026-02-26 03:04:40*
44

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

@@ -994,6 +994,9 @@ This directory contains automation scripts for MLPerf benchmarks, AI/ML workflow
994994
- **[get-dataset-mlperf-inference-yolo-coco2017-filtered-dataset](get-dataset-mlperf-inference-yolo-coco2017-filtered-dataset/)**
995995
- get-dataset-mlperf-inference-yolo-coco2017-filtered-dataset
996996
- Tags: `get`, `dataset`, `mlperf-inference`, `yolo-coco2017-filtered`, `get-dataset-mlperf-inference-yolo-coco2017-filtered-dataset`
997+
- **[get-dataset-mmlu](get-dataset-mmlu/)**
998+
- get-dataset-mmlu
999+
- Tags: `get-dataset-mmlu`
9971000
- **[get-dataset-nuscenes](get-dataset-nuscenes/)**
9981001
- get-dataset-nuscenes
9991002
- Tags: `get`, `dataset`, `nuscenes`
@@ -1080,7 +1083,7 @@ This directory contains automation scripts for MLPerf benchmarks, AI/ML workflow
10801083

10811084
## Statistics
10821085

1083-
- **Total Scripts**: 317
1086+
- **Total Scripts**: 318
10841087
- **Categories**: 29
10851088

10861089
## Usage

script/detect-cpu/run.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ extract_field() {
1313

1414
if [[ ${MLC_HOST_OS_FLAVOR} == "macos" ]]; then
1515
sysctl -a | grep hw > tmp-lscpu.out
16+
cpu_model_name=$(sysctl -n machdep.cpu.brand_string)
17+
echo "MLC_HOST_CPU_MODEL_NAME=$cpu_model_name">>tmp-run-env.out
1618
else
1719
lscpu > tmp-lscpu.out
1820
memory_capacity=`free -h --si | grep Mem: | tr -s ' ' | cut -d' ' -f2`

script/get-lib-mimalloc/meta.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ category: Detection or installation of tools and artifacts
66
deps:
77
- env:
88
MLC_GIT_CHECKOUT_PATH_ENV_NAME: MLC_MIMALLOC_SRC_PATH
9+
MLC_GIT_REPO_VERSION_ENV_NAME: MLC_MIMALLOC_VERSION
910
extra_cache_tags: mimalloc,repo,mimalloc-repo
1011
force_env_keys:
1112
- MLC_GIT_*
@@ -28,6 +29,7 @@ deps:
2829
new_env_keys:
2930
- MLC_MIMALLOC_PATH
3031
- MLC_MIMALLOC_LIB_PATH
32+
- MLC_MIMALLOC_VERSION
3133
- +LD_LIBRARY_PATH
3234
new_state_keys: []
3335
post_deps: []

script/get-lib-tcmalloc/meta.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ category: Detection or installation of tools and artifacts
66
deps:
77
- env:
88
MLC_GIT_CHECKOUT_PATH_ENV_NAME: MLC_TCMALLOC_SRC_PATH
9+
MLC_GIT_REPO_VERSION_ENV_NAME: MLC_TCMALLOC_VERSION
910
extra_cache_tags: tcmalloc,repo,tcmalloc-repo
1011
force_env_keys:
1112
- MLC_GIT_*
@@ -28,6 +29,7 @@ deps:
2829
tags: get,generic-sys-util,_build-essential
2930
new_env_keys:
3031
- MLC_TCMALLOC_PATH
32+
- MLC_TCMALLOC_VERSION
3133
- MLC_TCMALLOC_LIB_PATH
3234
- +LD_LIBRARY_PATH
3335
new_state_keys: []

script/install-gcc-src/meta.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@ input_mapping:
3838
extra: MLC_GCC_EXTRA_CONFIGURE_STRING
3939
pull_changes: MLC_GCC_REPO_PULL_CHANGES
4040

41+
update_meta_if_env:
42+
- default_variations:
43+
repo: darwin
44+
enable_if_env:
45+
MLC_HOST_OS_TYPE:
46+
- darwin
4147

4248
new_env_keys:
4349
- MLC_GCC_*

0 commit comments

Comments
 (0)