Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upTracking issue for SIMD support #27731
Comments
alexcrichton
added
T-libs
B-unstable
labels
Aug 12, 2015
This comment has been minimized.
This comment has been minimized.
|
Note that #26403 may well be a blocker issue for 100% safe + composable SIMD |
This comment has been minimized.
This comment has been minimized.
|
This issue now tracks the |
This comment has been minimized.
This comment has been minimized.
|
Status update: In the compiler:
In https://github.com/huonw/simd:
I'm intending to work on the simd crate first, starting with the rewrite of the autogenerator, but I've currently got a thesis to work on. |
rkruppe
referenced this issue
Feb 14, 2016
Closed
target_feature cfg only obeys `-C target-feature="+feature"` #31662
This comment has been minimized.
This comment has been minimized.
|
@huonw How's the thesis going? :) Any progress on this issue, to relay to those interested in SIMD stabilization? |
This comment has been minimized.
This comment has been minimized.
|
@BurntSushi, @nikomatsakis, and I talked about this recently at the work week, and our thoughts are:
All of this was discussed hopefully with an eye to start the process of stabilization soon-ish, and then we can all get SIMD on stable Rust! cc @eddyb, you likely have many opinions as well! |
This comment has been minimized.
This comment has been minimized.
|
@alexcrichton Ahh, I ignored the multiple-definition option in my recent comment. I am still wary about stabilizing intrinsics, but Other than that, this seems like a good move forward, without the complexities I was worried about. |
This comment has been minimized.
This comment has been minimized.
|
@eddyb hm yeah I'm not sure if |
This comment has been minimized.
This comment has been minimized.
|
There are other useful intrinsics like |
This comment has been minimized.
This comment has been minimized.
|
Oh interesting! I'd be ok punting on those for now in favor of just dealing with the SIMD pieces, but we can relatively easily reevaluate to do something different though. |
This comment has been minimized.
This comment has been minimized.
|
So I had a really interesting conversation with @sunfishcode on the topic of SIMD, and in particular the design of SIMD in WASM. The high-level summary was two points:
Some other interesting points that he raised:
|
This comment has been minimized.
This comment has been minimized.
|
On the topic of intrinsics, I feel overall pretty good about some kind of attribute that can be applied to a However, I feel mildly less good about the generic versions, since these cannot be checked until trans time, which means we have to face two annoying choices:
However, it does seem that there is a third way out: we could remove all support for generic intrinsics, and instead have people define their own traits that map to these operations. For example, today the #[simd_intrinsic(...)]
fn simd_eq<T,U>(t: T, u: T) -> U;
unsafe trait Simd {
type EqType;
}
fn generic_eq<T:Simd>(t: T, u: T) -> T::EqType {
simd_eq(t, t)
}
unsafe impl Simd for u32x4 { ... } // etcIt seems like we could instead do: trait Simd { // no longer an unsafe trait
type EqType;
// we now include a method for the various simd operations we might want to do:
fn eq(x: &Self, y: &Self) -> Self::EqType;
...
}
#[simd_intrinsic]
fn eq_u32x4(x: u32x4, y: u32x4) -> boolx4 {...}
impl Simd for u32x4 {
#[inline(always)]
fn eq(x: &Self, y: &Self) -> Self::EqType {
eq_u32x4(x, y)
}
}I'm probably getting some of the details wrong (have to consult the crate for the precise names involved) but hopefully you get the idea. Basically, the compiler only supports monotype intrinsics, and the wrapper crate adds (using normal trait methods) any generic dispatch needed. |
This comment has been minimized.
This comment has been minimized.
Is there a good reason for making the function recurse into itself? It seems like unnecessary repetition to me. Would a macro like
I agree. This is one of the papercuts of the current state: most of the platform-specific intrinsics are there with their usual names, except for a few basic arithmetic operations, which are |
This comment has been minimized.
This comment has been minimized.
Maybe it's contrived, but casting the function to a function pointer would naturally give you a pointer to a function which contains the intrinsic operation.
There's a very good reason for keeping those that way: they're basic LLVM operations (i.e. |
This comment has been minimized.
This comment has been minimized.
|
Can anyone provide an overview of the status of this? I was talking with someone whose GitHub name I don't know on IRC, and there was some indication that no one is handling further development of this feature. I have enough experience with X86 SIMD that I could probably help. I like @nikomatsakis approach, except that sometimes you need to be able to treat One other possibility that comes to mind now that we're close to it is to finish type-level integers, then make generic intrinsics with declarations like this:
This of course depends on how close we are to having type-level integers, but it should be checkable well before trans in any sane implementation of type-level integers I can think of. Just a thought. |
This comment has been minimized.
This comment has been minimized.
LLVM shuffles don't care what the element types are, and neither do the Rust intrinsics exposing them. |
This comment has been minimized.
This comment has been minimized.
|
@eddyb If you drop the cross-platform shuffles in favor of putting it all in a crate and also drop the weird semi-generic nature of the original RFC, this does indeed become a problem. |
This comment has been minimized.
This comment has been minimized.
|
@camlorn afaik, nobody is carrying this forward, but I would very much like to see progress! I still basically stand by my previous comment, though I think @eddyb suggested (perhaps on IRC) the idea of applying the special attribute directly to the method in the impl, and that seems even better (perhaps just making it a lang item -- it would mean though that this lang item can be applied multiple times). I have no objection to exposing the platform intrinsics explicitly, but it also doesn't seem like a required ingredient. It'd be great to make progress on the wrapper library, and adding in platform-specific names feels orthogonal to me. (Right? This is a bit out of cache.) |
This comment has been minimized.
This comment has been minimized.
|
I'm not exactly sure what's the best next step. Perhaps a new RFC is warranted, just to lay out the plan clearly? At minimum some kind of canonical write-up feels appropriate. Hopefully the changes vis-a-vis today are relatively minimal. |
This comment has been minimized.
This comment has been minimized.
|
@nikomatsakis It seems to me that you could provide only the platform specific intrinsics, get the optimizer doing a good job with eliminating temporary moves, get type-level integers, and then add a As I understand it, we almost have type-level integers. And @pcwalton is working on the needed optimizer stuff. But that said, I have no problem with the original RFC. I started at the bottom of this thread and read up, however, and it seems to me that people are no longer convinced that this is a good way. Perhaps this impression changes once I read the whole thing. |
This comment has been minimized.
This comment has been minimized.
|
@BurntSushi I knew I saw something somewhere! See #27731 (comment) above. |
mfarrugi
referenced this issue
Nov 17, 2016
Closed
implement `#[repr(align)]` (tracking issue for RFC 1358) #33626
This comment has been minimized.
This comment has been minimized.
|
Hate to just jump in out of the blue, but since there hasn't been an update in a while, is there any news on getting simd support in? |
This comment has been minimized.
This comment has been minimized.
|
@jonathandturner No big updates, but @BurntSushi continues to plug away at it. If he follows his typical pattern, one morning he'll show up, open a massive, beautiful PR, and we'll be totally set :-) |
Ms2ger
referenced this issue
Jun 29, 2017
Open
Tracking: Unstable Rust feature gates used by Servo #5286
Mark-Simulacrum
added
the
C-tracking-issue
label
Jul 22, 2017
alexcrichton
added
the
A-simd
label
Sep 25, 2017
SimonSapin
added a commit
to SimonSapin/stdsimd
that referenced
this issue
May 24, 2018
SimonSapin
referenced this issue
May 24, 2018
Merged
Make SIMD tracking issue marked for `stdsimd` too #460
gnzlbg
added a commit
to rust-lang-nursery/stdsimd
that referenced
this issue
May 24, 2018
This comment has been minimized.
This comment has been minimized.
|
FYI this issue is a bit of a dumping ground for SIMD features that we don't know what to do with yet.
I don't think it is worth it to clean up this issue. As parts of the above get proposed for stabilization they will get their own tracking issues. The only thing that might be worth doing is splitting |
This comment has been minimized.
This comment has been minimized.
|
@gnzlbg want to file some follow-up tracking issues and re-point unstable features to the focused tracking issues? Agreed that this tracking issue isn't really serving much purpose nowadays! |
alexcrichton commentedAug 12, 2015
This is a tracking issue for the unstable
core_simdfeature in the standard library. SIMD support is quite a thorny topic, but it's largely covered in rust-lang/rfcs#1199, being implemented in #27169, and @huonw will be creating an external crate for full-fledged SIMD support.cc @huonw