about summary refs log tree commit diff
path: root/src/ci/docker
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2019-02-01 23:43:34 +0000
committerbors <bors@rust-lang.org>2019-02-01 23:43:34 +0000
commit2efa31b2d9bf171fecd294b8e0126d8ffdb453e3 (patch)
treea7be085de514ca23d9b4737697eb4aec45092460 /src/ci/docker
parent852701ad6df90f4e4cdb11d487373f026f38e5b3 (diff)
parent49931fda56dc6268ba3c104b64768f551cfc4636 (diff)
downloadrust-2efa31b2d9bf171fecd294b8e0126d8ffdb453e3.tar.gz
rust-2efa31b2d9bf171fecd294b8e0126d8ffdb453e3.zip
Auto merge of #57937 - denzp:nvptx, r=nagisa
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
Diffstat (limited to 'src/ci/docker')
-rw-r--r--src/ci/docker/dist-various-2/Dockerfile1
-rw-r--r--src/ci/docker/test-various/Dockerfile (renamed from src/ci/docker/wasm32-unknown/Dockerfile)19
2 files changed, 15 insertions, 5 deletions
diff --git a/src/ci/docker/dist-various-2/Dockerfile b/src/ci/docker/dist-various-2/Dockerfile
index 97892405b8e..e2710a18bda 100644
--- a/src/ci/docker/dist-various-2/Dockerfile
+++ b/src/ci/docker/dist-various-2/Dockerfile
@@ -70,6 +70,7 @@ ENV TARGETS=$TARGETS,x86_64-sun-solaris
 ENV TARGETS=$TARGETS,x86_64-unknown-linux-gnux32
 ENV TARGETS=$TARGETS,x86_64-unknown-cloudabi
 ENV TARGETS=$TARGETS,x86_64-fortanix-unknown-sgx
+ENV TARGETS=$TARGETS,nvptx64-nvidia-cuda
 
 ENV X86_FORTANIX_SGX_LIBS="/x86_64-fortanix-unknown-sgx/lib/"
 
diff --git a/src/ci/docker/wasm32-unknown/Dockerfile b/src/ci/docker/test-various/Dockerfile
index 161f0c0062f..6c419e13c9f 100644
--- a/src/ci/docker/wasm32-unknown/Dockerfile
+++ b/src/ci/docker/test-various/Dockerfile
@@ -13,14 +13,16 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
   gdb \
   xz-utils
 
+# FIXME: build the `ptx-linker` instead.
+RUN curl -sL https://github.com/denzp/rust-ptx-linker/releases/download/v0.9.0-alpha.2/rust-ptx-linker.linux64.tar.gz | \
+  tar -xzvC /usr/bin
+
 RUN curl -sL https://nodejs.org/dist/v9.2.0/node-v9.2.0-linux-x64.tar.xz | \
-    tar -xJ
+  tar -xJ
 
 COPY scripts/sccache.sh /scripts/
 RUN sh /scripts/sccache.sh
 
-ENV TARGETS=wasm32-unknown-unknown
-
 ENV RUST_CONFIGURE_ARGS \
   --set build.nodejs=/node-v9.2.0-linux-x64/bin/node \
   --set rust.lld
@@ -31,11 +33,18 @@ ENV RUST_CONFIGURE_ARGS \
 # other contexts as well
 ENV NO_DEBUG_ASSERTIONS=1
 
-ENV SCRIPT python2.7 /checkout/x.py test --target $TARGETS \
+ENV WASM_TARGETS=wasm32-unknown-unknown
+ENV WASM_SCRIPT python2.7 /checkout/x.py test --target $WASM_TARGETS \
   src/test/run-make \
   src/test/ui \
   src/test/run-pass \
   src/test/compile-fail \
   src/test/mir-opt \
   src/test/codegen-units \
-  src/libcore \
+  src/libcore
+
+ENV NVPTX_TARGETS=nvptx64-nvidia-cuda
+ENV NVPTX_SCRIPT python2.7 /checkout/x.py test --target $NVPTX_TARGETS \
+  src/test/run-make
+
+ENV SCRIPT $WASM_SCRIPT && $NVPTX_SCRIPT