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
|
/*
* Copyright (C) 2020-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include "level_zero/core/source/cmdlist/cmdlist.h"
#include "level_zero/core/source/device/device.h"
#include "level_zero/experimental/source/graph/graph_captured_apis.h"
#include <level_zero/ze_api.h>
namespace L0 {
ze_result_t ZE_APICALL zeCommandListAppendBarrier(
ze_command_list_handle_t hCommandList,
ze_event_handle_t hSignalEvent,
uint32_t numWaitEvents,
ze_event_handle_t *phWaitEvents) {
auto cmdList = L0::CommandList::fromHandle(hCommandList);
auto ret = cmdList->capture<CaptureApi::zeCommandListAppendBarrier>(hCommandList, hSignalEvent, numWaitEvents, phWaitEvents);
if (ret != ZE_RESULT_ERROR_NOT_AVAILABLE) {
return ret;
}
return cmdList->appendBarrier(hSignalEvent, numWaitEvents, phWaitEvents, false);
}
ze_result_t ZE_APICALL zeCommandListAppendMemoryRangesBarrier(
ze_command_list_handle_t hCommandList,
uint32_t numRanges,
const size_t *pRangeSizes,
const void **pRanges,
ze_event_handle_t hSignalEvent,
uint32_t numWaitEvents,
ze_event_handle_t *phWaitEvents) {
auto cmdList = L0::CommandList::fromHandle(hCommandList);
auto ret = cmdList->capture<CaptureApi::zeCommandListAppendMemoryRangesBarrier>(hCommandList, numRanges, pRangeSizes, pRanges, hSignalEvent, numWaitEvents, phWaitEvents);
if (ret != ZE_RESULT_ERROR_NOT_AVAILABLE) {
return ret;
}
return L0::CommandList::fromHandle(hCommandList)->appendMemoryRangesBarrier(numRanges, pRangeSizes, pRanges, hSignalEvent, numWaitEvents, phWaitEvents);
}
ze_result_t ZE_APICALL zeDeviceSystemBarrier(
ze_device_handle_t hDevice) {
return L0::Device::fromHandle(hDevice)->systemBarrier();
}
ze_result_t ZE_APICALL zeCommandListHostSynchronize(
ze_command_list_handle_t hCommandList,
uint64_t timeout) {
return L0::CommandList::fromHandle(hCommandList)->hostSynchronize(timeout);
}
} // namespace L0
extern "C" {
ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandListAppendBarrier(
ze_command_list_handle_t hCommandList,
ze_event_handle_t hSignalEvent,
uint32_t numWaitEvents,
ze_event_handle_t *phWaitEvents) {
return L0::zeCommandListAppendBarrier(
hCommandList,
hSignalEvent,
numWaitEvents,
phWaitEvents);
}
ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandListAppendMemoryRangesBarrier(
ze_command_list_handle_t hCommandList,
uint32_t numRanges,
const size_t *pRangeSizes,
const void **pRanges,
ze_event_handle_t hSignalEvent,
uint32_t numWaitEvents,
ze_event_handle_t *phWaitEvents) {
return L0::zeCommandListAppendMemoryRangesBarrier(
hCommandList,
numRanges,
pRangeSizes,
pRanges,
hSignalEvent,
numWaitEvents,
phWaitEvents);
}
ZE_APIEXPORT ze_result_t ZE_APICALL zeDeviceSystemBarrier(
ze_device_handle_t hDevice) {
return L0::zeDeviceSystemBarrier(
hDevice);
}
ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandListHostSynchronize(
ze_command_list_handle_t hCommandList,
uint64_t timeout) {
return L0::zeCommandListHostSynchronize(
hCommandList,
timeout);
}
}
|