unrolled(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ NAME ✨

okay bestie, meet unrolled(9) β€” the Kernel API Manual page for loop attributes that literally ask the compiler to unroll your loop πŸ’…. It's filed under unrolled, and its whole personality is: loop attributes to ask the compiler to unroll it. Slay.

🌸 SYNOPSIS 🌸

unrolled

πŸ¦‹ DESCRIPTION πŸ¦‹

Here's the usage, bestie β€” copy-paste energy:

#define BATCH 8

unrolled_count(BATCH) for (u32 i = 0; i < BATCH; i++) // loop body
without cross-iteration dependencies

So yeah: unrolled_count(BATCH) goes right before that for loop, and the loop body is the no-cross-iteration-dependencies vibe. πŸ‘‘

⚠️ plot twist: this is only a hint. The compiler is free to disable unrolling if it thinks the count is suboptimal and may hurt performance and/or hugely increase object code size. No cap β€” it can ghost your unroll 😭.

Not having any cross-iteration dependencies β€” i.e. when iter x + 1 depends on what iter x will do with variables β€” is not a strict requirement, but it provides best performance and object code size. That's the highkey ideal scenario ✨.

🌈 Available only on Clang and GCC 8.x onwards. If your compiler is older, this is not the vibe.

πŸ’œ SEE ALSO πŸ’œ

Kernel file ./include/linux/unroll.h β€” go peek, bestie 🫢.


made with πŸ’– from ./include/linux β€” October 2026 β€” unrolled(9) out πŸ’…

πŸ“¦ where this page comes from