Skip to content

Commit dd8bdce

Browse files
authored
Improve LLVM Support (#190)
* Added LLVM installation CLI * Added Windows C++ compiler flag to allow for stable parallel compilation (issue for devices with many cores)
1 parent 037db62 commit dd8bdce

File tree

41 files changed

+2526
-475
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+2526
-475
lines changed

.github/actions/setup-llvm/action.yml

Lines changed: 0 additions & 97 deletions
This file was deleted.

.github/workflows/julia-release.yml

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,38 @@ jobs:
9797
- name: Set up Rust
9898
run: rustup show
9999

100-
- name: Setup LLVM 14.0.6
101-
uses: ./.github/actions/setup-llvm
100+
- name: Install LLVM 14.0.6 using pecos-llvm (Unix)
101+
if: runner.os != 'Windows'
102+
run: |
103+
echo "Installing LLVM using pecos-llvm-utils..."
104+
cargo run -p pecos-llvm-utils --bin pecos-llvm --release -- install
105+
106+
echo "Setting LLVM environment variables..."
107+
export PECOS_LLVM=$(cargo run -p pecos-llvm-utils --bin pecos-llvm --release -- find 2>/dev/null)
108+
export LLVM_SYS_140_PREFIX="$PECOS_LLVM"
109+
110+
echo "PECOS_LLVM=$PECOS_LLVM" >> $GITHUB_ENV
111+
echo "LLVM_SYS_140_PREFIX=$LLVM_SYS_140_PREFIX" >> $GITHUB_ENV
112+
113+
echo "Verifying LLVM installation..."
114+
cargo run -p pecos-llvm-utils --bin pecos-llvm --release -- check
115+
116+
- name: Install LLVM 14.0.6 using pecos-llvm (Windows)
117+
if: runner.os == 'Windows'
118+
shell: pwsh
119+
run: |
120+
Write-Host "Installing LLVM using pecos-llvm-utils..."
121+
cargo run -p pecos-llvm-utils --bin pecos-llvm --release -- install
122+
123+
Write-Host "Setting LLVM environment variables..."
124+
$env:PECOS_LLVM = (cargo run -p pecos-llvm-utils --bin pecos-llvm --release -- find 2>$null)
125+
$env:LLVM_SYS_140_PREFIX = $env:PECOS_LLVM
126+
127+
"PECOS_LLVM=$env:PECOS_LLVM" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
128+
"LLVM_SYS_140_PREFIX=$env:LLVM_SYS_140_PREFIX" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
129+
130+
Write-Host "Verifying LLVM installation..."
131+
cargo run -p pecos-llvm-utils --bin pecos-llvm --release -- check
102132
103133
- name: Install Rust target
104134
run: |

.github/workflows/julia-test.yml

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,38 @@ jobs:
5757
- name: Set up Rust
5858
run: rustup show
5959

60-
- name: Setup LLVM 14.0.6
61-
uses: ./.github/actions/setup-llvm
60+
- name: Install LLVM 14.0.6 using pecos-llvm (Unix)
61+
if: runner.os != 'Windows'
62+
run: |
63+
echo "Installing LLVM using pecos-llvm-utils..."
64+
cargo run -p pecos-llvm-utils --bin pecos-llvm --release -- install
65+
66+
echo "Setting LLVM environment variables..."
67+
export PECOS_LLVM=$(cargo run -p pecos-llvm-utils --bin pecos-llvm --release -- find 2>/dev/null)
68+
export LLVM_SYS_140_PREFIX="$PECOS_LLVM"
69+
70+
echo "PECOS_LLVM=$PECOS_LLVM" >> $GITHUB_ENV
71+
echo "LLVM_SYS_140_PREFIX=$LLVM_SYS_140_PREFIX" >> $GITHUB_ENV
72+
73+
echo "Verifying LLVM installation..."
74+
cargo run -p pecos-llvm-utils --bin pecos-llvm --release -- check
75+
76+
- name: Install LLVM 14.0.6 using pecos-llvm (Windows)
77+
if: runner.os == 'Windows'
78+
shell: pwsh
79+
run: |
80+
Write-Host "Installing LLVM using pecos-llvm-utils..."
81+
cargo run -p pecos-llvm-utils --bin pecos-llvm --release -- install
82+
83+
Write-Host "Setting LLVM environment variables..."
84+
$env:PECOS_LLVM = (cargo run -p pecos-llvm-utils --bin pecos-llvm --release -- find 2>$null)
85+
$env:LLVM_SYS_140_PREFIX = $env:PECOS_LLVM
86+
87+
"PECOS_LLVM=$env:PECOS_LLVM" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
88+
"LLVM_SYS_140_PREFIX=$env:LLVM_SYS_140_PREFIX" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
89+
90+
Write-Host "Verifying LLVM installation..."
91+
cargo run -p pecos-llvm-utils --bin pecos-llvm --release -- check
6292
6393
- name: Cache Rust
6494
uses: Swatinem/rust-cache@v2

.github/workflows/python-test.yml

Lines changed: 38 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,38 @@ jobs:
5757
with:
5858
workspaces: python/pecos-rslib
5959

60-
- name: Setup LLVM 14.0.6
61-
uses: ./.github/actions/setup-llvm
60+
- name: Install LLVM 14.0.6 using pecos-llvm (Unix)
61+
if: runner.os != 'Windows'
62+
run: |
63+
echo "Installing LLVM using pecos-llvm-utils..."
64+
cargo run -p pecos-llvm-utils --bin pecos-llvm --release -- install
65+
66+
echo "Setting LLVM environment variables..."
67+
export PECOS_LLVM=$(cargo run -p pecos-llvm-utils --bin pecos-llvm --release -- find 2>/dev/null)
68+
export LLVM_SYS_140_PREFIX="$PECOS_LLVM"
69+
70+
echo "PECOS_LLVM=$PECOS_LLVM" >> $GITHUB_ENV
71+
echo "LLVM_SYS_140_PREFIX=$LLVM_SYS_140_PREFIX" >> $GITHUB_ENV
72+
73+
echo "Verifying LLVM installation..."
74+
cargo run -p pecos-llvm-utils --bin pecos-llvm --release -- check
75+
76+
- name: Install LLVM 14.0.6 using pecos-llvm (Windows)
77+
if: runner.os == 'Windows'
78+
shell: pwsh
79+
run: |
80+
Write-Host "Installing LLVM using pecos-llvm-utils..."
81+
cargo run -p pecos-llvm-utils --bin pecos-llvm --release -- install
82+
83+
Write-Host "Setting LLVM environment variables..."
84+
$env:PECOS_LLVM = (cargo run -p pecos-llvm-utils --bin pecos-llvm --release -- find 2>$null)
85+
$env:LLVM_SYS_140_PREFIX = $env:PECOS_LLVM
86+
87+
"PECOS_LLVM=$env:PECOS_LLVM" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
88+
"LLVM_SYS_140_PREFIX=$env:LLVM_SYS_140_PREFIX" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
89+
90+
Write-Host "Verifying LLVM installation..."
91+
cargo run -p pecos-llvm-utils --bin pecos-llvm --release -- check
6292
6393
- name: Build and test PECOS (Windows)
6494
if: runner.os == 'Windows'
@@ -86,6 +116,9 @@ jobs:
86116
# Also ensure LLVM bin is in PATH
87117
$llvmBinDir = Join-Path -Path $env:LLVM_SYS_140_PREFIX -ChildPath "bin"
88118
if (Test-Path $llvmBinDir) {
119+
# Update PATH for current session (so pytest can find llvm-as)
120+
$env:PATH = "$llvmBinDir;$env:PATH"
121+
# Update PATH for future steps
89122
"$llvmBinDir" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
90123
Write-Host "Added LLVM bin to PATH: $llvmBinDir"
91124
}
@@ -227,7 +260,7 @@ jobs:
227260
if [ -f "$lib" ]; then
228261
libname=$(basename "$lib")
229262
if otool -L "$lib" 2>/dev/null | grep -q "libunwind"; then
230-
echo " ⚠️ $libname HAS libunwind reference:"
263+
echo " [WARNING] $libname HAS libunwind reference:"
231264
otool -L "$lib" | grep libunwind
232265
fi
233266
fi
@@ -293,10 +326,10 @@ jobs:
293326
294327
exit 1
295328
else
296-
echo "✅ SUCCESS: No @rpath/libunwind reference found!"
329+
echo "[OK] No @rpath/libunwind reference found"
297330
fi
298331
else
299-
echo "⚠️ WARNING: Could not find extension module to check"
332+
echo "[WARNING] Could not find extension module to check"
300333
fi
301334
fi
302335

.github/workflows/rust-test.yml

Lines changed: 46 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,20 @@ jobs:
4949
with:
5050
save-if: ${{ github.ref_name == 'master' || github.ref_name == 'development' || github.ref_name == 'dev' }}
5151

52-
- name: Setup LLVM 14.0.6
53-
uses: ./.github/actions/setup-llvm
52+
- name: Install LLVM 14.0.6 using pecos-llvm
53+
run: |
54+
echo "Installing LLVM using pecos-llvm-utils..."
55+
cargo run -p pecos-llvm-utils --bin pecos-llvm --release -- install
56+
57+
echo "Setting LLVM environment variables..."
58+
export PECOS_LLVM=$(cargo run -p pecos-llvm-utils --bin pecos-llvm --release -- find 2>/dev/null)
59+
export LLVM_SYS_140_PREFIX="$PECOS_LLVM"
60+
61+
echo "PECOS_LLVM=$PECOS_LLVM" >> $GITHUB_ENV
62+
echo "LLVM_SYS_140_PREFIX=$LLVM_SYS_140_PREFIX" >> $GITHUB_ENV
63+
64+
echo "Verifying LLVM installation..."
65+
cargo run -p pecos-llvm-utils --bin pecos-llvm --release -- check
5466
5567
- name: Install rustfmt
5668
run: rustup component add rustfmt
@@ -179,8 +191,38 @@ jobs:
179191
with:
180192
save-if: ${{ github.ref_name == 'master' || github.ref_name == 'development' || github.ref_name == 'dev' }}
181193

182-
- name: Setup LLVM 14.0.6
183-
uses: ./.github/actions/setup-llvm
194+
- name: Install LLVM 14.0.6 using pecos-llvm (Unix)
195+
if: matrix.os != 'windows-latest'
196+
run: |
197+
echo "Installing LLVM using pecos-llvm-utils..."
198+
cargo run -p pecos-llvm-utils --bin pecos-llvm --release -- install
199+
200+
echo "Setting LLVM environment variables..."
201+
export PECOS_LLVM=$(cargo run -p pecos-llvm-utils --bin pecos-llvm --release -- find 2>/dev/null)
202+
export LLVM_SYS_140_PREFIX="$PECOS_LLVM"
203+
204+
echo "PECOS_LLVM=$PECOS_LLVM" >> $GITHUB_ENV
205+
echo "LLVM_SYS_140_PREFIX=$LLVM_SYS_140_PREFIX" >> $GITHUB_ENV
206+
207+
echo "Verifying LLVM installation..."
208+
cargo run -p pecos-llvm-utils --bin pecos-llvm --release -- check
209+
210+
- name: Install LLVM 14.0.6 using pecos-llvm (Windows)
211+
if: matrix.os == 'windows-latest'
212+
shell: pwsh
213+
run: |
214+
Write-Host "Installing LLVM using pecos-llvm-utils..."
215+
cargo run -p pecos-llvm-utils --bin pecos-llvm --release -- install
216+
217+
Write-Host "Setting LLVM environment variables..."
218+
$env:PECOS_LLVM = (cargo run -p pecos-llvm-utils --bin pecos-llvm --release -- find 2>$null)
219+
$env:LLVM_SYS_140_PREFIX = $env:PECOS_LLVM
220+
221+
"PECOS_LLVM=$env:PECOS_LLVM" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
222+
"LLVM_SYS_140_PREFIX=$env:LLVM_SYS_140_PREFIX" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
223+
224+
Write-Host "Verifying LLVM installation..."
225+
cargo run -p pecos-llvm-utils --bin pecos-llvm --release -- check
184226
185227
- name: Set up Visual Studio environment on Windows
186228
if: matrix.os == 'windows-latest'

.github/workflows/test-docs-examples.yml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,20 @@ jobs:
4141
with:
4242
workspaces: python/pecos-rslib
4343

44-
- name: Setup LLVM 14.0.6
45-
uses: ./.github/actions/setup-llvm
44+
- name: Install LLVM 14.0.6 using pecos-llvm
45+
run: |
46+
echo "Installing LLVM using pecos-llvm-utils..."
47+
cargo run -p pecos-llvm-utils --bin pecos-llvm --release -- install
48+
49+
echo "Setting LLVM environment variables..."
50+
export PECOS_LLVM=$(cargo run -p pecos-llvm-utils --bin pecos-llvm --release -- find 2>/dev/null)
51+
export LLVM_SYS_140_PREFIX="$PECOS_LLVM"
52+
53+
echo "PECOS_LLVM=$PECOS_LLVM" >> $GITHUB_ENV
54+
echo "LLVM_SYS_140_PREFIX=$LLVM_SYS_140_PREFIX" >> $GITHUB_ENV
55+
56+
echo "Verifying LLVM installation..."
57+
cargo run -p pecos-llvm-utils --bin pecos-llvm --release -- check
4658
4759
- name: Generate lockfile and install dependencies
4860
run: |

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ tmp/
66
# LLVM (extracted from archive for Windows development)
77
llvm/
88

9+
# Cargo config with machine-specific LLVM paths
10+
.cargo/config.toml
11+
912
# pytest results
1013
junit/
1114

0 commit comments

Comments
 (0)