Commit fa16fa55
fa16fa55d4e2Merged
Yukihiro "Matz" Matsumoto <[email protected]> · 6 months ago · 1 file · ~1 modified
Description
build: split bootstrap into per-binary targets for parallel build
The previous bootstrap target ran analyze and codegen pipelines
serially via a single multi-recipe rule. The two pipelines are
independent though -- analyze.rb's compilation doesn't depend on
codegen.rb's IR or vice versa -- so the analyze and codegen sides
of round 2 (and round 3) can run concurrently under make -j.
Split each pipeline step into its own target with explicit dependencies:
build/analyze2.ir : analyze.ast spinel_analyze build/analyze2.c : analyze.ast analyze2.ir spinel_codegen build/bin2_analyze : analyze2.c sp_runtime_lib
build/codegen2.ir : codegen.ast spinel_analyze build/codegen2.c : codegen.ast codegen2.ir spinel_codegen build/bin2_codegen : codegen2.c sp_runtime_lib
build/analyze3.{ir,c} : ... bin2_analyze, bin2_codegen build/codegen3.{ir,c} : ... bin2_analyze, bin2_codegen
bootstrap : analyze3.c codegen3.c (runs the four diffs, copies bin2_* to spinel_*)
Wall-clock on a 24-core box:
make -j1 bootstrap ~118 s (serial; original behaviour) make bootstrap ~61 s (-j default; new parallel shape, ~48% faster)
The fixpoint coverage stays identical -- the four diff lines at the
end of the bootstrap target produce the same analyze.rb: IR fixpoint OK / analyze.rb: C fixpoint OK / codegen.rb: IR fixpoint OK /
codegen.rb: C fixpoint OK messages they always did.
Details
- Commit
- fa16fa55d4e2
- Parent
- 2bbda3308498
MakefilemodifiedView file
# analysis IR and the emitted C, so any drift in either phase is# caught.bootstrap: spinel_analyze$(EXE) spinel_codegen$(EXE) @echo "=== Bootstrap round 2: analyze + codegen with spinel_{analyze,codegen} ==="# Round 2: gen1 binaries (spinel_{analyze,codegen}) compile each .rb# source into a fresh `bin2_*` binary. The analyze and codegen sources# are independent, so the two pipelines are split into per-binary# targets that `make -j` can run in parallel. Same for the round 3# verify step.build/analyze2.ir: build/analyze.ast spinel_analyze$(EXE) ./spinel_analyze$(EXE) build/analyze.ast build/analyze2.irbuild/analyze2.c: build/analyze.ast build/analyze2.ir spinel_codegen$(EXE) ./spinel_codegen$(EXE) build/analyze.ast build/analyze2.ir build/analyze2.cbuild/bin2_analyze$(EXE): build/analyze2.c $(SP_RT_LIB) $(CC) $(BOOTSTRAP_CFLAGS) -Ilib build/analyze2.c $(LDFLAGS) -lm -o build/bin2_analyze$(EXE)build/codegen2.ir: build/codegen.ast spinel_analyze$(EXE) ./spinel_analyze$(EXE) build/codegen.ast build/codegen2.irbuild/codegen2.c: build/codegen.ast build/codegen2.ir spinel_codegen$(EXE) ./spinel_codegen$(EXE) build/codegen.ast build/codegen2.ir build/codegen2.cbuild/bin2_codegen$(EXE): build/codegen2.c $(SP_RT_LIB) $(CC) $(BOOTSTRAP_CFLAGS) -Ilib build/codegen2.c $(LDFLAGS) -lm -o build/bin2_codegen$(EXE) @echo "=== Bootstrap round 3: analyze + codegen with bin2_* — verify ==="build/analyze3.ir: build/analyze.ast build/bin2_analyze$(EXE) ./build/bin2_analyze$(EXE) build/analyze.ast build/analyze3.irbuild/analyze3.c: build/analyze.ast build/analyze3.ir build/bin2_codegen$(EXE) ./build/bin2_codegen$(EXE) build/analyze.ast build/analyze3.ir build/analyze3.cbuild/codegen3.ir: build/codegen.ast build/bin2_analyze$(EXE) ./build/bin2_analyze$(EXE) build/codegen.ast build/codegen3.irbuild/codegen3.c: build/codegen.ast build/codegen3.ir build/bin2_codegen$(EXE) ./build/bin2_codegen$(EXE) build/codegen.ast build/codegen3.ir build/codegen3.cbootstrap: build/analyze3.c build/codegen3.c @diff build/analyze2.ir build/analyze3.ir > /dev/null && echo "analyze.rb: IR fixpoint OK" || (echo "BOOTSTRAP FAILED: analyze.rb IR diverged" && exit 1) @diff build/analyze2.c build/analyze3.c > /dev/null && echo "analyze.rb: C fixpoint OK" || (echo "BOOTSTRAP FAILED: analyze.rb C diverged" && exit 1) @diff build/codegen2.ir build/codegen3.ir > /dev/null && echo "codegen.rb: IR fixpoint OK" || (echo "BOOTSTRAP FAILED: codegen.rb IR diverged" && exit 1)