Skip to content

fix: filelist and build threads#96

Open
Makiras wants to merge 2 commits into
masterfrom
agent/fix-filelist-build-threads
Open

fix: filelist and build threads#96
Makiras wants to merge 2 commits into
masterfrom
agent/fix-filelist-build-threads

Conversation

@Makiras

@Makiras Makiras commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Description

This PR fixes RTL filelist handling and adds control over generated-project build parallelism.

The RTL parser now excludes .so, .a, and .o linker inputs before passing filelists to slang. These files
remain in the generated simulator filelist, so they are still available to Verilator, VCS, and UVS during
compilation and linking.

This PR also adds the -j,--build-threads export option:

  • A positive value limits the parallelism used when building generated projects.
  • The configured value is propagated to DUT and language-wrapper Makefiles.
  • A value of 0, which is the default, continues to use all available CPU cores.
  • Users can still override the generated value with make NPROC=<value>.

No additional dependencies are required.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

The following checks were performed:

  • Built Picker with 16 parallel build jobs:
    cmake --build build --target picker -j16
  • Ran the slang RTL parser unit test:
    ctest --test-dir build -R '^test_parser_sv_unit$' --output-on-failure
  • Ran the export filelist integration test:
    bash test/scripts/test_export_filelist.sh
  • Verified that --build-threads 3 renders export NPROC := 3.
  • Verified that the default value renders automatic CPU detection.
  • Verified that negative build-thread values are rejected.
  • Added coverage confirming .so, .a, and .o are ignored by slang but retained in generated simulator
    filelists.

test_codegen_filelist encounters an existing path-string assertion on this environment because /tmp/ picker_test_filelist/ and /tmp/picker_test_filelist differ only by a trailing slash. This occurs before the
newly added linker-input assertions and is unrelated to this change.

Test Configuration:

  • Firmware version: N/A
  • Hardware: x86_64
  • Toolchain: C++20, CMake/Ninja, slang v11
  • SDK: N/A

Checklist:

  • My code follows the style guidelines of this project
  • I have added the appropriate labels
  • I have performed a self-review of my code
  • I have commented my code where additional explanation is required
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Copilot AI review requested due to automatic review settings July 15, 2026 08:47
@Makiras Makiras added the bug Something isn't working label Jul 15, 2026

Copilot AI left a comment

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.

Pull request overview

This PR improves Picker’s export flow by (1) making the SystemVerilog parsing step robust to linker artifacts present in RTL filelists, and (2) adding a user-facing --build-threads option to control parallelism when building generated projects (propagated through generated Makefiles).

Changes:

  • Exclude .so, .a, and .o entries from slang’s RTL parsing inputs while keeping them in generated simulator filelists.
  • Add -j,--build-threads to picker export, plumb it through codegen, and propagate it via NPROC in generated Makefiles.
  • Add/extend tests and documentation covering both the filelist behavior and the new build-parallelism option.

Reviewed changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/parser/sv.cpp Adds slang driver args to exclude linker-input extensions during RTL parsing.
test/test_parser_sv_unit.cpp Adds a unit test ensuring .so/.a/.o in filelists don’t break RTL parsing.
test/test_codegen_filelist.cpp Adds assertions that generated filelists still include .so/.a/.o entries.
include/type.hpp Extends export_opts with build_threads.
src/picker.cpp Adds -j,--build-threads CLI option with validation and default.
src/codegen/lib.cpp Renders __BUILD_THREADS__ for templates (numeric or auto-detect).
template/lib/Makefile Exports NPROC from the generated project root based on __BUILD_THREADS__.
template/{python,cpp,java,scala,golang,lua}/Makefile Switches NPROC to conditional assignment so exported NPROC can override.
test/scripts/test_export_filelist.sh Extends integration test to validate NPROC propagation into generated Makefiles.
README.md Documents the new --build-threads option in the export help snippet.
README.zh.md Documents the new --build-threads option in Chinese documentation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants