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

Portable SIMD Project Group #4

Open
KodrAus opened this issue Sep 18, 2020 · 7 comments
Open

Portable SIMD Project Group #4

KodrAus opened this issue Sep 18, 2020 · 7 comments
Labels
project-group An active project group T-libs Relevant to the libraries subteam, which will review and decide on the PR/issue.

Comments

@KodrAus
Copy link
Contributor

KodrAus commented Sep 18, 2020

Summary

Produce a portable SIMD API, exposed through a new std::simd (and core::simd) module in the standard library in the same manner as stdarch. The output of this project group will be the finalization of RFC 2948 and stabilization of std::simd.

Info

What is this issue?

This issue represents an active project group. It is meant to be used for
the group to post updates to the libs team (and others) in a lightweight
fashion. Please do not use the comments here for discussion, that should be kept
in the Zulip stream (discussion comments here will be marked as off-topic).

@KodrAus KodrAus added T-libs Relevant to the libraries subteam, which will review and decide on the PR/issue. project-group An active project group labels Sep 18, 2020
@KodrAus
Copy link
Contributor Author

KodrAus commented Sep 23, 2020

Portable SIMD 2020-09-22 Meeting

tags: Portable SIMD Minutes

https://rust-lang.zulipchat.com/#narrow/stream/257879-project-portable-simd/topic/2020-09-21.20meeting

Summary

Where does the code live?

  • rust-lang/stdarch exists independently of rust-lang/rust for historical reasons. It has a lot of CI infra that we'd probably also need for std::simd.
  • rust-lang/rust can be difficult to work on directly, we'd rather at least start externally.
  • Complex CI infra might keep std::simd independent of rust-lang/rust. It means updating std::simd needs a PR to update the submodule.

Announcement post

  • We'd like to wait until we have the repo set up with a Hello, SIMD! before we post the announcement.
  • People have opionions about SIMD so we're expecting interest.

Nomenclature

  • It's worth being accurate and accessible with the language we use when talking about SIMD.
  • Do we call them intrinsics, operations, intrinsic functions?
  • We'd like to develop some resources to help newcomers understand what SIMD is all about.

Are we looking at length-agnostic APIs?

  • OpenMP has omp simd reduction directives for vectorization hints.
  • There's also ARM SVE (Scalable Vector Extensions) but those probably won't be supported in Rust for a while because they use "magic" unsized types.

Outcomes

  1. Finish working over the announcement, it's not going out today. try to post it to rust-lang?
  2. Build out a repo for std::simd, overwhelming preference is to have it outside rust-lang/rust for now.
  3. Figure out our own project group repo and get some "Hello, SIMD!" intro on it. Scratch space: https://hackmd.io/T-cUNypRRUKGVBGlzr5fNA
  4. finish bikeshedding on "what do we call intrinsics?"
  5. address the packed_simd maintenance question
  6. same time next week? Or in 2 weeks?

@KodrAus
Copy link
Contributor Author

KodrAus commented Oct 6, 2020

Portable SIMD 2020-10-05 Meeting

tags: Portable SIMD Minutes

https://rust-lang.zulipchat.com/#narrow/stream/257879-project-portable-simd/topic/2020-10-05.20meeting

Summary

Testing

  • There are a lot of moving parts in a portable SIMD API we need to test. There's a bit of a state explosion to manage to make sure everything actually does work portably.
  • Using property testing and fuzzing is something we'd like to do. quickcheck has been used in the past for sanity-checking SIMD code, but wasn't enough on its own.
  • With a good set of edge-case inputs we can probably cover a lot of interesting cases without a lot of test infrastructure.

Contributing docs

  • People want to get on board and help out, but it's not totally clear how they can yet. We need some more docs and coordination of work that's up-for-grabs.

Runtime detection

  • This one comes up pretty regularly, and is currently considered out-of-scope for an initial release.
  • We don't want to paint ourselves into a corner and not be able to add it, but don't want to commit to it beyond existing #[target_feature] support in core::arch.
  • We need to communicate what is and isn't in-scope better.

Julia

  • Julia's portable SIMD API is considered very good, but quite high-level. They have some interesting test cases we should look at.

Shuffles

  • We don't actually have a concrete design for shuffles yet, besides wanting to use const generics for the indexes. There's a bug in Miri where invalid const indexes are UB instead of compile errors.

Portable nomenclature

  • We're feeling the need to come up with consistent and portable terms to discuss SIMD. There's a lot of vendor-specific stuff to try abstract over.

Outcomes

  1. Don't quickcheck yet (but proptest/hypothesis maybe later?)
    • focus on edge case testing and parameterization
  2. We need to lay out a welcome mat for stdsimd as well.
    • a CONTRIBUTING.md
    • links to Zulip, FAQ, etc.
    • Lokathor has volunteered to help chunk issues

@KodrAus
Copy link
Contributor Author

KodrAus commented Oct 14, 2020

Portable SIMD 2020-10-12 Meeting

tags: Portable SIMD Minutes

https://rust-lang.zulipchat.com/#narrow/stream/257879-project-portable-simd/topic/2020-10-12.20meeting

Summary

Compiler bug on RISCV

  • We've hit an issue with broken LLVM intrinsics with SIMD FFI on riscv64gc. It's a compiler bug.
  • We can't ship on nightly until it's fixed. It's raised a few questions:
    • How do we deal with compiler bugs that are bound to pop up on various platforms?
    • What is our plan for getting stdsimd in the mainline?

For how we deal with compiler bugs:

  • Raise them as ICEs as normal
  • For RISCV since it's pretty much the whole target that doesn't work we'll just exclude it for now until the ICE is fixed up
  • Once the source is part of rust-lang/rust these kinds of issues should be caught

For our plan for getting stdsimd in the mainline:

  • Let users depend on it directly as a Git dependency for now
  • Release on crates.io
  • Submodule it in to rust-lang/rust as an unstable API

Outcomes

  • We are definitely disabling RISCV for now, but this blocks us adding the crate to nightly.
  • OPINIONS! "Minimize bloat on the f32x4 (etc.) type please, the masks are fine." Also apparently horizontal ops are really bad.

@KodrAus
Copy link
Contributor Author

KodrAus commented Oct 26, 2020

Portable SIMD 2020-10-26 Meeting

tags: Portable SIMD Minutes

https://rust-lang.zulipchat.com/#narrow/stream/257879-project-portable-simd/topic/meeting.202020-10-26

Summary

What's blocking us from nightly?

  • Cranelift: Try kick off a MCP in T-compiler for portable SIMD intrinsics in rustc to abstract us from a future Cranelift backend.
  • riscv64gc: Still generating invalid code for riscv64gc, but we're not sure if it's actually an issue with that target or not. It needs some more investigation work. So far we've just been checking it using cargo cross.

Floating points

  • Floating points are a bit of a mess and Portable SIMD is exposed to all of it. It looks like there's a separate project in nailing down our floating point story in Rust.
  • We should also figure out what Portable SIMD needs at a minimum as a foundation for its API.

@KodrAus
Copy link
Contributor Author

KodrAus commented Nov 9, 2020

Portable SIMD 2020-11-09 Meeting

tags: Portable SIMD Minutes

https://rust-lang.zulipchat.com/#narrow/stream/257879-project-portable-simd/topic/Meeting.202020-11-09

Summary

Masks

rust-lang/portable-simd#44

  • There are some compilation errors in the tests right now to fix up.
  • We spent a while before opening the PR discussing designs for the masks API. This PR uses opaque types to represent them.
  • We might want to come up with alternatives based on the experience of using this approach.

Wiring up backend-agnostic intrinsics

rust-lang/compiler-team#381

  • MCP is updated with some more detail and is ready for more t-compiler input.
  • We're generally happy with the approach, even if it uses more concrete machinery than we'd really like. Alternatives have big open design spaces to explore, where this is fairly well constrained.

Allowing #[repr(simd)] on A([T; N])

rust-lang/rust#78863

  • The original PR has been rebased.
  • There are some codegen issues that we might need to spend some time investigating.

packed_simd

  • No obvious issues that need to be raised right now.

@KodrAus
Copy link
Contributor Author

KodrAus commented Nov 17, 2020

Portable SIMD 2020-11-16 Meeting

https://rust-lang.zulipchat.com/#narrow/stream/257879-project-portable-simd/topic/Meeting.202020-11-16

tags: Portable SIMD Minutes

Outcomes

  • Try break #[repr(simd)] with [T; N].
  • Finalize and merge Feature/comparisons portable-simd#44
  • See if we can implement floor, ceil, round, truncate intrinsics to remove direct dependency on LLVM from core::simd.

Summary

  • Allowing #[repr(simd)] with [T; N] has been approved and should merge soon!
  • We're considering leaning on const generics a bit more for the API now that we could do that with less macro-magic.
  • We don't want to go down exactly the same road as packed_simd with its Simd<T> and type aliases. It was limited by the tools that were available at the time though.
  • We may want something like vf32<const N: usize> instead of a generic Simd<f32, const N: usize> or our current f32xN.
  • We can get everything implemented and in nightly in some form and then revisit this.

@KodrAus
Copy link
Contributor Author

KodrAus commented Feb 11, 2021

Portable SIMD 2021-02-08 Meeting

tags: Portable SIMD Minutes

Summary

Immediate Goals

  • audit our API for necessities
  • initially launching to the core_simd_arithmetic feature flag

Later Goals

  • internal work on rustc to add SIMD support
  • maybe "static shuffles" (interleave, etc.)?
    • find out what users want
  • simd trig

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
project-group An active project group T-libs Relevant to the libraries subteam, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

1 participant