-
Notifications
You must be signed in to change notification settings - Fork 10
feat: add LLVM setup script for modular installation #116
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
Changes from 2 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
ad371a0
feat: add LLVM setup script for modular installation
cmagina c446c05
Updated llvm install paths in the devinstall_triton script
cmagina a8279b1
Added suggested missing /llvm-install error path
cmagina 9dd87fe
Reorder devsetup triton and llvm devinstall calls
cmagina ff4cbb3
Don't use uv inside LLVM image build
cmagina 306c41d
Removed unnecessary git fetch
cmagina 1a9c4ea
Setup .bashrc.d for better user environment variable management
cmagina 3a0acca
Removed check for CUSTOM_LLVM and always pass in INSTALL_LLVM
cmagina 5831d1e
Moved to using specific bashrc files for env vars
cmagina 8a49731
Fixes for shellcheck in devcreate_user
cmagina 582a20d
Fix for missing .bashrc.d directory inside custom llvm build image
cmagina 13da1e4
Resolved more coderabbit review comments
cmagina 1943484
Few fixes for dealing with triton and llvm
cmagina 407ad41
Remove CUSTOM_LLVM image and all usage
cmagina File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,102 @@ | ||
| #! /bin/bash -e | ||
|
|
||
| trap "echo -e '\nScript interrupted. Exiting gracefully.'; exit 1" SIGINT | ||
|
|
||
| # Copyright (C) 2024-2025 Red Hat, Inc. | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
| # | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| set -euo pipefail | ||
|
|
||
| WORKSPACE=${WORKSPACE:-${HOME}} | ||
|
|
||
| LLVM_DIR=${WORKSPACE}/llvm-project | ||
| LLVM_REPO=https://github.com/llvm/llvm-project.git | ||
| LLVM_BUILD_PATH=$LLVM_DIR/build | ||
|
|
||
| pip_install() { | ||
| if command -v uv &>/dev/null; then | ||
| uv pip install "$@" | ||
cmagina marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| else | ||
| pip install "$@" | ||
| fi | ||
| } | ||
|
|
||
| setup_src() { | ||
| echo "Downloading LLVM source code and setting up the environment for building from source..." | ||
|
|
||
| if [ ! -d "$LLVM_DIR" ]; then | ||
| echo "Cloning the LLVM Project repo $LLVM_REPO to $LLVM_DIR ..." | ||
| git clone "$LLVM_REPO" "$LLVM_DIR" | ||
| if [ ! -d "$LLVM_DIR" ]; then | ||
| echo "$LLVM_DIR not found. ERROR Cloning repository..." | ||
| exit 1 | ||
| else | ||
| pushd "$LLVM_DIR" 1>/dev/null || exit 1 | ||
| git fetch origin | ||
hinriksnaer marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| # shellcheck source=/dev/null | ||
| [ -f "${HOME}"/.bashrc ] && source "${HOME}"/.bashrc | ||
cmagina marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
hinriksnaer marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| if [ -n "${LLVM_GITREF:-}" ]; then | ||
cmagina marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| git checkout "$LLVM_GITREF" | ||
| fi | ||
| popd 1>/dev/null | ||
| fi | ||
| else | ||
| echo "LLVM repo already present, not cloning ..." | ||
| fi | ||
|
|
||
| echo "Adding LLVM_BUILD_PATH to ${HOME}/.bashrc ..." | ||
| echo "export LLVM_BUILD_PATH=$LLVM_BUILD_PATH" >>"${HOME}/.bashrc" | ||
cmagina marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
hinriksnaer marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| echo "Run 'source ${HOME}/.bashrc' to update the current shell" | ||
| } | ||
|
|
||
| install_build_deps() { | ||
| pushd "$LLVM_DIR" 1>/dev/null || exit 1 | ||
| if [ -f mlir/python/requirements.txt ]; then | ||
| echo "Installing LLVM build dependencies ..." | ||
| pip_install -r mlir/python/requirements.txt | ||
cmagina marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| fi | ||
cmagina marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| popd 1>/dev/null | ||
| } | ||
|
|
||
| usage() { | ||
| cat >&2 <<EOF | ||
| Usage: $(basename "$0") [COMMAND] | ||
| source Download LLVM's source (if needed) and install the build deps | ||
| EOF | ||
| } | ||
|
|
||
| ## | ||
| ## Main | ||
| ## | ||
|
|
||
| if [ $# -ne 1 ]; then | ||
| usage | ||
| exit 1 | ||
| fi | ||
|
|
||
| COMMAND=${1,,} | ||
|
|
||
| case $COMMAND in | ||
| source) | ||
| setup_src | ||
| install_build_deps | ||
| ;; | ||
| *) | ||
| usage | ||
| exit 1 | ||
| ;; | ||
| esac | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.