Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@simd is unsound #26976

Open
Keno opened this issue May 4, 2018 · 2 comments
Open

@simd is unsound #26976

Keno opened this issue May 4, 2018 · 2 comments
Labels
compiler:codegen Generation of LLVM IR and native code compiler:simd instruction-level vectorization

Comments

@Keno
Copy link
Member

Keno commented May 4, 2018

The @simd macro works by attach metadata to an instruction in the current insert block and then enabling unsafe algebra (amongst other things) on all instructions contained within the loop (as determined by LLVM). The problem with this is that the annotation runs after an initial round of LLVM optimizations, so LLVM's notion of the containing loop may not match the loop annotated by @simd. A better design would explicitly demarcate the loop body (e.g. by a pair of markers) and limit modifications to that region.

Keno added a commit that referenced this issue May 4, 2018
Previously the simdloop marker was metadata on a random add instruction in the loop.
This is problematic if that add instruction gets moved around or folded by an earlier
optimization pass. Switching to using an explicit marker instruction. Eventually we
should do something different here to address #26976. This just makes it more robust
to make sure it keeps working with the new optimizer.
Keno added a commit that referenced this issue May 5, 2018
Previously the simdloop marker was metadata on a random add instruction in the loop.
This is problematic if that add instruction gets moved around or folded by an earlier
optimization pass. Switching to using an explicit marker instruction. Eventually we
should do something different here to address #26976. This just makes it more robust
to make sure it keeps working with the new optimizer.
Keno added a commit that referenced this issue May 6, 2018
Previously the simdloop marker was metadata on a random add instruction in the loop.
This is problematic if that add instruction gets moved around or folded by an earlier
optimization pass. Switching to using an explicit marker instruction. Eventually we
should do something different here to address #26976. This just makes it more robust
to make sure it keeps working with the new optimizer.
Keno added a commit that referenced this issue May 6, 2018
Previously the simdloop marker was metadata on a random add instruction in the loop.
This is problematic if that add instruction gets moved around or folded by an earlier
optimization pass. Switching to using an explicit marker instruction. Eventually we
should do something different here to address #26976. This just makes it more robust
to make sure it keeps working with the new optimizer.
@JeffBezanson JeffBezanson added the compiler:codegen Generation of LLVM IR and native code label May 7, 2018
@KristofferC
Copy link
Sponsor Member

Fixed by #26985?

@Keno
Copy link
Member Author

Keno commented May 21, 2018

No, that was just a bandaid.

@mbauman mbauman added the compiler:simd instruction-level vectorization label Jun 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler:codegen Generation of LLVM IR and native code compiler:simd instruction-level vectorization
Projects
None yet
Development

No branches or pull requests

4 participants