]>
Commit | Line | Data |
---|---|---|
29967ef6 | 1 | use crate::spec::{LinkerFlavor, MergeFunctions, PanicStrategy, Target, TargetOptions}; |
9fa01778 | 2 | |
29967ef6 XL |
3 | pub fn target() -> Target { |
4 | Target { | |
9fa01778 XL |
5 | arch: "nvptx64".to_string(), |
6 | data_layout: "e-i64:64-i128:128-v16:16-v32:32-n16:32:64".to_string(), | |
7 | llvm_target: "nvptx64-nvidia-cuda".to_string(), | |
29967ef6 | 8 | pointer_width: 64, |
9fa01778 XL |
9 | |
10 | options: TargetOptions { | |
29967ef6 XL |
11 | os: "cuda".to_string(), |
12 | vendor: "nvidia".to_string(), | |
13 | linker_flavor: LinkerFlavor::PtxLinker, | |
9fa01778 XL |
14 | // The linker can be installed from `crates.io`. |
15 | linker: Some("rust-ptx-linker".to_string()), | |
17df50a5 | 16 | linker_is_gnu: false, |
9fa01778 | 17 | |
74b04a01 | 18 | // With `ptx-linker` approach, it can be later overridden via link flags. |
9fa01778 XL |
19 | cpu: "sm_30".to_string(), |
20 | ||
21 | // FIXME: create tests for the atomics. | |
22 | max_atomic_width: Some(64), | |
23 | ||
24 | // Unwinding on CUDA is neither feasible nor useful. | |
25 | panic_strategy: PanicStrategy::Abort, | |
26 | ||
27 | // Needed to use `dylib` and `bin` crate types and the linker. | |
28 | dynamic_linking: true, | |
29 | executables: true, | |
30 | ||
31 | // Avoid using dylib because it contain metadata not supported | |
32 | // by LLVM NVPTX backend. | |
33 | only_cdylib: true, | |
34 | ||
35 | // Let the `ptx-linker` to handle LLVM lowering into MC / assembly. | |
36 | obj_is_bitcode: true, | |
37 | ||
74b04a01 | 38 | // Convenient and predicable naming scheme. |
9fa01778 XL |
39 | dll_prefix: "".to_string(), |
40 | dll_suffix: ".ptx".to_string(), | |
41 | exe_suffix: ".ptx".to_string(), | |
42 | ||
43 | // Disable MergeFunctions LLVM optimisation pass because it can | |
44 | // produce kernel functions that call other kernel functions. | |
45 | // This behavior is not supported by PTX ISA. | |
46 | merge_functions: MergeFunctions::Disabled, | |
3c0e092e XL |
47 | |
48 | // The LLVM backend does not support stack canaries for this target | |
49 | supports_stack_protector: false, | |
50 | ||
dfeec247 | 51 | ..Default::default() |
9fa01778 | 52 | }, |
29967ef6 | 53 | } |
9fa01778 | 54 | } |