@@ -9,26 +9,62 @@ source ./versions.sh
99
1010set -eux -o pipefail
1111
12+ source_variant=patched
13+
14+ while [[ $# -gt 0 ]]; do
15+ case " $1 " in
16+ --source-variant)
17+ if [[ $# -lt 2 ]]; then
18+ >&2 echo " error: --source-variant requires a value"
19+ exit 1
20+ fi
21+ source_variant=" $2 "
22+ shift 2
23+ ;;
24+ --source-variant=* )
25+ source_variant=" ${1#* =} "
26+ shift
27+ ;;
28+ * )
29+ >&2 echo " error: unknown option '$1 '"
30+ exit 1
31+ ;;
32+ esac
33+ done
34+
35+ case " $source_variant " in
36+ upstream|pinned|patched) ;;
37+ * )
38+ >&2 echo " error: invalid --source-variant '$source_variant '"
39+ >&2 echo " valid values: upstream, pinned, patched"
40+ exit 1
41+ ;;
42+ esac
43+
1244git-shallow-clone https://github.com/pytorch/pytorch.git $PYTORCH_HASH
1345(
14- # Apply patches to PyTorch build
1546 cd pytorch
1647
17- # https://github.com/pytorch/pytorch/pull/182655 - Update ACL/OpenBLAS/manywheel build scripts and add ccache support
18- apply-github-patch pytorch/pytorch 159406ab7f210bacadb757fabef28ac9ddacb706
48+ # Apply patches to PyTorch
49+ if [[ " $source_variant " != patched ]]; then
50+ echo " Not applying extra patches to PyTorch build for source variant '$source_variant '"
51+ else
52+ # https://github.com/pytorch/pytorch/pull/182655 - Update ACL/OpenBLAS/manywheel build scripts and add ccache support
53+ apply-github-patch pytorch/pytorch 159406ab7f210bacadb757fabef28ac9ddacb706
1954
20- # https://github.com/pytorch/pytorch/pull/170600 - Gate deletion of clean-up steps in build_common.sh
21- apply-github-patch pytorch/pytorch e368ec2693b8b2b8ba35d0913f1d663ba2fdc804
55+ # https://github.com/pytorch/pytorch/pull/170600 - Gate deletion of clean-up steps in build_common.sh
56+ apply-github-patch pytorch/pytorch e368ec2693b8b2b8ba35d0913f1d663ba2fdc804
2257
23- # https://github.com/pytorch/pytorch/pull/167328 - Build cpuinfo into c10 shared library
24- apply-github-patch pytorch/pytorch 7c053dd1582b778c81101dd452708c4ec6e58233
25- apply-github-patch pytorch/pytorch b1782bbe0eda5957870e2f6e95b8f167e04843cb
26- apply-github-patch pytorch/pytorch 337925aed2babb3ef7808f78536bbbc9df346a4f
58+ # https://github.com/pytorch/pytorch/pull/167328 - Build cpuinfo into c10 shared library
59+ apply-github-patch pytorch/pytorch 7c053dd1582b778c81101dd452708c4ec6e58233
60+ apply-github-patch pytorch/pytorch b1782bbe0eda5957870e2f6e95b8f167e04843cb
61+ apply-github-patch pytorch/pytorch 337925aed2babb3ef7808f78536bbbc9df346a4f
2762
28- # https://github.com/pytorch/pytorch/pull/177867 - Add ASIMD_BF16 Vectorized class specialisation
29- apply-github-patch pytorch/pytorch 6cbed7b8e0d5985569b4cc36931afc717930fe00
30- apply-github-patch pytorch/pytorch 6e6878ec8869fd8f7d9314571a3e84933f149ef5
31- apply-github-patch pytorch/pytorch e14a2184c44c96e433f468ba12e104dc6be85886
63+ # https://github.com/pytorch/pytorch/pull/177867 - Add ASIMD_BF16 Vectorized class specialisation
64+ apply-github-patch pytorch/pytorch 6cbed7b8e0d5985569b4cc36931afc717930fe00
65+ apply-github-patch pytorch/pytorch 6e6878ec8869fd8f7d9314571a3e84933f149ef5
66+ apply-github-patch pytorch/pytorch e14a2184c44c96e433f468ba12e104dc6be85886
67+ fi
3268
3369 # Remove deps that we don't need for manylinux AArch64 CPU builds before fetching.
3470 # Only used when jni.h is present (see .ci/pytorch/build.sh:116), which is not the case for manylinux
@@ -63,19 +99,30 @@ git-shallow-clone https://github.com/pytorch/pytorch.git $PYTORCH_HASH
6399 git rm 3rdparty/composable_kernel
64100 )
65101
66- (
67- cd third_party/ideep
68- git fetch origin $IDEEP_HASH && git clean -f && git checkout -f FETCH_HEAD
102+ # Fetch desired version of ideep/oneDNN/KleidiAI
103+ if [[ " $source_variant " == upstream ]]; then
104+ echo " Using PyTorch's upstream submodule hashes for ideep, oneDNN, and KleidiAI for source variant '$source_variant '"
105+ else
106+ (
107+ cd third_party/ideep
108+ git fetch origin $IDEEP_HASH && git clean -f && git checkout -f FETCH_HEAD
69109
110+ (
111+ cd mkl-dnn
112+ git fetch origin $ONEDNN_HASH && git clean -f && git checkout -f FETCH_HEAD
113+
114+ if [[ " $source_variant " != patched ]]; then
115+ echo " Not applying extra patches to oneDNN build for source variant '$source_variant '"
116+ else
117+ echo " No oneDNN patches to apply"
118+ fi
119+ )
120+ )
70121 (
71- cd mkl-dnn
72- git fetch origin $ONEDNN_HASH && git clean -f && git checkout -f FETCH_HEAD
122+ cd third_party/kleidiai
123+ git fetch origin $KLEIDIAI_HASH && git clean -f && git checkout -f FETCH_HEAD
73124 )
74- )
75- (
76- cd third_party/kleidiai
77- git fetch origin $KLEIDIAI_HASH && git clean -f && git checkout -f FETCH_HEAD
78- )
125+ fi
79126
80127 # rebuild third_party/LICENSES_BUNDLED.txt after modifying PyTorch submodules if we can
81128 # this will also get done in PyTorch build too
0 commit comments