Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 0 additions & 44 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ jobs:
platform: macos
cuda-sub-packages: ''
cuda-non-cuda-packages: ''
outputs:
artifact-url: ${{ steps.native-headers.outputs.artifact-url }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand Down Expand Up @@ -102,14 +100,6 @@ jobs:
name: build-artifact-${{ matrix.platform }}
path: warp/bin/

- name: Upload native headers
uses: actions/upload-artifact@v4
id: native-headers
with:
name: native-headers-${{ matrix.platform }}
path: |
warp/native/exports.h
warp/native/version.h

test-warp:
runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -260,40 +250,6 @@ jobs:
run: >
git diff --exit-code docs/api_reference docs/language_reference ||
(echo "Please run build_docs.py (or download from $ARTIFACT_URL) and add docs/api_reference and docs/language_reference to your pull request." && false)
- name: Check stubs
env:
ARTIFACT_URL: ${{ needs.build-docs.outputs.artifact-url }}
run: >
git diff --exit-code warp/__init__.pyi ||
(echo "Please run build_docs.py (or download from $ARTIFACT_URL) and add warp/__init__.pyi to your pull request." && false)

check-generated-files:
runs-on: ubuntu-latest
needs: build-warp
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@d4b2f3b6ecc6e67c4457f6d3e41ec42d3d0fcb86
with:
version: "0.8.23"
- name: Set up Python
run: uv python install
- name: Download native headers
uses: actions/download-artifact@v4
with:
name: native-headers-ubuntu-x86_64
path: warp/native/
- name: Check version consistency
run: uv run --no-project tools/ci/publishing/check_version_consistency.py --verbose
- name: Check exports.h is committed
run: >
git diff --exit-code warp/native/exports.h ||
(echo "Please run build_lib.py and add warp/native/exports.h to your pull request." && false)
- name: Check version.h is committed
run: >
git diff --exit-code warp/native/version.h ||
(echo "Please run build_lib.py and add warp/native/version.h to your pull request." && false)

check-unnamespaced-symbols:
runs-on: ubuntu-latest
Expand Down
22 changes: 4 additions & 18 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -958,13 +958,12 @@ merge request docs:
after_script:
- echo "View the website at https://$CI_PROJECT_ROOT_NAMESPACE.$CI_PAGES_DOMAIN/-/$CI_PROJECT_NAME/-/jobs/$CI_JOB_ID/artifacts/public/index.html"

# Merge requests: Ensure that exports.h, __init__.pyi, and docs reference files have been
# Merge requests: Ensure that docs reference files generated by Sphinx have been
# manually added to the MR if they are changed
check generated files:
check generated docs:
stage: deploy
image: $UV_TRIXIE_IMAGE
needs:
- job: linux-x86_64 build
- job: merge request docs
optional: true
extends:
Expand All @@ -976,25 +975,12 @@ check generated files:
when: on_failure
expose_as: "Generated source files"
paths:
- warp/native/exports.h
- warp/native/version.h
- warp/__init__.pyi
- docs/api_reference
- docs/language_reference
script:
# Check version consistency across VERSION.md, config.py, and version.h
- uv run tools/ci/publishing/check_version_consistency.py --verbose
# Check that generated documentation files are committed
- >
git diff --exit-code warp/__init__.pyi docs/api_reference docs/language_reference ||
(echo "Please run build_docs.py (or download from $CI_JOB_URL/artifacts/browse) and add modified files to your merge request." && false)
# Check that generated native files are committed
- >
git diff --exit-code warp/native/exports.h ||
(echo "Please run build_lib.py (or download from $CI_JOB_URL/artifacts/browse) and add warp/native/exports.h to your merge request." && false)
- >
git diff --exit-code warp/native/version.h ||
(echo "Please run build_lib.py (or download from $CI_JOB_URL/artifacts/browse) and add warp/native/version.h to your merge request." && false)
git diff --exit-code docs/api_reference docs/language_reference ||
(echo "Please run build_docs.py (or download from $CI_JOB_URL/artifacts/browse) and add docs/api_reference and docs/language_reference to your merge request." && false)

# Build documentation and publish on GitLab
# This only runs in the default branch pipeline. The "pages" name is special for GitLab.
Expand Down
16 changes: 16 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,22 @@ ci:
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: local
hooks:
- id: warp-check-generated-files
name: "warp: regenerate generated files"
entry: python tools/pre-commit-hooks/check_generated_files.py
language: python
# NOTE: ruff version must match ruff-pre-commit rev below to avoid formatting drift.
additional_dependencies: [numpy, ruff==0.14.10]
always_run: true
pass_filenames: false
- id: warp-check-version-consistency
name: "warp: check version consistency and regenerate version.h"
entry: python tools/pre-commit-hooks/check_version_consistency.py --verbose
language: python
always_run: true
pass_filenames: false
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.14.10
Expand Down
75 changes: 1 addition & 74 deletions build_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
import build_llvm
import warp._src.build_dll as build_dll
import warp.config as config
from warp._src.context import export_builtins
from warp._src.generated_files import generate_exports_header_file, generate_version_header


def handle_ci_nightly_build(base_path: str) -> str | None:
Expand Down Expand Up @@ -92,40 +92,6 @@ def handle_ci_nightly_build(base_path: str) -> str | None:
return dev_version_string


def generate_version_header(base_path: str, version: str) -> None:
"""Generate version.h with WP_VERSION_STRING macro."""
version_header_path = os.path.join(base_path, "warp", "native", "version.h")
current_year = datetime.date.today().year

copyright_notice = f"""/*
* SPDX-FileCopyrightText: Copyright (c) {current_year} NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

"""

with open(version_header_path, "w") as f:
f.write(copyright_notice)
f.write("#ifndef WP_VERSION_H\n")
f.write("#define WP_VERSION_H\n\n")
f.write(f'#define WP_VERSION_STRING "{version}"\n\n')
f.write("#endif // WP_VERSION_H\n")

print(f"Generated {version_header_path} with version {version}")


def find_cuda_sdk() -> str | None:
# check environment variables
for env in ["WARP_CUDA_PATH", "CUDA_HOME", "CUDA_PATH"]:
Expand Down Expand Up @@ -249,45 +215,6 @@ def lib_name(name: str) -> str:
return f"{name}.so"


def generate_exports_header_file(base_path: str) -> None:
"""Generates warp/native/exports.h, which lets built-in functions be callable from outside kernels."""
export_path = os.path.join(base_path, "warp", "native", "exports.h")
os.makedirs(os.path.dirname(export_path), exist_ok=True)

try:
with open(export_path, "w") as f:
copyright_notice = """/*
* SPDX-FileCopyrightText: Copyright (c) 2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

"""
f.write(copyright_notice)
export_builtins(f)

print(f"Finished writing {export_path}")
except FileNotFoundError:
print(f"Error: The file '{export_path}' was not found.")
except PermissionError:
print(f"Error: Permission denied. Unable to write to '{export_path}'.")
except OSError as e:
print(f"Error: An OS-related error occurred: {e}")
except Exception as e:
print(f"An unexpected error occurred: {e}")


def main(argv: list[str] | None = None) -> int:
parser = argparse.ArgumentParser(
description="Build Warp native libraries with optional CUDA, LLVM, and MathDx support",
Expand Down
142 changes: 0 additions & 142 deletions tools/ci/publishing/check_version_consistency.py

This file was deleted.

Loading