1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205
|
/*
* Copyright (C) 2023-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include "shared/source/os_interface/os_library.h"
#include "level_zero/core/source/helpers/api_handle_helper.h"
#include <level_zero/ze_api.h>
#include <string>
struct _ze_rtas_builder_exp_handle_t : BaseHandle {};
static_assert(IsCompliantWithDdiHandlesExt<_ze_rtas_builder_exp_handle_t>);
struct _ze_rtas_parallel_operation_exp_handle_t : BaseHandle {};
static_assert(IsCompliantWithDdiHandlesExt<_ze_rtas_parallel_operation_exp_handle_t>);
struct _ze_rtas_builder_ext_handle_t : BaseHandle {};
static_assert(IsCompliantWithDdiHandlesExt<_ze_rtas_builder_ext_handle_t>);
struct _ze_rtas_parallel_operation_ext_handle_t : BaseHandle {};
static_assert(IsCompliantWithDdiHandlesExt<_ze_rtas_parallel_operation_ext_handle_t>);
namespace L0 {
/*
* Note: RTAS Library using same headers as Level Zero, but using function
* pointers to access these symbols in the external Library.
*/
// Exp Functions
typedef ze_result_t (*pRTASBuilderCreateExpImpl)(ze_driver_handle_t hDriver,
const ze_rtas_builder_exp_desc_t *pDescriptor,
ze_rtas_builder_exp_handle_t *phBuilder);
typedef ze_result_t (*pRTASBuilderDestroyExpImpl)(ze_rtas_builder_exp_handle_t hBuilder);
typedef ze_result_t (*pRTASBuilderGetBuildPropertiesExpImpl)(ze_rtas_builder_exp_handle_t hBuilder,
const ze_rtas_builder_build_op_exp_desc_t *args,
ze_rtas_builder_exp_properties_t *pProp);
typedef ze_result_t (*pRTASBuilderBuildExpImpl)(ze_rtas_builder_exp_handle_t hBuilder,
const ze_rtas_builder_build_op_exp_desc_t *args,
void *pScratchBuffer, size_t scratchBufferSizeBytes,
void *pRtasBuffer, size_t rtasBufferSizeBytes,
ze_rtas_parallel_operation_exp_handle_t hParallelOperation,
void *pBuildUserPtr, ze_rtas_aabb_exp_t *pBounds,
size_t *pRtasBufferSizeBytes);
typedef ze_result_t (*pDriverRTASFormatCompatibilityCheckExpImpl)(ze_driver_handle_t hDriver,
const ze_rtas_format_exp_t accelFormat,
const ze_rtas_format_exp_t otherAccelFormat);
typedef ze_result_t (*pRTASParallelOperationCreateExpImpl)(ze_driver_handle_t hDriver,
ze_rtas_parallel_operation_exp_handle_t *phParallelOperation);
typedef ze_result_t (*pRTASParallelOperationDestroyExpImpl)(ze_rtas_parallel_operation_exp_handle_t hParallelOperation);
typedef ze_result_t (*pRTASParallelOperationGetPropertiesExpImpl)(ze_rtas_parallel_operation_exp_handle_t hParallelOperation,
ze_rtas_parallel_operation_exp_properties_t *pProperties);
typedef ze_result_t (*pRTASParallelOperationJoinExpImpl)(ze_rtas_parallel_operation_exp_handle_t hParallelOperation);
// Ext Functions
typedef ze_result_t (*pRTASBuilderCreateExtImpl)(ze_driver_handle_t hDriver,
const ze_rtas_builder_ext_desc_t *pDescriptor,
ze_rtas_builder_ext_handle_t *phBuilder);
typedef ze_result_t (*pRTASBuilderDestroyExtImpl)(ze_rtas_builder_ext_handle_t hBuilder);
typedef ze_result_t (*pRTASBuilderGetBuildPropertiesExtImpl)(ze_rtas_builder_ext_handle_t hBuilder,
const ze_rtas_builder_build_op_ext_desc_t *args,
ze_rtas_builder_ext_properties_t *pProp);
typedef ze_result_t (*pRTASBuilderBuildExtImpl)(ze_rtas_builder_ext_handle_t hBuilder,
const ze_rtas_builder_build_op_ext_desc_t *args,
void *pScratchBuffer, size_t scratchBufferSizeBytes,
void *pRtasBuffer, size_t rtasBufferSizeBytes,
ze_rtas_parallel_operation_ext_handle_t hParallelOperation,
void *pBuildUserPtr, ze_rtas_aabb_ext_t *pBounds,
size_t *pRtasBufferSizeBytes);
typedef ze_result_t (*pDriverRTASFormatCompatibilityCheckExtImpl)(ze_driver_handle_t hDriver,
const ze_rtas_format_ext_t accelFormat,
const ze_rtas_format_ext_t otherAccelFormat);
typedef ze_result_t (*pRTASParallelOperationCreateExtImpl)(ze_driver_handle_t hDriver,
ze_rtas_parallel_operation_ext_handle_t *phParallelOperation);
typedef ze_result_t (*pRTASParallelOperationDestroyExtImpl)(ze_rtas_parallel_operation_ext_handle_t hParallelOperation);
typedef ze_result_t (*pRTASParallelOperationGetPropertiesExtImpl)(ze_rtas_parallel_operation_ext_handle_t hParallelOperation,
ze_rtas_parallel_operation_ext_properties_t *pProperties);
typedef ze_result_t (*pRTASParallelOperationJoinExtImpl)(ze_rtas_parallel_operation_ext_handle_t hParallelOperation);
extern pRTASBuilderCreateExpImpl builderCreateExpImpl;
extern pRTASBuilderDestroyExpImpl builderDestroyExpImpl;
extern pRTASBuilderGetBuildPropertiesExpImpl builderGetBuildPropertiesExpImpl;
extern pRTASBuilderBuildExpImpl builderBuildExpImpl;
extern pDriverRTASFormatCompatibilityCheckExpImpl formatCompatibilityCheckExpImpl;
extern pRTASParallelOperationCreateExpImpl parallelOperationCreateExpImpl;
extern pRTASParallelOperationDestroyExpImpl parallelOperationDestroyExpImpl;
extern pRTASParallelOperationGetPropertiesExpImpl parallelOperationGetPropertiesExpImpl;
extern pRTASParallelOperationJoinExpImpl parallelOperationJoinExpImpl;
// RTAS Extension function pointers
extern pRTASBuilderCreateExtImpl builderCreateExtImpl;
extern pRTASBuilderDestroyExtImpl builderDestroyExtImpl;
extern pRTASBuilderGetBuildPropertiesExtImpl builderGetBuildPropertiesExtImpl;
extern pRTASBuilderBuildExtImpl builderBuildExtImpl;
extern pDriverRTASFormatCompatibilityCheckExtImpl formatCompatibilityCheckExtImpl;
extern pRTASParallelOperationCreateExtImpl parallelOperationCreateExtImpl;
extern pRTASParallelOperationDestroyExtImpl parallelOperationDestroyExtImpl;
extern pRTASParallelOperationGetPropertiesExtImpl parallelOperationGetPropertiesExtImpl;
extern pRTASParallelOperationJoinExtImpl parallelOperationJoinExtImpl;
extern std::string rtasLibraryName;
struct RTASBuilder : _ze_rtas_builder_exp_handle_t {
public:
virtual ~RTASBuilder() = default;
ze_result_t destroy();
ze_result_t getProperties(const ze_rtas_builder_build_op_exp_desc_t *args,
ze_rtas_builder_exp_properties_t *pProp);
ze_result_t build(const ze_rtas_builder_build_op_exp_desc_t *args,
void *pScratchBuffer, size_t scratchBufferSizeBytes,
void *pRtasBuffer, size_t rtasBufferSizeBytes,
ze_rtas_parallel_operation_exp_handle_t hParallelOperation,
void *pBuildUserPtr, ze_rtas_aabb_exp_t *pBounds,
size_t *pRtasBufferSizeBytes);
static RTASBuilder *fromHandle(ze_rtas_builder_exp_handle_t handle) { return static_cast<RTASBuilder *>(handle); }
inline ze_rtas_builder_exp_handle_t toHandle() { return this; }
static bool loadEntryPoints(NEO::OsLibrary *libraryHandle);
template <class T>
static bool getSymbolAddr(NEO::OsLibrary *libraryHandle, const std::string name, T &proc) {
void *addr = libraryHandle->getProcAddress(name);
proc = reinterpret_cast<T>(addr);
return nullptr != proc;
}
ze_rtas_builder_exp_handle_t handleImpl;
};
struct RTASParallelOperation : _ze_rtas_parallel_operation_exp_handle_t {
public:
virtual ~RTASParallelOperation() = default;
ze_result_t destroy();
ze_result_t getProperties(ze_rtas_parallel_operation_exp_properties_t *pProperties);
ze_result_t join();
static RTASParallelOperation *fromHandle(ze_rtas_parallel_operation_exp_handle_t handle) { return static_cast<RTASParallelOperation *>(handle); }
inline ze_rtas_parallel_operation_exp_handle_t toHandle() { return this; }
ze_rtas_parallel_operation_exp_handle_t handleImpl;
};
struct RTASBuilderExt : _ze_rtas_builder_ext_handle_t {
public:
virtual ~RTASBuilderExt() = default;
ze_result_t destroy();
ze_result_t getProperties(const ze_rtas_builder_build_op_ext_desc_t *args,
ze_rtas_builder_ext_properties_t *pProp);
ze_result_t build(const ze_rtas_builder_build_op_ext_desc_t *args,
void *pScratchBuffer, size_t scratchBufferSizeBytes,
void *pRtasBuffer, size_t rtasBufferSizeBytes,
ze_rtas_parallel_operation_ext_handle_t hParallelOperation,
void *pBuildUserPtr, ze_rtas_aabb_ext_t *pBounds,
size_t *pRtasBufferSizeBytes);
static RTASBuilderExt *fromHandle(ze_rtas_builder_ext_handle_t handle) { return static_cast<RTASBuilderExt *>(handle); }
inline ze_rtas_builder_ext_handle_t toHandle() { return this; }
static bool loadEntryPoints(NEO::OsLibrary *libraryHandle);
template <class T>
static bool getSymbolAddr(NEO::OsLibrary *libraryHandle, const std::string name, T &proc) {
void *addr = libraryHandle->getProcAddress(name);
proc = reinterpret_cast<T>(addr);
return nullptr != proc;
}
ze_rtas_builder_ext_handle_t handleImpl;
};
struct RTASParallelOperationExt : _ze_rtas_parallel_operation_ext_handle_t {
public:
virtual ~RTASParallelOperationExt() = default;
ze_result_t destroy();
ze_result_t getProperties(ze_rtas_parallel_operation_ext_properties_t *pProperties);
ze_result_t join();
static RTASParallelOperationExt *fromHandle(ze_rtas_parallel_operation_ext_handle_t handle) { return static_cast<RTASParallelOperationExt *>(handle); }
inline ze_rtas_parallel_operation_ext_handle_t toHandle() { return this; }
ze_rtas_parallel_operation_ext_handle_t handleImpl;
};
} // namespace L0
|