Skip to content

Commit d7e9fd2

Browse files
authored
[SYCL] Add new aspect ext_oneapi_virtual_functions (#15577)
Spec: #10540
1 parent 3ba29f3 commit d7e9fd2

File tree

10 files changed

+25
-13
lines changed

10 files changed

+25
-13
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: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -768,6 +768,13 @@ 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+
// TODO: move to UR like e.g. aspect::ext_oneapi_virtual_mem
773+
backend BE = getBackend();
774+
bool isCompatibleBE = BE == sycl::backend::ext_oneapi_level_zero ||
775+
BE == sycl::backend::opencl;
776+
return (is_cpu() || is_gpu()) && isCompatibleBE;
777+
}
771778
}
772779

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

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: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
// UNSUPPORTED: cuda, hip, acc
2-
// FIXME: replace unsupported with an aspect check once we have it
3-
//
41
// RUN: %{build} -o %t.out %helper-includes
52
// RUN: %{run} %t.out
63

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
// UNSUPPORTED: cuda, hip, acc
2-
// FIXME: replace unsupported with an aspect check once we have it
3-
//
41
// RUN: %{build} -o %t.out %helper-includes
52
// RUN: %{run} %t.out
63

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
// UNSUPPORTED: cuda, hip, acc
2-
// FIXME: replace unsupported with an aspect check once we have it
3-
//
41
// RUN: %{build} -o %t.out %helper-includes
52
// RUN: %{run} %t.out
63

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
// UNSUPPORTED: cuda, hip, acc
2-
// FIXME: replace unsupported with an aspect check once we have it
3-
//
41
// RUN: %{build} -o %t.out %helper-includes
52
// RUN: %{run} %t.out
63

sycl/test-e2e/VirtualFunctions/lit.local.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ import os
44
# paths like "../../../helper.hpp" in them, so let's just register a
55
# substitution to add directory with helper headers into include search path
66
config.substitutions.append(("%helper-includes", "-I {}".format(os.path.dirname(os.path.abspath(__file__)))))
7+
config.required_features += ['aspect-ext_oneapi_virtual_functions']

0 commit comments

Comments
 (0)