Skip to content

Commit 40ee3b9

Browse files
committed
[SYCL] Add new aspect ext_oneapi_virtual_functions
Spec: #10540
1 parent ce0dc32 commit 40ee3b9

File tree

10 files changed

+28
-9
lines changed

10 files changed

+28
-9
lines changed

llvm/include/llvm/SYCLLowerIR/DeviceConfigFile.td

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ def AspectExt_oneapi_virtual_mem : Aspect<"ext_oneapi_virtual_mem">;
8585
def AspectExt_oneapi_cuda_cluster_group : Aspect<"ext_oneapi_cuda_cluster_group">;
8686
def AspectExt_intel_fpga_task_sequence : Aspect<"ext_intel_fpga_task_sequence">;
8787
def AspectExt_oneapi_atomic16 : Aspect<"ext_oneapi_atomic16">;
88+
def AspectExt_oneapi_virtual_functions : Aspect<"ext_oneapi_virtual_functions">;
8889
// Deprecated aspects
8990
def AspectInt64_base_atomics : Aspect<"int64_base_atomics">;
9091
def AspectInt64_extended_atomics : Aspect<"int64_extended_atomics">;
@@ -148,7 +149,8 @@ def : TargetInfo<"__TestAspectList",
148149
AspectExt_oneapi_graph, AspectExt_oneapi_limited_graph, AspectExt_oneapi_private_alloca,
149150
AspectExt_oneapi_queue_profiling_tag, AspectExt_oneapi_virtual_mem, AspectExt_oneapi_cuda_cluster_group,
150151
AspectExt_intel_fpga_task_sequence,
151-
AspectExt_oneapi_atomic16],
152+
AspectExt_oneapi_atomic16,
153+
AspectExt_oneapi_virtual_functions],
152154
[]>;
153155
// This definition serves the only purpose of testing whether the deprecated aspect list defined in here and in SYCL RT
154156
// match.

sycl/include/sycl/device_aspect_macros.hpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,11 @@
395395
#define __SYCL_ALL_DEVICES_HAVE_ext_oneapi_atomic16__ 0
396396
#endif
397397

398+
#ifndef __SYCL_ALL_DEVICES_HAVE_ext_oneapi_virtual_functions__
399+
//__SYCL_ASPECT(ext_oneapi_virtual_functions, 81)
400+
#define __SYCL_ALL_DEVICES_HAVE_ext_oneapi_virtual_functions__ 0
401+
#endif
402+
398403
#ifndef __SYCL_ANY_DEVICE_HAS_host__
399404
// __SYCL_ASPECT(host, 0)
400405
#define __SYCL_ANY_DEVICE_HAS_host__ 0
@@ -779,3 +784,8 @@
779784
//__SYCL_ASPECT(ext_oneapi_oneapi_atomic16, 80)
780785
#define __SYCL_ANY_DEVICE_HAS_ext_oneapi_atomic16__ 0
781786
#endif
787+
788+
#ifndef __SYCL_ANY_DEVICE_HAS_ext_oneapi_virtual_functions__
789+
//__SYCL_ASPECT(ext_oneapi_virtual_functions, 81)
790+
#define __SYCL_ANY_DEVICE_HAS_ext_oneapi_virtual_functions__ 0
791+
#endif

sycl/include/sycl/info/aspects.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,4 @@ __SYCL_ASPECT(ext_oneapi_unique_addressing_per_dim, 77)
7171
__SYCL_ASPECT(ext_oneapi_bindless_images_sample_1d_usm, 78)
7272
__SYCL_ASPECT(ext_oneapi_bindless_images_sample_2d_usm, 79)
7373
__SYCL_ASPECT(ext_oneapi_atomic16, 80)
74+
__SYCL_ASPECT(ext_oneapi_virtual_functions, 81)

sycl/source/detail/device_impl.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -768,6 +768,12 @@ bool device_impl::has(aspect Aspect) const {
768768
// Likely L0 doesn't check it properly. Need to double-check.
769769
return has_extension("cl_ext_float_atomics");
770770
}
771+
case aspect::ext_oneapi_virtual_functions: {
772+
backend BE = getBackend();
773+
bool isCompatibleBE = BE == sycl::backend::ext_oneapi_level_zero ||
774+
BE == sycl::backend::opencl;
775+
return (is_cpu() || is_gpu()) && isCompatibleBE;
776+
}
771777
}
772778

773779
return false; // This device aspect has not been implemented yet.

sycl/source/feature_test.hpp.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ inline namespace _V1 {
110110
#define SYCL_EXT_ONEAPI_ENQUEUE_NATIVE_COMMAND 1
111111
// In progress yet
112112
#define SYCL_EXT_ONEAPI_ATOMIC16 0
113+
#define SYCL_EXT_ONEAPI_VIRTUAL_FUNCTIONS 0
113114

114115
#ifndef __has_include
115116
#define __has_include(x) 0

sycl/test-e2e/Basic/aspects.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,9 @@ int main() {
9090
if (plt.has(aspect::ext_oneapi_atomic16)) {
9191
std::cout << " ext_oneapi_atomic16" << std::endl;
9292
}
93+
if (plt.has(aspect::ext_oneapi_virtual_functions)) {
94+
std::cout << " ext_oneapi_virtual_functions" << std::endl;
95+
}
9396
}
9497
std::cout << "Passed." << std::endl;
9598
return 0;

sycl/test-e2e/VirtualFunctions/2/1/1/missing-overrides.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
// UNSUPPORTED: cuda, hip, acc
2-
// FIXME: replace unsupported with an aspect check once we have it
1+
// REQUIRES: aspect-ext_oneapi_virtual_functions
32
//
43
// RUN: %{build} -o %t.out %helper-includes
54
// RUN: %{run} %t.out

sycl/test-e2e/VirtualFunctions/2/1/1/more-complex-hierarchy.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
// UNSUPPORTED: cuda, hip, acc
2-
// FIXME: replace unsupported with an aspect check once we have it
1+
// REQUIRES: aspect-ext_oneapi_virtual_functions
32
//
43
// RUN: %{build} -o %t.out %helper-includes
54
// RUN: %{run} %t.out

sycl/test-e2e/VirtualFunctions/2/1/1/simple-hierarchy.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
// UNSUPPORTED: cuda, hip, acc
2-
// FIXME: replace unsupported with an aspect check once we have it
1+
// REQUIRES: aspect-ext_oneapi_virtual_functions
32
//
43
// RUN: %{build} -o %t.out %helper-includes
54
// RUN: %{run} %t.out

sycl/test-e2e/VirtualFunctions/2/2/single-construct-single-use.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
// UNSUPPORTED: cuda, hip, acc
2-
// FIXME: replace unsupported with an aspect check once we have it
1+
// REQUIRES: aspect-ext_oneapi_virtual_functions
32
//
43
// RUN: %{build} -o %t.out %helper-includes
54
// RUN: %{run} %t.out

0 commit comments

Comments
 (0)