Release witwin 0.3.0 with Stable ABI CUDA wheels#2
Closed
Asixa wants to merge 6 commits into
Closed
Conversation
Replace smplpytorch's per-call forward with a batched LBS (~10x faster, ~2ms vs ~21ms) that is numerically equivalent, plus a Rodrigues that offsets the axis-angle vector rather than its norm so the gradient at exactly-zero pose stays finite. Cache SMPL faces per (gender, root, device). Enables stable pose optimization starting from T-pose.
Comment on lines
86
to
+248
| @@ -99,7 +98,7 @@ jobs: | |||
| - name: Set up Python | |||
| uses: actions/setup-python@v5 | |||
| with: | |||
| python-version: ${{ matrix.python_version }} | |||
| python-version: "3.10" | |||
|
|
|||
| - name: Free disk space (Linux) | |||
| if: runner.os == 'Linux' | |||
| @@ -113,11 +112,11 @@ jobs: | |||
| echo "Disk after cleanup:"; df -h / | |||
|
|
|||
| - name: Install CUDA Toolkit | |||
| uses: Jimver/cuda-toolkit@v0.2.29 | |||
| uses: Jimver/cuda-toolkit@v0.2.35 | |||
| with: | |||
| cuda: "12.5.0" | |||
| cuda: "12.8.1" | |||
| method: local | |||
| log-file-suffix: "${{ runner.os }}-py${{ matrix.python_version }}" | |||
| log-file-suffix: "${{ runner.os }}-stable-abi" | |||
|
|
|||
| - name: Set up MSVC | |||
| if: runner.os == 'Windows' | |||
| @@ -149,41 +148,54 @@ jobs: | |||
| - name: Install CUDA extension build dependencies | |||
| run: | | |||
| python -m pip install --upgrade pip setuptools wheel ninja numpy | |||
| python -m pip install torch==2.6.0 --index-url https://download.pytorch.org/whl/cu124 | |||
| python -m pip install torch==2.10.0 --index-url https://download.pytorch.org/whl/cu128 | |||
| python -m pip install build | |||
|
|
|||
| - name: Build packaged mesh SDF CUDA extension | |||
| - name: Build packaged stable mesh SDF CUDA extension | |||
| shell: bash | |||
| env: | |||
| MAX_JOBS: "2" | |||
| TORCH_CUDA_ARCH_LIST: "7.0;8.0;8.6;8.9;9.0+PTX" | |||
| WITWIN_CORE_MESH_SDF_CUDA_BUILD_DIR: ${{ runner.temp }}/witwin_core_mesh_sdf_cuda | |||
| WITWIN_CUDA_GENCODE_ARCHES: "7.0;7.5;8.0;8.6;8.9;9.0;10.0;10.1;12.0+PTX" | |||
| PACKAGE_DIR: ${{ needs.validate_release.outputs.package_dir }} | |||
| WITWIN_CORE_MESH_SDF_CUDA_BUILD_DIR: ${{ runner.temp }}/witwin_core_mesh_sdf_cuda/stable_abi_v1 | |||
| run: | | |||
| python "$PACKAGE_DIR"/scripts/build_mesh_sdf_cuda_prebuilt.py --verbose | |||
|
|
|||
| - name: Verify compiled CUDA architectures | |||
| shell: bash | |||
| env: | |||
| PACKAGE_DIR: ${{ needs.validate_release.outputs.package_dir }} | |||
| run: | | |||
| python "$PACKAGE_DIR"/scripts/verify_cuda_binary_arches.py \ | |||
| --stem witwin_core_mesh_sdf_cuda \ | |||
| "$PACKAGE_DIR"/witwin/core/geometry/cuda/prebuilt | |||
|
|
|||
| - name: Build platform wheel | |||
| shell: bash | |||
| env: | |||
| PACKAGE_DIR: ${{ needs.validate_release.outputs.package_dir }} | |||
| run: | | |||
| python -m build --wheel "$PACKAGE_DIR" | |||
|
|
|||
| - name: Normalize Linux wheel platform tag | |||
| - name: Repair Linux wheel platform tag | |||
| if: runner.os == 'Linux' | |||
| shell: bash | |||
| env: | |||
| PACKAGE_DIR: ${{ needs.validate_release.outputs.package_dir }} | |||
| run: | | |||
| # PyPI rejects the raw linux_x86_64 tag; the extension is built on the | |||
| # ubuntu-22.04 runner (glibc 2.35), so retag to the matching manylinux | |||
| # tag. torch/CUDA runtime libraries are runtime dependencies and stay | |||
| # unbundled, so no auditwheel repair is required. | |||
| shopt -s nullglob | |||
| python -m pip install auditwheel patchelf | |||
| mkdir -p "$PACKAGE_DIR"/wheelhouse | |||
| for whl in "$PACKAGE_DIR"/dist/*-linux_x86_64.whl; do | |||
| echo "Retagging $whl" | |||
| python -m wheel tags --platform-tag manylinux_2_35_x86_64 --remove "$whl" | |||
| python -m auditwheel repair "$whl" \ | |||
| --plat manylinux_2_35_x86_64 \ | |||
| --wheel-dir "$PACKAGE_DIR"/wheelhouse \ | |||
| --exclude libc10.so --exclude libc10_cuda.so \ | |||
| --exclude libtorch.so --exclude libtorch_cpu.so \ | |||
| --exclude libtorch_cuda.so --exclude libtorch_python.so \ | |||
| --exclude libcudart.so.12 --exclude libcuda.so.1 | |||
| done | |||
| rm -f "$PACKAGE_DIR"/dist/*-linux_x86_64.whl | |||
| mv "$PACKAGE_DIR"/wheelhouse/*.whl "$PACKAGE_DIR"/dist/ | |||
| ls -l "$PACKAGE_DIR"/dist | |||
|
|
|||
| - name: Smoke install prebuilt wheel | |||
| @@ -197,9 +209,18 @@ jobs: | |||
| python -m pip install --no-deps "$PACKAGE_DIR"/dist/*.whl | |||
| python - <<'PY' | |||
| import importlib.util | |||
| import os | |||
| import site | |||
| import zipfile | |||
| from pathlib import Path | |||
|
|
|||
| wheel = next((Path(os.environ["PACKAGE_DIR"]) / "dist").glob("*.whl")) | |||
| names = zipfile.ZipFile(wheel).namelist() | |||
| native = [name for name in names if "witwin_core_mesh_sdf_cuda" in name and name.endswith((".so", ".pyd"))] | |||
| assert len(native) == 1, native | |||
| assert "/prebuilt/" in f"/{native[0]}" | |||
| assert "torch_" not in native[0] | |||
|
|
|||
| candidates = [] | |||
| for root in site.getsitepackages() + [site.getusersitepackages()]: | |||
| candidates.append(Path(root) / "witwin" / "core" / "geometry" / "cuda" / "build.py") | |||
| @@ -212,17 +233,91 @@ jobs: | |||
|
|
|||
| path = module.prebuilt_extension_path() | |||
| assert path.exists(), f"missing packaged prebuilt extension: {path}" | |||
| assert path.parent.name == "prebuilt" | |||
| extension = module.build_extension() | |||
| print(f"Loaded packaged mesh SDF CUDA extension from {extension.__file__}") | |||
| PY | |||
|
|
|||
| - name: Upload wheel artifact | |||
| uses: actions/upload-artifact@v4 | |||
| with: | |||
| name: wheel-${{ matrix.os }}-py${{ matrix.python_version }} | |||
| name: wheel-${{ matrix.os }} | |||
| path: ${{ needs.validate_release.outputs.package_dir }}/dist/*.whl | |||
| if-no-files-found: error | |||
|
|
|||
| test_torch_compatibility: | |||
| name: Stable ABI / ${{ matrix.os }} / py${{ matrix.compatibility.python_version }} / torch${{ matrix.compatibility.torch_version }} | |||
| needs: | |||
| - validate_release | |||
| - build_cuda_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"} | |||
|
|
|||
| steps: | |||
| - name: Set up Python | |||
| uses: actions/setup-python@v5 | |||
| with: | |||
| python-version: ${{ matrix.compatibility.python_version }} | |||
|
|
|||
| - name: Download stable wheel | |||
| uses: actions/download-artifact@v4 | |||
| with: | |||
| name: wheel-${{ matrix.os }} | |||
| path: dist | |||
|
|
|||
| - name: Install compatibility environment | |||
| 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 }}" | |||
| python -m pip install --no-deps dist/*.whl | |||
|
|
|||
| - name: Load the same stable binary | |||
| shell: bash | |||
| env: | |||
| EXPECTED_TORCH: ${{ matrix.compatibility.torch_version }} | |||
Member
Author
|
Closing in favor of the requested direct main-branch release workflow. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Validation
Publishing is triggered by the witwin-v0.3.0 GitHub Release after merge.
Need help on this PR? Tag
/codesmithwith what you need. Autofix is disabled.