Repository navigation
feat: profile compiler phases and compile-to-result (#735) - #1343
Merged
Merged
Conversation
godofecht
marked this pull request as ready for review
October 4, 2026 20:19
cursor
Bot
force-pushed
the
cursor/compile-phase-timing-ce23
branch
4 times, most recently
from
October 4, 2026 22:28
532e15e to
85d9533
Compare
Instrument parse, import resolution, typecheck and codegen behind FLOWC_PROFILE, and teach compile_bench to record cold/warm compile-to-result plus the top fixed vs scaling cost. Co-authored-by: Abhishek Shivakumar <[email protected]>
resolve.flow imports .profile for FLOWC_PROFILE spans. Roundtrip compiled resolve without emitting profile first, so cc failed on implicit flowc_prof_span_begin / FLOWC_PROF_* undeclared. Add profile to roundtrip, gate_lib frontend/self-emit, and g2 fixed-point modules. Scripts only; no bootstrap regen. Co-authored-by: Abhishek Shivakumar <[email protected]>
Rebased onto d0e2a8a (#1341). Source keeps FLOWC_PROFILE plus FLOW_MEM_PROFILE cgen checks. Regen fixed point at gen2; --verify matches compiler/src. Co-authored-by: Abhishek Shivakumar <[email protected]>
cursor
Bot
force-pushed
the
cursor/compile-phase-timing-ce23
branch
from
October 4, 2026 23:21
85d9533 to
abff37e
Compare
cursor Bot
pushed a commit
that referenced
this pull request
Oct 5, 2026
Fixed-point C after rebasing onto phase timing (#1343 / c5332d7). bootstrap_from_c.sh --regen (FIXED POINT at gen3) then --verify PASS. Co-authored-by: Abhishek Shivakumar <[email protected]>
7 of 8 tasks
godofecht
added a commit
that referenced
this pull request
Oct 5, 2026
* perf: emit proven restrict/noalias in C and MLIR backends (#731) Add a fail-closed provenance certificate for local arrays and constant slices, then mark only proven-disjoint internal pointer parameters and unique local pointers with C restrict and MLIR {llvm.noalias}. Co-authored-by: Abhishek Shivakumar <[email protected]> * fix: link noalias into stage-A frontend (#731) cgen calls flowc_noalias_* but the module was missing from frontend_modules, the self-emit plan, roundtrip compile_module, and the g2 fixed-point list. Same inventory pattern as type_id / rt_summary. Co-authored-by: Abhishek Shivakumar <[email protected]> * test: re-record parity_mlir corpus after noalias metadata (#731) {llvm.noalias} and // flowc.noalias comments change normalized MLIR digests. Refresh via parity_mlir.flow --record (also records newly accepted programs from #1341/#1342 and the noalias fixtures). Co-authored-by: Abhishek Shivakumar <[email protected]> * fix: regenerate bootstrap C after noalias rebase onto #1343 Fixed-point C after rebasing onto phase timing (#1343 / c5332d7). bootstrap_from_c.sh --regen (FIXED POINT at gen3) then --verify PASS. Co-authored-by: Abhishek Shivakumar <[email protected]> * test: retarget mlir_defer_addr golden for flowc.noalias (#731) flowc now emits // flowc.noalias on proven-local MLIR allocas. Re-record the mlir_commands expected text so the check matches without weakening noalias/restrict emission. Co-authored-by: Abhishek Shivakumar <[email protected]> --------- Co-authored-by: Cursor Agent <[email protected]>
This was referenced Oct 5, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Intent
Linked issue: #735 (parent #727).
First useful slice of compile-to-result phase profiling.
FLOWC_PROFILE=1|jsonmakes flowc emit machine-readable per-phase timings, andcompile_benchrecords cold/warm compile-to-result for tiny/medium/large programs, including self-hosted flowc with no Python on PATH.This is additive instrumentation plus harness rows, not a pipeline rewrite.
Overlap check
Overlap / dependency notes:
tools/compile_bench) already landed process-levelemit_ms/cc_ms/run_ms. This PR is the in-compiler remainder that PR called out.compile_bench(--python-codefor [Performance #727] Minimize compiled-program cold start and runtime initialization overhead #746). This change is additive (--host,--compiler, profile fields) and should merge cleanly.archive/feat/735-compile-profilingis the retired Python design; this follows its schema (flow-compile-profile/1,[flow-profile]marker) on flowc.main(d0e2a8a8, feat: opt-in runtime memory profiler (#740) #1341 runtime memory profiler). Overlap: bootstrap C, CHANGELOG, andmain.flow(theirFLOW_MEM_PROFILEcgen checks vs our emit wrappers / selftests). No source conflict; rebase was clean.FLOWC_PROFILE(compile phases) stays distinct fromFLOW_MEM_PROFILE(runtime heap). Roundtrip still compilesprofilebeforeresolve.Evidence
Baseline before this change:
compile_benchreported only emit/cc/run process times.FLOWC_PROFILEreport.FLOW_PROFILEremains the safety-profile switch.Targeted proof that exercises the changed behaviour (re-run after rebase onto #1341):
Repository gate(s) run after rebase onto #1341:
flowc: PASS,type_id_ok=1,rt_summary_ok=1,profile_ok=1)./flow tool tests/scripts/compile_profile.flow(4 passed)./compiler/scripts/bootstrap_from_c.sh --regen(fixed point at gen2)./compiler/scripts/bootstrap_from_c.sh --verify(PASS bootstrap C matches compiler/src)Generated/bootstrap state, if any:
main(feat: opt-in runtime memory profiler (#740) #1341). Stale bootstrap commit dropped;compiler/bootstrap/flowc_stage_a.cregenerated to a fixed point and committed separately (fix: regenerate bootstrap C after rebase onto mem profiler).Risk
Compatibility, performance, security, lifetime, backend, or release implications:
Opt-in only. Unset/
0/false/offis a cached no-op besides onegetenv.No language or public CLI syntax change. New env:
FLOWC_PROFILE(notFLOW_PROFILEsafety/flight, and notFLOW_MEM_PROFILEruntime heap).compile_benchdefault output gains fields; existing keys stay.No unresolved language/API design decision is being implemented implicitly.
No unrelated generated artifacts or local state are included.
Docs changed when user-visible behaviour or syntax changed.
docs/project/Questions.mdupdated if this needs a language-design decision.Compatibility
docs/project/CHANGELOG.md.Additive
FLOWC_PROFILEand extracompile_benchJSON fields are noted under Unreleased.Remaining gaps (not this slice)
monomorphizeandloweringreport 0; they still run inside codegen.parse, not a separate phase.codegenbucket ([MLIR Performance #727] Bound MLIR/JIT compile latency and time-to-first-result #748 covers JIT).Agent handoff
Agent/provider/session: Cursor cloud agent, branch
cursor/compile-phase-timing-ce23.Head:
abff37e2f04250ec4626138605350b3f82f5898f. Rebased ontod0e2a8a8(#1341). FLOWC_PROFILE / compile_bench / roundtrip profile wiring intact. Do not merge unless asked.