Skip to content

Commit 7663dc2

Browse files
[SYCL] Reenable fp64 aspect runtime check (#8682)
This commit reenables the fp64 aspect check when ensuring compatibility of a given device image, following the relaxation of aspect propagation for the aspect. --------- Signed-off-by: Larsen, Steffen <[email protected]>
1 parent 3cc55de commit 7663dc2

File tree

2 files changed

+26
-2
lines changed

2 files changed

+26
-2
lines changed

sycl/source/detail/program_manager/program_manager.cpp

+2-2
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");
@@ -2319,7 +2319,7 @@ bool doesDevSupportDeviceRequirements(const device &Dev,
23192319
while (!Aspects.empty()) {
23202320
aspect Aspect = Aspects.consume<aspect>();
23212321
// Strict check for fp64 is disabled temporarily to avoid confusion.
2322-
if (Aspect != aspect::fp64 && !Dev.has(Aspect))
2322+
if (!Dev.has(Aspect))
23232323
return false;
23242324
}
23252325
}
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 -fno-sycl-early-optimizations -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)