{"id":30714068,"url":"https://github.com/halide/llvm-wheel","last_synced_at":"2026-02-12T12:10:15.068Z","repository":{"id":308727158,"uuid":"1033777989","full_name":"halide/llvm-wheel","owner":"halide","description":"Binary wheels for libLLVM","archived":false,"fork":false,"pushed_at":"2025-08-07T13:27:46.000Z","size":5,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-07T15:25:48.372Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"CMake","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/halide.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-08-07T10:28:34.000Z","updated_at":"2025-08-07T13:27:50.000Z","dependencies_parsed_at":"2025-08-07T15:27:00.744Z","dependency_job_id":"d32d1a4d-9678-449a-aab9-a81c519138e5","html_url":"https://github.com/halide/llvm-wheel","commit_stats":null,"previous_names":["halide/llvm-wheel"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/halide/llvm-wheel","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/halide%2Fllvm-wheel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/halide%2Fllvm-wheel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/halide%2Fllvm-wheel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/halide%2Fllvm-wheel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/halide","download_url":"https://codeload.github.com/halide/llvm-wheel/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/halide%2Fllvm-wheel/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273392282,"owners_count":25097257,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-03T02:00:09.631Z","response_time":76,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-09-03T04:41:54.693Z","updated_at":"2026-02-12T12:10:15.062Z","avatar_url":"https://github.com/halide.png","language":"CMake","funding_links":[],"categories":[],"sub_categories":[],"readme":"# halide-llvm\n\nPre-built LLVM wheels for [Halide](https://github.com/halide/Halide), hosted on\n[pypi.halide-lang.org](https://pypi.halide-lang.org/). Builds against any\narbitrary LLVM git reference (tag, branch, or commit SHA) and produces\nmanylinux, macOS, and Windows wheels.\n\n## Installation\n\n```bash\npip install halide-llvm==21.1.8 \\\n  --extra-index-url https://pypi.halide-lang.org/simple/\n```\n\n### Available platforms\n\n| Platform       | Wheel tag                |\n|----------------|--------------------------|\n| Linux x86-64   | `manylinux_2_28_x86_64`  |\n| Linux x86-32   | `manylinux_2_28_i686`    |\n| Linux AArch64  | `manylinux_2_28_aarch64` |\n| Linux ARMv7    | `manylinux_2_31_armv7l`  |\n| macOS x86-64   | `macosx_11_0_x86_64`     |\n| macOS ARM64    | `macosx_11_0_arm64`      |\n| Windows x86-64 | `win_amd64`              |\n| Windows x86-32 | `win32`                  |\n\n### Usage with CMake\n\nAfter installing, use the CLI to get the paths CMake needs:\n\n```bash\n# LLVM installation prefix (contains bin/, lib/, include/)\nhalide-llvm --prefix\n\n# Directly usable with CMake\ncmake -DHalide_LLVM_ROOT=$(halide-llvm --prefix) ...\n```\n\nAll CLI options:\n\n```\nhalide-llvm --prefix       # Installation root\nhalide-llvm --bindir       # bin/ directory (clang, lld, etc.)\nhalide-llvm --includedir   # include/ directory\nhalide-llvm --libdir       # lib/ directory\nhalide-llvm --cmakedir     # CMake modules (lib/cmake/llvm/)\n```\n\n### Usage from Python\n\n```python\nfrom halide_llvm import get_root_dir, get_cmake_dir, get_bin_dir\n\nllvm_prefix = get_root_dir()\ncmake_dir = get_cmake_dir()\nclang = get_bin_dir() / \"clang\"\n```\n\n## Why This Architecture?\n\nLLVM is a massive monorepo (gigabytes of history). Standard packaging approaches\nfail here:\n\n- **Git submodules are too heavy:** Cloning full history for every CI run is\n  agonizingly slow.\n- **Hardcoded versions are too rigid:** We often need to build against specific\n  commits to test upstream fixes or experimental features.\n- **PEP 517 build isolation:** Python build frontends isolate the build\n  environment, making it difficult to inject source code from the outside.\n\n**The Solution:** We use `scikit-build-core` with a custom **Dynamic Version\nProvider** that reads `HALIDE_LLVM_REF` from the environment. This single\nvariable controls both the version string and the source code to fetch.\n\n## How It Works\n\n1. **User sets `HALIDE_LLVM_REF`** (e.g., `llvmorg-21.1.8` or `main`)\n2. **Version provider runs** (`_version_provider.py`):\n\n- Downloads the LLVM tarball from GitHub into `src_cache/\u003cref\u003e/`\n- Computes a PEP 440 version string\n\n3. **CMake configures** (`CMakeLists.txt`):\n\n- Reads `HALIDE_LLVM_REF` from the environment\n- Finds the cached source at `src_cache/\u003cref\u003e/`\n- Applies settings from `toolchains/initial-cache.cmake`\n- Builds LLVM via `add_subdirectory()`\n\n### Version Strings\n\n| Ref                  | Version                 |\n|----------------------|-------------------------|\n| `llvmorg-21.1.8`     | `21.1.8`                |\n| `llvmorg-22.1.0-rc2` | `22.1.0rc2`             |\n| `main`               | `22.0.0.dev0+gabcd1234` |\n| `\u003ccommit-sha\u003e`       | `22.0.0.dev0+gabcd1234` |\n\nRelease tags produce clean versions. RC tags produce PEP 440 pre-release\nversions. Everything else produces dev versions with a short SHA for\ntraceability.\n\n## Build Instructions\n\n**Prerequisites:**\n\n- C++ compiler (Clang, GCC, or MSVC)\n- CMake 3.21+\n- Ninja\n- Python 3.12+\n\n### Release Build\n\n```bash\nexport HALIDE_LLVM_REF=\"llvmorg-21.1.8\"\npip wheel . --no-build-isolation\n```\n\n### Development Build (main branch)\n\n```bash\nexport HALIDE_LLVM_REF=\"main\"\npip wheel . --no-build-isolation\n```\n\n### Incremental Rebuilds\n\nLLVM caches the Python interpreter path. When using build isolation (the\ndefault), the ephemeral venv path changes between runs, breaking incremental\nbuilds. For local development, always use `--no-build-isolation`:\n\n```bash\n# pip\npip wheel . --no-build-isolation\n\n# uv\nUV_NO_BUILD_ISOLATION=1 uv build --wheel\n```\n\nFor CI, where you want fresh builds anyway, build isolation is fine.\n\n### With a Specific Toolchain\n\n```bash\nexport HALIDE_LLVM_REF=\"llvmorg-21.1.8\"\npip wheel . --config-settings=cmake.define.CMAKE_TOOLCHAIN_FILE=toolchains/x86-64-linux.cmake\n```\n\n## Toolchains\n\nPre-configured toolchain files are provided in `toolchains/`:\n\n| File                   | Platform                                           |\n|------------------------|----------------------------------------------------|\n| `x86-64-linux.cmake`   | Linux x86-64 (native)                              |\n| `x86-32-linux.cmake`   | Linux x86-32 (cross-compile)                       |\n| `arm-32-linux.cmake`   | Linux arm-32 (cross-compile)                       |\n| `arm-64-linux.cmake`   | Linux arm-64 (native)                              |\n| `x86-64-macos.cmake`   | macOS x86-64 (native)                              |\n| `arm-64-macos.cmake`   | macOS arm-64 (native, Apple Silicon)               |\n| `x86-64-windows.cmake` | Windows x86-64 (native, requires vcvarsall)        |\n| `x86-32-windows.cmake` | Windows x86-32 (cross-compile, requires vcvarsall) |\n\nAll toolchains include `initial-cache.cmake` which configures:\n\n- Projects: clang, lld, clang-tools-extra\n- Runtimes: compiler-rt, libcxx, libcxxabi, libunwind\n- Targets: AArch64, ARM, Hexagon, NVPTX, PowerPC, RISCV, WebAssembly, X86\n- Assertions, RTTI, and exception handling enabled\n- Unnecessary tools and features disabled for faster builds\n\n## Environment Variables\n\n| Variable          | Required | Description                            |\n|-------------------|----------|----------------------------------------|\n| `HALIDE_LLVM_REF` | Yes      | Git ref to build (tag, branch, or SHA) |\n| `GITHUB_TOKEN`    | No       | Avoids GitHub API rate limiting in CI  |\n\n## CI Workflow\n\nThe `build-wheels.yml` workflow builds and uploads wheels for all platforms:\n\n```bash\ngh workflow run build-wheels.yml -f llvm_ref=llvmorg-21.1.8\n```\n\nIt will skip the build if wheels for that ref already exist on\npypi.halide-lang.org. Wheels are uploaded automatically after all platform\nbuilds succeed.\n\n## Caching\n\nDownloaded sources are cached in `src_cache/`. To force a re-download, delete\nthe corresponding directory:\n\n```bash\nrm -rf src_cache/llvmorg-21.1.8\n```\n\n## Known Issues\n\n- **scikit-build-core x86 cross-compile tag bug:** On Windows, cross-compiling\n  for x86 from an x64 host produces a wheel incorrectly tagged `win_amd64`. The\n  CI workflow works around this by retagging the wheel after building. See\n  `get_archs()` in scikit-build-core's `builder/builder.py`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhalide%2Fllvm-wheel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhalide%2Fllvm-wheel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhalide%2Fllvm-wheel/lists"}