Skip to content

Convert build parallelism to a more synchronous model - #3569

Merged
peterebden merged 8 commits into
thought-machine:masterfrom
peterebden:peter/sync-push-final
Sep 14, 2026
Merged

peterebden merged 8 commits into
thought-machine:masterfrom
peterebden:peter/sync-push-final

Conversation

@peterebden

@peterebden peterebden commented Aug 9, 2026

Copy link
Copy Markdown
Collaborator

This will (hopefully) make the parallelism easier to understand and avoids some of the weird edge cases we had before. The fan-out logic is now all in src/plz and has been cut out of src/core. The model there is quite a lot more synchronous - essentially it calls a function like Build or Test which builds all a target's dependencies, then that target, blocking until it's done.

We can drop a few of the concepts we had before (like "parse mode", "resolving dependencies" and things like that) and we can lose the maps of "pending things" on the build state. It's simpler around things like subincludes because when we get there we just ask to build the thing, we don't have to ask it to parse then figure out at the end of that whether we should trigger things to build or not.

I ran the in-repo perf tests and they are actually faster than before. That's nice to see although it was not expected - it appears to be that we have fewer concurrently live goroutines because all the dependency resolution stuff is gone. I think it's a bit of a parse-only effect though.

@peterebden

Copy link
Copy Markdown
Collaborator Author

Note to self: I think there might be something slightly off about debug tools somewhere (have observed this internally but I have little understanding yet of what the test in question is doing)

@peterebden

Copy link
Copy Markdown
Collaborator Author

Note to self: I think there might be something slightly off about debug tools somewhere (have observed this internally but I have little understanding yet of what the test in question is doing)

Nope not caused by this. I assumed a failure that obvious would be, but it seems broken on master. Fixed in #3593

Comment thread src/cmap/cmap.go Outdated
Comment thread src/cmap/cmap.go Outdated
Comment thread src/cmap/cmap_test.go Outdated
Comment thread src/core/build_target.go Outdated
Comment thread src/core/build_target.go
Comment thread src/plz/plz.go Outdated
Comment thread src/plz/plz.go
Comment thread src/plz/plz.go Outdated
Comment thread src/plz/plz.go Outdated
Comment thread src/plz/plz.go Outdated
@peterebden
peterebden force-pushed the peter/sync-push-final branch from c1ae6b0 to 8dfcf5d Compare September 9, 2026 16:19
@peterebden
peterebden merged commit fa55336 into thought-machine:master Sep 14, 2026
16 checks passed
Comment thread src/cmap/cerrmap.go
if v.Err != nil {
return v.Val, v.Err
} else if first {
defer func() {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please document the fact that this will recover if f panics

Comment thread src/parse/asp/builtins.go
}

// WaitForPackage drops the interpreter lock and waits for the given package to be parsed. Like
// WaitForSubrepo drops the interpreter lock and waits for the given package to be parsed. Like

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"given package" -> "given subrepo"

"to be parsed" -> "to be defined"?

Comment thread src/plz/plz.go

type runner struct {
tasks *errgroup.Group
ctx context.Context //nolint:containedctx

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please justify why it's reasonable to store the context?

Comment thread src/plz/plz.go
if s != nil {
return nil
}
if _, err := r.parse(ctx, defining, dependent, true, wait); err != nil && !errors.Is(err, parse.ErrMissingBuildFile) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we ignore ErrMissingBuildFile, doesn't that imply that this can return nil and the subrepo still is not available?

PeterNeiss pushed a commit to PeterNeiss/please that referenced this pull request Sep 14, 2026
The fork's master carried the Windows port on top of 17.33.0. That same work,
rebased onto upstream's master after thought-machine#3569 ("Convert build parallelism to a
more synchronous model") and with plz update now downloading the whole release
zip on Windows, is on windows-rebase.

This merge takes windows-rebase's tree as it is, so master now matches what is
headed upstream, while keeping the old history reachable instead of rewriting it.
PeterNeiss pushed a commit to PeterNeiss/please that referenced this pull request Sep 14, 2026
Brings back the fork's 18.0.0 and 18.0.1 ChangeLog entries and milestone page,
which the upstream-bound branch leaves out, and adds 18.1.0: the rebase onto
thought-machine#3569, plz update downloading the whole zip on Windows, and --shell's
slash-separated directory.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaLmkJrkt7eRJC9uPXvbKe
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