@@ -139,11 +139,192 @@ jobs:
139139 name : triton-wheel-py${{ matrix.python_version }}
140140 path : wheelhouse/*.whl
141141
142- - name : Release wheels
143- if : |
144- github.event_name == 'workflow_dispatch' ||
145- github.event_name == 'schedule' ||
146- (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/'))
142+ build-wheels-windows :
143+ name : Build triton wheel Windows (Python ${{ matrix.python_version }})
144+ needs : [check-changes]
145+ if : >-
146+ always() &&
147+ (needs.check-changes.result == 'skipped' ||
148+ needs.check-changes.outputs.has_new_commits == 'true')
149+
150+ runs-on : windows-latest
151+
152+ permissions :
153+ id-token : write
154+ contents : write
155+ packages : read
156+
157+ strategy :
158+ fail-fast : false
159+ matrix :
160+ # Python matrix is narrower than Linux: Xilinx publishes mlir-air
161+ # Windows wheels only for cp310/cp311/cp312 (no cp313/cp314).
162+ python_version : ["3.10", "3.11", "3.12"]
163+
164+ env :
165+ # Pinned XRT Windows SDK release. Provides headers, xrt_coreutil.lib,
166+ # and xclbinutil/aiebu-asm. The build expects the SDK at
167+ # C:\Program Files\AMD\xrt (see utils/env_setup.ps1).
168+ XRT_WINDOWS_SDK_URL : " https://github.com/Xilinx/XRT/releases/download/2.21.75/xrt_windows_sdk.zip"
169+
170+ steps :
171+ - name : Disable Git CRLF conversion
172+ # Must run before checkout. windows-latest defaults to
173+ # core.autocrlf=true, which rewrites text files to CRLF on
174+ # checkout. The third_party/triton_shared.patch hunks were
175+ # generated with LF context lines, so the rewrite makes
176+ # `git apply --check` fail and apply_patches.py aborts —
177+ # the build then dies with a C2397 narrowing-conversion
178+ # error in PtrAnalysis.cpp that the patch was supposed to
179+ # fix. Forcing LF avoids the conversion entirely.
180+ shell : bash
181+ run : |
182+ git config --global core.autocrlf false
183+ git config --global core.eol lf
184+
185+ - name : Checkout repository
186+ uses : actions/checkout@v4
187+ with :
188+ fetch-depth : 2
189+ submodules : recursive
190+
191+ - name : Set up Python ${{ matrix.python_version }}
192+ uses : actions/setup-python@v5
193+ with :
194+ python-version : ${{ matrix.python_version }}
195+
196+ - name : Get commit info
197+ id : commit-info
198+ run : |
199+ if [ -n "${{ inputs.TRITON_XDNA_COMMIT }}" ]; then
200+ COMMIT="${{ inputs.TRITON_XDNA_COMMIT }}"
201+ else
202+ COMMIT=$(git rev-parse --short=7 HEAD)
203+ fi
204+ echo "commit=$COMMIT" >> $GITHUB_OUTPUT
205+ echo "datetime=$(date +%Y%m%d%H)" >> $GITHUB_OUTPUT
206+ echo "Building triton-xdna commit: $COMMIT"
207+
208+ - name : Install XRT Windows SDK
209+ shell : pwsh
210+ run : |
211+ Write-Host "Downloading $env:XRT_WINDOWS_SDK_URL"
212+ Invoke-WebRequest -Uri $env:XRT_WINDOWS_SDK_URL -OutFile xrt_windows_sdk.zip
213+ # Zip layout is xrt_sdk/xrt/{include,lib,...}; extract to a temp
214+ # location and move the inner xrt/ folder to where the build
215+ # expects it (C:\Program Files\AMD\xrt).
216+ $tempDir = Join-Path $env:RUNNER_TEMP "xrt_extract"
217+ New-Item -ItemType Directory -Force -Path $tempDir | Out-Null
218+ Expand-Archive -Path xrt_windows_sdk.zip -DestinationPath $tempDir -Force
219+ $srcXrt = Join-Path $tempDir "xrt_sdk\xrt"
220+ if (-not (Test-Path $srcXrt)) {
221+ Write-Error "Unexpected SDK zip layout: $srcXrt not found"
222+ exit 1
223+ }
224+ New-Item -ItemType Directory -Force -Path "C:\Program Files\AMD" | Out-Null
225+ Move-Item -Path $srcXrt -Destination "C:\Program Files\AMD\xrt" -Force
226+ $hdr = "C:\Program Files\AMD\xrt\include\xrt\xrt_bo.h"
227+ if (-not (Test-Path $hdr)) {
228+ Write-Error "XRT SDK extraction failed: $hdr not found"
229+ exit 1
230+ }
231+ Write-Host "XRT SDK installed at C:\Program Files\AMD\xrt"
232+ Remove-Item xrt_windows_sdk.zip
233+ Remove-Item -Recurse -Force $tempDir
234+
235+ - name : Set up MSVC developer environment
236+ # cibuildwheel doesn't activate vcvars on Windows; without this step
237+ # cmake fails with "Could not find compiler set in environment
238+ # variable CXX: cl.exe" because PATH/INCLUDE/LIB aren't populated.
239+ uses : ilammy/msvc-dev-cmd@v1
240+ with :
241+ arch : x64
242+
243+ - name : Install cibuildwheel
244+ # Use `python -m pip` instead of `pip` because Windows can't replace
245+ # the running pip.exe wrapper while it holds the file open.
246+ run : |
247+ python -m pip install --upgrade pip
248+ python -m pip install cibuildwheel
249+
250+ - name : Build wheels with cibuildwheel
251+ env :
252+ TRITON_XDNA_PROJECT_COMMIT : ${{ steps.commit-info.outputs.commit }}
253+ DATETIME : ${{ steps.commit-info.outputs.datetime }}
254+ XILINX_XRT : " C:\\ Program Files\\ AMD\\ xrt"
255+ run : |
256+ # Convert python version (e.g., "3.11" -> "cp311")
257+ PY_VERSION="${{ matrix.python_version }}"
258+ CIBW_BUILD="cp${PY_VERSION//./}-win_amd64"
259+ echo "Building for: $CIBW_BUILD"
260+
261+ CIBW_BUILD="$CIBW_BUILD" cibuildwheel --platform windows --output-dir wheelhouse
262+
263+ - name : List built wheels
264+ run : |
265+ ls -la wheelhouse/
266+ echo "Built wheels:"
267+ ls wheelhouse/*.whl
268+
269+ - name : Upload wheel artifact
270+ uses : actions/upload-artifact@v4
271+ with :
272+ name : triton-wheel-windows-py${{ matrix.python_version }}
273+ path : wheelhouse/*.whl
274+
275+ publish-release :
276+ name : Publish wheels to GitHub release
277+ needs : [build-wheels, build-wheels-windows]
278+ # Run after both build matrices finish, regardless of partial failures —
279+ # publish whatever wheels did build. Skipped on pull_request / merge_group
280+ # to avoid mutating release tags from non-mainline events.
281+ if : |
282+ always() &&
283+ (
284+ github.event_name == 'workflow_dispatch' ||
285+ github.event_name == 'schedule' ||
286+ (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/'))
287+ ) &&
288+ (
289+ needs.build-wheels.result == 'success' ||
290+ needs.build-wheels-windows.result == 'success'
291+ )
292+
293+ runs-on : ubuntu-latest
294+
295+ permissions :
296+ contents : write
297+
298+ steps :
299+ - name : Checkout repository
300+ uses : actions/checkout@v4
301+ with :
302+ fetch-depth : 1
303+
304+ - name : Get commit info
305+ id : commit-info
306+ run : |
307+ if [ -n "${{ inputs.TRITON_XDNA_COMMIT }}" ]; then
308+ COMMIT="${{ inputs.TRITON_XDNA_COMMIT }}"
309+ else
310+ COMMIT=$(git rev-parse --short=7 HEAD)
311+ fi
312+ echo "commit=$COMMIT" >> $GITHUB_OUTPUT
313+ echo "datetime=$(date +%Y%m%d%H)" >> $GITHUB_OUTPUT
314+
315+ - name : Download all wheel artifacts
316+ uses : actions/download-artifact@v4
317+ with :
318+ pattern : triton-wheel-*
319+ merge-multiple : true
320+ path : wheelhouse
321+
322+ - name : List collected wheels
323+ run : |
324+ ls -la wheelhouse/
325+ echo "Wheel count: $(ls wheelhouse/*.whl 2>/dev/null | wc -l)"
326+
327+ - name : Publish release
147328 uses : ncipollo/release-action@v1.12.0
148329 with :
149330 artifacts : wheelhouse/*.whl
@@ -155,9 +336,11 @@ jobs:
155336
156337 **Commit:** ${{ steps.commit-info.outputs.commit }}
157338 **Build Date:** ${{ steps.commit-info.outputs.datetime }}
158- **Python Version:** ${{ matrix.python_version }}
159339
160- ### Installation
340+ Linux wheels: Python 3.10–3.14 (manylinux_x86_64)
341+ Windows wheels: Python 3.10–3.12 (win_amd64)
342+
343+ ### Installation (Linux)
161344
162345 ```bash
163346 pip install triton-xdna \
@@ -166,6 +349,16 @@ jobs:
166349 --find-links https://github.com/Xilinx/llvm-aie/releases/expanded_assets/nightly \
167350 --find-links https://github.com/Xilinx/mlir-air/releases/expanded_assets/latest-air-wheels-no-rtti
168351 ```
352+
353+ ### Installation (Windows)
354+
355+ ```powershell
356+ pip install triton-xdna `
357+ --find-links https://github.com/${{ github.repository }}/releases/expanded_assets/latest-wheels `
358+ --find-links https://github.com/Xilinx/mlir-aie/releases/expanded_assets/latest-wheels-no-rtti `
359+ --find-links https://github.com/Xilinx/llvm-aie/releases/expanded_assets/nightly `
360+ --find-links https://github.com/Xilinx/mlir-air/releases/expanded_assets/latest-air-wheels-no-rtti
361+ ```
169362 allowUpdates : true
170363 replacesArtifacts : ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') }}
171364 makeLatest : ${{ github.event_name == 'push' }}
0 commit comments