|
| 1 | +//===-DeviceConfigFile.td - Device Config File for SYCL ---*--- tablegen -*-==// |
| 2 | +// |
| 3 | +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 | +// See https://llvm.org/LICENSE.txt for license information. |
| 5 | +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 6 | +// |
| 7 | +//===----------------------------------------------------------------------===// |
| 8 | + |
| 9 | +include "llvm/TableGen/DynamicTable.td" |
| 10 | + |
| 11 | +class Aspect<string name> { |
| 12 | + string Name = name; |
| 13 | +} |
| 14 | + |
| 15 | +def AspectCpu : Aspect<"cpu">; |
| 16 | +def AspectGpu : Aspect<"gpu">; |
| 17 | +def AspectAccelerator : Aspect<"accelerator">; |
| 18 | +def AspectCustom : Aspect<"custom">; |
| 19 | +def AspectFp16 : Aspect<"fp16">; |
| 20 | +def AspectFp64 : Aspect<"fp64">; |
| 21 | +def AspectImage : Aspect<"image">; |
| 22 | +def AspectOnline_compiler : Aspect<"online_compiler">; |
| 23 | +def AspectOnline_linker : Aspect<"online_linker">; |
| 24 | +def AspectQueue_profiling : Aspect<"queue_profiling">; |
| 25 | +def AspectUsm_device_allocations : Aspect<"usm_device_allocations">; |
| 26 | +def AspectUsm_host_allocations : Aspect<"usm_host_allocations">; |
| 27 | +def AspectUsm_shared_allocations : Aspect<"usm_shared_allocations">; |
| 28 | +def AspectUsm_system_allocations : Aspect<"usm_system_allocations">; |
| 29 | +def AspectExt_intel_pci_address : Aspect<"ext_intel_pci_address">; |
| 30 | +def AspectExt_intel_gpu_eu_count : Aspect<"ext_intel_gpu_eu_count">; |
| 31 | +def AspectExt_intel_gpu_eu_simd_width : Aspect<"ext_intel_gpu_eu_simd_width">; |
| 32 | +def AspectExt_intel_gpu_slices : Aspect<"ext_intel_gpu_slices">; |
| 33 | +def AspectExt_intel_gpu_subslices_per_slice : Aspect<"ext_intel_gpu_subslices_per_slice">; |
| 34 | +def AspectExt_intel_gpu_eu_count_per_subslice : Aspect<"ext_intel_gpu_eu_count_per_subslice">; |
| 35 | +def AspectExt_intel_max_mem_bandwidth : Aspect<"ext_intel_max_mem_bandwidth">; |
| 36 | +def AspectExt_intel_mem_channel : Aspect<"ext_intel_mem_channel">; |
| 37 | +def AspectUsm_atomic_host_allocations : Aspect<"usm_atomic_host_allocations">; |
| 38 | +def AspectUsm_atomic_shared_allocations : Aspect<"usm_atomic_shared_allocations">; |
| 39 | +def AspectAtomic64 : Aspect<"atomic64">; |
| 40 | +def AspectExt_intel_device_info_uuid : Aspect<"ext_intel_device_info_uuid">; |
| 41 | +def AspectExt_oneapi_srgb : Aspect<"ext_oneapi_srgb">; |
| 42 | +def AspectExt_oneapi_native_assert : Aspect<"ext_oneapi_native_assert">; |
| 43 | +def AspectHost_debuggable : Aspect<"host_debuggable">; |
| 44 | +def AspectExt_intel_gpu_hw_threads_per_eu : Aspect<"ext_intel_gpu_hw_threads_per_eu">; |
| 45 | +def AspectExt_oneapi_cuda_async_barrier : Aspect<"ext_oneapi_cuda_async_barrier">; |
| 46 | +def AspectExt_oneapi_bfloat16_math_functions : Aspect<"ext_oneapi_bfloat16_math_functions">; |
| 47 | +def AspectExt_intel_free_memory : Aspect<"ext_intel_free_memory">; |
| 48 | +def AspectExt_intel_device_id : Aspect<"ext_intel_device_id">; |
| 49 | +def AspectExt_intel_memory_clock_rate : Aspect<"ext_intel_memory_clock_rate">; |
| 50 | +def AspectExt_intel_memory_bus_width : Aspect<"ext_intel_memory_bus_width">; |
| 51 | +def AspectEmulated : Aspect<"emulated">; |
| 52 | +def AspectExt_intel_legacy_image : Aspect<"ext_intel_legacy_image">; |
| 53 | +// Deprecated aspects |
| 54 | +def AspectInt64_base_atomics : Aspect<"int64_base_atomics">; |
| 55 | +def AspectInt64_extended_atomics : Aspect<"int64_extended_atomics">; |
| 56 | +def AspectUsm_system_allocator : Aspect<"usm_system_allocator">; |
| 57 | +def AspectUsm_restricted_shared_allocations : Aspect<"usm_restricted_shared_allocations">; |
| 58 | +def AspectHost : Aspect<"host">; |
| 59 | +defvar AllUSMAspects = [AspectUsm_device_allocations, AspectUsm_host_allocations, |
| 60 | + AspectUsm_shared_allocations, AspectUsm_system_allocations, AspectUsm_atomic_host_allocations, |
| 61 | + AspectUsm_atomic_shared_allocations]; |
| 62 | + |
| 63 | + |
| 64 | +def TargetTable : DynamicTable { |
| 65 | + let FilterClass = "TargetInfo"; |
| 66 | + let Fields = ["DeviceId", "maySupportOtherAspects", "aspects", |
| 67 | + "subGroupSizes", "aotToolchain", "aotToolchainOptions"]; |
| 68 | + string TypeOf_aspects = "list<Aspect>"; |
| 69 | + string TypeOf_subGroupSizes = "list<int>"; |
| 70 | +} |
| 71 | + |
| 72 | +// TargetInfo is a cpp struct defined in DeviceConfigFile.hpp. Both the fields |
| 73 | +// and the name must match those in DeviceConfigFile.hpp. Thus, any |
| 74 | +// modification to this definition in this file must be mirrored in |
| 75 | +// DeviceConfigFile.hpp. |
| 76 | +class TargetInfo<string targetName, list<Aspect> aspectList, list<int> subGroupSizesList, string toolchain = "", string options = "", bit maySupportOtherAspects_init = 0> { |
| 77 | + string DeviceId = targetName; |
| 78 | + bits<1> maySupportOtherAspects = maySupportOtherAspects_init; |
| 79 | + list<Aspect> aspects = aspectList; |
| 80 | + list<int> subGroupSizes = subGroupSizesList; |
| 81 | + string aotToolchain = toolchain; |
| 82 | + string aotToolchainOptions = options; |
| 83 | +} |
| 84 | + |
| 85 | +// This definition serves the only purpose of testing whether the aspect list defined in here and in SYCL RT match. |
| 86 | +def : TargetInfo<"__TestAspectList", |
| 87 | + [AspectCpu, AspectGpu, AspectAccelerator, AspectCustom, AspectFp16, AspectFp64, AspectImage, AspectOnline_compiler, |
| 88 | + AspectOnline_linker, AspectQueue_profiling, AspectUsm_device_allocations, AspectUsm_host_allocations, |
| 89 | + AspectUsm_shared_allocations, AspectUsm_system_allocations, AspectExt_intel_pci_address, |
| 90 | + AspectExt_intel_gpu_eu_count, AspectExt_intel_gpu_eu_simd_width, AspectExt_intel_gpu_slices, |
| 91 | + AspectExt_intel_gpu_subslices_per_slice, AspectExt_intel_gpu_eu_count_per_subslice, |
| 92 | + AspectExt_intel_max_mem_bandwidth, AspectExt_intel_mem_channel, AspectUsm_atomic_host_allocations, |
| 93 | + AspectUsm_atomic_shared_allocations, AspectAtomic64, AspectExt_intel_device_info_uuid, AspectExt_oneapi_srgb, |
| 94 | + AspectExt_oneapi_native_assert, AspectHost_debuggable, AspectExt_intel_gpu_hw_threads_per_eu, |
| 95 | + AspectExt_oneapi_cuda_async_barrier, AspectExt_oneapi_bfloat16_math_functions, AspectExt_intel_free_memory, |
| 96 | + AspectExt_intel_device_id, AspectExt_intel_memory_clock_rate, AspectExt_intel_memory_bus_width, AspectEmulated, |
| 97 | + AspectExt_intel_legacy_image], |
| 98 | + []>; |
| 99 | +// This definition serves the only purpose of testing whether the deprecated aspect list defined in here and in SYCL RT |
| 100 | +// match. |
| 101 | +def : TargetInfo<"__TestDeprecatedAspectList", |
| 102 | + [AspectInt64_base_atomics, AspectInt64_extended_atomics, AspectUsm_system_allocator, |
| 103 | + AspectUsm_restricted_shared_allocations, AspectHost], |
| 104 | + []>; |
| 105 | + |
| 106 | +// Examples of how to use a combination of explicitly specified values + predefined lists |
| 107 | +//defvar AspectList = [AspectCpu] # AllUSMAspects; |
| 108 | +//def : TargetInfo<"Test", AspectList, []>; |
| 109 | +//def : TargetInfo<"Test2", [AspectCpu] # AllUSMAspects, []>; |
0 commit comments