|
#pragma once |
|
|
|
#include <c10/xpu/XPUMacros.h> |
|
#include <sycl/sycl.hpp> |
|
|
|
namespace c10::xpu { |
|
|
|
#define AT_FORALL_XPU_DEVICE_PROPERTIES(_) \ |
|
\ |
|
_(name) \ |
|
\ |
|
\ |
|
_(device_type) \ |
|
\ |
|
\ |
|
_(vendor) \ |
|
\ |
|
\ |
|
_(driver_version) \ |
|
\ |
|
\ |
|
_(version) \ |
|
\ |
|
\ |
|
_(is_available) \ |
|
\ |
|
|
|
\ |
|
_(max_parameter_size) \ |
|
\ |
|
\ |
|
_(max_compute_units) \ |
|
\ |
|
|
|
\ |
|
_(max_work_item_dimensions) \ |
|
\ |
|
|
|
\ |
|
_(max_work_group_size) \ |
|
\ |
|
|
|
\ |
|
_(max_num_sub_groups) \ |
|
\ |
|
|
|
\ |
|
_(sub_group_sizes) \ |
|
\ |
|
\ |
|
_(max_clock_frequency) \ |
|
\ |
|
|
|
\ |
|
_(address_bits) \ |
|
\ |
|
\ |
|
_(max_mem_alloc_size) \ |
|
\ |
|
|
|
|
|
\ |
|
_(mem_base_addr_align) \ |
|
\ |
|
|
|
\ |
|
_(half_fp_config) \ |
|
_(single_fp_config) \ |
|
_(double_fp_config) \ |
|
\ |
|
\ |
|
_(global_mem_size) \ |
|
\ |
|
\ |
|
_(global_mem_cache_type) \ |
|
\ |
|
\ |
|
_(global_mem_cache_size) \ |
|
\ |
|
\ |
|
_(global_mem_cache_line_size) \ |
|
\ |
|
\ |
|
_(local_mem_type) \ |
|
\ |
|
\ |
|
_(local_mem_size) \ |
|
\ |
|
|
|
\ |
|
_(partition_max_sub_devices) \ |
|
\ |
|
\ |
|
_(profiling_timer_resolution) \ |
|
\ |
|
|
|
\ |
|
_(preferred_vector_width_char) \ |
|
_(preferred_vector_width_short) \ |
|
_(preferred_vector_width_int) \ |
|
_(preferred_vector_width_long) \ |
|
_(preferred_vector_width_float) \ |
|
_(preferred_vector_width_double) \ |
|
_(preferred_vector_width_half) \ |
|
\ |
|
|
|
\ |
|
_(native_vector_width_char) \ |
|
_(native_vector_width_short) \ |
|
_(native_vector_width_int) \ |
|
_(native_vector_width_long) \ |
|
_(native_vector_width_float) \ |
|
_(native_vector_width_double) \ |
|
_(native_vector_width_half) |
|
|
|
#define AT_FORALL_XPU_EXT_DEVICE_PROPERTIES(_) \ |
|
\ |
|
_(gpu_eu_count, 512) \ |
|
\ |
|
\ |
|
_(gpu_eu_count_per_subslice, 8) \ |
|
\ |
|
\ |
|
_(gpu_eu_simd_width, 8) \ |
|
\ |
|
\ |
|
_(gpu_hw_threads_per_eu, 8) |
|
|
|
#define AT_FORALL_XPU_DEVICE_ASPECT(_) \ |
|
\ |
|
_(fp16) \ |
|
\ |
|
\ |
|
_(fp64) \ |
|
\ |
|
\ |
|
_(atomic64) |
|
|
|
#define _DEFINE_SYCL_PROP(ns, property, member) \ |
|
ns::property::return_type member; |
|
|
|
#define DEFINE_DEVICE_PROP(property) \ |
|
_DEFINE_SYCL_PROP(sycl::info::device, property, property) |
|
|
|
#define DEFINE_PLATFORM_PROP(property, member) \ |
|
_DEFINE_SYCL_PROP(sycl::info::platform, property, member) |
|
|
|
#define DEFINE_EXT_DEVICE_PROP(property, ...) \ |
|
_DEFINE_SYCL_PROP(sycl::ext::intel::info::device, property, property) |
|
|
|
#define DEFINE_DEVICE_ASPECT(member) bool has_##member; |
|
|
|
struct C10_XPU_API DeviceProp { |
|
AT_FORALL_XPU_DEVICE_PROPERTIES(DEFINE_DEVICE_PROP); |
|
|
|
|
|
DEFINE_PLATFORM_PROP(name, platform_name); |
|
|
|
AT_FORALL_XPU_EXT_DEVICE_PROPERTIES(DEFINE_EXT_DEVICE_PROP); |
|
|
|
AT_FORALL_XPU_DEVICE_ASPECT(DEFINE_DEVICE_ASPECT); |
|
}; |
|
|
|
#undef _DEFINE_SYCL_PROP |
|
#undef DEFINE_DEVICE_PROP |
|
#undef DEFINE_PLATFORM_PROP |
|
#undef DEFINE_EXT_DEVICE_PROP |
|
#undef DEFINE_DEVICE_ASPECT |
|
|
|
} |
|
|