Skip to content

Commit 92f7701

Browse files
committed
[SYCL] Reenable fp64 aspect runtime check
This commit reenables the fp64 aspect check when ensuring compatability of a given device image, following the relaxation of aspect propagation for the aspect. Signed-off-by: Larsen, Steffen <[email protected]>
1 parent 93a629a commit 92f7701

File tree

2 files changed

+26
-2
lines changed

2 files changed

+26
-2
lines changed

sycl/source/detail/program_manager/program_manager.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,7 @@ RT::PiProgram ProgramManager::getBuiltPIProgram(
567567
while (AIt != AEnd) {
568568
auto Aspect = static_cast<aspect>(*AIt);
569569
// Strict check for fp64 is disabled temporarily to avoid confusion.
570-
if (Aspect != aspect::fp64 && !Dev->has(Aspect))
570+
if (!Dev->has(Aspect))
571571
throw sycl::exception(errc::kernel_not_supported,
572572
"Required aspect " + getAspectNameStr(Aspect) +
573573
" is not supported on the device");
@@ -2309,7 +2309,7 @@ bool doesDevSupportDeviceRequirements(const device &Dev,
23092309
while (!Aspects.empty()) {
23102310
aspect Aspect = Aspects.consume<aspect>();
23112311
// Strict check for fp64 is disabled temporarily to avoid confusion.
2312-
if (Aspect != aspect::fp64 && !Dev.has(Aspect))
2312+
if (!Dev.has(Aspect))
23132313
return false;
23142314
}
23152315
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// RUN: %clangxx %s -S -o %t_opt.ll -fsycl-device-only -Xclang -verify -Xclang -verify-ignore-unexpected=note
2+
// RUN: FileCheck %s --input-file %t_opt.ll --check-prefix=CHECK-OPT
3+
// RUN: %clangxx %s -S -O0 -o %t_noopt.ll -fsycl-device-only -Xclang -verify -Xclang -verify-ignore-unexpected=note
4+
// RUN: FileCheck %s --input-file %t_noopt.ll --check-prefix=CHECK-NOOPT
5+
6+
// Tests that an optimization that removes the use of double still produces a
7+
// warning.
8+
9+
// CHECK-OPT-NOT: double
10+
// CHECK-NOOPT: double
11+
12+
#include <sycl/sycl.hpp>
13+
14+
int main() {
15+
sycl::queue Q;
16+
// expected-warning-re@+1 {{function '{{.*}}' uses aspect 'fp64' not listed in its 'sycl::device_has' attribute}}
17+
Q.single_task([=]() [[sycl::device_has()]] {
18+
// Double will be optimized out as LoweredFloat can be set directly to a
19+
// lowered value.
20+
double Double = 3.14;
21+
volatile float LoweredFloat = Double;
22+
});
23+
return 0;
24+
}

0 commit comments

Comments
 (0)