Skip to content

Commit a7a1c79

Browse files
peterhjgnzlbg
authored andcommitted
Add a build libcore-only nvptx64 test (using xargo).
This also disables the "integer_atomics" feature on nvptx/nvptx64.
1 parent ee6e4c8 commit a7a1c79

File tree

6 files changed

+87
-8
lines changed

6 files changed

+87
-8
lines changed

.travis.yml

+9-1
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,14 @@ matrix:
5656
script: ci/run.sh
5757
- name: "wasm32-unknown-unknown"
5858
env: TARGET=wasm32-unknown-unknown
59+
- name: "nvptx64-nvidia-cuda - cross compiled, build libcore only"
60+
env: TARGET=x86_64-unknown-linux-gnu CROSS_TARGET=nvptx64-nvidia-cuda-cross NORUN=1 NOSTD=1
61+
install:
62+
- travis_retry rustup target add $TARGET
63+
- travis_retry rustup component add rust-src
64+
- cargo install xargo
65+
- xargo --version
66+
- mkdir -p $HOME/.xargo
5967
- name: "thumbv6m-none-eabi - build libcore only"
6068
env: TARGET=thumbv6m-none-eabi NORUN=1 NOSTD=1
6169
script: ci/run.sh
@@ -103,7 +111,7 @@ matrix:
103111
install: travis_retry rustup target add $TARGET
104112
script:
105113
- cargo generate-lockfile
106-
- ci/run-docker.sh $TARGET $FEATURES
114+
- ci/run-docker.sh $TARGET $CROSS_TARGET $FEATURES
107115

108116
notifications:
109117
email:

ci/cross/nvptx64-nvidia-cuda.json

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"arch": "nvptx64"
3+
, "cpu": "sm_35"
4+
, "data-layout": "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v16:16:16-v32:32:32-v64:64:64-v128:128:128-n16:32:64"
5+
, "linker": false
6+
, "linker-flavor": "ld"
7+
, "llvm-target": "nvptx64-nvidia-cuda"
8+
, "max-atomic-width": 0
9+
, "obj-is-bitcode": true
10+
, "os": "cuda"
11+
, "panic-strategy": "abort"
12+
, "target-c-int-width": "32"
13+
, "target-endian": "little"
14+
, "target-pointer-width": "64"
15+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
FROM ubuntu:18.04
2+
RUN apt-get update && apt-get install -y --no-install-recommends \
3+
gcc \
4+
libc6-dev \
5+
ca-certificates

ci/run-docker.sh

+15-4
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,18 @@
66
set -ex
77

88
run() {
9-
echo "Building docker container for TARGET=${1}"
10-
docker build -t stdsimd -f "ci/docker/${1}/Dockerfile" ci/
11-
mkdir -p target
129
target=$(echo "${1}" | sed 's/-emulated//')
10+
cross="0"
11+
if [ -z "${2}" ]; then
12+
echo "Building docker container for TARGET=${1}"
13+
docker build -t stdsimd -f "ci/docker/${1}/Dockerfile" ci/
14+
else
15+
target=$(echo "${2}" | sed 's/-cross//')
16+
cross="1"
17+
echo "Building docker container for CROSS_TARGET=${2}"
18+
docker build -t stdsimd -f "ci/docker/${2}/Dockerfile" ci/
19+
fi
20+
mkdir -p target
1321
echo "Running docker"
1422
# shellcheck disable=SC2016
1523
docker run \
@@ -18,6 +26,8 @@ run() {
1826
--init \
1927
--volume "${HOME}"/.cargo:/cargo-h \
2028
--env CARGO_HOME=/cargo-h \
29+
--volume "${HOME}"/.xargo:/xargo-h \
30+
--env XARGO_HOME=/xargo-h \
2131
--volume "$(rustc --print sysroot)":/rust:ro \
2232
--env TARGET="${target}" \
2333
--env STDSIMD_TEST_EVERYTHING \
@@ -27,6 +37,7 @@ run() {
2737
--env NORUN \
2838
--env RUSTFLAGS \
2939
--env STDSIMD_TEST_NORUN \
40+
--env CROSS="${cross}" \
3041
--volume "$(pwd)":/checkout:ro \
3142
--volume "$(pwd)"/target:/checkout/target \
3243
--workdir /checkout \
@@ -41,5 +52,5 @@ if [ -z "$1" ]; then
4152
run "${d}"
4253
done
4354
else
44-
run "${1}"
55+
run "${1}" "${2}"
4556
fi

ci/run.sh

+35-2
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,34 @@ echo "FEATURES=${FEATURES}"
3030
echo "OBJDUMP=${OBJDUMP}"
3131
echo "STDSIMD_DISABLE_ASSERT_INSTR=${STDSIMD_DISABLE_ASSERT_INSTR}"
3232
echo "STDSIMD_TEST_EVERYTHING=${STDSIMD_TEST_EVERYTHING}"
33+
echo "CROSS=${CROSS}"
34+
35+
cargo_setup() {
36+
if [ "$CROSS" = "1" ]
37+
then
38+
export RUST_TARGET_PATH="/checkout/ci/cross"
39+
echo "RUST_TARGET_PATH=${RUST_TARGET_PATH}"
40+
fi
41+
}
3342

3443
cargo_test() {
44+
if [ "$CROSS" = "1" ]
45+
then
46+
cmd="/cargo-h/bin/xargo"
47+
else
48+
cmd="cargo"
49+
fi
3550
subcmd="test"
3651
if [ "$NORUN" = "1" ]
3752
then
38-
export subcmd="build"
53+
if [ "$CROSS" = "1" ]
54+
then
55+
export subcmd="rustc"
56+
else
57+
export subcmd="build"
58+
fi
3959
fi
40-
cmd="cargo ${subcmd} --target=$TARGET $1"
60+
cmd="$cmd ${subcmd} --target=$TARGET $1"
4161
if [ "$NOSTD" = "1" ]
4262
then
4363
cmd="$cmd -p coresimd"
@@ -52,11 +72,24 @@ cargo_test() {
5272
cmd="$cmd --quiet"
5373
fi
5474
fi
75+
if [ "$CROSS" = "1" ]
76+
then
77+
cmd="$cmd --emit=asm"
78+
fi
5579
$cmd
5680
}
5781

82+
cargo_output() {
83+
if [ "$CROSS" = "1" ]
84+
then
85+
find /checkout/target -name "*.s"
86+
fi
87+
}
88+
89+
cargo_setup
5890
cargo_test
5991
cargo_test "--release"
92+
cargo_output
6093

6194
# Test targets compiled with extra features.
6295
case ${TARGET} in

crates/coresimd/src/lib.rs

+8-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
simd_ffi,
1919
asm,
2020
proc_macro_hygiene,
21-
integer_atomics,
2221
stmt_expr_attributes,
2322
core_intrinsics,
2423
no_core,
@@ -38,6 +37,14 @@
3837
powerpc_target_feature,
3938
wasm_target_feature
4039
)]
40+
// NB: When running nvptx/nvptx64 cross tests, enabling "integer_atomics" yields
41+
// a compile-time error: 'unknown feature `integer_atomics`'. This ought to be
42+
// investigated further, but for now just disable "integer_atomics" so we can
43+
// run _some_ test for the nvptx/nvptx64 targets.
44+
#![cfg_attr(
45+
not(any(target_arch = "nvptx", target_arch = "nvptx64")),
46+
feature(integer_atomics)
47+
)]
4148
#![cfg_attr(test, feature(test, abi_vectorcall, untagged_unions))]
4249
#![cfg_attr(
4350
feature = "cargo-clippy",

0 commit comments

Comments
 (0)