File: zer_libddi.cpp

package info (click to toggle)
level-zero 1.26.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 13,468 kB
  • sloc: cpp: 130,327; ansic: 16,197; python: 9,824; makefile: 4
file content (57 lines) | stat: -rw-r--r-- 1,999 bytes parent folder | download
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
/*
 *
 * Copyright (C) 2019-2025 Intel Corporation
 *
 * SPDX-License-Identifier: MIT
 *
 * @file zer_libddi.cpp
 *
 */
#include "ze_lib.h"
#ifndef L0_STATIC_LOADER_BUILD
#include "zer_ddi.h"
#endif

namespace ze_lib
{
    ///////////////////////////////////////////////////////////////////////////////

#ifdef L0_STATIC_LOADER_BUILD
    __zedlllocal ze_result_t context_t::zerDdiTableInit(ze_api_version_t version)
    {
        ze_result_t result = ZE_RESULT_SUCCESS;

        if( ZE_RESULT_SUCCESS == result )
        {
            // Optional
            auto getTable = reinterpret_cast<zer_pfnGetGlobalProcAddrTable_t>(
                GET_FUNCTION_PTR(loader, "zerGetGlobalProcAddrTable") );
            getTableWithCheck(getTable, version, &initialzerDdiTable.Global );
            initialzerDdiTable.Global.pfnGetLastErrorDescription = reinterpret_cast<zer_pfnGetLastErrorDescription_t>(
                GET_FUNCTION_PTR(loader, "zerGetLastErrorDescription") );
            initialzerDdiTable.Global.pfnTranslateDeviceHandleToIdentifier = reinterpret_cast<zer_pfnTranslateDeviceHandleToIdentifier_t>(
                GET_FUNCTION_PTR(loader, "zerTranslateDeviceHandleToIdentifier") );
            initialzerDdiTable.Global.pfnTranslateIdentifierToDeviceHandle = reinterpret_cast<zer_pfnTranslateIdentifierToDeviceHandle_t>(
                GET_FUNCTION_PTR(loader, "zerTranslateIdentifierToDeviceHandle") );
            initialzerDdiTable.Global.pfnGetDefaultContext = reinterpret_cast<zer_pfnGetDefaultContext_t>(
                GET_FUNCTION_PTR(loader, "zerGetDefaultContext") );
        }

        return result;
    }
#else
    __zedlllocal ze_result_t context_t::zerDdiTableInit(ze_api_version_t version)
    {
        ze_result_t result = ZE_RESULT_SUCCESS;

        if( ZE_RESULT_SUCCESS == result )
        {
            // Optional
            zerGetGlobalProcAddrTable( version, &initialzerDdiTable.Global );
        }

        return result;
    }
#endif

} // namespace ze_lib