[BugFix][Relax] Add structural_equal verification to subroutine cache lookup by 3em0 · Pull Request #18930 · apache/tvm
… lookup SubroutineMixin._get_subroutine() used structural_hash as the sole cache key without structural_equal verification. If two different arg_sinfo values produced the same 64-bit hash, the cache would return a previously compiled function with mismatched parameter shapes, leading to silently incorrect compiled output. The fix changes the cache to store a list of (arg_sinfo, result) pairs per hash bucket and verifies each candidate with structural_equal before returning. This follows the same pattern used in block_builder.cc (StructuralHash + StructuralEqual). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
bot reviewed Mar 25, 2026
- Extract result tuple into variable and break down setdefault/append - Use list comprehension for subroutine collection in test Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters