Skip to content

Commit

Permalink
clarify why not to use static / non-local vector initializers
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 623784403
  • Loading branch information
jan-wassenberg authored and copybara-github committed Apr 11, 2024
1 parent f577f98 commit 9900c94
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,11 @@ be prefixed with `HWY_ATTR`, OR reside between `HWY_BEFORE_NAMESPACE()` and
`HWY_AFTER_NAMESPACE()`. Lambda functions currently require `HWY_ATTR` before
their opening brace.

Do not use namespace-scope nor `static` initializers for SIMD vectors because
this can cause SIGILL when using runtime dispatch and the compiler chooses an
initializer compiled for a target not supported by the current CPU. Instead,
constants initialized via `Set` should generally be local (const) variables.

The entry points into code using Highway differ slightly depending on whether
they use static or dynamic dispatch. In both cases, we recommend that the
top-level function receives one or more pointers to arrays, rather than
Expand Down

0 comments on commit 9900c94

Please sign in to comment.