MCPcopy Create free account
hub / github.com/XpuOS/xsched / XCommandQueueExecuteCommandLists

Function XCommandQueueExecuteCommandLists

platforms/levelzero/shim/src/shim.cpp:38–74  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

36}
37
38ze_result_t XCommandQueueExecuteCommandLists(ze_command_queue_handle_t cmdq, uint32_t num, ze_command_list_handle_t *cmd_lists, ze_fence_handle_t fence)
39{
40 for (uint32_t i = 0; i < num; i++) {
41 XDEBG("XCommandQueueExecuteCommandLists(cmdq: %p, cmd_list: %p, fence: %p)", cmdq, cmd_lists[i], fence);
42 }
43
44 auto xq = HwQueueManager::GetXQueue(GetHwQueueHandle(cmdq));
45 if (xq == nullptr) return Driver::CommandQueueExecuteCommandLists(cmdq, num, cmd_lists, fence);
46
47 std::list<std::shared_ptr<ZeListExecuteCommand>> cmds;
48 for (uint32_t i = 0; i < num; i++) {
49 auto sliced = CommandListManager::Instance().Get(cmd_lists[i]);
50 if (sliced == nullptr || sliced->cmd_lists.empty()) {
51 // no sliced, submit the true command list
52 auto cmd = std::make_shared<ZeListExecuteCommand>(cmdq, cmd_lists[i]);
53 g_cmdlist_to_cmd.Add(cmd_lists[i], cmd);
54 cmds.push_back(cmd);
55 continue;
56 }
57 // submit each slice
58 for (auto &cl : sliced->cmd_lists) {
59 auto cmd = std::make_shared<ZeListExecuteCommand>(cmdq, cl);
60 g_cmdlist_to_cmd.Add(cl, cmd);
61 cmds.push_back(cmd);
62 }
63 }
64
65 for (auto it = cmds.begin(); it != cmds.end(); it++) {
66 if (fence != nullptr && std::next(it) == cmds.end()) {
67 XASSERT((*it)->EnableSynchronization(), "fail to enable synchronization");
68 g_fence_to_cmd.Add(fence, *it);
69 }
70 xq->Submit(*it);
71 }
72
73 return ZE_RESULT_SUCCESS;
74}
75
76ze_result_t XCommandQueueSynchronize(ze_command_queue_handle_t hCommandQueue, uint64_t timeout)
77{

Callers

nothing calls this directly

Calls 5

SubmitMethod · 0.80
GetHwQueueHandleFunction · 0.50
GetMethod · 0.45
AddMethod · 0.45
EnableSynchronizationMethod · 0.45

Tested by

no test coverage detected