Skip to content

🐛 Reject nonlinear QTensor shrink chains safely - #2303

Closed
simon1hofmann wants to merge 1 commit into
mainfrom
codex/2255-qtensor-one-use-guard
Closed

🐛 Reject nonlinear QTensor shrink chains safely#2303
simon1hofmann wants to merge 1 commit into
mainfrom
codex/2255-qtensor-one-use-guard

Conversation

@simon1hofmann

@simon1hofmann simon1hofmann commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

🤖 AI text below 🤖

Summary

  • Require each tensor in a shrink chain to have exactly one user before dereferencing it.
  • Leave nonlinear or incomplete chains unchanged.
  • Add a no-mutation regression for a tensor with two deallocation users.

Follow-up to #2295 and part of #2255.

Validation

  • QTensor transforms unit-test suite: 3 passed.
  • uvx nox -s lint: passed.
  • uvx nox -s cpp-lint: could not start locally because clang-tidy 22 is unavailable; CI will run the canonical check.

AI assistance: Codex extracted the minimal follow-up from the contract audit branch and ran the listed validation.

Checklist

  • The pull request only contains commits that are focused and relevant to this change.
  • I have added appropriate tests that cover the new/changed functionality.
  • I have updated the documentation to reflect these changes. (Not applicable: no user-facing documentation change is needed.)
  • I have added entries to the changelog for any noteworthy additions, changes, fixes, or removals. (Not applicable: this focused fix is labeled skip-changelog.)
  • I have added migration instructions to the upgrade guide (if needed). (Not needed.)
  • The changes follow the project's style guidelines and introduce no new warnings.
  • The changes are fully tested and pass the CI checks.
  • I have reviewed my own code changes.

If PR contains AI-assisted content:

  • Any agent that created, edited, or submitted GitHub content was explicitly authorized for that scope, as required by our AI Usage Guidelines.
  • Every agent-authored or agent-edited public text body begins with the visible disclosure 🤖 *AI text below* 🤖 (titles are exempt).
  • I have disclosed AI assistance in the PR description.
  • I confirm that I have personally reviewed and understood all AI-generated content, and accept full responsibility for it.

@codecov

codecov Bot commented Aug 31, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@simon1hofmann simon1hofmann added c++ Anything related to C++ code code quality Code quality improvements fix Fix for something that isn't working MLIR Anything related to MLIR skip-changelog Changes that do not need to show up in the changelog labels Sep 1, 2026
@burgholzer

Copy link
Copy Markdown
Member

This feels like a fix at the wrong level. QTensor, by-definition, is a linear type. Any violation of that constraint already constitutes an invalid program. Please revisit.

@simon1hofmann

Copy link
Copy Markdown
Contributor Author

🤖 AI text below 🤖

Agreed. This follow-up reintroduced the same one-use guard and invalid nonlinear regression that were removed from #2295 after review. QTensor linearity is the owning contract, and qco::verifyLinearity already requires each tensor value to have exactly one use. I am closing this PR as redundant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++ Anything related to C++ code code quality Code quality improvements fix Fix for something that isn't working MLIR Anything related to MLIR skip-changelog Changes that do not need to show up in the changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants