Skip to content

ci(tensilelite): prevent new legacy Tensile imports (AIHPBLAS-3989) - #13278

Merged
talumbau merged 2 commits into
developfrom
users/alvasile/no-absolute-imports
Oct 14, 2026
Merged

talumbau merged 2 commits into
developfrom
users/alvasile/no-absolute-imports

Conversation

@Alex-Vasile

@Alex-Vasile Alex-Vasile commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

JIRA ID : AIHPBLAS-3989

Motivation

#12150 moves the Python implementation from Tensile to tensilelite while keeping Tensile importable through a temporary compatibility package. New imports using the old name would add references that must be removed before that package can go away.

Technical Details

  • Add a root pre-commit hook that checks newly added or modified import statements in Python files under both package roots. It rejects absolute imports beginning with Tensile or tensilelite, so internal modules use package-relative imports.
  • Check changed lines only, allowing existing imports to remain during the migration. The checker ignores strings, comments, and files under Tests/.
  • Allow the one absolute import needed by Tensile/__init__.py to install the compatibility alias. This exception will be removed in #12162 when that PR removes the bridge.

This PR depends on #12150.

Test Plan

Run the checker's Python unit tests, which exercise staged and PR-range changes, both package roots, the bridge exception, and existing imports. Run the repository's pre-commit checks in PR CI. GPU testing is unnecessary because this change only examines Python source.

Test Result

  • Checker unit tests: 34 passed.
  • git diff --check: passed.
  • PR CI: pending.

Submission Checklist

Risk level

Medium (3/5): the new check can reject TensileLite Python changes in pre-commit CI. It does not change packaged code or GPU behavior.

@therock-pr-bot

therock-pr-bot Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

✅ All Checks Passed — Ready for Review

Check Status Details
📝 PR Description ✅ Pass —
⛔ Forbidden Files ✅ Pass —
🧪 Unit Test ✅ Pass —
🔎 pre-commit ✅ Pass —
🚫 Draft PR 🔜 To Be Enabled —
🚩 Feature Flag 🔜 To Be Enabled —
📊 Code Coverage 🔜 To Be Enabled —
🤖 therock-pr-bot ✅ Pass —

🎉 All checks passed! This PR is ready for review.

📖 Need help? See the Policy FAQ for details on every check and how to fix failures.

🙋 Wish to Override Policy?

@therock-pr-bot

therock-pr-bot Bot commented Oct 7, 2026

Copy link
Copy Markdown

🎉 All checks passed! This PR is ready for review.

@codecov

codecov Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #13278      +/-   ##
===========================================
- Coverage    74.64%   74.63%   -0.01%     
===========================================
  Files         2881     2881              
  Lines       480340   480423      +83     
  Branches     71286    71290       +4     
===========================================
+ Hits        358536   358562      +26     
- Misses       97494    97550      +56     
- Partials     24310    24311       +1     
Flag Coverage Δ *Carryforward flag
TensileLite-CPP 49.70% <ø> (ø)
TensileLite-Unit 83.57% <ø> (ø)
hipBLAS 90.62% <ø> (ø) Carriedforward from 8db16c8
hipBLASLt 43.29% <ø> (-0.04%) ⬇️
hipCUB 82.68% <ø> (ø) Carriedforward from 8db16c8
hipDNN 86.80% <ø> (ø) Carriedforward from 8db16c8
hipFFT 42.00% <ø> (ø) Carriedforward from 8db16c8
hipRAND 76.12% <ø> (ø) Carriedforward from 8db16c8
hipSOLVER 69.45% <ø> (ø) Carriedforward from 8db16c8
hipSPARSE 86.99% <ø> (ø) Carriedforward from 8db16c8
rocBLAS 68.73% <ø> (ø) Carriedforward from 8db16c8
rocFFT 45.70% <ø> (ø) Carriedforward from 8db16c8
rocRAND 57.29% <ø> (ø) Carriedforward from 8db16c8
rocSOLVER 76.83% <ø> (ø) Carriedforward from 8db16c8
rocSPARSE 77.05% <ø> (ø) Carriedforward from 8db16c8
rocThrust 93.15% <ø> (ø) Carriedforward from 8db16c8

*This pull request uses carry forward flags. Click here to find out more.
see 3 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Alex-Vasile
Alex-Vasile force-pushed the users/alvasile/no-absolute-imports branch from 5a6efa4 to c5c5738 Compare October 9, 2026 15:56
@Alex-Vasile
Alex-Vasile marked this pull request as ready for review October 9, 2026 15:56
@Alex-Vasile
Alex-Vasile requested a review from a team as a code owner October 9, 2026 15:56
@Alex-Vasile
Alex-Vasile requested a review from newling October 9, 2026 17:00

@newling newling left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Just to understand, what's the alternative here, that we don't add these tests and then at some point in the future we just make import Tensile stop working and patch any remaining Tensile->tensilelite fixes that are needed, in a single PR, i.e. make Tensile illegal and fix remaining cases in 1 PR. What is the problem with that, is it just that we can 2 PRs that pass CI that are mutually imcompatible?

@Alex-Vasile

Copy link
Copy Markdown
Contributor Author

Just to understand, what's the alternative here, that we don't add these tests and then at some point in the future we just make import Tensile stop working and patch any remaining Tensile->tensilelite fixes that are needed, in a single PR, i.e. make Tensile illegal and fix remaining cases in 1 PR. What is the problem with that, is it just that we can 2 PRs that pass CI that are mutually imcompatible?

The problem with that approach is practicality. There are still a lot of imports that need to be changed and getting all of those through CI will take time, during which new (Tensile-style) imports will be added, which either require a new PRs to clean up, or continuously patching and rebasing the final PR that removes that support for import Tensile. In addition to rebasing to fix merge conflicts. We had to do this for #12150, and it cost a lot of developer and CI time and made it difficult to land.

@newling newling left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM, argument for adding these (temporarily) makes sense to me

@Alex-Vasile
Alex-Vasile force-pushed the users/alvasile/no-absolute-imports branch from c5c5738 to 8b3e04e Compare October 13, 2026 18:27
@Alex-Vasile
Alex-Vasile enabled auto-merge (squash) October 13, 2026 18:27
@Alex-Vasile
Alex-Vasile force-pushed the users/alvasile/no-absolute-imports branch from 8b3e04e to 9123cd7 Compare October 14, 2026 17:18
@Alex-Vasile
Alex-Vasile requested a review from a team as a code owner October 14, 2026 17:18

@jaopaulolc jaopaulolc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM.

@talumbau

Copy link
Copy Markdown
Collaborator

miopen failures on Windows gfx110x-all is a timeout
rocfft failure on Windows gfx110x-all is a time out.
rocprofiler-sdk failure is not related to this change.

@talumbau
talumbau disabled auto-merge October 14, 2026 19:58
@talumbau
talumbau merged commit e160811 into develop Oct 14, 2026
177 of 186 checks passed
@talumbau
talumbau deleted the users/alvasile/no-absolute-imports branch October 14, 2026 19:58
@assistant-librarian

Copy link
Copy Markdown
Contributor

TheRock Submodule Bump Activity

Newest first

talumbau pushed a commit that referenced this pull request Nov 5, 2026
…3989) (#13932)

JIRA ID : AIHPBLAS-3989

## Motivation

#12162 removes the `Tensile` compatibility package, so a new import of
the old name now fails at import time. The absolute-import pre-commit
hook added in #13278 still carries the `Tensile` package root, a bridge
exemption for `Tensile/__init__.py`, and `Tensile` as a banned name. All
of that is dead after #12162. The rule that remains useful is that
`tensilelite` modules use package-relative imports.

## Technical Details

- `check_no_absolute_imports.py` now checks only
`projects/hipblaslt/tensilelite/tensilelite`. The `Tensile` package
root, the `TEMPORARY_EXEMPTIONS` bridge exception and the `Tensile`
banned name are removed, and the docstring and failure message are
updated.
- The `tensilelite-no-absolute-imports` pre-commit entry matches only
the `tensilelite` package and its `Tests/` exclusion, and its stale
"move in flight" comment is removed.
- The checker's unit tests use `tensilelite` as the banned example. The
bridge-exemption and missing-package-root tests are removed. An added
test records that `Tensile` imports are no longer reported by this hook.
- Behavior is unchanged for `tensilelite`: only lines added by a change
are checked, and `Tests/` is excluded.

## Test Plan

Run the checker's unit tests, which exercise staged and PR-range
changes, the package root, test-directory exclusion, existing imports
and unparseable files. Run the repository's pre-commit checks in PR CI.
GPU testing is unnecessary because this change only examines Python
source.

## Test Result

- Checker unit tests: 29 passed (run with `--noconftest`; at this point
in the stack the package conftest still fails on stale `Tensile` imports
inherited from `develop`).
- Pre-commit hook run against the full tree and PR CI: not run locally.

## Submission Checklist

- [x] Look over the contributing guidelines at
https://github.com/ROCm/TheRock/blob/main/GOVERNANCE.md#pull-requests.

## Risk level

Low (1/5): only the pre-commit hook and its tests change. It does not
change packaged code or GPU behavior.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants