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

RFC: SIMD vectors in FFI #2574

Merged
merged 8 commits into from Jul 28, 2019
Merged

RFC: SIMD vectors in FFI #2574

merged 8 commits into from Jul 28, 2019

Conversation

gnzlbg
Copy link
Contributor

@gnzlbg gnzlbg commented Oct 23, 2018

This RFC allows using architecture-specific vector types like core::arch::x86_64::__m128 in C FFI.

Rendered.
Tracking issue

@gnzlbg gnzlbg changed the title Initial simd_ffi RFC RFC: SIMD in FFI Oct 23, 2018
@gnzlbg gnzlbg changed the title RFC: SIMD in FFI RFC: SIMD vectors in FFI Oct 23, 2018
@Centril Centril added T-lang Relevant to the language team, which will review and decide on the RFC. T-compiler Relevant to the compiler team, which will review and decide on the RFC. labels Oct 23, 2018
text/0000-simd-ffi.md Outdated Show resolved Hide resolved
text/0000-simd-ffi.md Outdated Show resolved Hide resolved
text/0000-simd-ffi.md Outdated Show resolved Hide resolved
text/0000-simd-ffi.md Outdated Show resolved Hide resolved
text/0000-simd-ffi.md Outdated Show resolved Hide resolved
@Centril Centril added A-simd SIMD related proposals & ideas A-ffi FFI related proposals. A-typesystem Type system related proposals & ideas labels Nov 22, 2018
@joshtriplett
Copy link
Member

This seems like a straightforward, reasonable change.

@rfcbot merge

@rfcbot
Copy link
Collaborator

rfcbot commented Mar 16, 2019

Team member @joshtriplett has proposed to merge this. The next step is review by the rest of the tagged team members:

No concerns currently listed.

Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!

See this document for info about what commands tagged team members can give me.

@rfcbot rfcbot added proposed-final-comment-period Currently awaiting signoff of all team members in order to enter the final comment period. disposition-merge This RFC is in PFCP or FCP with a disposition to merge it. labels Mar 16, 2019
@oli-obk
Copy link
Contributor

oli-obk commented Mar 16, 2019

@rfcbot reviewed

text/0000-simd-ffi.md Outdated Show resolved Hide resolved
text/0000-simd-ffi.md Outdated Show resolved Hide resolved
text/0000-simd-ffi.md Outdated Show resolved Hide resolved
@Centril
Copy link
Contributor

Centril commented Mar 27, 2019

@gnzlbg Thanks! The implementation in rust-lang/rust#59238 doesn't seem all that complex so therefore:

@rfcbot reviewed

@gnzlbg
Copy link
Contributor Author

gnzlbg commented Jul 16, 2019

ping @Zoxc @varkor @withoutboats

@rfcbot
Copy link
Collaborator

rfcbot commented Jul 17, 2019

🔔 This is now entering its final comment period, as per the review above. 🔔

@rfcbot rfcbot added the final-comment-period Will be merged/postponed/closed in ~10 calendar days unless new substational objections are raised. label Jul 17, 2019
@rfcbot rfcbot removed the proposed-final-comment-period Currently awaiting signoff of all team members in order to enter the final comment period. label Jul 17, 2019
@Zoxc
Copy link

Zoxc commented Jul 19, 2019

Are architecture-specific vector types always passed in the vector registers in C ABIs or is that an x86-ism? I know ARM has lots of interesting ABI stuff.

@comex
Copy link

comex commented Jul 21, 2019

I checked whether a few architectures pass vector arguments in registers:

  • ARM does: link
  • Power does: link (section 2.2.3)
  • MIPS does not: link (section 5.2.4)

(But ARM also has older "soft float" ABIs that don't even use floating-point registers when passing arguments, let alone SIMD registers.)

@gnzlbg
Copy link
Contributor Author

gnzlbg commented Jul 23, 2019

Are architecture-specific vector types always passed in the vector registers in C ABIs or is that an x86-ism?

How vector types are passed depends on the ABI used. One could define an x86 ABI that doesn't pass vectors in registers, and in fact, the "Rust ABI" is such an ABI since it currently passes vectors by memory on x86.


FWIW this RFC does not propose always using vector registers on C FFI. Instead, it proposes passing them to C using the ABI of the target, whatever that might be. For doing that correctly, we do need to know whether the type being passed to C is a vector type, its element type, and length, because in most widely used platform ABIs those things will determine which vector register to use.

@rfcbot
Copy link
Collaborator

rfcbot commented Jul 27, 2019

The final comment period, with a disposition to merge, as per the review above, is now complete.

As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed.

The RFC will be merged soon.

@rfcbot rfcbot added finished-final-comment-period The final comment period is finished for this RFC. and removed final-comment-period Will be merged/postponed/closed in ~10 calendar days unless new substational objections are raised. labels Jul 27, 2019
@Centril Centril merged commit 638af43 into rust-lang:master Jul 28, 2019
@Centril
Copy link
Contributor

Centril commented Jul 28, 2019

Huzzah! This RFC has been merged!

Tracking issue: rust-lang/rust#63068

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ffi FFI related proposals. A-simd SIMD related proposals & ideas A-typesystem Type system related proposals & ideas disposition-merge This RFC is in PFCP or FCP with a disposition to merge it. finished-final-comment-period The final comment period is finished for this RFC. T-compiler Relevant to the compiler team, which will review and decide on the RFC. T-lang Relevant to the language team, which will review and decide on the RFC.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants