Skip to content

fix(mlir): doom -O2 path; close out #253/#254 and ILP32 ptr sizing (#255) - #257

Merged
cursor[bot] merged 1 commit into
mainfrom
cursor/mlir-doom-issues-b994
Aug 9, 2026
Merged

cursor[bot] merged 1 commit into
mainfrom
cursor/mlir-doom-issues-b994

Conversation

@godofecht

Copy link
Copy Markdown
Contributor

Summary

Sorts the new doom-flow MLIR follow-ups (#253–#256) against Flow tip.

#253 — -O1+ drops the main loop

Already fixed by #250 (addressof for &module_global). Root cause was not a noreturn attribute on D_DoomMain: drawshim_*_addr / return &dc_yh used to load the global into a stack alloca and return that pointer (UB). At -O1+, LLVM turns callers into unreachable, false-noreturn spreads through draw/render, and emcc/binaryen drop usable code. Tip emits ret ptr @dc_yh.

Verified: doom-flow BACKEND=mlir + emcc -O2 smoke reaches thousands of frames (D_DoomLoop returns → main loop ticks).

#254 — static string-array globals

Already on main via _emit_static_llvm_array_global (#250). @config_doom_names is a concrete [N x ptr] initializer (not undef). Added regression tests + API existence check matching doom-flow’s build gate.

#255 — wasm32 ILP32 pointer width

Partial fix: --wasm32 now sizes ptr / string as 4 bytes in memref struct layouts and pointer-element byte scaling (several fallbacks hardcoded 8). Typed LLVM GEP was already target-correct. doom-flow should keep rmain_ptr_bytes() instead of Flow-source * 8. u8 as i32 zero-extend remains from #250 (rdata masks are defensive).

#256 tracking

Please close #253 and #254, and update #256 to drop closed #221/#232/#233 plus these two. #255 can stay open for any remaining LP64 offsetof constants in doom-flow itself.

Also

  • Docs: docs/language/wasm.md, ROADMAP.md, CHANGELOG
  • Refreshed site/wasm/doom_mlir/ preview at -O2

Test plan

  • pytest MLIR unit tests (addressof, string arrays, pointer ABI, struct statics, unsigned, module statics)
  • doom-flow MLIR rebuild + Node smoke at -O2 (no crash; frame loop runs)
Open in Web Open in Cursor 

Confirm #253/#254 against Flow tip: addressof for module globals (from #250)
stops -O1+ turning drawshim getters into unreachable/noreturn, and static
string arrays initialize via _emit_static_llvm_array_global. Size ptr/string
to 4 bytes under --wasm32 in memref layouts (#255). Refresh doom_mlir -O2
preview and document status.

Co-authored-by: Abhishek Shivakumar <[email protected]>
@godofecht
godofecht marked this pull request as ready for review August 9, 2026 20:40
@cursor

cursor Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@cursor
cursor Bot merged commit bd93e40 into main Aug 9, 2026
18 checks passed
@cursor
cursor Bot deleted the cursor/mlir-doom-issues-b994 branch August 9, 2026 20:40
@cursor

cursor Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Follow-up (agent cannot write issues or push doom-flow):

cursor Bot pushed a commit that referenced this pull request Aug 9, 2026
Agent cannot push godofecht/doom-flow or close flow#253/#254/#256. Bundle the
verified build_wasm.sh/README patch and point wasm.md at it after #257.

Co-authored-by: Cursor Agent <[email protected]>
godofecht added a commit that referenced this pull request Aug 9, 2026
)

Confirm #253/#254 against Flow tip: addressof for module globals (from #250)
stops -O1+ turning drawshim getters into unreachable/noreturn, and static
string arrays initialize via _emit_static_llvm_array_global. Size ptr/string
to 4 bytes under --wasm32 in memref layouts (#255). Refresh doom_mlir -O2
preview and document status.

Co-authored-by: Cursor Agent <[email protected]>
godofecht added a commit that referenced this pull request Aug 9, 2026
Agent cannot push godofecht/doom-flow or close flow#253/#254/#256. Bundle the
verified build_wasm.sh/README patch and point wasm.md at it after #257.

Co-authored-by: Cursor Agent <[email protected]>
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.

MLIR: -O1+ infers D_DoomMain as noreturn and drops the main loop MLIR WASM: gfx + preload parity with C path (doom-flow scale)

2 participants