xref: /llvm-project/clang/test/Driver/rocm-device-libs.cl (revision 60fa7c7690d65f23636c5ca51e0fbfc54ed09370)
1// REQUIRES: !system-windows
2
3// Test flush-denormals-to-zero enabled uses oclc_daz_opt_on
4
5// RUN: %clang -### -target amdgcn-amd-amdhsa \
6// RUN:   -x cl -mcpu=gfx900 \
7// RUN:   --rocm-path=%S/Inputs/rocm \
8// RUN:   %s \
9// RUN: 2>&1 | FileCheck  --check-prefixes=COMMON,COMMON-DEFAULT,GFX900-DEFAULT,GFX900,WAVE64 %s
10
11
12
13// Make sure the different denormal default is respected for gfx8
14// RUN: %clang -### -target amdgcn-amd-amdhsa \
15// RUN:   -x cl -mcpu=gfx803 \
16// RUN:   --rocm-path=%S/Inputs/rocm \
17// RUN:   %s \
18// RUN: 2>&1 | FileCheck  --check-prefixes=COMMON,COMMON-DEFAULT,GFX803-DEFAULT,GFX803,WAVE64 %s
19
20
21
22// Make sure the non-canonical name works
23// RUN: %clang -### -target amdgcn-amd-amdhsa \
24// RUN:   -x cl -mcpu=fiji \
25// RUN:   --rocm-path=%S/Inputs/rocm \
26// RUN:   %s \
27// RUN: 2>&1 | FileCheck  --check-prefixes=COMMON,COMMON-DEFAULT,GFX803-DEFAULT,GFX803,WAVE64 %s
28
29
30
31// RUN: %clang -### -target amdgcn-amd-amdhsa \
32// RUN:   -x cl -mcpu=gfx900 \
33// RUN:   -cl-denorms-are-zero \
34// RUN:   --rocm-path=%S/Inputs/rocm \
35// RUN:   %s \
36// RUN: 2>&1 | FileCheck  --check-prefixes=COMMON,COMMON-DAZ,GFX900,WAVE64 %s
37
38
39// RUN: %clang -### -target amdgcn-amd-amdhsa \
40// RUN:   -x cl -mcpu=gfx803 \
41// RUN:   -cl-denorms-are-zero \
42// RUN:   --rocm-path=%S/Inputs/rocm \
43// RUN:   %s \
44// RUN: 2>&1 | FileCheck  --check-prefixes=COMMON,COMMON-DAZ,GFX803,WAVE64 %s
45
46
47
48// RUN: %clang -### -target amdgcn-amd-amdhsa \
49// RUN:   -x cl -mcpu=gfx803 \
50// RUN:   -cl-finite-math-only \
51// RUN:   --rocm-path=%S/Inputs/rocm \
52// RUN:   %s \
53// RUN: 2>&1 | FileCheck  --check-prefixes=COMMON,COMMON-FINITE-ONLY,GFX803,WAVE64 %s
54
55
56
57// RUN: %clang -### -target amdgcn-amd-amdhsa    \
58// RUN:   -x cl -mcpu=gfx803                     \
59// RUN:   -cl-fp32-correctly-rounded-divide-sqrt \
60// RUN:   --rocm-path=%S/Inputs/rocm \
61// RUN:   %s \
62// RUN: 2>&1 | FileCheck  --check-prefixes=COMMON,COMMON-CORRECT-SQRT,GFX803,WAVE64 %s
63
64
65
66// RUN: %clang -### -target amdgcn-amd-amdhsa    \
67// RUN:   -x cl -mcpu=gfx803                     \
68// RUN:   -cl-fast-relaxed-math \
69// RUN:   --rocm-path=%S/Inputs/rocm \
70// RUN:   %s \
71// RUN: 2>&1 | FileCheck  --check-prefixes=COMMON,COMMON-FAST-RELAXED,GFX803,WAVE64 %s
72
73
74
75// RUN: %clang -### -target amdgcn-amd-amdhsa    \
76// RUN:   -x cl -mcpu=gfx803                     \
77// RUN:   -cl-unsafe-math-optimizations \
78// RUN:   --rocm-path=%S/Inputs/rocm \
79// RUN:   %s 2>&1 | \
80// RUN:   FileCheck  --check-prefixes=COMMON,GFX803,WAVE64 %s
81
82// RUN: %clang -### -target amdgcn-amd-amdhsa    \
83// RUN:   -x cl -mcpu=gfx1010                    \
84// RUN:   --rocm-path=%S/Inputs/rocm \
85// RUN:   %s 2>&1 | \
86// RUN:   FileCheck  --check-prefix=WAVE32 %s
87
88// RUN: %clang -### -target amdgcn-amd-amdhsa    \
89// RUN:   -x cl -mcpu=gfx1011                    \
90// RUN:   --rocm-path=%S/Inputs/rocm \
91// RUN:   %s 2>&1 | \
92// RUN:   FileCheck  --check-prefix=WAVE32 %s
93
94// RUN: %clang -### -target amdgcn-amd-amdhsa    \
95// RUN:   -x cl -mcpu=gfx1012                    \
96// RUN:   --rocm-path=%S/Inputs/rocm \
97// RUN:   %s 2>&1 | \
98// RUN:   FileCheck  --check-prefix=WAVE32 %s
99
100
101// RUN: %clang -### -target amdgcn-amd-amdhsa    \
102// RUN:   -x cl -mcpu=gfx1010 -mwavefrontsize64  \
103// RUN:   --rocm-path=%S/Inputs/rocm \
104// RUN:   %s 2>&1 | \
105// RUN:   FileCheck  --check-prefix=WAVE64 %s
106
107// RUN: %clang -### -target amdgcn-amd-amdhsa    \
108// RUN:   -x cl -mcpu=gfx1010 -mwavefrontsize64 -mno-wavefrontsize64  \
109// RUN:   --rocm-path=%S/Inputs/rocm \
110// RUN:   %s 2>&1 | \
111// RUN:   FileCheck  --check-prefix=WAVE32 %s
112
113// Ignore -mno-wavefrontsize64 without wave32 support
114// RUN: %clang -### -target amdgcn-amd-amdhsa       \
115// RUN:   -x cl -mcpu=gfx803  -mno-wavefrontsize64  \
116// RUN:   --rocm-path=%S/Inputs/rocm    \
117// RUN:   %s 2>&1 | \
118// RUN:   FileCheck  --check-prefixes=GFX803,WAVE64 %s
119
120
121
122// Test --hip-device-lib-path format
123// RUN: %clang -### -target amdgcn-amd-amdhsa \
124// RUN:   -x cl -mcpu=gfx900 \
125// RUN:   --hip-device-lib-path=%S/Inputs/rocm/amdgcn/bitcode \
126// RUN:   %S/opencl.cl \
127// RUN: 2>&1 | FileCheck  --check-prefixes=COMMON,COMMON-DEFAULT,GFX900-DEFAULT,GFX900,WAVE64 %s
128
129// Test environment variable HIP_DEVICE_LIB_PATH
130// RUN: env HIP_DEVICE_LIB_PATH=%S/Inputs/rocm/amdgcn/bitcode %clang -### -target amdgcn-amd-amdhsa \
131// RUN:   -x cl -mcpu=gfx900 \
132// RUN:   %S/opencl.cl \
133// RUN: 2>&1 | FileCheck  --check-prefixes=COMMON,COMMON-DEFAULT,GFX900-DEFAULT,GFX900,WAVE64 %s
134
135// RUN: %clang -### -target amdgcn-amd-amdhsa \
136// RUN:   -x cl -mcpu=gfx908:xnack+ -fsanitize=address \
137// RUN:   --rocm-path=%S/Inputs/rocm \
138// RUN:   %s \
139// RUN: 2>&1 | FileCheck  --check-prefixes=ASAN,COMMON %s
140
141// RUN: %clang -### -target amdgcn-amd-amdhsa \
142// RUN:   -x cl -mcpu=gfx908:xnack+ \
143// RUN:   --rocm-path=%S/Inputs/rocm \
144// RUN:   %s \
145// RUN: 2>&1 | FileCheck  --check-prefixes=NOASAN %s
146
147// COMMON: "-triple" "amdgcn-amd-amdhsa"
148// ASAN-SAME: "-mlink-bitcode-file" "{{.*}}/amdgcn/bitcode/asanrtl.bc"
149// COMMON-SAME: "-mlink-builtin-bitcode" "{{.*}}/amdgcn/bitcode/opencl.bc"
150// COMMON-SAME: "-mlink-builtin-bitcode" "{{.*}}/amdgcn/bitcode/ocml.bc"
151// COMMON-SAME: "-mlink-builtin-bitcode" "{{.*}}/amdgcn/bitcode/ockl.bc"
152
153// GFX900-DEFAULT-SAME: "-mlink-builtin-bitcode" "{{.*}}/amdgcn/bitcode/oclc_daz_opt_off.bc"
154// GFX803-DEFAULT-SAME: "-mlink-builtin-bitcode" "{{.*}}/amdgcn/bitcode/oclc_daz_opt_on.bc"
155// GFX700-DEFAULT-SAME: "-mlink-builtin-bitcode" "{{.*}}/amdgcn/bitcode/oclc_daz_opt_on.bc"
156// COMMON-DAZ-SAME: "-mlink-builtin-bitcode" "{{.*}}/amdgcn/bitcode/oclc_daz_opt_on.bc"
157
158
159// COMMON-DEFAULT-SAME: "-mlink-builtin-bitcode" "{{.*}}/amdgcn/bitcode/oclc_unsafe_math_off.bc"
160// COMMON-DEFAULT-SAME: "-mlink-builtin-bitcode" "{{.*}}/amdgcn/bitcode/oclc_finite_only_off.bc"
161// COMMON-DEFAULT-SAME: "-mlink-builtin-bitcode" "{{.*}}/amdgcn/bitcode/oclc_correctly_rounded_sqrt_off.bc"
162
163
164// COMMON-FINITE-ONLY-SAME: "-mlink-builtin-bitcode" "{{.*}}/amdgcn/bitcode/oclc_unsafe_math_off.bc"
165// COMMON-FINITE-ONLY-SAME: "-mlink-builtin-bitcode" "{{.*}}/amdgcn/bitcode/oclc_finite_only_on.bc"
166// COMMON-FINITE-ONLY-SAME: "-mlink-builtin-bitcode" "{{.*}}/amdgcn/bitcode/oclc_correctly_rounded_sqrt_off.bc"
167
168
169// COMMON-CORRECT-SQRT-SAME: "-mlink-builtin-bitcode" "{{.*}}/amdgcn/bitcode/oclc_unsafe_math_off.bc"
170// COMMON-CORRECT-SQRT-SAME: "-mlink-builtin-bitcode" "{{.*}}/amdgcn/bitcode/oclc_finite_only_off.bc"
171// COMMON-CORRECT-SQRT-SAME: "-mlink-builtin-bitcode" "{{.*}}/amdgcn/bitcode/oclc_correctly_rounded_sqrt_on.bc"
172
173
174// COMMON-FAST-RELAXED-SAME: "-mlink-builtin-bitcode" "{{.*}}/amdgcn/bitcode/oclc_unsafe_math_on.bc"
175// COMMON-FAST-RELAXED-SAME: "-mlink-builtin-bitcode" "{{.*}}/amdgcn/bitcode/oclc_finite_only_on.bc"
176// COMMON-FAST-RELAXED-SAME: "-mlink-builtin-bitcode" "{{.*}}/amdgcn/bitcode/oclc_correctly_rounded_sqrt_off.bc"
177
178
179// COMMON-UNSAFE-MATH-SAME: "-mlink-builtin-bitcode" "{{.*}}/amdgcn/bitcode/oclc_unsafe_math_on.bc"
180// COMMON-UNSAFE-MATH-SAME: "-mlink-builtin-bitcode" "{{.*}}/amdgcn/bitcode/oclc_finite_only_off.bc"
181// COMMON-UNSAFE-MATH-SAME: "-mlink-builtin-bitcode" "{{.*}}/amdgcn/bitcode/oclc_correctly_rounded_sqrt_off.bc"
182
183// ASAN-SAME: "-fsanitize=address"
184
185// NOASAN-NOT: "-fsanitize=address"
186// NOASAN-NOT: amdgcn/bitcode/asanrtl.bc
187
188// WAVE64: "-mlink-builtin-bitcode" "{{.*}}/amdgcn/bitcode/oclc_wavefrontsize64_on.bc"
189// WAVE32: "-mlink-builtin-bitcode" "{{.*}}/amdgcn/bitcode/oclc_wavefrontsize64_off.bc"
190
191// GFX900: "-mlink-builtin-bitcode" "{{.*}}/amdgcn/bitcode/oclc_isa_version_900.bc"
192// GFX803: "-mlink-builtin-bitcode" "{{.*}}/amdgcn/bitcode/oclc_isa_version_803.bc"
193
194kernel void func(void);
195