Skip to content

scatter and gather are not strict provenance compatible #271

Closed
rust-lang/rust
#95961

Description

@RalfJung

The implementations of gather and scatter in portable-simd currently are not compatible with strict provenance. Specifically, it is SimdConstPtr::wrapping_add that transmutes a vector of pointers to a vector of integers, does integer arithmetic, and then transmutes back the result. It also has safety comments that are somewhat in conflict with what I am writing in rust-lang/rust#95547. ;)

Activity

  1. calebzulawski commented on Apr 3, 2022

    @calebzulawski
    Member

    I think this is easy to fix, we just need a new intrinsic for vector pointer offset

  2. RalfJung commented on Apr 10, 2022

    @RalfJung
    MemberAuthor

    So how would one start fixing this? Add a new simd_offset case around here? Can I just call bx.inbounds_gep with SIMD types?

  3. calebzulawski commented on Apr 10, 2022

    @calebzulawski
    Member

    Yeah, that seems right to me. It might also be possible to implement it in rustc_codegen_ssa?

  4. RalfJung commented on Apr 10, 2022

    @RalfJung
    MemberAuthor

    It might also be possible to implement it in rustc_codegen_ssa?

    Are there other SIMD intrinsics that do that that could be used as a template?

  5. calebzulawski commented on Apr 10, 2022

    @calebzulawski
    Member

    Hmm, I was thinking offsetting pointers is pretty backend-agnostic but I don't see anything similar. It's probably fine putting it in the LLVM backend with all of the other SIMD intrinsics.

  6. added a commit that references this issue on Apr 15, 2022
  7. added 3 commits that reference this issue on Apr 15, 2022
  8. added a commit that references this issue on Apr 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions