Skip to content

Fix lists in install-llvm-src #309

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Mar 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/build_wheel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ on:
paths:
- VERSION


jobs:

build_wheels:
Expand Down
30 changes: 16 additions & 14 deletions automation/script/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,11 @@ def _run(self, i):
# Add permanent env from OS (such as MLC_WINDOWS:"yes" on Windows)
env_from_os_info = os_info.get('env', {})
if len(env_from_os_info) > 0:
env.update(env_from_os_info)
# env.update(env_from_os_info)
utils.merge_dicts({'dict1': env,
'dict2': env_from_os_info,
'append_lists': True,
'append_unique': True})

# take some env from the user environment
keys = [
Expand Down Expand Up @@ -833,7 +837,10 @@ def _run(self, i):
script_item_env = meta.get('env', {})
# print(f"script meta env= {script_item_env}")

env.update(script_item_env)
utils.merge_dicts({'dict1': env,
'dict2': script_item_env,
'append_lists': True,
'append_unique': True})
# print(f"env = {env}")

script_item_state = meta.get('state', {})
Expand Down Expand Up @@ -1915,8 +1922,7 @@ def _run(self, i):
# Finalize script

# Force consts in the final new env and state
utils.merge_dicts({'dict1': env, 'dict2': const,
'append_lists': True, 'append_unique': True})
env.update(const)
utils.merge_dicts({'dict1': state,
'dict2': const_state,
'append_lists': True,
Expand Down Expand Up @@ -3473,7 +3479,7 @@ def _run_deps(self, deps, clean_env_keys_deps, env, state, const, const_state, a
if r['return'] > 0:
return r

# Update env/state with cost
# Update env/state with const
env.update(const)
utils.merge_dicts({'dict1': state,
'dict2': const_state,
Expand Down Expand Up @@ -5052,10 +5058,7 @@ def prepare_and_run_script_with_postprocessing(i, postprocess="postprocess"):
'return': 16, 'error': 'script {} not found - please add one'.format(path_to_run_script)}

# Update env and state with const
utils.merge_dicts({'dict1': env,
'dict2': const,
'append_lists': True,
'append_unique': True})
env.update(const)
utils.merge_dicts({'dict1': state, 'dict2': const_state,
'append_lists': True, 'append_unique': True})

Expand Down Expand Up @@ -5281,8 +5284,7 @@ def run_detect_version(customize_code, customize_common_input,
logger.debug(recursion_spaces + ' - Running detect_version ...')

# Update env and state with const
utils.merge_dicts({'dict1': env, 'dict2': const,
'append_lists': True, 'append_unique': True})
env.update(const)
utils.merge_dicts({'dict1': state,
'dict2': const_state,
'append_lists': True,
Expand Down Expand Up @@ -5312,8 +5314,7 @@ def run_postprocess(customize_code, customize_common_input, recursion_spaces,
logger.debug(recursion_spaces + ' - Running postprocess ...')

# Update env and state with const
utils.merge_dicts({'dict1': env, 'dict2': const,
'append_lists': True, 'append_unique': True})
env.update(const)
utils.merge_dicts({'dict1': state,
'dict2': const_state,
'append_lists': True,
Expand Down Expand Up @@ -5745,7 +5746,8 @@ def update_state_from_meta(meta, env, state, const, const_state, deps, post_deps
env.setdefault(key, default_env[key])

update_env = meta.get('env', {})
env.update(update_env)
utils.merge_dicts({'dict1': env, 'dict2': update_env,
'append_lists': True, 'append_unique': True})

update_meta_if_env = meta.get('update_meta_if_env', [])
update_meta_if_env_from_state = run_state.get('update_meta_if_env', [])
Expand Down
4 changes: 2 additions & 2 deletions script/install-llvm-src/customize.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ def preprocess(i):

llvm_build_type = env['MLC_LLVM_BUILD_TYPE']

targets_to_buuild = env.get('MLC_LLVM_TARGETS_TO_BUILD', 'X86')
targets_to_build = env.get('MLC_LLVM_TARGETS_TO_BUILD', 'X86')

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} -DLLVM_ENABLE_RTTI=ON -DLLVM_INSTALL_UTILS=ON -DLLVM_TARGETS_TO_BUILD={targets_to_build} {extra_cmake_options}"""
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} {extra_cmake_options}"""

env['MLC_LLVM_CMAKE_CMD'] = cmake_cmd

Expand Down
9 changes: 6 additions & 3 deletions script/install-llvm-src/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,14 @@ variations:
clang:
default: true
env:
+MLC_LLVM_ENABLE_PROJECTS: clang
+MLC_LLVM_ENABLE_PROJECTS:
- clang
group: clang
lld:
default: true
env:
+MLC_LLVM_ENABLE_PROJECTS: lld
+MLC_LLVM_ENABLE_PROJECTS:
- lld
group: lld
no-clang:
group: clang
Expand Down Expand Up @@ -207,7 +209,8 @@ variations:
group: repo
runtimes.#:
env:
+MLC_LLVM_ENABLE_RUNTIMES: '#'
+MLC_LLVM_ENABLE_RUNTIMES:
- '#'
sha.#:
env:
MLC_GIT_CHECKOUT_SHA: '#'
Expand Down
Loading