Clang Project

clang_source_code/test/Driver/cuda-arch-translation.cu
1// Tests that "sm_XX" gets correctly converted to "compute_YY" when we invoke
2// fatbinary.
3//
4// REQUIRES: clang-driver
5// REQUIRES: x86-registered-target
6// REQUIRES: nvptx-registered-target
7
8// RUN: %clang -### -target x86_64-linux-gnu -c --cuda-gpu-arch=sm_20 %s 2>&1 \
9// RUN: | FileCheck -check-prefixes=COMMON,SM20 %s
10// RUN: %clang -### -target x86_64-linux-gnu -c --cuda-gpu-arch=sm_21 %s 2>&1 \
11// RUN: | FileCheck -check-prefixes=COMMON,SM21 %s
12// RUN: %clang -### -target x86_64-linux-gnu -c --cuda-gpu-arch=sm_30 %s 2>&1 \
13// RUN: | FileCheck -check-prefixes=COMMON,SM30 %s
14// RUN: %clang -### -target x86_64-linux-gnu -c --cuda-gpu-arch=sm_32 %s 2>&1 \
15// RUN: | FileCheck -check-prefixes=COMMON,SM32 %s
16// RUN: %clang -### -target x86_64-linux-gnu -c --cuda-gpu-arch=sm_35 %s 2>&1 \
17// RUN: | FileCheck -check-prefixes=COMMON,SM35 %s
18// RUN: %clang -### -target x86_64-linux-gnu -c --cuda-gpu-arch=sm_37 %s 2>&1 \
19// RUN: | FileCheck -check-prefixes=COMMON,SM37 %s
20// RUN: %clang -### -target x86_64-linux-gnu -c --cuda-gpu-arch=sm_50 %s 2>&1 \
21// RUN: | FileCheck -check-prefixes=COMMON,SM50 %s
22// RUN: %clang -### -target x86_64-linux-gnu -c --cuda-gpu-arch=sm_52 %s 2>&1 \
23// RUN: | FileCheck -check-prefixes=COMMON,SM52 %s
24// RUN: %clang -### -target x86_64-linux-gnu -c --cuda-gpu-arch=sm_53 %s 2>&1 \
25// RUN: | FileCheck -check-prefixes=COMMON,SM53 %s
26// RUN: %clang -### -target x86_64-linux-gnu -c --cuda-gpu-arch=sm_60 %s 2>&1 \
27// RUN: | FileCheck -check-prefixes=COMMON,SM60 %s
28// RUN: %clang -### -target x86_64-linux-gnu -c --cuda-gpu-arch=sm_61 %s 2>&1 \
29// RUN: | FileCheck -check-prefixes=COMMON,SM61 %s
30// RUN: %clang -### -target x86_64-linux-gnu -c --cuda-gpu-arch=sm_62 %s 2>&1 \
31// RUN: | FileCheck -check-prefixes=COMMON,SM62 %s
32// RUN: %clang -### -target x86_64-linux-gnu -c --cuda-gpu-arch=sm_70 %s 2>&1 \
33// RUN: | FileCheck -check-prefixes=COMMON,SM70 %s
34// RUN: %clang -### -target x86_64-linux-gnu -c --cuda-gpu-arch=gfx600 %s 2>&1 \
35// RUN: | FileCheck -check-prefixes=COMMON,GFX600 %s
36// RUN: %clang -### -target x86_64-linux-gnu -c --cuda-gpu-arch=gfx601 %s 2>&1 \
37// RUN: | FileCheck -check-prefixes=COMMON,GFX601 %s
38// RUN: %clang -### -target x86_64-linux-gnu -c --cuda-gpu-arch=gfx700 %s 2>&1 \
39// RUN: | FileCheck -check-prefixes=COMMON,GFX700 %s
40// RUN: %clang -### -target x86_64-linux-gnu -c --cuda-gpu-arch=gfx701 %s 2>&1 \
41// RUN: | FileCheck -check-prefixes=COMMON,GFX701 %s
42// RUN: %clang -### -target x86_64-linux-gnu -c --cuda-gpu-arch=gfx702 %s 2>&1 \
43// RUN: | FileCheck -check-prefixes=COMMON,GFX702 %s
44// RUN: %clang -### -target x86_64-linux-gnu -c --cuda-gpu-arch=gfx703 %s 2>&1 \
45// RUN: | FileCheck -check-prefixes=COMMON,GFX703 %s
46// RUN: %clang -### -target x86_64-linux-gnu -c --cuda-gpu-arch=gfx704 %s 2>&1 \
47// RUN: | FileCheck -check-prefixes=COMMON,GFX704 %s
48// RUN: %clang -### -target x86_64-linux-gnu -c --cuda-gpu-arch=gfx801 %s 2>&1 \
49// RUN: | FileCheck -check-prefixes=COMMON,GFX801 %s
50// RUN: %clang -### -target x86_64-linux-gnu -c --cuda-gpu-arch=gfx802 %s 2>&1 \
51// RUN: | FileCheck -check-prefixes=COMMON,GFX802 %s
52// RUN: %clang -### -target x86_64-linux-gnu -c --cuda-gpu-arch=gfx803 %s 2>&1 \
53// RUN: | FileCheck -check-prefixes=COMMON,GFX803 %s
54// RUN: %clang -### -target x86_64-linux-gnu -c --cuda-gpu-arch=gfx810 %s 2>&1 \
55// RUN: | FileCheck -check-prefixes=COMMON,GFX810 %s
56// RUN: %clang -### -target x86_64-linux-gnu -c --cuda-gpu-arch=gfx900 %s 2>&1 \
57// RUN: | FileCheck -check-prefixes=COMMON,GFX900 %s
58// RUN: %clang -### -target x86_64-linux-gnu -c --cuda-gpu-arch=gfx902 %s 2>&1 \
59// RUN: | FileCheck -check-prefixes=COMMON,GFX902 %s
60
61// COMMON: ptxas
62// COMMON-SAME: -m64
63// COMMON: fatbinary
64
65// SM20:--image=profile=sm_20{{.*}}--image=profile=compute_20
66// SM21:--image=profile=sm_21{{.*}}--image=profile=compute_20
67// SM30:--image=profile=sm_30{{.*}}--image=profile=compute_30
68// SM32:--image=profile=sm_32{{.*}}--image=profile=compute_32
69// SM35:--image=profile=sm_35{{.*}}--image=profile=compute_35
70// SM37:--image=profile=sm_37{{.*}}--image=profile=compute_37
71// SM50:--image=profile=sm_50{{.*}}--image=profile=compute_50
72// SM52:--image=profile=sm_52{{.*}}--image=profile=compute_52
73// SM53:--image=profile=sm_53{{.*}}--image=profile=compute_53
74// SM60:--image=profile=sm_60{{.*}}--image=profile=compute_60
75// SM61:--image=profile=sm_61{{.*}}--image=profile=compute_61
76// SM62:--image=profile=sm_62{{.*}}--image=profile=compute_62
77// SM70:--image=profile=sm_70{{.*}}--image=profile=compute_70
78// GFX600:--image=profile=gfx600{{.*}}--image=profile=compute_amdgcn
79// GFX601:--image=profile=gfx601{{.*}}--image=profile=compute_amdgcn
80// GFX700:--image=profile=gfx700{{.*}}--image=profile=compute_amdgcn
81// GFX701:--image=profile=gfx701{{.*}}--image=profile=compute_amdgcn
82// GFX702:--image=profile=gfx702{{.*}}--image=profile=compute_amdgcn
83// GFX703:--image=profile=gfx703{{.*}}--image=profile=compute_amdgcn
84// GFX704:--image=profile=gfx704{{.*}}--image=profile=compute_amdgcn
85// GFX801:--image=profile=gfx801{{.*}}--image=profile=compute_amdgcn
86// GFX802:--image=profile=gfx802{{.*}}--image=profile=compute_amdgcn
87// GFX803:--image=profile=gfx803{{.*}}--image=profile=compute_amdgcn
88// GFX810:--image=profile=gfx810{{.*}}--image=profile=compute_amdgcn
89// GFX900:--image=profile=gfx900{{.*}}--image=profile=compute_amdgcn
90// GFX902:--image=profile=gfx902{{.*}}--image=profile=compute_amdgcn
91