compilation: run a rule's independent commands concurrently - #186
Open
atassis wants to merge 1 commit into
Open
Conversation
execute() ran every command of every rule one after another, so a design's kernel objects cost the SUM of their compiles: 7.9 s of a 17.1 s encoder-MHA build for two kernels, 2.6 s once parallel. Only the rule knows whether its commands are independent, so it declares it; KernelCompilationRule does.
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.
Problem
execute()runs every command of every rule one after another:A rule that emits one command per worklist artifact —
KernelCompilationRuleis the one that matters— therefore costs the SUM of its compiles rather than the max, even though the commands write
separate outputs and never read each other's.
Fix
A rule declares whether its commands are independent (
commands_are_independent, default off) andexecuteruns those concurrently. The default is off deliberately: a rule that batches dependentsteps into one application must keep its order, and only the rule knows which kind it is.
KernelCompilationRulesets it, since it emits one command perKernelObjectArtifact, each readingits own source and writing its own object.
The first failure is raised only after every sibling has finished, so a failing command cannot leave
half-written outputs behind a raised error.
Bounded by cores — each kernel compile is a single-threaded clang peaking near 205 MB of RSS.
IRON_COMPILE_JOBSoverrides.Test
On a two-kernel design the kernel-compile step goes 7.9 s -> 2.6 s of a 17.1 s build, with the
artifacts unchanged. The gain is
maxinstead ofsum, so it scales with a design's kernel count andis nothing for a single-kernel design.