Skip to content

Commit 410f00e

Browse files
committed
Apply suggestions
1 parent 7823d65 commit 410f00e

File tree

5 files changed

+59
-47
lines changed

5 files changed

+59
-47
lines changed

sycl/include/sycl/aspects.hpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,17 @@
1212
namespace sycl {
1313
__SYCL_INLINE_VER_NAMESPACE(_V1) {
1414

15-
#define __SYCL_ASPECT(A, B, C) A = B,
16-
#define __SYCL_SPECIAL_ASPECT(A, B, C) A = B,
15+
#define __SYCL_ASPECT(ASPECT, ID) ASPECT = ID,
16+
#define __SYCL_ASPECT_DEPRECATED(ASPECT, ID, MESSAGE) \
17+
ASPECT __SYCL2020_DEPRECATED(MESSAGE) = ID,
18+
#define __SYCL_SPECIAL_ASPECT_DEPRECATED(ASPECT, ID, MESSAGE) \
19+
__SYCL_ASPECT_DEPRECATED(ASPECT, ID, MESSAGE)
1720
enum class __SYCL_TYPE(aspect) aspect {
1821
#include <sycl/info/aspects.def>
22+
#include <sycl/info/aspects_deprecated.def>
1923
};
20-
#undef __SYCL_SPECIAL_ASPECT
24+
#undef __SYCL_SPECIAL_ASPECT_DEPRECATED
25+
#undef __SYCL_ASPECT_DEPRECATED
2126
#undef __SYCL_ASPECT
2227

2328
} // __SYCL_INLINE_VER_NAMESPACE(_V1)

sycl/include/sycl/info/aspects.def

Lines changed: 35 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,35 @@
1-
__SYCL_ASPECT(host, 0, "host")
2-
__SYCL_ASPECT(cpu, 1, "cpu")
3-
__SYCL_ASPECT(gpu, 2, "gpu")
4-
__SYCL_ASPECT(accelerator, 3, "accelerator")
5-
__SYCL_ASPECT(custom, 4, "custom")
6-
__SYCL_ASPECT(fp16, 5, "fp16")
7-
__SYCL_ASPECT(fp64, 6, "fp64")
8-
__SYCL_ASPECT(int64_base_atomics __SYCL2020_DEPRECATED("use atomic64 instead"), 7, "int64_base_atomics")
9-
__SYCL_ASPECT(int64_extended_atomics __SYCL2020_DEPRECATED("use atomic64 instead"), 8, "int64_extended_atomics")
10-
__SYCL_ASPECT(image, 9, "image")
11-
__SYCL_ASPECT(online_compiler, 10, "online_compiler")
12-
__SYCL_ASPECT(online_linker, 11, "online_linker")
13-
__SYCL_ASPECT(queue_profiling, 12, "queue_profiling")
14-
__SYCL_ASPECT(usm_device_allocations, 13, "usm_device_allocations")
15-
__SYCL_ASPECT(usm_host_allocations, 14, "usm_host_allocations")
16-
__SYCL_ASPECT(usm_shared_allocations, 15, "usm_shared_allocations")
17-
__SYCL_ASPECT(usm_restricted_shared_allocations, 16, "usm_restricted_shared_allocations")
18-
__SYCL_ASPECT(usm_system_allocations, 17, "usm_system_allocations")
19-
__SYCL_SPECIAL_ASPECT(usm_system_allocator __SYCL2020_DEPRECATED("use usm_system_allocations instead"), usm_system_allocations, "usm_system_allocations")
20-
__SYCL_ASPECT(ext_intel_pci_address, 18, "ext_intel_pci_address")
21-
__SYCL_ASPECT(ext_intel_gpu_eu_count, 19, "ext_intel_gpu_eu_count")
22-
__SYCL_ASPECT(ext_intel_gpu_eu_simd_width, 20, "ext_intel_gpu_eu_simd_width")
23-
__SYCL_ASPECT(ext_intel_gpu_slices, 21, "ext_intel_gpu_slices")
24-
__SYCL_ASPECT(ext_intel_gpu_subslices_per_slice, 22, "ext_intel_gpu_subslices_per_slice")
25-
__SYCL_ASPECT(ext_intel_gpu_eu_count_per_subslice, 23, "ext_intel_gpu_eu_count_per_subslice")
26-
__SYCL_ASPECT(ext_intel_max_mem_bandwidth, 24, "ext_intel_max_mem_bandwidth")
27-
__SYCL_ASPECT(ext_intel_mem_channel, 25, "ext_intel_mem_channel")
28-
__SYCL_ASPECT(usm_atomic_host_allocations, 26, "usm_atomic_host_allocations")
29-
__SYCL_ASPECT(usm_atomic_shared_allocations, 27, "usm_atomic_shared_allocations")
30-
__SYCL_ASPECT(atomic64, 28, "atomic64")
31-
__SYCL_ASPECT(ext_intel_device_info_uuid, 29, "ext_intel_device_info_uuid")
32-
__SYCL_ASPECT(ext_oneapi_srgb, 30, "ext_oneapi_srgb")
33-
__SYCL_ASPECT(ext_oneapi_native_assert, 31, "ext_oneapi_native_assert")
34-
__SYCL_ASPECT(host_debuggable, 32, "host_debuggable")
35-
__SYCL_ASPECT(ext_intel_gpu_hw_threads_per_eu, 33, "ext_intel_gpu_hw_threads_per_eu")
36-
__SYCL_ASPECT(ext_oneapi_cuda_async_barrier, 34, "ext_oneapi_cuda_async_barrier")
37-
__SYCL_ASPECT(ext_oneapi_bfloat16, 35, "ext_oneapi_bfloat16")
38-
__SYCL_ASPECT(ext_intel_free_memory, 36, "ext_intel_free_memory")
1+
__SYCL_ASPECT(host, 0)
2+
__SYCL_ASPECT(cpu, 1)
3+
__SYCL_ASPECT(gpu, 2)
4+
__SYCL_ASPECT(accelerator, 3)
5+
__SYCL_ASPECT(custom, 4)
6+
__SYCL_ASPECT(fp16, 5)
7+
__SYCL_ASPECT(fp64, 6)
8+
__SYCL_ASPECT(image, 9)
9+
__SYCL_ASPECT(online_compiler, 10)
10+
__SYCL_ASPECT(online_linker, 11)
11+
__SYCL_ASPECT(queue_profiling, 12)
12+
__SYCL_ASPECT(usm_device_allocations, 13)
13+
__SYCL_ASPECT(usm_host_allocations, 14)
14+
__SYCL_ASPECT(usm_shared_allocations, 15)
15+
__SYCL_ASPECT(usm_restricted_shared_allocations, 16)
16+
__SYCL_ASPECT(usm_system_allocations, 17)
17+
__SYCL_ASPECT(ext_intel_pci_address, 18)
18+
__SYCL_ASPECT(ext_intel_gpu_eu_count, 19)
19+
__SYCL_ASPECT(ext_intel_gpu_eu_simd_width, 20)
20+
__SYCL_ASPECT(ext_intel_gpu_slices, 21)
21+
__SYCL_ASPECT(ext_intel_gpu_subslices_per_slice, 22)
22+
__SYCL_ASPECT(ext_intel_gpu_eu_count_per_subslice, 23)
23+
__SYCL_ASPECT(ext_intel_max_mem_bandwidth, 24)
24+
__SYCL_ASPECT(ext_intel_mem_channel, 25)
25+
__SYCL_ASPECT(usm_atomic_host_allocations, 26)
26+
__SYCL_ASPECT(usm_atomic_shared_allocations, 27)
27+
__SYCL_ASPECT(atomic64, 28)
28+
__SYCL_ASPECT(ext_intel_device_info_uuid, 29)
29+
__SYCL_ASPECT(ext_oneapi_srgb, 30)
30+
__SYCL_ASPECT(ext_oneapi_native_assert, 31)
31+
__SYCL_ASPECT(host_debuggable, 32)
32+
__SYCL_ASPECT(ext_intel_gpu_hw_threads_per_eu, 33)
33+
__SYCL_ASPECT(ext_oneapi_cuda_async_barrier, 34)
34+
__SYCL_ASPECT(ext_oneapi_bfloat16, 35)
35+
__SYCL_ASPECT(ext_intel_free_memory, 36)
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
__SYCL_ASPECT_DEPRECATED(int64_base_atomics, 7, "use atomic64 instead")
2+
__SYCL_ASPECT_DEPRECATED(int64_extended_atomics, 8, "use atomic64 instead")
3+
// Special macro for aspects that don't have own token
4+
__SYCL_SPECIAL_ASPECT_DEPRECATED(usm_system_allocator, usm_system_allocations, "use usm_system_allocations instead")

sycl/include/sycl/stl.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include <memory>
2020
#include <mutex>
2121
#include <string>
22+
#include <string_view>
2223
#include <vector>
2324

2425
namespace sycl {

sycl/source/detail/program_manager/program_manager.cpp

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -553,24 +553,29 @@ RT::PiProgram ProgramManager::getBuiltPIProgram(
553553
const RTDeviceBinaryImage::PropertyRange &ARange =
554554
Img.getDeviceRequirements();
555555

556-
#define __SYCL_ASPECT(A, B, C) \
557-
case aspect::A: \
558-
return C;
559-
#define __SYCL_SPECIAL_ASPECT(A, B, C)
556+
#define __SYCL_ASPECT(ASPECT, ID) \
557+
case aspect::ASPECT: \
558+
return #ASPECT;
559+
#define __SYCL_ASPECT_DEPRECATED(ASPECT, ID, MESSAGE) __SYCL_ASPECT(ASPECT, ID)
560+
// We don't need "case aspect::usm_allocator" here because it will duplicate
561+
// "case aspect::usm_system_allocations", therefore leave this macro empty
562+
#define __SYCL_SPECIAL_ASPECT_DEPRECATED(ASPECT, ID, MESSAGE)
560563
auto getAspectNameStr = [](aspect AspectNum) -> std::string {
561564
switch (AspectNum) {
562565
#include <sycl/info/aspects.def>
566+
#include <sycl/info/aspects_deprecated.def>
563567
default:
564568
throw sycl::exception(
565569
errc::kernel_not_supported,
566570
"Unknown aspect " + std::to_string(static_cast<unsigned>(AspectNum)));
567571
}
568572
};
569-
#undef __SYCL_SPECIAL_ASPECT
573+
#undef __SYCL_SPECIAL_ASPECT_DEPRECATED
574+
#undef __SYCL_ASPECT_DEPRECATED
570575
#undef __SYCL_ASPECT
571576

572577
for (RTDeviceBinaryImage::PropertyRange::ConstIterator It : ARange) {
573-
auto KName = std::string((*It)->Name);
578+
auto KName = std::string_view((*It)->Name);
574579
if (KName != "aspects")
575580
continue;
576581
ByteArray Aspects = DeviceBinaryProperty(*It).asByteArray();

0 commit comments

Comments
 (0)