fix: use closest ancestor tag in git_describe_rocm.py#125
fix: use closest ancestor tag in git_describe_rocm.py#125diptorupd merged 1 commit intoROCm:amd-integrationfrom
Conversation
There was a problem hiding this comment.
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.
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.
b753f96 to
f6754f7
Compare
demandal25
left a comment
There was a problem hiding this comment.
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."
fix: use closest ancestor tag in git_describe_rocm.py (#125)
* 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>
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.
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.