-
Notifications
You must be signed in to change notification settings - Fork 269
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
add nvptx vendor intrinsics and initial no_std support #191
Conversation
This looks OK to me. r? @alexcrichton |
@alexcrichton I am not suggesting that we should stabilize Currently compiling CUDA code using Rust requires three unstable features: So... if we were to ever stabilize this... that basically cuts it down to In the mean time this allows those interested to implement and use these intrinsics on unstable rust without having to use @japaric I have tested this by switching the dependency of your |
we don't really need cross to use the nvptx targets though. Emitting NVPTX doesn't require any system library or tool and there's no binary distribution of core for these targets either so Xargo is enough -- provided that you have the target specification file around since these targets are not built-in. (semi on-topic: I'd like to see |
Yes, the problem is not compiling, but running the tests. So what I was thinking is using
Even less on-topic: I'd like to just be able to stamp a But until then a |
Nit: Cargo features should be additive (couldn't find a better link but Steve has mentioned this), so it'd be better to have a |
@mattico thanks, looks better now :) |
@@ -32,3 +32,4 @@ cupid = "0.3" | |||
|
|||
[features] | |||
strict = [] | |||
std = [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should there be default = ["std"]
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought about this, and I think we should settle it before the next release. I've opened #193.
@@ -128,6 +128,10 @@ | |||
cast_possible_truncation, cast_precision_loss, | |||
shadow_reuse, cyclomatic_complexity, similar_names, | |||
doc_markdown, many_single_char_names))] | |||
#![cfg_attr(not(feature = "std"), no_std)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typically this is an unconditional #![no_std]
if a crate is no_std compatible, but I'll send a PR for this.
Is there a URL at which we can point the documentation to as well? Something like Intel's source of truth for these intrinsic definitions? |
@alexcrichton probably the CUDA API docs are the closest thing to that. The problem is that CUDA considers these to be part of the CUDA language, we only see them as intrinsics here because CUDA Rust is not a thing. So I am going to link those there and also link the docs of the LLVM's NVPTX backend but I will mention that these intrinsics are experimental and if you don't know what they do you probably shouldn't be using them. I still think this is pretty exciting. If we get @japaric's https://github.com/japaric/cuda and nvptx libraries to work on top of this, we might one day offer CUDA on stable Rust "as a library" by just stabilizing these. |
stdsimd
does currently not compile as is with#![no_std]
.This PR adds the "nostd" crate feature that enforces
#![no_std]
and ci test to cover this.The only dependency
stdsimd
has onstd
isstd::os::raw::c_void
, which I've worked around by c&pc_void
into thex86
module.Once we merge ARM run-time feature detection it will also get a dependency on
std::fs
. The plan is then to split stdsimd into a core component, and a std component.The
nvptx
intrinsics are always available independently of the architecture, but one can only call them from annvptx
kernel.