Skip to content

Commit

Permalink
[SYCL] Add new aspect ext_oneapi_virtual_functions
Browse files Browse the repository at this point in the history
  • Loading branch information
KornevNikita committed Oct 2, 2024
1 parent ce0dc32 commit 40ee3b9
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 9 deletions.
4 changes: 3 additions & 1 deletion llvm/include/llvm/SYCLLowerIR/DeviceConfigFile.td
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ def AspectExt_oneapi_virtual_mem : Aspect<"ext_oneapi_virtual_mem">;
def AspectExt_oneapi_cuda_cluster_group : Aspect<"ext_oneapi_cuda_cluster_group">;
def AspectExt_intel_fpga_task_sequence : Aspect<"ext_intel_fpga_task_sequence">;
def AspectExt_oneapi_atomic16 : Aspect<"ext_oneapi_atomic16">;
def AspectExt_oneapi_virtual_functions : Aspect<"ext_oneapi_virtual_functions">;
// Deprecated aspects
def AspectInt64_base_atomics : Aspect<"int64_base_atomics">;
def AspectInt64_extended_atomics : Aspect<"int64_extended_atomics">;
Expand Down Expand Up @@ -148,7 +149,8 @@ def : TargetInfo<"__TestAspectList",
AspectExt_oneapi_graph, AspectExt_oneapi_limited_graph, AspectExt_oneapi_private_alloca,
AspectExt_oneapi_queue_profiling_tag, AspectExt_oneapi_virtual_mem, AspectExt_oneapi_cuda_cluster_group,
AspectExt_intel_fpga_task_sequence,
AspectExt_oneapi_atomic16],
AspectExt_oneapi_atomic16,
AspectExt_oneapi_virtual_functions],
[]>;
// This definition serves the only purpose of testing whether the deprecated aspect list defined in here and in SYCL RT
// match.
Expand Down
10 changes: 10 additions & 0 deletions sycl/include/sycl/device_aspect_macros.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,11 @@
#define __SYCL_ALL_DEVICES_HAVE_ext_oneapi_atomic16__ 0
#endif

#ifndef __SYCL_ALL_DEVICES_HAVE_ext_oneapi_virtual_functions__
//__SYCL_ASPECT(ext_oneapi_virtual_functions, 81)
#define __SYCL_ALL_DEVICES_HAVE_ext_oneapi_virtual_functions__ 0
#endif

#ifndef __SYCL_ANY_DEVICE_HAS_host__
// __SYCL_ASPECT(host, 0)
#define __SYCL_ANY_DEVICE_HAS_host__ 0
Expand Down Expand Up @@ -779,3 +784,8 @@
//__SYCL_ASPECT(ext_oneapi_oneapi_atomic16, 80)
#define __SYCL_ANY_DEVICE_HAS_ext_oneapi_atomic16__ 0
#endif

#ifndef __SYCL_ANY_DEVICE_HAS_ext_oneapi_virtual_functions__
//__SYCL_ASPECT(ext_oneapi_virtual_functions, 81)
#define __SYCL_ANY_DEVICE_HAS_ext_oneapi_virtual_functions__ 0
#endif
1 change: 1 addition & 0 deletions sycl/include/sycl/info/aspects.def
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,4 @@ __SYCL_ASPECT(ext_oneapi_unique_addressing_per_dim, 77)
__SYCL_ASPECT(ext_oneapi_bindless_images_sample_1d_usm, 78)
__SYCL_ASPECT(ext_oneapi_bindless_images_sample_2d_usm, 79)
__SYCL_ASPECT(ext_oneapi_atomic16, 80)
__SYCL_ASPECT(ext_oneapi_virtual_functions, 81)
6 changes: 6 additions & 0 deletions sycl/source/detail/device_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -768,6 +768,12 @@ bool device_impl::has(aspect Aspect) const {
// Likely L0 doesn't check it properly. Need to double-check.
return has_extension("cl_ext_float_atomics");
}
case aspect::ext_oneapi_virtual_functions: {
backend BE = getBackend();
bool isCompatibleBE = BE == sycl::backend::ext_oneapi_level_zero ||
BE == sycl::backend::opencl;
return (is_cpu() || is_gpu()) && isCompatibleBE;
}
}

return false; // This device aspect has not been implemented yet.
Expand Down
1 change: 1 addition & 0 deletions sycl/source/feature_test.hpp.in
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ inline namespace _V1 {
#define SYCL_EXT_ONEAPI_ENQUEUE_NATIVE_COMMAND 1
// In progress yet
#define SYCL_EXT_ONEAPI_ATOMIC16 0
#define SYCL_EXT_ONEAPI_VIRTUAL_FUNCTIONS 0

#ifndef __has_include
#define __has_include(x) 0
Expand Down
3 changes: 3 additions & 0 deletions sycl/test-e2e/Basic/aspects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ int main() {
if (plt.has(aspect::ext_oneapi_atomic16)) {
std::cout << " ext_oneapi_atomic16" << std::endl;
}
if (plt.has(aspect::ext_oneapi_virtual_functions)) {
std::cout << " ext_oneapi_virtual_functions" << std::endl;
}
}
std::cout << "Passed." << std::endl;
return 0;
Expand Down
3 changes: 1 addition & 2 deletions sycl/test-e2e/VirtualFunctions/2/1/1/missing-overrides.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// UNSUPPORTED: cuda, hip, acc
// FIXME: replace unsupported with an aspect check once we have it
// REQUIRES: aspect-ext_oneapi_virtual_functions
//
// RUN: %{build} -o %t.out %helper-includes
// RUN: %{run} %t.out
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// UNSUPPORTED: cuda, hip, acc
// FIXME: replace unsupported with an aspect check once we have it
// REQUIRES: aspect-ext_oneapi_virtual_functions
//
// RUN: %{build} -o %t.out %helper-includes
// RUN: %{run} %t.out
Expand Down
3 changes: 1 addition & 2 deletions sycl/test-e2e/VirtualFunctions/2/1/1/simple-hierarchy.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// UNSUPPORTED: cuda, hip, acc
// FIXME: replace unsupported with an aspect check once we have it
// REQUIRES: aspect-ext_oneapi_virtual_functions
//
// RUN: %{build} -o %t.out %helper-includes
// RUN: %{run} %t.out
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// UNSUPPORTED: cuda, hip, acc
// FIXME: replace unsupported with an aspect check once we have it
// REQUIRES: aspect-ext_oneapi_virtual_functions
//
// RUN: %{build} -o %t.out %helper-includes
// RUN: %{run} %t.out
Expand Down

0 comments on commit 40ee3b9

Please sign in to comment.