8000 [docs] Document the `unroll_for!` expression in the DSLX reference by amalsaidov · Pull Request #5334 · google/xls · GitHub
[go: up one dir, main page]

Skip to content

[docs] Document the unroll_for! expression in the DSLX reference - #5334

Closed
amalsaidov wants to merge 1 commit into
google:mainfrom
amalsaidov:docs-unroll-for
Closed

amalsaidov wants to merge 1 commit into
google:mainfrom
amalsaidov:docs-unroll-for

Conversation

@amalsaidov
Copy link
Copy Markdown

What

Adds documentation for the unroll_for! expression to the DSLX reference
(docs_src/dslx_reference.md), in a new section next to the existing for
expression section.

Why

Fixes #1708. unroll_for! is listed in the DSLX keyword table and is
used throughout the tutorials (e.g. how_to_use_procs.md) and modules, but it
had no reference documentation under
https://google.github.io/xls/dslx_reference/.

Details

The new section follows the structure and style of the adjacent for
documentation (prose + Syntax + Examples) and covers:

  • That it is a counted loop fully unrolled at compile time (one specialized copy
    of the body per iteration), so the iteration count must be known at compile
    time.
  • That, like for, it is an expression that evolves an accumulator and
    evaluates to its final value, using the same trailing-argument syntax.
  • That the constexpr loop index is what enables uses a regular for cannot:
    spawning procs, indexing arrays of channels, and building unique assert_fmt!
    labels (with a pointer to the Procs tutorial).

Semantics were drawn from the frontend AST (ConstFor / unroll_for!) and
existing usages in the tree. Docs only; no behavior change.

🤖 Generated with Claude Code

`unroll_for!` appears in the DSLX keyword table and is used throughout the
tutorials and modules, but it was never documented in the DSLX reference.

Add an `unroll_for!` section next to the `for` expression section describing
its compile-time full-unrolling semantics, how it evolves an accumulator like
`for`, the constexpr loop index that enables proc spawning / channel-array
indexing / `assert_fmt!` labels, its syntax, and examples.

Docs only; no behavior change.

Fixes google#1708

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@google-cla
google-cla Bot commented Nov 10, 2026
Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@grebe
grebe commented Nov 11, 2026
Copy link
Copy Markdown
Contributor

Seems duplicative of #5234

@amalsaidov
Copy link
Copy Markdown
Author

Closing this one on my side — thanks for taking a look 🙏

@amalsaidov amalsaidov closed this Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

unroll_for! is not documented

2 participants

0