-
Notifications
You must be signed in to change notification settings - Fork 1
769 lines (747 loc) · 33 KB
/
Copy pathpypi.yml
File metadata and controls
769 lines (747 loc) · 33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
name: Build And Publish RayD Distributions
on:
release:
types: [published]
workflow_dispatch:
inputs:
scope:
description: Manual validation scope
required: true
default: full
type: choice
options:
- full
- windows-torch-smoke
concurrency:
group: distributions-${{ github.ref }}-${{ github.event_name == 'workflow_dispatch' && github.sha || github.event_name }}
cancel-in-progress: ${{ github.event_name != 'release' }}
permissions:
contents: read
env:
RAYD_CUDA_GENCODE_ARCHES: "70,75,80,86,87,89,90,100,101,120"
RAYD_CUDA_PTX_ARCH: "120"
TORCH_CUDA_ARCH_LIST: "7.0;7.5;8.0;8.6;8.7;8.9;9.0;10.0;10.1;12.0+PTX"
jobs:
metadata:
name: Packaging metadata / py${{ matrix.python-version }}
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
steps:
- uses: actions/checkout@v5
- uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- run: python -m pip install "tomli>=2; python_version < '3.11'"
- name: Validate published release tag
if: github.event_name == 'release' && github.event.action == 'published'
env:
RAYD_RELEASE_TAG: ${{ github.event.release.tag_name }}
run: python scripts/validate_release_tag.py --tag "$RAYD_RELEASE_TAG" --pyproject pyproject.toml
- name: Validate package and release metadata
shell: bash
run: |
python -m unittest \
tests.packaging.test_project_metadata \
tests.packaging.test_release_metadata \
tests.governance.test_gpu_ci_contract \
tests.governance.test_drjit_project_metadata \
tests.governance.test_verify_cuda_binary_arches_jit \
tests.test_rt_host_compile \
tests.packaging.test_torch_project_metadata \
-v
build-drjit-linux:
name: rayd-drjit / manylinux_2_28 / py${{ matrix.python-version }}
runs-on: ubuntu-22.04
timeout-minutes: 120
needs: metadata
if: inputs.scope != 'windows-torch-smoke'
env:
SCCACHE_DIR: ${{ github.workspace }}/.cache/rayd-sccache
SCCACHE_CACHE_SIZE: 1G
SCCACHE_IGNORE_SERVER_IO_ERROR: "1"
strategy:
fail-fast: false
matrix:
include:
- {python-version: "3.10", cibw-build: "cp310-manylinux_x86_64"}
- {python-version: "3.11", cibw-build: "cp311-manylinux_x86_64"}
- {python-version: "3.12", cibw-build: "cp312-manylinux_x86_64"}
- {python-version: "3.13", cibw-build: "cp313-manylinux_x86_64"}
- {python-version: "3.14", cibw-build: "cp314-manylinux_x86_64"}
steps:
- uses: actions/checkout@v5
- uses: actions/setup-python@v6
with:
python-version: "3.12"
cache: pip
- name: Install sccache
uses: mozilla-actions/sccache-action@v0.0.10
with:
version: "v0.11.0"
- name: Restore compiler and cibuildwheel caches
uses: actions/cache@v5
with:
path: |
${{ github.workspace }}/.cache/rayd-sccache
${{ github.workspace }}/.cache/cibuildwheel
key: rayd-sccache-v2-full-linux-drjit-${{ github.event.pull_request.head.sha || github.sha }}
restore-keys: |
rayd-sccache-v2-full-linux-drjit-
- name: Expose sccache to manylinux
shell: bash
run: |
mkdir -p "$GITHUB_WORKSPACE/.cache/sccache-bin"
cp "$(command -v sccache)" "$GITHUB_WORKSPACE/.cache/sccache-bin/sccache"
- name: Free disk space
shell: bash
run: |
sudo rm -rf /usr/share/dotnet /opt/ghc /usr/local/lib/android \
/usr/local/share/boost /opt/hostedtoolcache/CodeQL \
/usr/local/share/powershell /usr/share/swift || true
sudo docker image prune --all --force || true
- name: Build and repair Dr.Jit wheels
uses: pypa/cibuildwheel@v3.3.0
env:
CIBW_BUILD: ${{ matrix.cibw-build }}
CIBW_SKIP: "*-musllinux_*"
CIBW_CACHE_PATH: ${{ github.workspace }}/.cache/cibuildwheel
CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28
CIBW_BUILD_VERBOSITY: "1"
CIBW_BEFORE_ALL_LINUX: >-
dnf install -y dnf-plugins-core gcc-toolset-12 &&
rpm --import https://developer.download.nvidia.com/compute/cuda/repos/rhel8/x86_64/D42D0685.pub &&
dnf config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/rhel8/x86_64/cuda-rhel8.repo &&
dnf clean expire-cache &&
dnf install -y
cuda-compiler-12-8
cuda-cudart-devel-12-8
cuda-cuobjdump-12-8 &&
ln -sfn /usr/local/cuda-12.8 /usr/local/cuda &&
/usr/local/cuda/bin/nvcc --version
CIBW_ENVIRONMENT_LINUX: >-
CUDA_HOME=/usr/local/cuda
CUDA_PATH=/usr/local/cuda
CUDA_ROOT=/usr/local/cuda
CUDA_BIN_PATH=/usr/local/cuda
CUDACXX=/usr/local/cuda/bin/nvcc
RAYD_SCCACHE_ROOT=/host${{ github.workspace }}/.cache
RAYD_CUDA_GENCODE_ARCHES=70,75,80,86,87,89,90,100,101,120
RAYD_CUDA_PTX_ARCH=120
RAYD_NVCC_LAUNCHER=$RAYD_SCCACHE_ROOT/sccache-bin/sccache
PIP_CONSTRAINT=/project/.github/constraints/drjit-build.txt
CMAKE_BUILD_PARALLEL_LEVEL=4
CMAKE_C_COMPILER_LAUNCHER=$RAYD_SCCACHE_ROOT/sccache-bin/sccache
CMAKE_CXX_COMPILER_LAUNCHER=$RAYD_SCCACHE_ROOT/sccache-bin/sccache
SCCACHE_DIR=$RAYD_SCCACHE_ROOT/rayd-sccache
SCCACHE_CACHE_SIZE=1G
SCCACHE_BASEDIRS=/project
SCCACHE_IGNORE_SERVER_IO_ERROR=1
SKBUILD_BUILD_DIR=/project/artifacts/skbuild
CC=/opt/rh/gcc-toolset-12/root/usr/bin/gcc
CXX=/opt/rh/gcc-toolset-12/root/usr/bin/g++
CUDAHOSTCXX=/opt/rh/gcc-toolset-12/root/usr/bin/g++
PATH=/usr/local/cuda/bin:$PATH
LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH
CIBW_TEST_COMMAND: >-
python -I {project}/tests/packaging/wheel_lifecycle_smoke.py installed drjit &&
python -m pip uninstall -y rayd-drjit &&
python -I {project}/tests/packaging/wheel_lifecycle_smoke.py absent drjit
CIBW_TEST_REQUIRES: "drjit==1.3.1"
CIBW_REPAIR_WHEEL_COMMAND_LINUX: >-
auditwheel repair --plat manylinux_2_28_x86_64
--exclude libcuda.so.1
--exclude libnvoptix.so.1
--exclude libdrjit-core.so
--exclude libdrjit-extra.so
--exclude libnanothread.so
-w {dest_dir} {wheel} &&
python /project/drjit/scripts/verify_cuda_binary_arches.py
--stem _C {dest_dir}/*.whl &&
$RAYD_SCCACHE_ROOT/sccache-bin/sccache --show-stats &&
chown -R --reference=/host${{ github.workspace }}
$RAYD_SCCACHE_ROOT/rayd-sccache
with:
package-dir: drjit
output-dir: dist/drjit
- uses: actions/upload-artifact@v4
with:
name: release-rayd-drjit-linux-py${{ matrix.python-version }}
path: dist/drjit/*.whl
if-no-files-found: error
build-torch-linux:
name: rayd-torch / manylinux_2_28 / py${{ matrix.python-version }}
runs-on: ubuntu-22.04
timeout-minutes: 180
needs: metadata
if: inputs.scope != 'windows-torch-smoke'
env:
SCCACHE_DIR: ${{ github.workspace }}/.cache/rayd-sccache
SCCACHE_CACHE_SIZE: 1G
SCCACHE_IGNORE_SERVER_IO_ERROR: "1"
strategy:
fail-fast: false
matrix:
include:
- {python-version: "3.10", cibw-build: "cp310-manylinux_x86_64"}
- {python-version: "3.11", cibw-build: "cp311-manylinux_x86_64"}
- {python-version: "3.12", cibw-build: "cp312-manylinux_x86_64"}
- {python-version: "3.13", cibw-build: "cp313-manylinux_x86_64"}
- {python-version: "3.14", cibw-build: "cp314-manylinux_x86_64"}
steps:
- uses: actions/checkout@v5
- name: Check out OptiX 8.1 headers
uses: actions/checkout@v5
with:
repository: NVIDIA/optix-dev
ref: v8.1.0
path: .optix
persist-credentials: false
- uses: actions/setup-python@v6
with:
python-version: "3.12"
cache: pip
- name: Install sccache
uses: mozilla-actions/sccache-action@v0.0.10
with:
version: "v0.11.0"
- name: Restore compiler and cibuildwheel caches
uses: actions/cache@v5
with:
path: |
${{ github.workspace }}/.cache/rayd-sccache
${{ github.workspace }}/.cache/cibuildwheel
key: rayd-sccache-v2-full-linux-torch-${{ github.event.pull_request.head.sha || github.sha }}
restore-keys: |
rayd-sccache-v2-full-linux-torch-
- name: Expose sccache to manylinux
shell: bash
run: |
mkdir -p "$GITHUB_WORKSPACE/.cache/sccache-bin"
cp "$(command -v sccache)" "$GITHUB_WORKSPACE/.cache/sccache-bin/sccache"
- name: Free disk space
shell: bash
run: |
sudo rm -rf /usr/share/dotnet /opt/ghc /usr/local/lib/android \
/usr/local/share/boost /opt/hostedtoolcache/CodeQL \
/usr/local/share/powershell /usr/share/swift || true
sudo docker image prune --all --force || true
- name: Build and repair Torch wheels
uses: pypa/cibuildwheel@v3.3.0
env:
CIBW_BUILD: ${{ matrix.cibw-build }}
CIBW_SKIP: "*-musllinux_*"
CIBW_CACHE_PATH: ${{ github.workspace }}/.cache/cibuildwheel
CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28
CIBW_BUILD_VERBOSITY: "1"
CIBW_BEFORE_ALL_LINUX: >-
dnf install -y dnf-plugins-core gcc-toolset-12 &&
rpm --import https://developer.download.nvidia.com/compute/cuda/repos/rhel8/x86_64/D42D0685.pub &&
dnf config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/rhel8/x86_64/cuda-rhel8.repo &&
dnf clean expire-cache &&
dnf install -y
cuda-compiler-12-8
cuda-cudart-devel-12-8
cuda-cuobjdump-12-8
cuda-driver-devel-12-8
cuda-nvrtc-devel-12-8
libcublas-devel-12-8
libcusparse-devel-12-8
libcusolver-devel-12-8 &&
ln -sfn /usr/local/cuda-12.8 /usr/local/cuda &&
/usr/local/cuda/bin/nvcc --version
CIBW_ENVIRONMENT_LINUX: >-
CUDA_HOME=/usr/local/cuda
CUDA_PATH=/usr/local/cuda
CUDA_ROOT=/usr/local/cuda
CUDA_BIN_PATH=/usr/local/cuda
CUDACXX=/usr/local/cuda/bin/nvcc
OPTIX_INCLUDE_DIR=/project/.optix/include
RAYD_SCCACHE_ROOT=/host${{ github.workspace }}/.cache
CMAKE_CUDA_ARCHITECTURES="70-real;75-real;80-real;86-real;87-real;89-real;90-real;100-real;101-real;120-real;120-virtual"
TORCH_CUDA_ARCH_LIST="7.0;7.5;8.0;8.6;8.7;8.9;9.0;10.0;10.1;12.0+PTX"
CMAKE_BUILD_PARALLEL_LEVEL=2
CMAKE_CUDA_FLAGS=--threads=2
CMAKE_C_COMPILER_LAUNCHER=$RAYD_SCCACHE_ROOT/sccache-bin/sccache
CMAKE_CXX_COMPILER_LAUNCHER=$RAYD_SCCACHE_ROOT/sccache-bin/sccache
CMAKE_CUDA_COMPILER_LAUNCHER=$RAYD_SCCACHE_ROOT/sccache-bin/sccache
SCCACHE_DIR=$RAYD_SCCACHE_ROOT/rayd-sccache
SCCACHE_CACHE_SIZE=1G
SCCACHE_BASEDIRS=/project
SCCACHE_IGNORE_SERVER_IO_ERROR=1
SKBUILD_BUILD_DIR=/project/artifacts/skbuild
PIP_CONSTRAINT=/project/.github/constraints/torch-build.txt
PIP_EXTRA_INDEX_URL=https://download.pytorch.org/whl/cu128
CC=/opt/rh/gcc-toolset-12/root/usr/bin/gcc
CXX=/opt/rh/gcc-toolset-12/root/usr/bin/g++
CUDAHOSTCXX=/opt/rh/gcc-toolset-12/root/usr/bin/g++
PATH=/usr/local/cuda/bin:$PATH
LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH
CIBW_TEST_COMMAND: >-
python -I {project}/tests/packaging/wheel_lifecycle_smoke.py installed torch &&
python -m pip uninstall -y rayd-torch &&
python -I {project}/tests/packaging/wheel_lifecycle_smoke.py absent torch
CIBW_TEST_REQUIRES: "torch==2.10.0"
CIBW_REPAIR_WHEEL_COMMAND_LINUX: >-
auditwheel repair --plat manylinux_2_28_x86_64
--exclude libcuda.so.1
--exclude libnvoptix.so.1
--exclude libcudart.so.12
--exclude libc10.so
--exclude libc10_cuda.so
--exclude libtorch.so
--exclude libtorch_cpu.so
--exclude libtorch_cuda.so
--exclude libtorch_python.so
--exclude libtorch_global_deps.so
-w {dest_dir} {wheel} &&
python /project/drjit/scripts/verify_cuda_binary_arches.py
--stem _legacy_ops --stem _stable_ops {dest_dir}/*.whl &&
python /project/torch/scripts/verify_stable_abi.py
--source-root /project/src {dest_dir}/*.whl &&
python /project/torch/scripts/verify_driver_independence.py
{dest_dir}/*.whl &&
$RAYD_SCCACHE_ROOT/sccache-bin/sccache --show-stats &&
chown -R --reference=/host${{ github.workspace }}
$RAYD_SCCACHE_ROOT/rayd-sccache
with:
package-dir: torch
output-dir: dist/torch
- uses: actions/upload-artifact@v4
with:
name: release-rayd-torch-linux-py${{ matrix.python-version }}
path: dist/torch/*.whl
if-no-files-found: error
build-windows-wheels:
name: rayd-${{ matrix.backend }} / Windows / py${{ matrix.python-version }}
runs-on: windows-2022
timeout-minutes: 180
needs: metadata
strategy:
fail-fast: false
matrix:
backend: ${{ fromJSON(inputs.scope == 'windows-torch-smoke' && '["torch"]' || '["drjit","torch"]') }}
python-version: ${{ fromJSON(inputs.scope == 'windows-torch-smoke' && '["3.10"]' || '["3.10","3.11","3.12","3.13","3.14"]') }}
env:
CMAKE_CUDA_ARCHITECTURES: "70-real;75-real;80-real;86-real;87-real;89-real;90-real;100-real;101-real;120-real;120-virtual"
CMAKE_BUILD_PARALLEL_LEVEL: ${{ matrix.backend == 'torch' && '2' || '4' }}
RAYD_TORCH_CUDA_GENCODE_FLAGS: >-
--generate-code=arch=compute_70,code=[sm_70,sm_75]
--generate-code=arch=compute_80,code=[sm_80,sm_86,sm_87,sm_89]
--generate-code=arch=compute_90,code=sm_90
--generate-code=arch=compute_100,code=[sm_100,sm_101]
--generate-code=arch=compute_120,code=[sm_120,compute_120]
CMAKE_C_COMPILER_LAUNCHER: sccache
CMAKE_CXX_COMPILER_LAUNCHER: sccache
# Windows sccache 0.11 loses secondary cubin files from grouped CUDA
# gencode calls. Keep C/C++ caching and Dr.Jit's single-output nvcc shim,
# but run Torch CMake CUDA commands directly.
CMAKE_CUDA_COMPILER_LAUNCHER: ""
RAYD_NVCC_LAUNCHER: sccache
SCCACHE_DIR: ${{ github.workspace }}/.cache/rayd-sccache
SCCACHE_CACHE_SIZE: 1G
SCCACHE_BASEDIRS: ${{ github.workspace }}
SCCACHE_IGNORE_SERVER_IO_ERROR: "1"
OPTIX_INCLUDE_DIR: ${{ github.workspace }}\.optix\include
steps:
- uses: actions/checkout@v5
- name: Check out OptiX 8.1 headers
if: matrix.backend == 'torch'
uses: actions/checkout@v5
with:
repository: NVIDIA/optix-dev
ref: v8.1.0
path: .optix
persist-credentials: false
- uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
cache: pip
- name: Install sccache
uses: mozilla-actions/sccache-action@v0.0.10
with:
version: "v0.11.0"
- name: Restore compiler cache
uses: actions/cache@v5
with:
path: ${{ github.workspace }}/.cache/rayd-sccache
key: rayd-sccache-v2-full-windows-${{ matrix.backend }}-${{ github.event.pull_request.head.sha || github.sha }}
restore-keys: |
rayd-sccache-v2-full-windows-${{ matrix.backend }}-
- name: Install CUDA Toolkit 12.8
uses: Jimver/cuda-toolkit@v0.2.35
with:
cuda: "12.8.1"
method: local
sub-packages: >-
${{ matrix.backend == 'torch'
&& '["nvcc", "cudart", "cuobjdump", "visual_studio_integration", "cublas", "cublas_dev", "cusparse", "cusparse_dev", "cusolver", "cusolver_dev"]'
|| '["nvcc", "cudart", "cuobjdump", "visual_studio_integration"]' }}
log-file-suffix: "${{ matrix.backend }}-windows-py${{ matrix.python-version }}"
- name: Set up MSVC
uses: ilammy/msvc-dev-cmd@v1
with:
arch: x64
- name: Export CUDA paths
shell: pwsh
run: |
$cudaRoot = $env:CUDA_PATH
if (-not $cudaRoot) {
$nvcc = (Get-Command nvcc -ErrorAction Stop).Source
$cudaRoot = Split-Path (Split-Path $nvcc -Parent) -Parent
}
"CUDA_HOME=$cudaRoot" >> $env:GITHUB_ENV
"CUDA_PATH=$cudaRoot" >> $env:GITHUB_ENV
"CMAKE_GENERATOR=Ninja" >> $env:GITHUB_ENV
- name: Install Dr.Jit build dependencies
if: matrix.backend == 'drjit'
shell: pwsh
run: |
python -m pip install --upgrade pip build twine "scikit-build-core>=0.10" "cmake>=3.22" ninja
$nativeExit=$LASTEXITCODE; if ($nativeExit -ne 0) { exit $nativeExit }
python -m pip install --constraint .github/constraints/drjit-build.txt "nanobind==2.11.0" "drjit==1.3.1"
$nativeExit=$LASTEXITCODE; if ($nativeExit -ne 0) { exit $nativeExit }
- name: Install Torch build dependencies
if: matrix.backend == 'torch'
shell: pwsh
run: |
python -m pip install --upgrade pip build twine "scikit-build-core>=0.10" "cmake>=3.26" ninja
$nativeExit=$LASTEXITCODE; if ($nativeExit -ne 0) { exit $nativeExit }
python -m pip install --constraint .github/constraints/torch-build.txt torch `
--index-url https://download.pytorch.org/whl/cu128
$nativeExit=$LASTEXITCODE; if ($nativeExit -ne 0) { exit $nativeExit }
- name: Build Dr.Jit wheel
if: matrix.backend == 'drjit'
working-directory: drjit
run: >-
python -m build --wheel --no-isolation --outdir ../dist/drjit
-Cbuild-dir=artifacts/skbuild
- name: Build Torch wheel
if: matrix.backend == 'torch'
working-directory: torch
shell: pwsh
run: |
$startedAt = Get-Date
python -m build --wheel --no-isolation --outdir ../dist/torch `
-Cbuild-dir=artifacts/skbuild
if ($LASTEXITCODE -ne 0) {
exit $LASTEXITCODE
}
$elapsedMinutes = ((Get-Date) - $startedAt).TotalMinutes
"Windows Torch full wheel build: {0:N2} minutes" -f $elapsedMinutes
if ($elapsedMinutes -ge 60) {
throw "Windows Torch full wheel build exceeded the 60-minute release limit."
}
- name: Verify Dr.Jit wheel
if: matrix.backend == 'drjit'
shell: pwsh
run: |
$wheel = (Get-ChildItem dist/drjit/*.whl).FullName
python drjit/scripts/verify_cuda_binary_arches.py --stem _C $wheel
$nativeExit=$LASTEXITCODE; if ($nativeExit -ne 0) { exit $nativeExit }
python -m twine check $wheel
$nativeExit=$LASTEXITCODE; if ($nativeExit -ne 0) { exit $nativeExit }
- name: Verify Torch wheel
if: matrix.backend == 'torch'
shell: pwsh
run: |
$wheel = (Get-ChildItem dist/torch/*.whl).FullName
python drjit/scripts/verify_cuda_binary_arches.py --stem _legacy_ops --stem _stable_ops $wheel
$nativeExit=$LASTEXITCODE; if ($nativeExit -ne 0) { exit $nativeExit }
python torch/scripts/verify_stable_abi.py --source-root src $wheel
$nativeExit=$LASTEXITCODE; if ($nativeExit -ne 0) { exit $nativeExit }
python torch/scripts/verify_driver_independence.py $wheel
$nativeExit=$LASTEXITCODE; if ($nativeExit -ne 0) { exit $nativeExit }
python -m twine check $wheel
$nativeExit=$LASTEXITCODE; if ($nativeExit -ne 0) { exit $nativeExit }
- name: Validate wheel install and uninstall lifecycle
shell: pwsh
working-directory: ${{ runner.temp }}
run: |
$backend = "${{ matrix.backend }}"
$wheel = (Get-ChildItem "$env:GITHUB_WORKSPACE/dist/$backend/*.whl").FullName
python -m pip install --no-deps --force-reinstall $wheel
$nativeExit=$LASTEXITCODE; if ($nativeExit -ne 0) { exit $nativeExit }
if ($backend -eq "drjit") {
$disabledLlvm = Join-Path $env:RUNNER_TEMP "rayd-drjit-disabled-llvm-does-not-exist.dll"
if (Test-Path -LiteralPath $disabledLlvm) {
throw "Expected the Dr.Jit LLVM isolation path to be absent: $disabledLlvm"
}
$env:DRJIT_LIBLLVM_PATH = $disabledLlvm
}
python -I "$env:GITHUB_WORKSPACE/tests/packaging/wheel_lifecycle_smoke.py" installed $backend
$nativeExit=$LASTEXITCODE
if ($backend -eq "drjit") {
Remove-Item Env:DRJIT_LIBLLVM_PATH
}
if ($nativeExit -ne 0) { exit $nativeExit }
python -m pip uninstall -y "rayd-$backend"
$nativeExit=$LASTEXITCODE; if ($nativeExit -ne 0) { exit $nativeExit }
python -I "$env:GITHUB_WORKSPACE/tests/packaging/wheel_lifecycle_smoke.py" absent $backend
$nativeExit=$LASTEXITCODE; if ($nativeExit -ne 0) { exit $nativeExit }
- uses: actions/upload-artifact@v4
with:
name: release-rayd-${{ matrix.backend }}-windows-py${{ matrix.python-version }}
path: dist/${{ matrix.backend }}/*.whl
if-no-files-found: error
test-torch-full-wheel-compatibility:
name: Full wheel / ${{ matrix.os }} / py${{ matrix.python-version }} / torch2.10
needs: [build-torch-linux, build-windows-wheels]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- {os: "ubuntu-22.04", python-version: "3.10", artifact: "release-rayd-torch-linux-py3.10"}
- {os: "ubuntu-22.04", python-version: "3.11", artifact: "release-rayd-torch-linux-py3.11"}
- {os: "ubuntu-22.04", python-version: "3.12", artifact: "release-rayd-torch-linux-py3.12"}
- {os: "ubuntu-22.04", python-version: "3.13", artifact: "release-rayd-torch-linux-py3.13"}
- {os: "ubuntu-22.04", python-version: "3.14", artifact: "release-rayd-torch-linux-py3.14"}
- {os: "windows-2022", python-version: "3.10", artifact: "release-rayd-torch-windows-py3.10"}
- {os: "windows-2022", python-version: "3.11", artifact: "release-rayd-torch-windows-py3.11"}
- {os: "windows-2022", python-version: "3.12", artifact: "release-rayd-torch-windows-py3.12"}
- {os: "windows-2022", python-version: "3.13", artifact: "release-rayd-torch-windows-py3.13"}
- {os: "windows-2022", python-version: "3.14", artifact: "release-rayd-torch-windows-py3.14"}
steps:
- uses: actions/checkout@v5
- uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- uses: actions/download-artifact@v4
with:
name: ${{ matrix.artifact }}
path: ${{ runner.temp }}/wheel-artifact
- name: Validate full wheel with Torch 2.10
shell: pwsh
working-directory: ${{ runner.temp }}
run: |
python -m pip install --upgrade pip
$nativeExit=$LASTEXITCODE; if ($nativeExit -ne 0) { exit $nativeExit }
python -m pip install --no-cache-dir torch==2.10.0 `
--index-url https://download.pytorch.org/whl/cu128
$nativeExit=$LASTEXITCODE; if ($nativeExit -ne 0) { exit $nativeExit }
$artifactDir = Join-Path $env:RUNNER_TEMP "wheel-artifact"
$wheels = @(Get-ChildItem -LiteralPath $artifactDir -Filter "*.whl")
if ($wheels.Count -ne 1) {
throw "Expected exactly one RayD Torch wheel in $artifactDir; found $($wheels.Count)."
}
$wheel = $wheels[0].FullName
python -m pip install --no-deps --force-reinstall $wheel
$nativeExit=$LASTEXITCODE; if ($nativeExit -ne 0) { exit $nativeExit }
python -m pip check
$nativeExit=$LASTEXITCODE; if ($nativeExit -ne 0) { exit $nativeExit }
python -I "$env:GITHUB_WORKSPACE/tests/packaging/wheel_lifecycle_smoke.py" installed torch
$nativeExit=$LASTEXITCODE; if ($nativeExit -ne 0) { exit $nativeExit }
python -m pip uninstall -y rayd-torch
$nativeExit=$LASTEXITCODE; if ($nativeExit -ne 0) { exit $nativeExit }
python -I "$env:GITHUB_WORKSPACE/tests/packaging/wheel_lifecycle_smoke.py" absent torch
$nativeExit=$LASTEXITCODE; if ($nativeExit -ne 0) { exit $nativeExit }
test-stable-torch-abi:
name: Stable ABI / ${{ matrix.os }} / py${{ matrix.compatibility.python-version }} / torch${{ matrix.compatibility.torch-version }}
needs: [build-torch-linux, build-windows-wheels]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, windows-2022]
compatibility:
- {python-version: "3.10", torch-version: "2.10.0", cuda-index: "cu128"}
- {python-version: "3.11", torch-version: "2.10.0", cuda-index: "cu128"}
- {python-version: "3.12", torch-version: "2.10.0", cuda-index: "cu128"}
- {python-version: "3.13", torch-version: "2.10.0", cuda-index: "cu128"}
- {python-version: "3.14", torch-version: "2.10.0", cuda-index: "cu128"}
- {python-version: "3.14", torch-version: "2.11.0", cuda-index: "cu128"}
- {python-version: "3.14", torch-version: "2.12.0", cuda-index: "cu126"}
- {python-version: "3.14", torch-version: "2.13.0", cuda-index: "cu126"}
steps:
- name: Set up compatibility Python
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.compatibility.python-version }}
- name: Download Linux Torch wheels
if: runner.os == 'Linux'
uses: actions/download-artifact@v4
with:
name: release-rayd-torch-linux-py3.10
path: wheel-artifact
- name: Download Windows Torch wheel
if: runner.os == 'Windows'
uses: actions/download-artifact@v4
with:
name: release-rayd-torch-windows-py3.10
path: wheel-artifact
- name: Install compatibility Torch
shell: bash
run: |
python -m pip install --upgrade pip
python -m pip install --no-cache-dir "torch==${{ matrix.compatibility.torch-version }}" \
--index-url "https://download.pytorch.org/whl/${{ matrix.compatibility.cuda-index }}"
- name: Load the same Stable ABI library
shell: bash
env:
EXPECTED_TORCH: ${{ matrix.compatibility.torch-version }}
run: |
python - <<'PY'
import os
import zipfile
from pathlib import Path
import torch
assert torch.__version__.split("+", 1)[0] == os.environ["EXPECTED_TORCH"]
wheels = sorted(Path("wheel-artifact").glob("*.whl"))
assert wheels, "RayD Torch wheel artifact is missing"
with zipfile.ZipFile(wheels[0]) as archive:
members = [
name
for name in archive.namelist()
if Path(name).name.startswith("_stable_ops")
and Path(name).suffix in {".dll", ".so"}
]
assert len(members) == 1, members
archive.extract(members[0], "stable-library")
library = Path("stable-library") / members[0]
torch.ops.load_library(str(library.resolve()))
assert torch.ops.rayd_torch_stable.camera_sample_to_world is not None
assert torch.ops.rayd_torch_stable.intersection_valid is not None
print(f"Loaded {library.name} with torch {torch.__version__}")
PY
build-meta:
name: rayd meta wheel and sdist
runs-on: ubuntu-22.04
needs: metadata
steps:
- uses: actions/checkout@v5
- uses: actions/setup-python@v6
with:
python-version: "3.12"
- run: python -m pip install --upgrade pip build twine "setuptools>=77"
- run: python -m build --wheel --sdist --no-isolation --outdir dist/meta
- run: python -m twine check dist/meta/*
- uses: actions/upload-artifact@v4
with:
name: release-rayd-meta
path: dist/meta/*
if-no-files-found: error
validate-wheel-set:
name: Validate complete release artifact set
runs-on: ubuntu-22.04
needs:
- build-drjit-linux
- build-torch-linux
- build-windows-wheels
- test-torch-full-wheel-compatibility
- test-stable-torch-abi
- build-meta
steps:
- uses: actions/checkout@v5
- uses: actions/setup-python@v6
with:
python-version: "3.12"
- uses: actions/download-artifact@v4
with:
path: dist
pattern: release-rayd-*
merge-multiple: true
- run: python -m pip install --upgrade pip twine
- name: Install representative wheel runtime dependencies
run: |
python -m pip install --constraint .github/constraints/drjit-build.txt "drjit==1.3.1"
python -m pip install --constraint .github/constraints/torch-build.txt torch --no-cache-dir \
--index-url https://download.pytorch.org/whl/cu128
- name: Validate wheel tags and artifact counts
env:
RAYD_RELEASE_DIST_DIR: ${{ github.workspace }}/dist
run: python -m unittest tests.packaging.test_release_artifact_matrix -v
- name: Validate representative wheel layout
shell: bash
run: |
set -euo pipefail
mapfile -t meta_wheels < <(find dist -maxdepth 1 -name 'rayd-*-none-any.whl' -print)
mapfile -t drjit_wheels < <(find dist -maxdepth 1 -name 'rayd_drjit-*-cp312-cp312-*manylinux_2_28_x86_64.whl' -print)
mapfile -t torch_wheels < <(find dist -maxdepth 1 -name 'rayd_torch-*-cp312-cp312-*manylinux_2_28_x86_64.whl' -print)
if [[ ${#meta_wheels[@]} -ne 1 || ${#drjit_wheels[@]} -ne 1 || ${#torch_wheels[@]} -ne 1 ]]; then
printf 'Expected exactly one representative wheel per distribution; meta=%s drjit=%s torch=%s\n' \
"${#meta_wheels[@]}" "${#drjit_wheels[@]}" "${#torch_wheels[@]}" >&2
exit 1
fi
meta_wheel="${meta_wheels[0]}"
drjit_wheel="${drjit_wheels[0]}"
torch_wheel="${torch_wheels[0]}"
if [[ -z "$meta_wheel" || -z "$drjit_wheel" || -z "$torch_wheel" ]]; then
echo "Representative wheel selection produced an empty path." >&2
exit 1
fi
{
echo "RAYD_META_WHEEL=$meta_wheel"
echo "RAYD_DRJIT_WHEEL=$drjit_wheel"
echo "RAYD_TORCH_WHEEL=$torch_wheel"
} >> "$GITHUB_ENV"
- run: >-
python -m unittest
tests.packaging.test_wheel_layout
tests.packaging.test_wheel_install_matrix
-v
- run: python -m twine check dist/*
publish-drjit:
name: Publish rayd-drjit to PyPI
if: github.event_name == 'release' && github.event.action == 'published'
needs: validate-wheel-set
runs-on: ubuntu-latest
environment:
name: pypi-rayd-drjit
url: https://pypi.org/p/rayd-drjit
permissions:
contents: read
id-token: write
steps:
- uses: actions/download-artifact@v4
with:
path: dist
pattern: release-rayd-drjit-*
merge-multiple: true
- uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist
verbose: true
publish-torch:
name: Publish rayd-torch to PyPI
if: github.event_name == 'release' && github.event.action == 'published'
needs: validate-wheel-set
runs-on: ubuntu-latest
environment:
name: pypi-rayd-torch
url: https://pypi.org/p/rayd-torch
permissions:
contents: read
id-token: write
steps:
- uses: actions/download-artifact@v4
with:
path: dist
pattern: release-rayd-torch-*
merge-multiple: true
- uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist
verbose: true
publish-rayd:
name: Publish rayd meta distribution to PyPI
if: github.event_name == 'release' && github.event.action == 'published'
needs: [build-meta, publish-drjit, publish-torch]
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/rayd
permissions:
contents: read
id-token: write
steps:
- uses: actions/download-artifact@v4
with:
name: release-rayd-meta
path: dist
- uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist
verbose: true