From 7c255f194ad95ab22deed5484f7dfb15c37b9078 Mon Sep 17 00:00:00 2001 From: Arjun Suresh Date: Sun, 14 Sep 2025 02:13:20 +0100 Subject: [PATCH 1/9] Fix typo in test-mlperf-inference-tvm-resnet50.yml --- .github/workflows/test-mlperf-inference-tvm-resnet50.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-mlperf-inference-tvm-resnet50.yml b/.github/workflows/test-mlperf-inference-tvm-resnet50.yml index d7b40d89b..27abcb242 100644 --- a/.github/workflows/test-mlperf-inference-tvm-resnet50.yml +++ b/.github/workflows/test-mlperf-inference-tvm-resnet50.yml @@ -29,7 +29,7 @@ jobs: pip install mlcflow - name: Pull MLOps repository env: - REPO: ${{ github.event.pull_request.head.repo.html_url } + REPO: ${{ github.event.pull_request.head.repo.html_url }} BRANCH: ${{ github.event.pull_request.head.ref }} run: | mlc pull repo "$REPO" --branch="$BRANCH" From cce5301331cf015d18428ed880a8e027a54a6d78 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 14 Sep 2025 15:47:20 +0530 Subject: [PATCH 2/9] Support cache_expiration for detect-os and detect-cpu --- automation/script/module.py | 2 +- automation/utils.py | 1 + script/detect-cpu/meta.yaml | 2 ++ script/detect-os/meta.yaml | 2 ++ 4 files changed, 6 insertions(+), 1 deletion(-) diff --git a/automation/script/module.py b/automation/script/module.py index 33e2e3d84..d7105b5c7 100644 --- a/automation/script/module.py +++ b/automation/script/module.py @@ -2041,7 +2041,7 @@ def _run(self, i): cached_meta['dependent_cached_path'] = dependent_cached_path if run_state.get('cache_expiration'): # convert to seconds - cached_meta['cache_expiration'] = utils.parse_expiration( + cached_meta['cache_expiration'] = parse_expiration( run_state['cache_expiration']) ii = {'action': 'update', diff --git a/automation/utils.py b/automation/utils.py index 252549452..cf9a47ba0 100644 --- a/automation/utils.py +++ b/automation/utils.py @@ -1104,6 +1104,7 @@ def print_json(i): def parse_expiration(user_input: str) -> float: + import time """ Parse user input like '10m', '2h', '3d' into a UNIX timestamp. """ diff --git a/script/detect-cpu/meta.yaml b/script/detect-cpu/meta.yaml index f2dcacc02..9be46ec67 100644 --- a/script/detect-cpu/meta.yaml +++ b/script/detect-cpu/meta.yaml @@ -2,6 +2,8 @@ alias: detect-cpu automation_alias: script automation_uid: 5b4e0237da074764 category: Platform information +cache: true +cache_expiration: 1h clean_files: - tmp-lscpu.out - tmp-systeminfo.csv diff --git a/script/detect-os/meta.yaml b/script/detect-os/meta.yaml index 8f9070cac..9460278a5 100644 --- a/script/detect-os/meta.yaml +++ b/script/detect-os/meta.yaml @@ -2,6 +2,8 @@ alias: detect-os automation_alias: script automation_uid: 5b4e0237da074764 category: Platform information +cache: true +cache_expiration: 1h clean_files: - tmp-run.out new_env_keys: From aaf2ab33e65e0da0519f772eabfa5606a002dad3 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 14 Sep 2025 17:08:47 +0530 Subject: [PATCH 3/9] Improve the handling of inputs with space for mlc docker run --- automation/script/docker_utils.py | 9 ++++----- automation/script/module.py | 2 +- automation/utils.py | 14 ++++++++++++++ ...e-cm-sut-info.json => sample-mlc-sut-info.json} | 0 4 files changed, 19 insertions(+), 6 deletions(-) rename script/generate-mlperf-inference-submission/{sample-cm-sut-info.json => sample-mlc-sut-info.json} (100%) diff --git a/automation/script/docker_utils.py b/automation/script/docker_utils.py index 8fe73d47f..a9d6c9831 100644 --- a/automation/script/docker_utils.py +++ b/automation/script/docker_utils.py @@ -349,7 +349,7 @@ def rebuild_flags( continue value = command_dict[key] - quote = '\\"' if full_key in quote_keys else "" + quote = '"' if full_key in quote_keys else "" # Recursively process nested dictionaries. if isinstance(value, dict): @@ -362,15 +362,14 @@ def rebuild_flags( ) # Process lists by concatenating values with commas. elif isinstance(value, list): - list_values = ",".join( - f"{quote}{str(item)}{quote}" for item in value) + list_values = ",".join(quote_if_needed(item, quote) for item in value) command_line += f" --{full_key},={list_values}" # Process scalar values. else: if full_key in ['s', 'v']: command_line += f" -{full_key}" - else: - command_line += f" --{full_key}={quote}{str(value)}{quote}" + elif : + command_line += f" --{full_key}={quote_if_needed(value, quote)}" return command_line diff --git a/automation/script/module.py b/automation/script/module.py index d7105b5c7..ae3e5f832 100644 --- a/automation/script/module.py +++ b/automation/script/module.py @@ -5290,7 +5290,7 @@ def prepare_and_run_script_with_postprocessing(i, postprocess="postprocess"): if r['return'] > 0: return r - # Save file to run without CM + # Save file to run without MLC if debug_script_tags != '' and all( item in found_script_tags for item in debug_script_tags.split(',')): diff --git a/automation/utils.py b/automation/utils.py index cf9a47ba0..e4338f4b3 100644 --- a/automation/utils.py +++ b/automation/utils.py @@ -1128,3 +1128,17 @@ def parse_expiration(user_input: str) -> float: seconds = value * units[unit] return time.time() + seconds + +def quote_if_needed(val: str, quote: str) -> str: + """ + Return the value, quoted with escaped quotes if it contains spaces + or quotes. + """ + s = str(val) + + if " " in s or '"' in s or quote == '"': + # Escape all existing double quotes + s = s.replace('"', r'\"') + return f"\\\"{s}\\\"" + return s + diff --git a/script/generate-mlperf-inference-submission/sample-cm-sut-info.json b/script/generate-mlperf-inference-submission/sample-mlc-sut-info.json similarity index 100% rename from script/generate-mlperf-inference-submission/sample-cm-sut-info.json rename to script/generate-mlperf-inference-submission/sample-mlc-sut-info.json From de73954c793027b286b89319b5b504df8ef4bb6b Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 14 Sep 2025 11:39:08 +0000 Subject: [PATCH 4/9] [Automated Commit] Format Codebase [skip ci] --- automation/script/docker_utils.py | 6 ++++-- automation/utils.py | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/automation/script/docker_utils.py b/automation/script/docker_utils.py index a9d6c9831..225c0183a 100644 --- a/automation/script/docker_utils.py +++ b/automation/script/docker_utils.py @@ -362,13 +362,15 @@ def rebuild_flags( ) # Process lists by concatenating values with commas. elif isinstance(value, list): - list_values = ",".join(quote_if_needed(item, quote) for item in value) + list_values = ",".join( + quote_if_needed( + item, quote) for item in value) command_line += f" --{full_key},={list_values}" # Process scalar values. else: if full_key in ['s', 'v']: command_line += f" -{full_key}" - elif : + elif: command_line += f" --{full_key}={quote_if_needed(value, quote)}" return command_line diff --git a/automation/utils.py b/automation/utils.py index e4338f4b3..460cff533 100644 --- a/automation/utils.py +++ b/automation/utils.py @@ -1129,16 +1129,16 @@ def parse_expiration(user_input: str) -> float: seconds = value * units[unit] return time.time() + seconds + def quote_if_needed(val: str, quote: str) -> str: """ Return the value, quoted with escaped quotes if it contains spaces or quotes. """ s = str(val) - + if " " in s or '"' in s or quote == '"': # Escape all existing double quotes s = s.replace('"', r'\"') return f"\\\"{s}\\\"" return s - From 485fa219f8396805ae83de198dea312608ecdb4f Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 14 Sep 2025 17:13:32 +0530 Subject: [PATCH 5/9] Improve the handling of inputs with space for mlc docker run --- automation/script/docker_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/automation/script/docker_utils.py b/automation/script/docker_utils.py index 225c0183a..7996c0b30 100644 --- a/automation/script/docker_utils.py +++ b/automation/script/docker_utils.py @@ -370,7 +370,7 @@ def rebuild_flags( else: if full_key in ['s', 'v']: command_line += f" -{full_key}" - elif: + else: command_line += f" --{full_key}={quote_if_needed(value, quote)}" return command_line From 13473f34fd39043f2c2b6ecf71481aa69bde7218 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 14 Sep 2025 17:20:14 +0530 Subject: [PATCH 6/9] Improve the handling of inputs with space for mlc docker run --- automation/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/automation/utils.py b/automation/utils.py index 460cff533..f6c8e7e6c 100644 --- a/automation/utils.py +++ b/automation/utils.py @@ -1140,5 +1140,5 @@ def quote_if_needed(val: str, quote: str) -> str: if " " in s or '"' in s or quote == '"': # Escape all existing double quotes s = s.replace('"', r'\"') - return f"\\\"{s}\\\"" + return f'"{s}"' return s From ae0f00fb715acc74574f6d0d90b6c2a8288717a6 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 14 Sep 2025 18:09:44 +0530 Subject: [PATCH 7/9] Handle escaping of quotes for env variables in script automation --- automation/script/docker_utils.py | 4 ++-- automation/script/module.py | 11 ++++++----- automation/utils.py | 2 ++ 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/automation/script/docker_utils.py b/automation/script/docker_utils.py index 7996c0b30..7c68fdf92 100644 --- a/automation/script/docker_utils.py +++ b/automation/script/docker_utils.py @@ -215,14 +215,14 @@ def update_docker_environment( # Add host group ID if specified in the Docker settings and not on Windows if not is_false(docker_settings.get('pass_group_id')) and os.name != 'nt': env['+ MLC_DOCKER_BUILD_ARGS'].append( - f"GID=\\\" $(id -g $USER) \\\"" + f"GID=\" $(id -g $USER) \"" ) # Add host user ID if specified in the Docker settings and not on Windows if not is_false(docker_settings.get( 'use_host_user_id')) and os.name != 'nt': env['+ MLC_DOCKER_BUILD_ARGS'].append( - f"UID=\\\" $(id -u $USER) \\\"" + f"UID=\" $(id -u $USER) \"" ) return {'return': 0} diff --git a/automation/script/module.py b/automation/script/module.py index ae3e5f832..0a73f90c3 100644 --- a/automation/script/module.py +++ b/automation/script/module.py @@ -3154,9 +3154,8 @@ def native_run(self, i): if os.name == 'nt': script.append('set ' + k + '=' + v) else: - if ' ' in v: - v = '"' + v + '"' - script.append('export ' + k + '=' + v) + safe_v = quote_if_needed(v) + script.append('export ' + k + '=' + safe_v) script.append('') @@ -5596,10 +5595,12 @@ def convert_env_to_script(env, os_info, start_script=None): os_info['env_var'].replace( 'env_var', key)}""" - # Replace placeholders in the platform-specific environment command + env_quote = os_info['env_quote'] + # Replace placeholders in the platform-specific environment command + # and escapes any quote in the env value env_command = os_info['set_env'].replace( '${key}', key).replace( - '${value}', str(env_value)) + '${value}', str(env_value).replace(env_quote, f"""\\{env_quote}""")) script.append(env_command) return script diff --git a/automation/utils.py b/automation/utils.py index f6c8e7e6c..4fecdea8d 100644 --- a/automation/utils.py +++ b/automation/utils.py @@ -45,6 +45,7 @@ def get_host_os_info(i={}): info['bat_ext'] = '.bat' info['set_env'] = 'set ${key}=${value}' info['env_separator'] = ';' + info['env_quote'] = '\'' info['env_var'] = '%env_var%' info['bat_rem'] = 'rem ${rem}' info['run_local_bat'] = 'call ${bat_file}' @@ -63,6 +64,7 @@ def get_host_os_info(i={}): info['bat_ext'] = '.sh' info['set_env'] = 'export ${key}="${value}"' info['env_separator'] = ':' + info['env_quote'] = '"' info['env_var'] = '${env_var}' info['set_exec_file'] = 'chmod 755 "${file_name}"' info['bat_rem'] = '# ${rem}' From 25301073451d51800dee9367b6461c3ce927d7aa Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 14 Sep 2025 12:40:02 +0000 Subject: [PATCH 8/9] [Automated Commit] Format Codebase [skip ci] --- automation/script/module.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/automation/script/module.py b/automation/script/module.py index 0a73f90c3..81025c4b8 100644 --- a/automation/script/module.py +++ b/automation/script/module.py @@ -5596,7 +5596,7 @@ def convert_env_to_script(env, os_info, start_script=None): 'env_var', key)}""" env_quote = os_info['env_quote'] - # Replace placeholders in the platform-specific environment command + # Replace placeholders in the platform-specific environment command # and escapes any quote in the env value env_command = os_info['set_env'].replace( '${key}', key).replace( From 7f89dce9a8725cca763d9486ea038ed725077193 Mon Sep 17 00:00:00 2001 From: Arjun Suresh Date: Sun, 14 Sep 2025 13:47:55 +0100 Subject: [PATCH 9/9] Update build_wheel_off.yml --- .github/workflows/build_wheel_off.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/build_wheel_off.yml b/.github/workflows/build_wheel_off.yml index 9a7eb65e9..4fbc24dba 100644 --- a/.github/workflows/build_wheel_off.yml +++ b/.github/workflows/build_wheel_off.yml @@ -1,6 +1,5 @@ name: Build wheel and release into PYPI (off now) - on: push: branches: