1 use crate::spec::abi::Abi;
3 LinkerFlavor, MergeFunctions, PanicStrategy, Target, TargetOptions, TargetResult,
6 pub fn target() -> TargetResult {
8 arch: "nvptx64".to_string(),
9 data_layout: "e-i64:64-i128:128-v16:16-v32:32-n16:32:64".to_string(),
10 llvm_target: "nvptx64-nvidia-cuda".to_string(),
12 target_os: "cuda".to_string(),
13 target_vendor: "nvidia".to_string(),
14 target_env: String::new(),
16 linker_flavor: LinkerFlavor::PtxLinker,
18 target_endian: "little".to_string(),
19 target_pointer_width: "64".to_string(),
20 target_c_int_width: "32".to_string(),
22 options: TargetOptions {
23 // The linker can be installed from `crates.io`.
24 linker: Some("rust-ptx-linker".to_string()),
26 // With `ptx-linker` approach, it can be later overriden via link flags.
27 cpu: "sm_30".to_string(),
29 // FIXME: create tests for the atomics.
30 max_atomic_width: Some(64),
32 // Unwinding on CUDA is neither feasible nor useful.
33 panic_strategy: PanicStrategy::Abort,
35 // Needed to use `dylib` and `bin` crate types and the linker.
36 dynamic_linking: true,
39 // Avoid using dylib because it contain metadata not supported
40 // by LLVM NVPTX backend.
43 // Let the `ptx-linker` to handle LLVM lowering into MC / assembly.
46 // Convinient and predicable naming scheme.
47 dll_prefix: "".to_string(),
48 dll_suffix: ".ptx".to_string(),
49 exe_suffix: ".ptx".to_string(),
51 // Disable MergeFunctions LLVM optimisation pass because it can
52 // produce kernel functions that call other kernel functions.
53 // This behavior is not supported by PTX ISA.
54 merge_functions: MergeFunctions::Disabled,
56 // FIXME: enable compilation tests for the target and
57 // create the tests for this.