Repository navigation
Conversation
A file is compiled as soon as the files it depends on are compiled, up to -p files at a time. Files of a library are compiled one at a time, since GHDL and Riviera-PRO update the index of a library without locking it and lose units when compiled into concurrently. NVC locks its libraries and compiles files of a library at the same time. The output of a file is written once it is compiled so that outputs do not mix. GHDL compiles one file at a time with gcc coverage, which writes .gcno files to the working directory. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
GHDL rewrites the index of a library by deleting it and renaming a new one into place, so a compile reading the library in between fails with "cannot find resource library". Unless a simulator locks its libraries, a file is not compiled while its library is read, or while a library it reads, that of any of its dependencies, is compiled into. A library clause fails in GHDL on a library nothing has been compiled into, which a file compiled in parallel may come before. GHDL creates every library with ghdl -i when setting up the library mapping. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Without it, files are compiled one at a time whatever -p is, so that a -p given for running tests does not change how files are compiled. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ru551n
marked this pull request as ready for review
October 15, 2026 12:34
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
LarsAsplund
reviewed
Nov 6, 2026
LarsAsplund
left a comment
Collaborator
There was a problem hiding this comment.
After fixing this PR, we should continue with the batch compile PR before merging anything. I haven't reviewed that yet and I suspect that there may be some dependencies with this PR that has to be sorted out.
Replace --parallel-compile with -j/--num-compile-threads, so that files can be compiled with many threads while tests run with few, and add --num-sim-threads as an alias of --num-threads. Decide once whether the output of a file is buffered, type the files compiled as a list and number the files and libraries of the compile tests from 0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Author
|
Posted by Claude on behalf of ru551n. OK, #1236 next. I'll rebase it on these changes, and it will pick up |
Creating an empty GHDL library with ghdl -i is not documented, so it is removed. Library clauses are parsed instead. A file waits for the first file before it in compile order of each other library in its library clauses, so the library exists as it does in a serial compile, and a library in a library clause counts as read. The database version is bumped since parse results have changed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
LarsAsplund
reviewed
Nov 7, 2026
| while another file is compiled into its library, or into a library it reads. NVC locks its libraries and compiles any | ||
| files at the same time. Without ``--parallel-compile``, files are compiled one at a time. | ||
| Files are compiled in parallel with ``-j`` (``--num-compile-threads``), independently of the number of tests ``-p`` | ||
| (``--num-threads`` or ``--num-sim-threads``) runs in parallel. A file is compiled once the files it depends on are |
Collaborator
There was a problem hiding this comment.
runs in parallel -> that runs in parallel
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.
Adds
-j/--num-compile-threads, the number of files compiled in parallel, independent of-p, so files can be compiled with many threads while tests run with few, for example when the simulator takes a license only to simulate. A file is compiled as soon as the files it depends on are compiled.-j 0uses all logical CPUs. The default,-j 1, compiles one file at a time as before.--num-sim-threadsis added as an alias of-p/--num-threads.What was added
Scheduler:
SimulatorInterface.compile_source_filescompiles each file once its dependencies are compiled, using a thread pool. As before, the dependents of a failed file are skipped, and--keep-compilingkeeps going. Without it, no new files start after a failure.Library rule: GHDL and Riviera-PRO update a library's index without locking it.
Unless a simulator sets
supports_concurrent_compiles_into_library, a file is therefore not compiled while its own library is compiled into or read, or while a library it reads is compiled into. The libraries a file reads are those of its dependencies and those named in its library clauses. NVC sets the flag, because it holds a reader/writer lock on its libraries (see NVC performance with Vunit #1036).Library clauses: a library clause fails, in GHDL for example, on a library nothing has been compiled into yet. VUnit now parses library clauses, and a file waits for the first file before it in compile order of each other library it names, so the library exists as it does in a serial compile. A library that comes after the file in compile order fails as it does serially.
GHDL: with gcc coverage, GHDL compiles one file at a time, because the
.gcnofiles land in the working directory.Output: with
-j> 1, each file's output is written once its compile finishes, so outputs don't mix.Measured
A clean compile (
--compile --clean -j N) of hdl-modules, 330 files, wall time including VUnit's start-up, median of 3 runs:-j* With
--keep-compiling, because hdl-modules does not compile completely with Riviera-PRO on master either ('latencyattribute insine_calculator.vhd). Every run compiled the same 327 files.GHDL and Riviera-PRO level off early because almost every file reads
vunit_lib, so the library rule serialises most of the compile. The follow-up #1236, built on this PR, addresses that with--batch-compile, which compiles the files of a library that are ready at the same time in one call, the automatic form of the soft file groups discussed in #1088. With both flags, the clean compile of hdl-modules takes 1.42 s with NVC, 1.64 s with GHDL and 2.66 s with Riviera-PRO.Tested
-pis, and with-jthreads otherwise;--num-sim-threadssets-p.A news fragment is included.
🤖 Generated with Claude Code