Skip to content

spirv_opt: preserve functions with cyclic result aliases - #9701

Closed
Barbital11111 wants to merge 1 commit into
ProjectLeonida:mainfrom
Barbital11111:fix/spirv-opt-alias-cycle
Closed

Barbital11111 wants to merge 1 commit into
ProjectLeonida:mainfrom
Barbital11111:fix/spirv-opt-alias-cycle

Conversation

@Barbital11111

Copy link
Copy Markdown
Contributor

Claimed as SPIRV-OPT-ALIAS-CYCLE in the coordination issue. Follow-up to the Python resolver finding.

Depends on: #8451

This is a merge-order overlap. #8451 adds a module-information argument at the function optimization call. This change was tested directly on main. It merges cleanly with #9645.

What and why

The alias resolver assumes every replacement chain reaches a surviving definition. A cycle makes the original resolver keep following the same links.

Detect the cycle before committing a replacement. Preserve the affected function and its metadata, and continue optimizing the other functions. The usual direct alias keeps its short lookup.

Tested

  • All 13 optimizer tests passed on Windows and under WSL with SPIRV-Tools 2026.4.
  • The new tests exercise self and multi-node cycles in isolated alias maps. A separate two-function test injects that state at the resolver and verifies that the affected function and its debug name remain intact while the other function is optimized. The resulting synthetic module passes spirv-val.
  • A synthetic acyclic module with 3,000 copies produces the same optimized text as main.
  • Full WSL semantic suite, 16 jobs, 447 files and 5,957 tests. The two existing failures are test_image_atomics_guard and test_image_store_d16 (tests/semantic: three image test files red on main (stale after #4473 and #6805; LLVM_MC on Windows) #7284).
  • Changed-file no-game-data check and git diff --check passed.

CPU-only synthetic checks. AI-assisted (Codex).

@Barbital11111

Copy link
Copy Markdown
Contributor Author

Closing as a duplicate claim. @kallakata claimed the same Python alias-resolution issue first, and that claim carried over from the previous coordination issue.

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