Skip to content

fix: use closest ancestor tag in git_describe_rocm.py#125

Merged
diptorupd merged 1 commit intoROCm:amd-integrationfrom
diptorupd:fix-git-describe-version
Jan 23, 2026
Merged

fix: use closest ancestor tag in git_describe_rocm.py#125
diptorupd merged 1 commit intoROCm:amd-integrationfrom
diptorupd:fix-git-describe-version

Conversation

@diptorupd
Copy link
Copy Markdown
Collaborator

The previous implementation would pick the first tag in version-sorted order that was an ancestor of HEAD. This caused issues when multiple rc tags existed as ancestors - it would pick rc2 over the final release tag because version-sort considers 'rc2' > '' (empty string).

Now the script finds the closest ancestor tag by commit distance, which correctly selects the most recent tag reachable from HEAD.

Copilot AI review requested due to automatic review settings January 23, 2026 16:33
@diptorupd diptorupd requested a review from demandal25 January 23, 2026 16:36
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes the tag selection logic in git_describe_rocm.py to use commit distance instead of version-sort order when determining which ancestor tag to use. The previous implementation would incorrectly select RC tags over release tags due to version-sort semantics.

Changes:

  • Modified the algorithm to iterate through all ancestor tags and select the one with minimum commit distance from HEAD
  • Refactored the code to separate tag discovery from output generation, improving code organization
  • Preserved all existing functionality including special handling for tags with '+' characters and error cases

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread scripts/git_describe_rocm.py
The previous implementation would pick the first tag in version-sorted
order that was an ancestor of HEAD. This caused issues when multiple
rc tags existed as ancestors - it would pick rc2 over the final release
tag because version-sort considers 'rc2' > '' (empty string).

Now the script finds the closest ancestor tag by commit distance, which
correctly selects the most recent tag reachable from HEAD.
@diptorupd diptorupd force-pushed the fix-git-describe-version branch from b753f96 to f6754f7 Compare January 23, 2026 16:52
Copy link
Copy Markdown
Collaborator

@demandal25 demandal25 left a comment

Choose a reason for hiding this comment

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

Tested locally. It looked good.

Testing procedure from Dipto: "You can create a dummy tag v0.2.5+amd.3.rc1 and run python -m setuptools_scm. The version should be reported as v0.2.5+amd.3.rc1, then you can create another dummy tag v0.2.5+amd.3 and check what it reports. You can then remove the tags and merge your local branch into your local release branch and create a dummy tag in your local release branch and see what version is reported."

@diptorupd diptorupd merged commit 2361e9b into ROCm:amd-integration Jan 23, 2026
1 check passed
@diptorupd diptorupd deleted the fix-git-describe-version branch January 23, 2026 17:11
diptorupd added a commit that referenced this pull request Jan 23, 2026
fix: use closest ancestor tag in git_describe_rocm.py (#125)
diptorupd added a commit to diptorupd/flashinfer that referenced this pull request Jan 26, 2026
* Update rocm+torch versions in Dev Dockerfile (ROCm#118)

Update the ROCm and pytorch version to the supported versions in Jan
release in `.devcontainer/rocm/Dockerfile`

* Updated changelog for Jan 2026 release (ROCm#119)

Updated changelog for v0.2.5+amd.2 release

* Update/readme (ROCm#120)

Adds latest docker image names to README.
Updates the wheel file name from `flashinfer` to `amd_flashinfer` in the `build from source` section's instructions.

* Minor changes and linting fixes to README (ROCm#121)

Some minor changes to README and some linting fixes.

* fix: use closest ancestor tag in git_describe_rocm.py (ROCm#125)

The previous implementation would pick the first tag in version-sorted
order that was an ancestor of HEAD. This caused issues when multiple rc
tags existed as ancestors - it would pick rc2 over the final release tag
because version-sort considers 'rc2' > '' (empty string).

Now the script finds the closest ancestor tag by commit distance, which
correctly selects the most recent tag reachable from HEAD.

* Initial files for code coverage automation

* Remove include list from pyproject.toml

* Improvements

---------

Co-authored-by: Debasis Mandal <Debasis.Mandal@amd.com>
diptorupd added a commit to diptorupd/flashinfer that referenced this pull request Jan 28, 2026
The previous implementation would pick the first tag in version-sorted
order that was an ancestor of HEAD. This caused issues when multiple rc
tags existed as ancestors - it would pick rc2 over the final release tag
because version-sort considers 'rc2' > '' (empty string).

Now the script finds the closest ancestor tag by commit distance, which
correctly selects the most recent tag reachable from HEAD.
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.

3 participants