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