/*
 * Copyright (C) 2023-2026 Intel Corporation
 *
 * SPDX-License-Identifier: MIT
 *
 */

#include "level_zero/core/source/driver/driver_handle.h"
#include "level_zero/driver_experimental/zex_common.h"
#include "level_zero/driver_experimental/zex_driver.h"
#include "level_zero/driver_experimental/zex_graph.h"
#include "level_zero/driver_experimental/zex_memory.h"
#include "level_zero/driver_experimental/zex_visit.h"
#include "level_zero/ze_intel_gpu.h"
#include "level_zero/zet_intel_gpu_metric.h"

#include "additional_extensions_support.h"

namespace L0 {
const std::vector<std::pair<std::string, uint32_t>> DriverHandle::extensionsSupported = {

    // Standard Core Extensions
    {ZE_CACHELINE_SIZE_EXT_NAME, ZE_DEVICE_CACHE_LINE_SIZE_EXT_VERSION_1_0},
    {ZE_DEVICE_IP_VERSION_EXT_NAME, ZE_DEVICE_IP_VERSION_VERSION_1_0},
    {ZE_DEVICE_LUID_EXT_NAME, ZE_DEVICE_LUID_EXT_VERSION_1_0},
    {ZE_DEVICE_MEMORY_PROPERTIES_EXT_NAME, ZE_DEVICE_MEMORY_PROPERTIES_EXT_VERSION_1_0},
    {ZE_DEVICE_USABLEMEM_SIZE_PROPERTIES_EXT_NAME, ZE_DEVICE_USABLEMEM_SIZE_PROPERTIES_EXT_VERSION_1_0},
    {ZE_DEVICE_VECTOR_SIZES_EXT_NAME, ZE_DEVICE_VECTOR_SIZES_EXT_VERSION_1_0},
    {ZE_DRIVER_DDI_HANDLES_EXT_NAME, ZE_DRIVER_DDI_HANDLES_EXT_VERSION_1_1},
    {ZE_EU_COUNT_EXT_NAME, ZE_EU_COUNT_EXT_VERSION_1_0},
    {ZE_EVENT_QUERY_KERNEL_TIMESTAMPS_EXT_NAME, ZE_EVENT_QUERY_KERNEL_TIMESTAMPS_EXT_VERSION_1_0},
    {ZE_EXTERNAL_MEMORY_MAPPING_EXT_NAME, ZE_EXTERNAL_MEMMAP_SYSMEM_EXT_VERSION_1_0},
    {ZE_EXTERNAL_SEMAPHORES_EXTENSION_NAME, ZE_EXTERNAL_SEMAPHORE_EXT_VERSION_1_0},
    {ZE_FLOAT_ATOMICS_EXT_NAME, ZE_FLOAT_ATOMICS_EXT_VERSION_1_0},
    {ZE_IMAGE_COPY_EXT_NAME, ZE_IMAGE_COPY_EXT_VERSION_1_0},
    {ZE_IMAGE_QUERY_ALLOC_PROPERTIES_EXT_NAME, ZE_IMAGE_QUERY_ALLOC_PROPERTIES_EXT_VERSION_1_0},
    {ZE_IMAGE_VIEW_EXT_NAME, ZE_IMAGE_VIEW_EXT_VERSION_1_0},
    {ZE_IMAGE_VIEW_PLANAR_EXT_NAME, ZE_IMAGE_VIEW_PLANAR_EXT_VERSION_1_0},
    {ZE_KERNEL_MAX_GROUP_SIZE_PROPERTIES_EXT_NAME, ZE_KERNEL_MAX_GROUP_SIZE_PROPERTIES_EXT_VERSION_1_0},
    {ZE_LINKAGE_INSPECTION_EXT_NAME, ZE_LINKAGE_INSPECTION_EXT_VERSION_1_0},
    {ZE_MEMORY_COMPRESSION_HINTS_EXT_NAME, ZE_MEMORY_COMPRESSION_HINTS_EXT_VERSION_1_0},
    {ZE_MEMORY_FREE_POLICIES_EXT_NAME, ZE_MEMORY_FREE_POLICIES_EXT_VERSION_1_0},
    {ZE_PCI_PROPERTIES_EXT_NAME, ZE_PCI_PROPERTIES_EXT_VERSION_1_0},
    {ZE_RAYTRACING_EXT_NAME, ZE_RAYTRACING_EXT_VERSION_1_0},
    {ZE_RTAS_EXT_NAME, ZE_RTAS_BUILDER_EXT_VERSION_1_0},

    // Experimental extensions
    {ZE_BANDWIDTH_PROPERTIES_EXP_NAME, ZE_BANDWIDTH_PROPERTIES_EXP_VERSION_1_0},
    {ZE_CONTEXT_POWER_SAVING_HINT_EXP_NAME, ZE_POWER_SAVING_HINT_EXP_VERSION_1_0},
    {ZE_EVENT_POOL_COUNTER_BASED_EXP_NAME, ZE_EVENT_POOL_COUNTER_BASED_EXP_VERSION_1_0},
    {ZE_EVENT_QUERY_TIMESTAMPS_EXP_NAME, ZE_EVENT_QUERY_TIMESTAMPS_EXP_VERSION_1_0},
    {ZE_FABRIC_EXP_NAME, ZE_FABRIC_EXP_VERSION_1_0},
    {ZE_GET_KERNEL_ALLOCATION_PROPERTIES_EXP_NAME, ZE_KERNEL_GET_ALLOCATION_PROPERTIES_EXP_VERSION_1_0},
    {ZE_GET_KERNEL_BINARY_EXP_NAME, ZE_KERNEL_GET_BINARY_EXP_VERSION_1_0},
    {ZE_GLOBAL_OFFSET_EXP_NAME, ZE_GLOBAL_OFFSET_EXP_VERSION_1_0},
    {ZE_IMAGE_MEMORY_PROPERTIES_EXP_NAME, ZE_IMAGE_MEMORY_PROPERTIES_EXP_VERSION_1_0},
    {ZE_IMMEDIATE_COMMAND_LIST_APPEND_EXP_NAME, ZE_IMMEDIATE_COMMAND_LIST_APPEND_EXP_VERSION_1_0},
    {ZE_KERNEL_SCHEDULING_HINTS_EXP_NAME, ZE_SCHEDULING_HINTS_EXP_VERSION_1_0},
    {ZE_MODULE_PROGRAM_EXP_NAME, ZE_MODULE_PROGRAM_EXP_VERSION_1_0},
    {ZE_MUTABLE_COMMAND_LIST_EXP_NAME, ZE_MUTABLE_COMMAND_LIST_EXP_VERSION_1_1},
    {ZE_RECORD_REPLAY_GRAPH_EXP_NAME, ZE_RECORD_REPLAY_GRAPH_EXP_VERSION_1_0},
    {ZE_RELAXED_ALLOCATION_LIMITS_EXP_NAME, ZE_RELAXED_ALLOCATION_LIMITS_EXP_VERSION_1_0},
    {ZE_RTAS_BUILDER_EXP_NAME, ZE_RTAS_BUILDER_EXP_VERSION_1_0},
    {ZE_SUB_ALLOCATIONS_EXP_NAME, ZE_SUB_ALLOCATIONS_EXP_VERSION_1_0},
    {ZE_COMMAND_VISIT_EXT_NAME, ZE_COMMAND_VISIT_EXT_VERSION_1_0},
    {ZEX_COUNTER_BASED_EVENT_EXT_NAME, ZEX_COUNTER_BASED_EVENT_VERSION_1_0},
    {ZEX_MEMORY_FREE_CALLBACK_EXT_NAME, ZEX_MEMORY_FREE_CALLBACK_EXT_VERSION_1_0},
    {ZEX_MEM_IPC_HANDLES_NAME, ZEX_MEM_IPC_HANDLES_VERSION_1_0},
    {ZEX_DRIVER_IMPORT_HOST_POINTER_NAME, ZEX_DRIVER_IMPORT_HOST_POINTER_VERSION_1_0},

    // Intel specific experimental extensions
    {ZE_INTEL_COMMAND_LIST_MEMORY_SYNC, ZE_INTEL_COMMAND_LIST_MEMORY_SYNC_EXP_VERSION_1_0},
    {ZE_INTEL_DEVICE_BLOCK_ARRAY_EXP_NAME, ZE_INTEL_DEVICE_BLOCK_ARRAY_EXP_PROPERTIES_EXP_VERSION_1_0},
    {ZE_INTEL_DEVICE_MODULE_DP_PROPERTIES_EXP_NAME, ZE_INTEL_DEVICE_MODULE_DP_PROPERTIES_EXP_VERSION_1_0},
    {ZE_INTEL_GET_DRIVER_VERSION_STRING_EXP_NAME, ZE_INTEL_GET_DRIVER_VERSION_STRING_EXP_VERSION_1_0},
    {ZE_INTEL_KERNEL_GET_PROGRAM_BINARY_EXP_NAME, ZE_INTEL_KERNEL_GET_PROGRAM_BINARY_EXP_VERSION_1_0},
    {ZEX_INTEL_QUEUE_COPY_OPERATIONS_OFFLOAD_HINT_EXP_NAME, ZEX_INTEL_QUEUE_COPY_OPERATIONS_OFFLOAD_HINT_EXP_VERSION_1_0},
    {ZE_INTEL_XE_DEVICE_PROPERTIES_EXP_NAME, ZE_INTEL_XE_DEVICE_EXP_PROPERTIES_VERSION_1_0},

    // Metrics experimental extensions
    {ZET_METRICS_RUNTIME_ENABLE_DISABLE_EXP_NAME, ZET_METRICS_RUNTIME_ENABLE_DISABLE_EXP_VERSION_1_0},

    // Intel specific Metrics experimental extensions
    {ZET_INTEL_METRIC_CALCULATION_EXP_NAME, ZET_INTEL_METRIC_CALCULATION_EXP_VERSION_1_1},
    {ZET_INTEL_METRIC_HW_BUFFER_SIZE_EXP_NAME, ZET_INTEL_METRIC_HW_BUFFER_SIZE_EXP_VERSION_1_0},
    {ZET_INTEL_METRIC_SCOPES_EXP_NAME, ZET_INTEL_METRIC_SCOPES_EXP_VERSION_1_1},
    {ZET_INTEL_METRIC_SOURCE_ID_EXP_NAME, ZET_INTEL_METRIC_SOURCE_ID_EXP_VERSION_1_0},
    {ZET_INTEL_METRIC_TRACER_DECODE_EXP2_NAME, ZET_INTEL_METRIC_TRACER_DECODE_EXP2_VERSION_1_0},

#include "additional_extensions_support.inl"
};
} // namespace L0
