JuliaSIMD / JuliaSIMD/LoopVectorization.jl

Turbo precondition checks

Open
#286 4 comments 1 reaction 0 assignees View on GitHub
Dominant language
Julia
Stars
789
Forks
73
PR merge metrics
No merged PRs in 30d

Description

The readme warns

> We expect that any time you use the `@turbo` macro with a given block of code that you:
>
> Are not indexing an array out of bounds. `@turbo` does not perform any bounds checking.
> Are not iterating over an empty collection. Iterating over an empty loop such as for i ∈ eachindex(Float64[]) is undefined behavior, and will likely result in the out of bounds memory accesses. Ensure that loops behave correctly.
> Are not relying on a specific execution order. `@turbo` can and will re-order operations and loops inside its scope, so the correctness cannot depend on a particular order. You cannot implement cumsum with `@turbo`.
> Are not using multiple loops at the same level in nested loops.

The docs also warn

> Broadcasting an Array A when size(A,1) == 1 is NOT SUPPORTED, unless this is known at compile time (e.g., broadcasting a transposed vector is fine).

I assume turbo can't check these preconditions at runtime for performance reasons. During testing and debugging, I want to check the preconditions. Is it possible to enable these checks in a certain mode?

I count five checks. Are some of them more costly than others?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.