Skip to content

Wire NVDLA dev-mode RTL regeneration into Bazel #67

@mguthaus

Description

@mguthaus

Background

Every design in HighTide has two RTL sources selectable at build time:

  • Release — pre-generated Verilog committed into the repo (default, fast, offline).
  • Dev — RTL regenerated from upstream via designs/src/<design>/dev/setup.sh, opt-in via bazel build --define update_rtl=true.

The switch is a select() on //:update_rtl inside each design's BUILD.bazel, backed by a rtl_dev_gen genrule that invokes setup.sh.

For NVDLA (added in #68), the rtl alias currently points at :rtl_release unconditionally. --define update_rtl=true has no effect on NVDLA — regenerating its RTL from upstream still requires running designs/src/NVDLA/dev/setup.sh manually and committing the result.

Why it wasn't done in the first PR

  1. 423-file output. A Bazel genrule must enumerate every outs = [...] up front. NVDLA produces a 423-file vmod/ tree, versus one .v file for cnn / NyuziProcessor.
  2. Heavyweight toolchain. setup.sh installs JDK 11, OpenSSL 1.0.2u, Perl 5.10.1, Python 2.7.18, and SystemC 2.3.0 from source, then runs NVIDIA's tmake for hours. Not friendly to a hermetic Bazel action (needs network, large disk, internal caching that fights Bazel's).

Options

  • (a) Tarball output + extraction rule. rtl_dev_gen produces a single vmod.tar, a second rule extracts into a per-build tree. Bazel stays happy about declared outputs; NVDLA's generator doesn't need to learn file lists.
  • (b) Generated srcs.bzl listing outputs (the bp_processor pattern). setup.sh emits dev/generated/srcs.bzl as a side-effect of its run; the genrule declares those paths. Requires srcs.bzl to be committed alongside the generated tree.
  • (c) Keep release-only, document the manual refresh workflow. Status quo.

Acceptance

  • bazel build --define update_rtl=true //designs/asap7/NVDLA/partition_a:partition_a_final regenerates the RTL from the pinned upstream submodule and builds cleanly.
  • Manual refresh path (designs/src/NVDLA/dev/setup.sh + commit) still works for CI/baseline refreshes.
  • Document the chosen approach in designs/src/NVDLA/README.md (or CLAUDE.md) alongside the existing dev-mode section.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions