Skip to content

[REFACTOR][IR] Cleanup IR naming utilities#19781

Merged
tlopex merged 2 commits into
apache:mainfrom
tqchen:tvm-simplify-namesupply-and-globalvarsupply
Jun 15, 2026
Merged

[REFACTOR][IR] Cleanup IR naming utilities#19781
tlopex merged 2 commits into
apache:mainfrom
tqchen:tvm-simplify-namesupply-and-globalvarsupply

Conversation

@tqchen

@tqchen tqchen commented Jun 15, 2026

Copy link
Copy Markdown
Member

IR module cleanup benefits from using a single unique-name primitive directly at module call sites. This PR renames NameSupply to UniqueNameSupply and removes redundant wrappers around global variable naming.

Main changes:

  • Rename the public name supply API and header to UniqueNameSupply
  • Replace GlobalVarSupply with direct iterator-seeded UniqueNameSupply usage
  • Remove obsolete access-path repr registration now covered by tvm-ffi

IR module cleanup benefits from using a single unique-name primitive directly at module call sites. This renames NameSupply to UniqueNameSupply, removes the GlobalVarSupply wrapper and obsolete access-path repr registration, and updates the affected Python wrapper and tests.

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request refactors the codebase by replacing NameSupply and GlobalVarSupply with a unified UniqueNameSupply class, which uses ffi::Map instead of std::unordered_map for name tracking. The review feedback identifies a potential null pointer dereference in UniqueNameSupply when name_map is not defined, a redundant name reservation in src/ir/module.cc, and a minor typo in a comment within src/target/source/codegen_c.h.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread src/ir/unique_name_supply.cc
Comment thread src/ir/module.cc
Comment thread src/target/source/codegen_c.h
UniqueNameSupply should treat an explicitly undefined map the same as an empty map. This keeps the constructor robust while preserving the default empty-map behavior.
@tlopex tlopex merged commit 74f401f into apache:main Jun 15, 2026
10 checks passed
MasterJH5574 pushed a commit that referenced this pull request Jun 16, 2026
IR module cleanup benefits from using a single unique-name primitive
directly at module call sites. This PR renames NameSupply to
UniqueNameSupply and removes redundant wrappers around global variable
naming.

Main changes:

- Rename the public name supply API and header to UniqueNameSupply
- Replace GlobalVarSupply with direct iterator-seeded UniqueNameSupply
usage
- Remove obsolete access-path repr registration now covered by tvm-ffi
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