[IR] Validate global_symbol on all functions, not just Relax#18834
[IR] Validate global_symbol on all functions, not just Relax#18834tqchen wants to merge 2 commits intoapache:mainfrom
Conversation
Move CheckGlobalVarAndGsymbolConsistency call outside the Relax-function-only branch so it applies to all BaseFunc types (including TIR PrimFunc). Change the method parameter type from Function to BaseFunc and use structured bindings for the iteration loop. Fix tests that had inconsistent global_symbol attributes vs GlobalVar names: - test_tir_host_func.py: remove mismatched "global_symbol": "test" for main - test_tir_intrin.py: remove mismatched "global_symbol": "test_fma" for test_tir_fma - test_tir_transform_device_kernel_launch.py: fix kernel_by_another_name mismatch - test_s_tir_transform_manifest_shared_memory_local_stage.py: remove mismatched "default_function" for main
Summary of ChangesHello @tqchen, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enhances the robustness of the IRModule by enforcing consistent naming conventions across all function types. By broadening the scope of the Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request correctly extends the global_symbol consistency check to all function types in the well-formed verifier, not just Relax functions. This is a valuable improvement that prevents subtle bugs from mismatched names. The changes in src/relax/analysis/well_formed.cc are clean and effective. The accompanying test file updates correctly fix existing inconsistencies that the new check would flag. I have one minor suggestion for a small performance improvement in well_formed.cc.
This PR moves the
CheckGlobalVarAndGsymbolConsistencycheck in the well-formed verifier to apply to all functions (not just Relax functions), fixing issue #17176.Previously, only Relax functions were checked for consistency between
GlobalVarname andglobal_symbolattribute. This meant TIRPrimFuncand otherBaseFunctypes could have mismatched names silently, causing subtle bugs.Changes:
src/relax/analysis/well_formed.cc: Move consistency check outside the Relax-only branch; change parameter type fromFunctiontoBaseFuncglobal_symbolvsGlobalVarnamesBased on #17203.