Skip to content

Commit 710f6cb

Browse files
hcho3lowkeyrossi
andauthored
[backport] Add support for building xgboost wheels on Win-ARM64 (dmlc#11572, dmlc#11597, dmlc#11559) (dmlc#11599)
* Add support for building xgboost wheels on Win-ARM64 (dmlc#11572) * Add support for building xgboost wheels on Win-ARM64 * Add CI support for building xgboost wheels for WoA * Fix wheel upload with WoA (dmlc#11597) * [WIP] Debug wheel build with WoA * Add back conditional * Fix compilation on WoA (dmlc#11559) --------- Co-authored-by: newyork_loki <[email protected]>
1 parent f2d976a commit 710f6cb

File tree

2 files changed

+67
-1
lines changed

2 files changed

+67
-1
lines changed
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Build Python wheels targeting Windows ARM64
2+
3+
on: [push, pull_request]
4+
5+
permissions:
6+
contents: read # to fetch code (actions/checkout)
7+
8+
defaults:
9+
run:
10+
shell: pwsh
11+
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
14+
cancel-in-progress: true
15+
16+
env:
17+
BRANCH_NAME: >-
18+
${{ github.event.pull_request.number && 'PR-' }}${{ github.event.pull_request.number || github.ref_name }}
19+
20+
jobs:
21+
python-wheels-Win-ARM64:
22+
name: Build wheel for Windows ARM64
23+
runs-on: windows-11-arm
24+
steps:
25+
- uses: actions/checkout@v4
26+
with:
27+
submodules: 'true'
28+
29+
- name: Setup Python
30+
uses: actions/setup-python@v4
31+
with:
32+
python-version: '3.11'
33+
34+
- name: Install build dependencies
35+
run: |
36+
python -m pip install --upgrade pip
37+
python -m pip install wheel setuptools awscli
38+
39+
- name: Build XGBoost for Win-ARM64
40+
run: |
41+
mkdir build
42+
cd build
43+
cmake .. -G"Visual Studio 17 2022" -A ARM64
44+
cmake --build . --config Release -- /m /nodeReuse:false "/consoleloggerparameters:ShowCommandLine;Verbosity=minimal"
45+
46+
- name: Build XGBoost Python wheel for Win-ARM64
47+
run: |
48+
# Patch to rename pkg to xgboost-cpu
49+
python ops/script/pypi_variants.py --use-cpu-suffix=1 --require-nccl-dep=0
50+
cd python-package
51+
mkdir -p wheelhouse
52+
pip wheel --no-deps -v . --wheel-dir wheelhouse/
53+
$wheelFile = Get-ChildItem wheelhouse/*.whl | Select-Object -First 1 -ExpandProperty FullName
54+
python -m wheel tags --python-tag py3 --abi-tag none --platform win_arm64 --remove $wheelFile
55+
56+
- name: Upload Python wheel
57+
if: github.ref == 'refs/heads/master' || contains(github.ref, 'refs/heads/release_')
58+
run: |
59+
$wheelFile = Get-ChildItem python-package/wheelhouse/*.whl | Select-Object -First 1 -ExpandProperty FullName
60+
python ops/pipeline/manage-artifacts.py upload `
61+
--s3-bucket xgboost-nightly-builds `
62+
--prefix ${{ env.BRANCH_NAME }}/${{ github.sha }} --make-public `
63+
$wheelFile
64+
env:
65+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID_IAM_S3_UPLOADER }}
66+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY_IAM_S3_UPLOADER }}

src/common/bitfield.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ inline std::uint32_t TrailingZeroBits(std::uint32_t value) {
272272
}
273273
#if defined(__GNUC__)
274274
return __builtin_ctz(value);
275-
#elif defined(_MSC_VER)
275+
#elif defined(_MSC_VER) && defined(_M_X64)
276276
return _tzcnt_u32(value);
277277
#else
278278
return detail::TrailingZeroBitsImpl(value);

0 commit comments

Comments
 (0)