Skip to content

fix(parser): validate HIR return annotations - #142

Merged
zhen8838 merged 3 commits into
tile-ai:mainfrom
zhen8838:fix/prototype-return-type
Aug 31, 2026
Merged

fix(parser): validate HIR return annotations#142
zhen8838 merged 3 commits into
tile-ai:mainfrom
zhen8838:fix/prototype-return-type

Conversation

@zhen8838

Copy link
Copy Markdown
Collaborator

Why

  • HIR return annotations were parsed but did not validate the inferred body result, allowing real dispatch variants to silently disagree with their declared return contract.

What

  • Validate annotated HIR function bodies and dispatch variant bodies with types_compatible.
  • Require a return annotation on pass dispatch prototypes and support recursive tuple[...] return annotations.
  • Add a diagnostic regression test and make the decode fixture explicitly materialize its declared GMEM result.
  • Remove unrelated ordinary-function annotations whose bodies intentionally remain SMEM or UMAT.

Contract

  • Omitted Tensor[...] storage remains GMEM; it is not a wildcard.
  • Ordinary functions keep body.type as their IR return type after validation. Dispatch variants keep the exact prototype return type.

Risk

  • Existing authored return annotations now need to describe the body result. The full source suite passes after updating the affected fixtures and tests.

Comment thread docs/spec/hir.md Outdated
Comment thread docs/spec/parser.md Outdated
Comment thread docs/spec/parser.md Outdated
@zhen8838
zhen8838 merged commit b4cc057 into tile-ai:main Aug 31, 2026
1 check passed
@zhen8838
zhen8838 deleted the fix/prototype-return-type branch August 31, 2026 02:24
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