diff options
author | Alexander Lobakin <aleksander.lobakin@intel.com> | 2025-02-06 19:26:26 +0100 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2025-02-10 17:54:43 -0800 |
commit | c6594d64271704b335378e7b74c39fe4d4fcc777 (patch) | |
tree | 8bfd5baec9b16021b300ef7e8dd96734a7811a72 /scripts/generate_rust_analyzer.py | |
parent | 5b281fe7e396c519914863c5de5ce3a3f9cffd5b (diff) |
unroll: add generic loop unroll helpers
There are cases when we need to explicitly unroll loops. For example,
cache operations, filling DMA descriptors on very high speeds etc.
Add compiler-specific attribute macros to give the compiler a hint
that we'd like to unroll a loop.
Example usage:
#define UNROLL_BATCH 8
unrolled_count(UNROLL_BATCH)
for (u32 i = 0; i < UNROLL_BATCH; i++)
op(priv, i);
Note that sometimes the compilers won't unroll loops if they think this
would have worse optimization and perf than without unrolling, and that
unroll attributes are available only starting GCC 8. For older compiler
versions, no hints/attributes will be applied.
For better unrolling/parallelization, don't have any variables that
interfere between iterations except for the iterator itself.
Co-developed-by: Jose E. Marchesi <jose.marchesi@oracle.com> # pragmas
Signed-off-by: Jose E. Marchesi <jose.marchesi@oracle.com>
Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Signed-off-by: Alexander Lobakin <aleksander.lobakin@intel.com>
Link: https://patch.msgid.link/20250206182630.3914318-2-aleksander.lobakin@intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'scripts/generate_rust_analyzer.py')
0 files changed, 0 insertions, 0 deletions