-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
NVPTX: non-inlined functions can't be used cross crate #38787
Comments
This is another problem that would be solved by MIR-only rlibs. |
@michaelwoerister Indeed! Is there an issue tracking progress on that? Or do you know what's the status? (Is it blocked by anything?) |
I don't think we have a tracking issue for that. We might need an RFC for it too. |
Looks like we need to link the libs, but for me Could it be an option to introduce new linker that will have a behaviour of Sure, we don't really have to call these 2 commands (from the host environment), we could just call LLVM through ffi. |
@denzp Sounds like a plan to me. It also sounds like this can be prototyped out of tree without modifying the compiler. If it works then it sounds like we should land the llvm-link + llc approach in rustc because using external commands could fail if the external llvm-link / llc doesn't match rustc's LLVM version. |
NVPTX target specification This change adds a built-in `nvptx64-nvidia-cuda` GPGPU no-std target specification and a basic PTX assembly smoke tests. The approach is taken here and the target spec is based on `ptx-linker`, a project started about 1.5 years ago. Key feature: bitcode object files being linked with LTO into the final module on the linker's side. Prior to this change, the linker used a `ld` linker-flavor, but I think, having the special CLI convention is a more reliable way. Questions about further progress on reliable CUDA workflow with Rust: 1. Is it possible to create a test suite `codegen-asm` to verify end-to-end integration with LLVM backend? 1. How would it be better to organise no-std `compile-fail` tests: add `#![no_std]` where possible and mark others as `ignore-nvptx` directive, or alternatively, introduce `compile-fail-no-std` test suite? 1. Can we have the `ptx-linker` eventually be integrated as `rls` or `clippy`? Hopefully, this should allow to statically link against LLVM used in Rust and get rid of the [current hacky solution](https://github.com/denzp/rustc-llvm-proxy). 1. Am I missing some methods from `rustc_codegen_ssa::back::linker::Linker` that can be useful for bitcode-only linking? Currently, there are no major public CUDA projects written in Rust I'm aware of, but I'm expecting to have a built-in target will create a solid foundation for further experiments and awesome crates. Related to #38789 Fixes #38787 Fixes #38786
Or all functions should be "inlined" for the nvptx targets
STR
Note that
foo
appears as undefined (.extern .func
) in the PTX module.Workaround
Mark
lib::foo
as#[inline]
. Then you'll get the translation offoo
in the final PTX module:The text was updated successfully, but these errors were encountered: