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

scatter and gather are not strict provenance compatible #271

Closed
RalfJung opened this issue Apr 3, 2022 · 5 comments · Fixed by rust-lang/rust#95961
Closed

scatter and gather are not strict provenance compatible #271

RalfJung opened this issue Apr 3, 2022 · 5 comments · Fixed by rust-lang/rust#95961

Comments

@RalfJung
Copy link
Member

RalfJung commented Apr 3, 2022

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. ;)

@calebzulawski
Copy link
Member

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

@RalfJung
Copy link
Member Author

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?

@calebzulawski
Copy link
Member

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

@RalfJung
Copy link
Member Author

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?

@calebzulawski
Copy link
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.

fee1-dead added a commit to fee1-dead-contrib/rust that referenced this issue Apr 15, 2022
…ubilee

implement SIMD gather/scatter via vector getelementptr

Fixes rust-lang/portable-simd#271

However, I don't *really* know what I am doing here... Cc `@workingjubilee` `@calebzulawski`

I didn't do anything for cranelift -- `@bjorn3` not sure if it's okay for that backend to temporarily break. I'm happy to cherry-pick a patch that adds cranelift support. :)
RalfJung added a commit to RalfJung/rust that referenced this issue Apr 15, 2022
…ubilee

implement SIMD gather/scatter via vector getelementptr

Fixes rust-lang/portable-simd#271

However, I don't *really* know what I am doing here... Cc ``@workingjubilee`` ``@calebzulawski``

I didn't do anything for cranelift -- ``@bjorn3`` not sure if it's okay for that backend to temporarily break. I'm happy to cherry-pick a patch that adds cranelift support. :)
RalfJung added a commit to RalfJung/rust that referenced this issue Apr 15, 2022
…ubilee

implement SIMD gather/scatter via vector getelementptr

Fixes rust-lang/portable-simd#271

However, I don't *really* know what I am doing here... Cc ```@workingjubilee``` ```@calebzulawski```

I didn't do anything for cranelift -- ```@bjorn3``` not sure if it's okay for that backend to temporarily break. I'm happy to cherry-pick a patch that adds cranelift support. :)
RalfJung added a commit to RalfJung/rust that referenced this issue Apr 15, 2022
…ubilee

implement SIMD gather/scatter via vector getelementptr

Fixes rust-lang/portable-simd#271

However, I don't *really* know what I am doing here... Cc `@workingjubilee` `@calebzulawski`

I didn't do anything for cranelift -- `@bjorn3` not sure if it's okay for that backend to temporarily break. I'm happy to cherry-pick a patch that adds cranelift support. :)
workingjubilee pushed a commit to tcdi/postgrestd that referenced this issue Sep 15, 2022
implement SIMD gather/scatter via vector getelementptr

Fixes rust-lang/portable-simd#271

However, I don't *really* know what I am doing here... Cc ``@workingjubilee`` ``@calebzulawski``

I didn't do anything for cranelift -- ``@bjorn3`` not sure if it's okay for that backend to temporarily break. I'm happy to cherry-pick a patch that adds cranelift support. :)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants