mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-05 09:09:04 +08:00
refactor: add graph base entrypoints
- correct declaration of mutable command list entrypoints Related-To: NEO-15373 Signed-off-by: Zbigniew Zdanowicz <zbigniew.zdanowicz@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
c1ec5db4fc
commit
3e3f516434
@@ -113,7 +113,7 @@ ze_result_t zeCommandListCreateCloneExp(
|
||||
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
||||
}
|
||||
|
||||
ze_result_t zeCommandListImmediateAppendCommandListsExp(
|
||||
ze_result_t ZE_APICALL zeCommandListImmediateAppendCommandListsExp(
|
||||
ze_command_list_handle_t hCommandListImmediate,
|
||||
uint32_t numCommandLists,
|
||||
ze_command_list_handle_t *phCommandLists,
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include <level_zero/ze_api.h>
|
||||
|
||||
namespace L0 {
|
||||
ze_result_t zeCommandListGetNextCommandIdExp(
|
||||
ze_result_t ZE_APICALL zeCommandListGetNextCommandIdExp(
|
||||
ze_command_list_handle_t hCommandList,
|
||||
const ze_mutable_command_id_exp_desc_t *desc,
|
||||
uint64_t *pCommandId) {
|
||||
@@ -19,14 +19,14 @@ ze_result_t zeCommandListGetNextCommandIdExp(
|
||||
return L0::MCL::MutableCommandList::fromHandle(hCommandList)->getNextCommandId(desc, 0, nullptr, pCommandId);
|
||||
}
|
||||
|
||||
ze_result_t zeCommandListUpdateMutableCommandsExp(
|
||||
ze_result_t ZE_APICALL zeCommandListUpdateMutableCommandsExp(
|
||||
ze_command_list_handle_t hCommandList,
|
||||
const ze_mutable_commands_exp_desc_t *desc) {
|
||||
hCommandList = toInternalType(hCommandList);
|
||||
return L0::MCL::MutableCommandList::fromHandle(hCommandList)->updateMutableCommandsExp(desc);
|
||||
}
|
||||
|
||||
ze_result_t zeCommandListUpdateMutableCommandSignalEventExp(
|
||||
ze_result_t ZE_APICALL zeCommandListUpdateMutableCommandSignalEventExp(
|
||||
ze_command_list_handle_t hCommandList,
|
||||
uint64_t commandId,
|
||||
ze_event_handle_t hSignalEvent) {
|
||||
@@ -35,7 +35,7 @@ ze_result_t zeCommandListUpdateMutableCommandSignalEventExp(
|
||||
return L0::MCL::MutableCommandList::fromHandle(hCommandList)->updateMutableCommandSignalEventExp(commandId, hSignalEvent);
|
||||
}
|
||||
|
||||
ze_result_t zeCommandListUpdateMutableCommandWaitEventsExp(
|
||||
ze_result_t ZE_APICALL zeCommandListUpdateMutableCommandWaitEventsExp(
|
||||
ze_command_list_handle_t hCommandList,
|
||||
uint64_t commandId,
|
||||
uint32_t numWaitEvents,
|
||||
@@ -48,7 +48,7 @@ ze_result_t zeCommandListUpdateMutableCommandWaitEventsExp(
|
||||
return L0::MCL::MutableCommandList::fromHandle(hCommandList)->updateMutableCommandWaitEventsExp(commandId, numWaitEvents, translatedEvents.data());
|
||||
}
|
||||
|
||||
ze_result_t zeCommandListGetNextCommandIdWithKernelsExp(
|
||||
ze_result_t ZE_APICALL zeCommandListGetNextCommandIdWithKernelsExp(
|
||||
ze_command_list_handle_t hCommandList,
|
||||
const ze_mutable_command_id_exp_desc_t *desc,
|
||||
uint32_t numKernels,
|
||||
@@ -62,7 +62,7 @@ ze_result_t zeCommandListGetNextCommandIdWithKernelsExp(
|
||||
return L0::MCL::MutableCommandList::fromHandle(hCommandList)->getNextCommandId(desc, numKernels, translatedKernels.data(), pCommandId);
|
||||
}
|
||||
|
||||
ze_result_t zeCommandListUpdateMutableCommandKernelsExp(
|
||||
ze_result_t ZE_APICALL zeCommandListUpdateMutableCommandKernelsExp(
|
||||
ze_command_list_handle_t hCommandList,
|
||||
uint32_t numKernels,
|
||||
uint64_t *pCommandId,
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
namespace L0 {
|
||||
|
||||
ZE_APIEXPORT ze_result_t ZE_APICALL zeGraphCreateExp(ze_context_handle_t hContext, ze_graph_handle_t *phGraph, void *pNext) {
|
||||
ze_result_t ZE_APICALL zeGraphCreateExp(ze_context_handle_t hContext, ze_graph_handle_t *phGraph, void *pNext) {
|
||||
if (nullptr != pNext) {
|
||||
return ZE_RESULT_ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
@@ -32,7 +32,7 @@ ZE_APIEXPORT ze_result_t ZE_APICALL zeGraphCreateExp(ze_context_handle_t hContex
|
||||
return ZE_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandListBeginGraphCaptureExp(ze_command_list_handle_t hCommandList, void *pNext) {
|
||||
ze_result_t ZE_APICALL zeCommandListBeginGraphCaptureExp(ze_command_list_handle_t hCommandList, void *pNext) {
|
||||
if (nullptr != pNext) {
|
||||
return ZE_RESULT_ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
@@ -57,7 +57,7 @@ ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandListBeginGraphCaptureExp(ze_command
|
||||
return ZE_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandListBeginCaptureIntoGraphExp(ze_command_list_handle_t hCommandList, ze_graph_handle_t hGraph, void *pNext) {
|
||||
ze_result_t ZE_APICALL zeCommandListBeginCaptureIntoGraphExp(ze_command_list_handle_t hCommandList, ze_graph_handle_t hGraph, void *pNext) {
|
||||
if (nullptr != pNext) {
|
||||
return ZE_RESULT_ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
@@ -82,7 +82,7 @@ ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandListBeginCaptureIntoGraphExp(ze_com
|
||||
return ZE_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandListEndGraphCaptureExp(ze_command_list_handle_t hCommandList, ze_graph_handle_t *phGraph, void *pNext) {
|
||||
ze_result_t ZE_APICALL zeCommandListEndGraphCaptureExp(ze_command_list_handle_t hCommandList, ze_graph_handle_t *phGraph, void *pNext) {
|
||||
if (nullptr != pNext) {
|
||||
return ZE_RESULT_ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
@@ -113,7 +113,7 @@ ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandListEndGraphCaptureExp(ze_command_l
|
||||
return ZE_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandListInstantiateGraphExp(ze_graph_handle_t hGraph, ze_executable_graph_handle_t *phExecutableGraph, void *pNext) {
|
||||
ze_result_t ZE_APICALL zeCommandListInstantiateGraphExp(ze_graph_handle_t hGraph, ze_executable_graph_handle_t *phExecutableGraph, void *pNext) {
|
||||
if (nullptr != pNext) {
|
||||
return ZE_RESULT_ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
@@ -134,8 +134,8 @@ ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandListInstantiateGraphExp(ze_graph_ha
|
||||
return ZE_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandListAppendGraphExp(ze_command_list_handle_t hCommandList, ze_executable_graph_handle_t hGraph, void *pNext,
|
||||
ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t *phWaitEvents) {
|
||||
ze_result_t ZE_APICALL zeCommandListAppendGraphExp(ze_command_list_handle_t hCommandList, ze_executable_graph_handle_t hGraph, void *pNext,
|
||||
ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t *phWaitEvents) {
|
||||
if (nullptr != pNext) {
|
||||
return ZE_RESULT_ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
@@ -153,7 +153,7 @@ ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandListAppendGraphExp(ze_command_list_
|
||||
return graph->execute(cmdList, pNext, hSignalEvent, numWaitEvents, phWaitEvents);
|
||||
}
|
||||
|
||||
ZE_APIEXPORT ze_result_t ZE_APICALL zeGraphDestroyExp(ze_graph_handle_t hGraph) {
|
||||
ze_result_t ZE_APICALL zeGraphDestroyExp(ze_graph_handle_t hGraph) {
|
||||
auto graph = L0::Graph::fromHandle(hGraph);
|
||||
if (nullptr == graph) {
|
||||
return ZE_RESULT_ERROR_INVALID_ARGUMENT;
|
||||
@@ -162,7 +162,7 @@ ZE_APIEXPORT ze_result_t ZE_APICALL zeGraphDestroyExp(ze_graph_handle_t hGraph)
|
||||
return ZE_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
ZE_APIEXPORT ze_result_t ZE_APICALL zeExecutableGraphDestroyExp(ze_executable_graph_handle_t hGraph) {
|
||||
ze_result_t ZE_APICALL zeExecutableGraphDestroyExp(ze_executable_graph_handle_t hGraph) {
|
||||
auto graph = L0::ExecutableGraph::fromHandle(hGraph);
|
||||
if (nullptr == graph) {
|
||||
return ZE_RESULT_ERROR_INVALID_ARGUMENT;
|
||||
@@ -171,16 +171,69 @@ ZE_APIEXPORT ze_result_t ZE_APICALL zeExecutableGraphDestroyExp(ze_executable_gr
|
||||
return ZE_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandListIsGraphCaptureEnabledExp(ze_command_list_handle_t hCommandList) {
|
||||
ze_result_t ZE_APICALL zeCommandListIsGraphCaptureEnabledExp(ze_command_list_handle_t hCommandList) {
|
||||
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
||||
}
|
||||
|
||||
ZE_APIEXPORT ze_result_t ZE_APICALL zeGraphIsEmptyExp(ze_graph_handle_t hGraph) {
|
||||
ze_result_t ZE_APICALL zeGraphIsEmptyExp(ze_graph_handle_t hGraph) {
|
||||
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
||||
}
|
||||
|
||||
ZE_APIEXPORT ze_result_t ZE_APICALL zeGraphDumpContentsExp(ze_graph_handle_t hGraph, const char *filePath, void *pNext) {
|
||||
ze_result_t ZE_APICALL zeGraphDumpContentsExp(ze_graph_handle_t hGraph, const char *filePath, void *pNext) {
|
||||
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
||||
}
|
||||
|
||||
} // namespace L0
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
ZE_APIEXPORT ze_result_t ZE_APICALL zeGraphCreateExp(ze_context_handle_t hContext, ze_graph_handle_t *phGraph, void *pNext) {
|
||||
return L0::zeGraphCreateExp(hContext, phGraph, pNext);
|
||||
}
|
||||
|
||||
ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandListBeginGraphCaptureExp(ze_command_list_handle_t hCommandList, void *pNext) {
|
||||
return L0::zeCommandListBeginGraphCaptureExp(hCommandList, pNext);
|
||||
}
|
||||
|
||||
ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandListBeginCaptureIntoGraphExp(ze_command_list_handle_t hCommandList, ze_graph_handle_t hGraph, void *pNext) {
|
||||
return L0::zeCommandListBeginCaptureIntoGraphExp(hCommandList, hGraph, pNext);
|
||||
}
|
||||
|
||||
ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandListEndGraphCaptureExp(ze_command_list_handle_t hCommandList, ze_graph_handle_t *phGraph, void *pNext) {
|
||||
return L0::zeCommandListEndGraphCaptureExp(hCommandList, phGraph, pNext);
|
||||
}
|
||||
|
||||
ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandListInstantiateGraphExp(ze_graph_handle_t hGraph, ze_executable_graph_handle_t *phExecutableGraph, void *pNext) {
|
||||
return L0::zeCommandListInstantiateGraphExp(hGraph, phExecutableGraph, pNext);
|
||||
}
|
||||
|
||||
ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandListAppendGraphExp(ze_command_list_handle_t hCommandList, ze_executable_graph_handle_t hGraph, void *pNext,
|
||||
ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t *phWaitEvents) {
|
||||
return L0::zeCommandListAppendGraphExp(hCommandList, hGraph, pNext, hSignalEvent, numWaitEvents, phWaitEvents);
|
||||
}
|
||||
|
||||
ZE_APIEXPORT ze_result_t ZE_APICALL zeGraphDestroyExp(ze_graph_handle_t hGraph) {
|
||||
return L0::zeGraphDestroyExp(hGraph);
|
||||
}
|
||||
|
||||
ZE_APIEXPORT ze_result_t ZE_APICALL zeExecutableGraphDestroyExp(ze_executable_graph_handle_t hGraph) {
|
||||
return L0::zeExecutableGraphDestroyExp(hGraph);
|
||||
}
|
||||
|
||||
ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandListIsGraphCaptureEnabledExp(ze_command_list_handle_t hCommandList) {
|
||||
return L0::zeCommandListIsGraphCaptureEnabledExp(hCommandList);
|
||||
}
|
||||
|
||||
ZE_APIEXPORT ze_result_t ZE_APICALL zeGraphIsEmptyExp(ze_graph_handle_t hGraph) {
|
||||
return L0::zeGraphIsEmptyExp(hGraph);
|
||||
}
|
||||
|
||||
ZE_APIEXPORT ze_result_t ZE_APICALL zeGraphDumpContentsExp(ze_graph_handle_t hGraph, const char *filePath, void *pNext) {
|
||||
return L0::zeGraphDumpContentsExp(hGraph, filePath, pNext);
|
||||
}
|
||||
|
||||
#if defined(__cplusplus)
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
@@ -53,14 +53,14 @@ TEST(GraphTestApiCreate, GivenNonNullPNextThenGraphCreateReturnsError) {
|
||||
ze_base_desc_t ext = {};
|
||||
ext.stype = ZE_STRUCTURE_TYPE_MUTABLE_GRAPH_ARGUMENT_EXP_DESC;
|
||||
ext.pNext = nullptr;
|
||||
auto err = zeGraphCreateExp(&ctx, &graph, &ext);
|
||||
auto err = ::zeGraphCreateExp(&ctx, &graph, &ext);
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_INVALID_ARGUMENT, err);
|
||||
EXPECT_EQ(nullptr, graph);
|
||||
}
|
||||
|
||||
TEST(GraphTestApiCreate, GivenNullContextThenGraphCreateReturnsError) {
|
||||
ze_graph_handle_t graph = nullptr;
|
||||
auto err = zeGraphCreateExp(nullptr, &graph, nullptr);
|
||||
auto err = ::zeGraphCreateExp(nullptr, &graph, nullptr);
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_INVALID_ARGUMENT, err);
|
||||
EXPECT_EQ(nullptr, graph);
|
||||
}
|
||||
@@ -68,16 +68,16 @@ TEST(GraphTestApiCreate, GivenNullContextThenGraphCreateReturnsError) {
|
||||
TEST(GraphTestApiCreate, GivenValidContextThenGraphCreateReturnsSuccess) {
|
||||
Mock<Context> ctx;
|
||||
ze_graph_handle_t graph = nullptr;
|
||||
auto err = zeGraphCreateExp(&ctx, &graph, nullptr);
|
||||
auto err = ::zeGraphCreateExp(&ctx, &graph, nullptr);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, err);
|
||||
EXPECT_NE(nullptr, graph);
|
||||
|
||||
err = zeGraphDestroyExp(graph);
|
||||
err = ::zeGraphDestroyExp(graph);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, err);
|
||||
}
|
||||
|
||||
TEST(GraphTestApiCreate, GivenInvalidGraphThenGraphDestroyReturnsError) {
|
||||
auto err = zeGraphDestroyExp(nullptr);
|
||||
auto err = ::zeGraphDestroyExp(nullptr);
|
||||
EXPECT_NE(ZE_RESULT_SUCCESS, err);
|
||||
}
|
||||
|
||||
@@ -88,18 +88,18 @@ TEST(GraphTestApiCaptureBeginEnd, GivenNonNullPNextThenGraphBeginCaptureReturnsE
|
||||
ext.stype = ZE_STRUCTURE_TYPE_MUTABLE_GRAPH_ARGUMENT_EXP_DESC;
|
||||
ext.pNext = nullptr;
|
||||
|
||||
auto err = zeCommandListBeginGraphCaptureExp(&cmdlist, &ext);
|
||||
auto err = ::zeCommandListBeginGraphCaptureExp(&cmdlist, &ext);
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_INVALID_ARGUMENT, err);
|
||||
|
||||
L0::Graph graph(&ctx, true);
|
||||
err = zeCommandListBeginCaptureIntoGraphExp(&cmdlist, &graph, &ext);
|
||||
err = ::zeCommandListBeginCaptureIntoGraphExp(&cmdlist, &graph, &ext);
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_INVALID_ARGUMENT, err);
|
||||
}
|
||||
|
||||
TEST(GraphTestApiCaptureBeginEnd, GivenNullDestinyGraphThenBeginCaptureReturnsError) {
|
||||
Mock<CommandList> cmdlist;
|
||||
|
||||
auto err = zeCommandListBeginCaptureIntoGraphExp(&cmdlist, nullptr, nullptr);
|
||||
auto err = ::zeCommandListBeginCaptureIntoGraphExp(&cmdlist, nullptr, nullptr);
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_INVALID_ARGUMENT, err);
|
||||
}
|
||||
|
||||
@@ -108,11 +108,11 @@ TEST(GraphTestApiCaptureBeginEnd, GivenValidDestinyGraphThenBeginCaptureReturnsS
|
||||
Mock<CommandList> cmdlist;
|
||||
|
||||
L0::Graph graph(&ctx, true);
|
||||
auto err = zeCommandListBeginCaptureIntoGraphExp(&cmdlist, &graph, nullptr);
|
||||
auto err = ::zeCommandListBeginCaptureIntoGraphExp(&cmdlist, &graph, nullptr);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, err);
|
||||
|
||||
ze_graph_handle_t retGraph = nullptr;
|
||||
err = zeCommandListEndGraphCaptureExp(&cmdlist, &retGraph, nullptr);
|
||||
err = ::zeCommandListEndGraphCaptureExp(&cmdlist, &retGraph, nullptr);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, err);
|
||||
EXPECT_EQ(retGraph, &graph);
|
||||
}
|
||||
@@ -124,11 +124,11 @@ TEST(GraphTestApiCaptureBeginEnd, GivenNonNullPNextThenGraphEndCaptureReturnsErr
|
||||
ext.stype = ZE_STRUCTURE_TYPE_MUTABLE_GRAPH_ARGUMENT_EXP_DESC;
|
||||
ext.pNext = nullptr;
|
||||
|
||||
auto err = zeCommandListBeginGraphCaptureExp(&cmdlist, nullptr);
|
||||
auto err = ::zeCommandListBeginGraphCaptureExp(&cmdlist, nullptr);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, err);
|
||||
|
||||
ze_graph_handle_t retGraph = nullptr;
|
||||
err = zeCommandListEndGraphCaptureExp(&cmdlist, &retGraph, &ext);
|
||||
err = ::zeCommandListEndGraphCaptureExp(&cmdlist, &retGraph, &ext);
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_INVALID_ARGUMENT, err);
|
||||
EXPECT_EQ(nullptr, retGraph);
|
||||
}
|
||||
@@ -137,31 +137,31 @@ TEST(GraphTestApiCaptureBeginEnd, WhenNoDestinyGraphProvidedThenEndCaptureReturn
|
||||
Mock<Context> ctx;
|
||||
Mock<CommandList> cmdlist;
|
||||
|
||||
auto err = zeCommandListBeginGraphCaptureExp(&cmdlist, nullptr);
|
||||
auto err = ::zeCommandListBeginGraphCaptureExp(&cmdlist, nullptr);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, err);
|
||||
|
||||
ze_graph_handle_t retGraph = nullptr;
|
||||
err = zeCommandListEndGraphCaptureExp(&cmdlist, &retGraph, nullptr);
|
||||
err = ::zeCommandListEndGraphCaptureExp(&cmdlist, &retGraph, nullptr);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, err);
|
||||
EXPECT_NE(nullptr, retGraph);
|
||||
|
||||
zeGraphDestroyExp(retGraph);
|
||||
::zeGraphDestroyExp(retGraph);
|
||||
}
|
||||
|
||||
TEST(GraphTestApiCaptureBeginEnd, WhenCommandListIsNotRecordingThenEndCaptureReturnsError) {
|
||||
Mock<CommandList> cmdlist;
|
||||
ze_graph_handle_t retGraph = nullptr;
|
||||
auto err = zeCommandListEndGraphCaptureExp(&cmdlist, &retGraph, nullptr);
|
||||
auto err = ::zeCommandListEndGraphCaptureExp(&cmdlist, &retGraph, nullptr);
|
||||
EXPECT_NE(ZE_RESULT_SUCCESS, err);
|
||||
EXPECT_EQ(nullptr, retGraph);
|
||||
}
|
||||
|
||||
TEST(GraphTestApiCaptureBeginEnd, WhenNoDestinyGraphProvidedThenEndCaptureRequiresOutputGraphPlaceholder) {
|
||||
Mock<CommandList> cmdlist;
|
||||
auto err = zeCommandListBeginGraphCaptureExp(&cmdlist, nullptr);
|
||||
auto err = ::zeCommandListBeginGraphCaptureExp(&cmdlist, nullptr);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, err);
|
||||
|
||||
err = zeCommandListEndGraphCaptureExp(&cmdlist, nullptr, nullptr);
|
||||
err = ::zeCommandListEndGraphCaptureExp(&cmdlist, nullptr, nullptr);
|
||||
EXPECT_NE(ZE_RESULT_SUCCESS, err);
|
||||
}
|
||||
|
||||
@@ -169,10 +169,10 @@ TEST(GraphTestApiCaptureBeginEnd, WhenDestinyGraphProvidedThenEndCaptureDoesNotR
|
||||
Mock<Context> ctx;
|
||||
Mock<CommandList> cmdlist;
|
||||
L0::Graph graph(&ctx, true);
|
||||
auto err = zeCommandListBeginCaptureIntoGraphExp(&cmdlist, &graph, nullptr);
|
||||
auto err = ::zeCommandListBeginCaptureIntoGraphExp(&cmdlist, &graph, nullptr);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, err);
|
||||
|
||||
err = zeCommandListEndGraphCaptureExp(&cmdlist, nullptr, nullptr);
|
||||
err = ::zeCommandListEndGraphCaptureExp(&cmdlist, nullptr, nullptr);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, err);
|
||||
}
|
||||
|
||||
@@ -182,37 +182,37 @@ TEST(GraphTestApiCaptureBeginEnd, WhenCommandListIsAlreadyRecordingThenBeginCapt
|
||||
|
||||
L0::Graph graph1(&ctx, true);
|
||||
L0::Graph graph2(&ctx, true);
|
||||
auto err = zeCommandListBeginCaptureIntoGraphExp(&cmdlist, &graph1, nullptr);
|
||||
auto err = ::zeCommandListBeginCaptureIntoGraphExp(&cmdlist, &graph1, nullptr);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, err);
|
||||
|
||||
err = zeCommandListBeginCaptureIntoGraphExp(&cmdlist, &graph2, nullptr);
|
||||
err = ::zeCommandListBeginCaptureIntoGraphExp(&cmdlist, &graph2, nullptr);
|
||||
EXPECT_NE(ZE_RESULT_SUCCESS, err);
|
||||
|
||||
err = zeCommandListBeginGraphCaptureExp(&cmdlist, nullptr);
|
||||
err = ::zeCommandListBeginGraphCaptureExp(&cmdlist, nullptr);
|
||||
EXPECT_NE(ZE_RESULT_SUCCESS, err);
|
||||
|
||||
ze_graph_handle_t retGraph = nullptr;
|
||||
err = zeCommandListEndGraphCaptureExp(&cmdlist, &retGraph, nullptr);
|
||||
err = ::zeCommandListEndGraphCaptureExp(&cmdlist, &retGraph, nullptr);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, err);
|
||||
EXPECT_EQ(retGraph, &graph1);
|
||||
}
|
||||
|
||||
TEST(GraphTestApiInstantiate, GivenInvalidSourceGraphThenInstaniateGraphReturnsError) {
|
||||
TEST(GraphTestApiInstantiate, GivenInvalidSourceGraphThenInstantiateGraphReturnsError) {
|
||||
ze_executable_graph_handle_t execGraph = nullptr;
|
||||
auto err = zeCommandListInstantiateGraphExp(nullptr, &execGraph, nullptr);
|
||||
auto err = ::zeCommandListInstantiateGraphExp(nullptr, &execGraph, nullptr);
|
||||
EXPECT_NE(ZE_RESULT_SUCCESS, err);
|
||||
EXPECT_EQ(nullptr, execGraph);
|
||||
}
|
||||
|
||||
TEST(GraphTestApiInstantiate, GivenInvalidOutputGraphPlaceholderThenInstaniateGraphReturnsError) {
|
||||
TEST(GraphTestApiInstantiate, GivenInvalidOutputGraphPlaceholderThenInstantiateGraphReturnsError) {
|
||||
Mock<Context> ctx;
|
||||
L0::Graph srcGraph(&ctx, true);
|
||||
|
||||
auto err = zeCommandListInstantiateGraphExp(&srcGraph, nullptr, nullptr);
|
||||
auto err = ::zeCommandListInstantiateGraphExp(&srcGraph, nullptr, nullptr);
|
||||
EXPECT_NE(ZE_RESULT_SUCCESS, err);
|
||||
}
|
||||
|
||||
TEST(GraphTestApiInstantiate, GivenNonNullPNextThenInstaniateGraphReturnsError) {
|
||||
TEST(GraphTestApiInstantiate, GivenNonNullPNextThenInstantiateGraphReturnsError) {
|
||||
Mock<Context> ctx;
|
||||
L0::Graph srcGraph(&ctx, true);
|
||||
|
||||
@@ -221,46 +221,46 @@ TEST(GraphTestApiInstantiate, GivenNonNullPNextThenInstaniateGraphReturnsError)
|
||||
ext.pNext = nullptr;
|
||||
|
||||
ze_executable_graph_handle_t execGraph = nullptr;
|
||||
auto err = zeCommandListInstantiateGraphExp(&srcGraph, &execGraph, &ext);
|
||||
auto err = ::zeCommandListInstantiateGraphExp(&srcGraph, &execGraph, &ext);
|
||||
EXPECT_NE(ZE_RESULT_SUCCESS, err);
|
||||
EXPECT_EQ(nullptr, execGraph);
|
||||
}
|
||||
|
||||
TEST(GraphTestApiInstantiate, GivenValidSourceGraphThenInstaniateReturnsValidExecutableGraph) {
|
||||
TEST(GraphTestApiInstantiate, GivenValidSourceGraphThenInstantiateReturnsValidExecutableGraph) {
|
||||
Mock<Context> ctx;
|
||||
L0::Graph srcGraph(&ctx, true);
|
||||
|
||||
ze_executable_graph_handle_t execGraph = nullptr;
|
||||
auto err = zeCommandListInstantiateGraphExp(&srcGraph, &execGraph, nullptr);
|
||||
auto err = ::zeCommandListInstantiateGraphExp(&srcGraph, &execGraph, nullptr);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, err);
|
||||
EXPECT_NE(nullptr, execGraph);
|
||||
|
||||
err = zeExecutableGraphDestroyExp(execGraph);
|
||||
err = ::zeExecutableGraphDestroyExp(execGraph);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, err);
|
||||
}
|
||||
|
||||
TEST(GraphTestApiInstantiate, GivenInvalidExecutableGraphThenGraphDestroyReturnsError) {
|
||||
auto err = zeExecutableGraphDestroyExp(nullptr);
|
||||
auto err = ::zeExecutableGraphDestroyExp(nullptr);
|
||||
EXPECT_NE(ZE_RESULT_SUCCESS, err);
|
||||
}
|
||||
|
||||
TEST(GraphTestDebugApis, WhenIsGraphCaptureEnabledIsCalledThenReturnUnsupportedFeature) {
|
||||
Mock<CommandList> cmdlist;
|
||||
auto err = zeCommandListIsGraphCaptureEnabledExp(&cmdlist);
|
||||
auto err = ::zeCommandListIsGraphCaptureEnabledExp(&cmdlist);
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE, err);
|
||||
}
|
||||
|
||||
TEST(GraphTestDebugApis, WhenGraphIsEmptyIsCalledThenReturnUnsupportedFeature) {
|
||||
Mock<Context> ctx;
|
||||
L0::Graph srcGraph(&ctx, true);
|
||||
auto err = zeGraphIsEmptyExp(&srcGraph);
|
||||
auto err = ::zeGraphIsEmptyExp(&srcGraph);
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE, err);
|
||||
}
|
||||
|
||||
TEST(GraphTestDebugApis, WhenGraphDumpContentsIsCalledThenReturnUnsupportedFeature) {
|
||||
Mock<Context> ctx;
|
||||
L0::Graph srcGraph(&ctx, true);
|
||||
auto err = zeGraphDumpContentsExp(&srcGraph, "dump", nullptr);
|
||||
auto err = ::zeGraphDumpContentsExp(&srcGraph, "dump", nullptr);
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE, err);
|
||||
}
|
||||
|
||||
@@ -275,7 +275,7 @@ TEST(GraphTestApiSubmit, GivenNonNullPNextThenGraphAppendReturnsError) {
|
||||
ext.stype = ZE_STRUCTURE_TYPE_MUTABLE_GRAPH_ARGUMENT_EXP_DESC;
|
||||
ext.pNext = nullptr;
|
||||
|
||||
auto err = zeCommandListAppendGraphExp(&cmdlist, &execGraph, &ext, nullptr, 0, nullptr);
|
||||
auto err = ::zeCommandListAppendGraphExp(&cmdlist, &execGraph, &ext, nullptr, 0, nullptr);
|
||||
EXPECT_NE(ZE_RESULT_SUCCESS, err);
|
||||
}
|
||||
|
||||
@@ -284,14 +284,14 @@ TEST(GraphTestApiSubmit, GivenInvalidCmdListThenGraphAppendReturnsError) {
|
||||
L0::Graph srcGraph(&ctx, true);
|
||||
L0::ExecutableGraph execGraph;
|
||||
execGraph.instantiateFrom(srcGraph);
|
||||
auto err = zeCommandListAppendGraphExp(nullptr, &execGraph, nullptr, nullptr, 0, nullptr);
|
||||
auto err = ::zeCommandListAppendGraphExp(nullptr, &execGraph, nullptr, nullptr, 0, nullptr);
|
||||
EXPECT_NE(ZE_RESULT_SUCCESS, err);
|
||||
}
|
||||
|
||||
TEST(GraphTestApiSubmit, GivenInvalidGraphThenGraphAppendReturnsError) {
|
||||
Mock<CommandList> cmdlist;
|
||||
|
||||
auto err = zeCommandListAppendGraphExp(&cmdlist, nullptr, nullptr, nullptr, 0, nullptr);
|
||||
auto err = ::zeCommandListAppendGraphExp(&cmdlist, nullptr, nullptr, nullptr, 0, nullptr);
|
||||
EXPECT_NE(ZE_RESULT_SUCCESS, err);
|
||||
}
|
||||
|
||||
@@ -302,7 +302,7 @@ TEST(GraphTestApiSubmit, GivenValidCmdListAndGraphThenGraphAppendReturnsSuccess)
|
||||
L0::ExecutableGraph execGraph;
|
||||
execGraph.instantiateFrom(srcGraph);
|
||||
|
||||
auto err = zeCommandListAppendGraphExp(&cmdlist, &execGraph, nullptr, nullptr, 0, nullptr);
|
||||
auto err = ::zeCommandListAppendGraphExp(&cmdlist, &execGraph, nullptr, nullptr, 0, nullptr);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, err);
|
||||
}
|
||||
|
||||
@@ -335,7 +335,7 @@ TEST(GraphTestApiCapture, GivenCommandListInRecordStateThenCaptureCommandsInstea
|
||||
ze_group_count_t groupCount = {1, 1, 1};
|
||||
|
||||
L0::Graph graph(&ctx, true);
|
||||
auto err = zeCommandListBeginCaptureIntoGraphExp(&cmdlist, &graph, nullptr);
|
||||
auto err = ::zeCommandListBeginCaptureIntoGraphExp(&cmdlist, &graph, nullptr);
|
||||
ASSERT_EQ(ZE_RESULT_SUCCESS, err);
|
||||
|
||||
err = L0::zeCommandListAppendBarrier(&cmdlist, nullptr, 0, nullptr);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (C) 2024 Intel Corporation
|
||||
# Copyright (C) 2024-2025 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
@@ -8,8 +8,8 @@ set(L0_API_DRIVER_EXPERIMENTAL_INCLUDE_FILES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ze_bindless_image_exp.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/zex_api.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/zex_cmdlist.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/zex_context.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/zex_common.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/zex_context.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/zex_driver.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/zex_event.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/zex_memory.h
|
||||
@@ -20,6 +20,7 @@ target_sources(${L0_STATIC_LIB_NAME}
|
||||
PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
||||
${L0_API_DRIVER_EXPERIMENTAL_INCLUDE_FILES}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/zex_graph.h
|
||||
)
|
||||
|
||||
if(UNIX)
|
||||
|
||||
@@ -10,10 +10,16 @@
|
||||
|
||||
#include "zex_common.h"
|
||||
|
||||
#ifndef ZE_RECORD_REPLAY_GRAPH_EXP_NAME
|
||||
/// @brief Record and Replay Graph Extension Name
|
||||
#define ZE_RECORD_REPLAY_GRAPH_EXP_NAME "ZE_experimental_record_replay_graph"
|
||||
|
||||
typedef struct _ze_graph_handle_t *ze_graph_handle_t;
|
||||
typedef struct _ze_executable_graph_handle_t *ze_executable_graph_handle_t;
|
||||
|
||||
namespace L0 {
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
ZE_APIEXPORT ze_result_t ZE_APICALL zeGraphCreateExp(ze_context_handle_t hContext, ze_graph_handle_t *phGraph, void *pNext);
|
||||
ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandListBeginGraphCaptureExp(ze_command_list_handle_t hCommandList, void *pNext);
|
||||
@@ -28,4 +34,25 @@ ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandListIsGraphCaptureEnabledExp(ze_com
|
||||
ZE_APIEXPORT ze_result_t ZE_APICALL zeGraphIsEmptyExp(ze_graph_handle_t hGraph);
|
||||
ZE_APIEXPORT ze_result_t ZE_APICALL zeGraphDumpContentsExp(ze_graph_handle_t hGraph, const char *filePath, void *pNext);
|
||||
|
||||
#if defined(__cplusplus)
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif // ZE_RECORD_REPLAY_GRAPH_EXP_NAME
|
||||
|
||||
namespace L0 {
|
||||
|
||||
ze_result_t ZE_APICALL zeGraphCreateExp(ze_context_handle_t hContext, ze_graph_handle_t *phGraph, void *pNext);
|
||||
ze_result_t ZE_APICALL zeCommandListBeginGraphCaptureExp(ze_command_list_handle_t hCommandList, void *pNext);
|
||||
ze_result_t ZE_APICALL zeCommandListBeginCaptureIntoGraphExp(ze_command_list_handle_t hCommandList, ze_graph_handle_t hGraph, void *pNext);
|
||||
ze_result_t ZE_APICALL zeCommandListEndGraphCaptureExp(ze_command_list_handle_t hCommandList, ze_graph_handle_t *phGraph, void *pNext);
|
||||
ze_result_t ZE_APICALL zeCommandListInstantiateGraphExp(ze_graph_handle_t hGraph, ze_executable_graph_handle_t *phExecutableGraph, void *pNext);
|
||||
ze_result_t ZE_APICALL zeCommandListAppendGraphExp(ze_command_list_handle_t hCommandList, ze_executable_graph_handle_t hGraph, void *pNext,
|
||||
ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t *phWaitEvents);
|
||||
ze_result_t ZE_APICALL zeGraphDestroyExp(ze_graph_handle_t hGraph);
|
||||
ze_result_t ZE_APICALL zeExecutableGraphDestroyExp(ze_executable_graph_handle_t hGraph);
|
||||
ze_result_t ZE_APICALL zeCommandListIsGraphCaptureEnabledExp(ze_command_list_handle_t hCommandList);
|
||||
ze_result_t ZE_APICALL zeGraphIsEmptyExp(ze_graph_handle_t hGraph);
|
||||
ze_result_t ZE_APICALL zeGraphDumpContentsExp(ze_graph_handle_t hGraph, const char *filePath, void *pNext);
|
||||
|
||||
} // namespace L0
|
||||
|
||||
Reference in New Issue
Block a user