Skip to content

fix(mlir): abort on unhandled effect op as C does (migrates #1558 onto main per #1576) - #1680

Merged
godofecht merged 4 commits into
mainfrom
cursor/migrate-effects-pr1558-5d3c
Nov 5, 2026
Merged

godofecht merged 4 commits into
mainfrom
cursor/migrate-effects-pr1558-5d3c

Conversation

@godofecht

Copy link
Copy Markdown
Contributor

Migrates historical PR #1558 (effects work) onto current main as a new implementation.

Changes

MLIR effect dispatch now calls __flow_unhandled_effect("E.op") when no handler has the operation, matching the C backend's behavior (strict effects by default, unless FLOW_PERMISSIVE_EFFECTS=1 is set).

Implementation

  • mlirgen.flow: Added mlg_put_unhandled_effect helper and HP_EFFECT flag
  • mlirgen.flow: Effect dispatch emits unhandled calls in both branches before zero defaults
  • effects.flow: Updated fixture to test unhandled abort behavior (exit 134)
  • effects.mlir, effects.out: Updated fixture goldens
  • mlir_commands expecteds: Updated for new effect dispatch structure
  • corpus.txt: Hand-updated 77 digests for affected programs

Testing

  • Bootstrap selftest: PASS
  • Bootstrap fixed point: gen2
  • Bootstrap verification: PASS
  • parity_mlir: PASS (corpus 2716/2716, fixtures 28/28)

All 77 affected files are effect-related programs where the new unhandled dispatch changes the MLIR structure but preserves semantics.

Origin

Supersedes #1558.

Part of #1576.

Open in Web Open in Cursor 

cursoragent and others added 4 commits November 5, 2026 13:16
MLIR effect dispatch now calls __flow_unhandled_effect("E.op") when no
handler has the operation, matching the C backend's behavior unless
FLOW_PERMISSIVE_EFFECTS=1 is set.

Changes:
- mlirgen.flow: Added __flow_unhandled_effect helper and HP_EFFECT flag
- mlirgen.flow: Effect dispatch emits unhandled calls before zero defaults
- effects.flow: Updated fixture to test unhandled abort behavior
- effects.mlir, effects.out: Updated fixture goldens
- mlir_commands expecteds: Updated for new effect dispatch
- corpus.txt: Hand-updated 77 digests for affected programs

All affected files are effect-related programs where the new unhandled
dispatch changes the MLIR structure. Parity gate passes.

Migrated from historical PR #1558 (commits 76b5e0f, 472851f).
Part of #1576.

Co-authored-by: Abhishek Shivakumar <[email protected]>
…s-pr1558-5d3c

Co-authored-by: Abhishek Shivakumar <[email protected]>

# Conflicts:
#	compiler/bootstrap/flowc_stage_a
#	compiler/bootstrap/flowc_stage_a.c
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.

2 participants