Skip to content

Conversation

yzh119
Copy link
Collaborator

@yzh119 yzh119 commented Oct 5, 2025

πŸ“Œ Description

πŸ” Related Issues

πŸš€ Pull Request Checklist

Thank you for contributing to FlashInfer! Before we review your pull request, please make sure the following items are complete.

βœ… Pre-commit Checks

  • I have installed pre-commit by running pip install pre-commit (or used your preferred method).
  • I have installed the hooks with pre-commit install.
  • I have run the hooks manually with pre-commit run --all-files and fixed any reported issues.

If you are unsure about how to set up pre-commit, see the pre-commit documentation.

πŸ§ͺ Tests

  • Tests have been added or updated as needed.
  • All tests are passing (unittest, etc.).

Reviewer Notes

@yzh119 yzh119 changed the title [wip] ci/cd: add nightly build and CI for flashinfer-python,flashinfer-jit-cache,`flashinfer-cubin [wip] ci/cd: add nightly build and CI for flashinfer-python,flashinfer-jit-cache,flashinfer-cubin Oct 5, 2025
Copy link
Contributor

Summary of Changes

Hello @yzh119, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly upgrades the CI/CD pipeline for FlashInfer's Python packages, focusing on establishing a more robust and traceable build process for nightly and continuous integration. Key changes include embedding git commit information into package metadata, enabling flexible versioning for development releases, and overhauling the wheel index generation to support a multi-package, CUDA-aware structure. These enhancements aim to streamline the release process and improve the reliability of package distribution.

Highlights

  • Enhanced Versioning and Traceability: Packages now embed the git commit hash (__git_version__) directly into their metadata, improving traceability for builds and aiding in debugging specific versions.
  • Flexible Development Release Suffixes: A new environment variable, FLASHINFER_DEV_RELEASE_SUFFIX, has been introduced to allow custom suffixes for development versions, which is particularly useful for managing nightly or pre-release builds.
  • Refactored Wheel Indexing Script: The update_whl_index.py script has been completely rewritten to be more robust and versatile. It now supports multiple FlashInfer packages (flashinfer-python, flashinfer-cubin, flashinfer-jit-cache) and organizes flashinfer-jit-cache wheels by CUDA version, generating PEP 503 compliant index pages.
  • Improved Build Script Logging and Verification: Build scripts now include logging for the development release suffix and the git commit. A post-build verification step has also been added to ensure that the installed package correctly reports its version and git version.
Ignored Files
  • Ignored by pattern: .github/workflows/** (1)
    • .github/workflows/nightly-release.yml
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with πŸ‘ and πŸ‘Ž on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces changes to support nightly builds and enhance CI/CD processes by embedding git commit information into the packages. The changes are spread across several package build scripts and a new script to update the wheel index. My review focuses on improving the maintainability and correctness of this new build logic. I've identified an opportunity to reduce code duplication in the git version retrieval logic and a bug in the version parsing regex within the new update_whl_index.py script. Addressing these points will make the new CI/CD tooling more robust and easier to maintain.

Comment on lines +29 to +64
def get_package_info(wheel_path: pathlib.Path) -> Optional[dict]:
"""Extract package information from wheel filename."""
wheel_name = wheel_path.name

# Try flashinfer-python pattern
match = re.match(r"flashinfer_python-([0-9.]+(?:\.dev\d+)?)-", wheel_name)
if match:
version = match.group(1)
return {
"package": "flashinfer-python",
"version": version,
"cuda": None,
}

# Try flashinfer-cubin pattern
match = re.match(r"flashinfer_cubin-([0-9.]+(?:\.dev\d+)?)-", wheel_name)
if match:
version = match.group(1)
return {
"package": "flashinfer-cubin",
"version": version,
"cuda": None,
}

# Try flashinfer-jit-cache pattern (has CUDA suffix in version)
match = re.match(r"flashinfer_jit_cache-([0-9.]+(?:\.dev\d+)?\+cu\d+)-", wheel_name)
if match:
version = match.group(1)
cuda_ver = get_cuda_version(wheel_name)
return {
"package": "flashinfer-jit-cache",
"version": version,
"cuda": cuda_ver,
}

return None
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The regular expressions used to extract version numbers are flawed. The pattern [0-9.]+ is too greedy and will incorrectly parse versions that include a .dev suffix (e.g., 0.3.1.dev123), leading to an incorrect version string like 0.3.1..dev123. This will cause issues when trying to process the wheel information.

I've provided a more robust implementation of get_package_info that uses a correct regex pattern for parsing PEP 440-style versions.

def get_package_info(wheel_path: pathlib.Path) -> Optional[dict]:
    """Extract package information from wheel filename."""
    wheel_name = wheel_path.name

    # A more robust version pattern, e.g., for 0.3.1 or 0.3.1.dev123
    version_pattern = r"(\d+(?:\.\d+)*(?:\.dev\d+)?)"

    # Try flashinfer-python pattern
    match = re.match(rf"flashinfer_python-{version_pattern}-", wheel_name)
    if match:
        version = match.group(1)
        return {
            "package": "flashinfer-python",
            "version": version,
            "cuda": None,
        }

    # Try flashinfer-cubin pattern
    match = re.match(rf"flashinfer_cubin-{version_pattern}-", wheel_name)
    if match:
        version = match.group(1)
        return {
            "package": "flashinfer-cubin",
            "version": version,
            "cuda": None,
        }

    # Try flashinfer-jit-cache pattern (has CUDA suffix in version)
    jit_cache_version_pattern = r"(\d+(?:\.\d+)*(?:\.dev\d+)?\+cu\d+)"
    match = re.match(rf"flashinfer_jit_cache-{jit_cache_version_pattern}-", wheel_name)
    if match:
        version = match.group(1)
        cuda_ver = get_cuda_version(wheel_name)
        return {
            "package": "flashinfer-jit-cache",
            "version": version,
            "cuda": cuda_ver,
        }

    return None

Comment on lines 54 to 70
def _get_git_version():
"""Get git commit hash."""
import subprocess

try:
git_version = (
subprocess.check_output(
["git", "rev-parse", "HEAD"],
cwd=Path(__file__).parent.parent,
stderr=subprocess.DEVNULL,
)
.decode("ascii")
.strip()
)
return git_version
except Exception:
return "unknown"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This _get_git_version function is also present in flashinfer-jit-cache/setup.py and the root setup.py. To improve maintainability and avoid code duplication, consider moving this function to a shared build utility module and importing it where needed.

Additionally, the except Exception: is too broad. It's better practice to catch more specific exceptions that you expect to handle. In this case, subprocess.CalledProcessError (if the git command fails) and FileNotFoundError (if git is not installed) are the most likely exceptions.

Suggested change
def _get_git_version():
"""Get git commit hash."""
import subprocess
try:
git_version = (
subprocess.check_output(
["git", "rev-parse", "HEAD"],
cwd=Path(__file__).parent.parent,
stderr=subprocess.DEVNULL,
)
.decode("ascii")
.strip()
)
return git_version
except Exception:
return "unknown"
def _get_git_version():
"""Get git commit hash."""
import subprocess
try:
git_version = (
subprocess.check_output(
["git", "rev-parse", "HEAD"],
cwd=Path(__file__).parent.parent,
stderr=subprocess.DEVNULL,
)
.decode("ascii")
.strip()
)
return git_version
except (subprocess.CalledProcessError, FileNotFoundError):
return "unknown"

@yzh119
Copy link
Collaborator Author

yzh119 commented Oct 6, 2025

Moved to #1872

@yzh119 yzh119 closed this Oct 6, 2025
nvmbreughe pushed a commit that referenced this pull request Oct 8, 2025
…jit-cache`, `flashinfer-cubin` (#1872)

<!-- .github/pull_request_template.md -->

## πŸ“Œ Description

Duplicate of #1867,
created from flashinfer/nightly to get write permission.

## πŸ” Related Issues

<!-- Link any related issues here -->

## πŸš€ Pull Request Checklist

Thank you for contributing to FlashInfer! Before we review your pull
request, please make sure the following items are complete.

### βœ… Pre-commit Checks

- [x] I have installed `pre-commit` by running `pip install pre-commit`
(or used your preferred method).
- [x] I have installed the hooks with `pre-commit install`.
- [x] I have run the hooks manually with `pre-commit run --all-files`
and fixed any reported issues.

> If you are unsure about how to set up `pre-commit`, see [the
pre-commit documentation](https://pre-commit.com/).

## πŸ§ͺ Tests

- [x] Tests have been added or updated as needed.
- [x] All tests are passing (`unittest`, etc.).

## Reviewer Notes

<!-- Optional: anything you'd like reviewers to focus on, concerns, etc.
-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant