Improve parallel parsing with detach_sequence
#1793
acarlson1029
started this conversation in
Ideas
Replies: 2 comments
|
Sure, this makes sense. Thanks for reporting the findings. |
0 replies
|
Unfortunately after this some profiling this slows down large designs that have many small files. The thread pool library I'm using seems to not be able to handle both cases nicely; probably it needs to be upgraded to something more industrial grade. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Currently in
SourceLoader.cppthere is the following code for parallelizing the the parsing phase:From the definition of
detach_loop:Current behavior
This splits the files into fixed chunks that are parsed by each thread. For large file lists with large individual files it was observed that one thread became the long pole during parsing, leaving all of the other threads idle after they've finished their blocks.
See the trace generated as the baseline with a real file list. This ran with 64 threads and took 45 seconds. The typical performance depends on the distribution of files between the blocks. If one block has many large files (e.g. parsing generated code) it may take substantially longer.
slang_trace_baseline_sized.json
Updated behavior
This can be optimized by using
detach_sequenceinstead.This allows each thread to pull from the available tasks as they finish, preventing any thread from staying idle.
See the trace generated with this optimization enabled. This ran with 64 threads and took only 33s.
slang_trace_optimized_sized.json
NOTE: I haven't benchmarked this with a small list of files to see if it causes a performance regression.
All reactions