Skip to content

Commit 23fbba1

Browse files
authored
[SYCL] Small fix for sycl::is_compatible() (#9903)
Should return true if KernelIDs is empty.
1 parent 6166f8e commit 23fbba1

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

sycl/source/kernel_bundle.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ std::vector<kernel_id> get_kernel_ids() {
292292

293293
bool is_compatible(const std::vector<kernel_id> &KernelIDs, const device &Dev) {
294294
if (KernelIDs.empty())
295-
return false;
295+
return true;
296296
// TODO: also need to check that the architecture specified by the
297297
// "-fsycl-targets" flag matches the device when we are able to get the
298298
// device's arch.

sycl/test-e2e/OptionalKernelFeatures/is_compatible/is_compatible_with_aspects.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ int main() {
2424
sycl::device Dev;
2525
sycl::queue Q(Dev);
2626

27+
// Returns true for empty vector of kernels
28+
assert(sycl::is_compatible({}, Dev));
29+
2730
if (sycl::is_compatible<KernelCPU>(Dev)) {
2831
Q.submit(
2932
[&](sycl::handler &h) { h.single_task<KernelCPU>([=]() { foo(); }); });

0 commit comments

Comments
 (0)