Skip to content
This repository has been archived by the owner on Dec 9, 2018. It is now read-only.

Error compiling the minimal example. #2

Closed
bumzack opened this issue Feb 9, 2017 · 2 comments
Closed

Error compiling the minimal example. #2

bumzack opened this issue Feb 9, 2017 · 2 comments

Comments

@bumzack
Copy link

bumzack commented Feb 9, 2017

Hi.
I have successfully installed your cuda crate (with cuda 8.0).
My system: ubunto 16.04, Intel® Core™ i7-5500U CPU @ 2.40GHz × 4 , GeForce 940M/PCIe/SSE2
(Lenovo Yoga 500 Notebook)

rustup show
Default host: x86_64-unknown-linux-gnu

nightly-x86_64-unknown-linux-gnu (default)
rustc 1.17.0-nightly (29dece1c8 2017-02-08)

When trying to compile the minimal examples in the README I run into the following error:

RUST_BACKTRACE=1  xargo rustc --release --target nvptx64-nvidia-cuda -- --emit=asm --verbose


+ "rustc" "--print" "sysroot"
+ "rustc" "--print" "target-list"
+ "cargo" "build" "--release" "--manifest-path" "/tmp/xargo.YgwtgUACXnwK/Cargo.toml" "--target" "nvptx64-nvidia-cuda" "-v" "-p" "core"
   Compiling core v0.0.0 (file:///home/georg/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libcore)
     Running `rustc --crate-name core /home/georg/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libcore/lib.rs --crate-type lib --emit=dep-info,link -C opt-level=3 -C metadata=9513f6a24932021b -C extra-filename=-9513f6a24932021b --out-dir /tmp/xargo.YgwtgUACXnwK/target/nvptx64-nvidia-cuda/release/deps --target nvptx64-nvidia-cuda -L dependency=/tmp/xargo.YgwtgUACXnwK/target/nvptx64-nvidia-cuda/release/deps -L dependency=/tmp/xargo.YgwtgUACXnwK/target/release/deps --sysroot /home/georg/.xargo`
rustc: /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp:976: std::string llvm::NVPTXTargetLowering::getPrototype(const llvm::DataLayout&, llvm::Type*, const ArgListTy&, const llvm::SmallVectorImpl<llvm::ISD::OutputArg>&, unsigned int, const llvm::ImmutableCallSite*) const: Assertion `(getValueType(DL, Ty) == Outs[OIdx].VT || (getValueType(DL, Ty) == MVT::i8 && Outs[OIdx].VT == MVT::i16)) && "type mismatch between callee prototype and arguments"' failed.
error: Could not compile `core`.

Caused by:
  process didn't exit successfully: `rustc --crate-name core /home/georg/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libcore/lib.rs --crate-type lib --emit=dep-info,link -C opt-level=3 -C metadata=9513f6a24932021b -C extra-filename=-9513f6a24932021b --out-dir /tmp/xargo.YgwtgUACXnwK/target/nvptx64-nvidia-cuda/release/deps --target nvptx64-nvidia-cuda -L dependency=/tmp/xargo.YgwtgUACXnwK/target/nvptx64-nvidia-cuda/release/deps -L dependency=/tmp/xargo.YgwtgUACXnwK/target/release/deps --sysroot /home/georg/.xargo` (exit code: 1)
error: `"cargo" "build" "--release" "--manifest-path" "/tmp/xargo.YgwtgUACXnwK/Cargo.toml" "--target" "nvptx64-nvidia-cuda" "-v" "-p" "core"` failed with exit code: Some(101)
stack backtrace:
   0:     0x55ae51a8dd1d - backtrace::backtrace::trace::h0d0ee87a30cd6975
   1:     0x55ae51a8e202 - backtrace::capture::Backtrace::new::hb5a725a088a2a2fc
   2:     0x55ae51a82b66 - error_chain::make_backtrace::h3d048cb120b8c1ea
   3:     0x55ae51a82c18 - <error_chain::State as core::default::Default>::default::h872828f66aa5352f
   4:     0x55ae51a7314e - xargo::sysroot::build::hc3480546d64ef68b
   5:     0x55ae51a785b2 - xargo::sysroot::update::h876ac002099ed432
   6:     0x55ae51a80285 - xargo::run::h7a335e8f14257f91
   7:     0x55ae51a7d1ed - xargo::main::h219698d15c956fce
   8:     0x55ae51acb8aa - panic_unwind::__rust_maybe_catch_panic
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libpanic_unwind/lib.rs:98
   9:     0x55ae51ac51a6 - std::panicking::try<(),fn()>
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libstd/panicking.rs:436
                         - std::panic::catch_unwind<fn(),()>
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libstd/panic.rs:361
                         - std::rt::lang_start
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libstd/rt.rs:57
  10:     0x7f8c1d9bb82f - __libc_start_main
  11:     0x55ae51a638e8 - _start
  12:                0x0 - <unknown>

I also tried an older nightly versions - same error

active toolchain
----------------

nightly-2017-01-04-x86_64-unknown-linux-gnu (directory override for '/home/georg/stoff/rust/kernel')
rustc 1.16.0-nightly (468227129 2017-01-03)

Is Linux a supported platform or do you have any hints on how to get the minimal example to compile?
(next step would be compiling your examples - I am interested in matrix multiplication on the GPU)

Thanks a lot for your work!

kind regards georg

for the record: the command from the xargo repo works

xargo build --target thumbv6m-none-eabi
  Compiling core v0.0.0 (file:///home/georg/.rustup/toolchains/nightly-2017-01-04-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libcore)
   Finished release [optimized] target(s) in 14.45 secs
  Compiling kernel v0.1.0 (file:///home/georg/stoff/rust/kernel)
warning: function is never used: `foo`, #[warn(dead_code)] on by default
--> src/lib.rs:3:1
 |
3 | fn foo() {}
 | ^^^^^^^^^^^

   Finished debug [unoptimized] target(s) in 0.8 secs


@japaric
Copy link
Contributor

japaric commented Feb 9, 2017

See rust-lang/rust#38824.

That LLVM assertion is a bug in LLVM; it's caused by the i128 support than lives in libcore. There's no nightly that supports NVPTX that doesn't contain that bugs.

You have three options:

  • Wait until this get fixed in LLVM and that fix is backported to rustc

  • Recompile rustc without LLVM assertions and use that rustc

  • Modify libcore source (in the rust-src component) to not contain i128 support.

Option 2 is the easiest but it's time consuming to compile rustc.

Option 3 is the fastest but you have to know what you are doing.

@bumzack
Copy link
Author

bumzack commented Feb 10, 2017

thanks for your quick reply.

i tried to compile rustc with

RUSTFLAG="-C target-feature=+soft-float" make -j4

it was a wild guess - just an attempt.
i am new to rust and recompiling rust with special flags for LLVM is a little too much at this stage of my learning curve.

running xargo resulted in an error.
the next attempt was to copy the new compiled rust over the version installed by rustup.

running
RUST_BACKTRACE=1 xargo rustc --target nvptx64-nvidia-cuda -- --emit=asm --verbose

gave me the following error:

+ "rustc" "--print" "sysroot"
+ "rustc" "--print" "target-list"
+ "cargo" "build" "--release" "--manifest-path" "/tmp/xargo.Z46qniMGpyml/Cargo.toml" "--target" "nvptx64-nvidia-cuda" "-v" "-p" "core"
   Compiling core v0.0.0 (file:///home/georg/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libcore)
     Running `rustc --crate-name core /home/georg/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libcore/lib.rs --crate-type lib --emit=dep-info,link -C opt-level=3 -C metadata=9513f6a24932021b -C extra-filename=-9513f6a24932021b --out-dir /tmp/xargo.Z46qniMGpyml/target/nvptx64-nvidia-cuda/release/deps --target nvptx64-nvidia-cuda -L dependency=/tmp/xargo.Z46qniMGpyml/target/nvptx64-nvidia-cuda/release/deps -L dependency=/tmp/xargo.Z46qniMGpyml/target/release/deps --sysroot /home/georg/.xargo`
error: Could not compile `core`.

Caused by:
  process didn't exit successfully: `rustc --crate-name core /home/georg/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libcore/lib.rs --crate-type lib --emit=dep-info,link -C opt-level=3 -C metadata=9513f6a24932021b -C extra-filename=-9513f6a24932021b --out-dir /tmp/xargo.Z46qniMGpyml/target/nvptx64-nvidia-cuda/release/deps --target nvptx64-nvidia-cuda -L dependency=/tmp/xargo.Z46qniMGpyml/target/nvptx64-nvidia-cuda/release/deps -L dependency=/tmp/xargo.Z46qniMGpyml/target/release/deps --sysroot /home/georg/.xargo` (exit code: 1)
error: `"cargo" "build" "--release" "--manifest-path" "/tmp/xargo.Z46qniMGpyml/Cargo.toml" "--target" "nvptx64-nvidia-cuda" "-v" "-p" "core"` failed with exit code: Some(101)
stack backtrace:
   0:     0x560913b6be41 - backtrace::backtrace::libunwind::trace
                        at /home/georg/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.0/src/backtrace/mod.rs:90
                         - backtrace::backtrace::trace<closure>
                        at /home/georg/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.0/src/backtrace/mod.rs:42
   1:     0x560913b6ce84 - backtrace::capture::{{impl}}::new
                        at /home/georg/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.0/src/lib.rs:101
   2:     0x560913b1e7e1 - error_chain::make_backtrace
                        at /home/georg/.cargo/registry/src/github.com-1ecc6299db9ec823/error-chain-0.7.2/src/lib.rs:411
   3:     0x560913b1e8a7 - error_chain::{{impl}}::default
                        at /home/georg/.cargo/registry/src/github.com-1ecc6299db9ec823/error-chain-0.7.2/src/lib.rs:462
   4:     0x560913b18349 - xargo::errors::{{impl}}::from_kind
                        at /home/georg/stoff/rust/xargo/src/errors.rs:1
   5:     0x560913b18630 - xargo::errors::{{impl}}::from
                        at /home/georg/stoff/rust/xargo/src/errors.rs:1
   6:     0x560913b01900 - xargo::extensions::{{impl}}::run
                        at /home/georg/stoff/rust/xargo/src/extensions.rs:21
   7:     0x560913b096df - xargo::sysroot::build
                        at /home/georg/stoff/rust/xargo/src/sysroot.rs:95
   8:     0x560913b0c1d7 - xargo::sysroot::update
                        at /home/georg/stoff/rust/xargo/src/sysroot.rs:177
   9:     0x560913b172d9 - xargo::run
                        at /home/georg/stoff/rust/xargo/src/main.rs:173
  10:     0x560913b14bba - xargo::main
                        at /home/georg/stoff/rust/xargo/src/main.rs:77
  11:     0x560913be4b86 - __rust_maybe_catch_panic
  12:     0x560913bde52f - std::rt::lang_start::hb38f422e456d615a
  13:     0x560913b1ca72 - main
  14:     0x7f9e6054b82f - __libc_start_main
  15:     0x560913a86728 - _start
  16:                0x0 - <unknown>

thanks again for your help, but i guess i'll wait for the LLVM patches to be backported to rustc :-(

@bumzack bumzack closed this as completed Feb 10, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants