@@ -43,7 +43,7 @@ inline size_t command_list_descriptor_hash_t::operator()(
4343command_list_cache_t::command_list_cache_t (ze_context_handle_t ZeContext)
4444 : ZeContext{ZeContext} {}
4545
46- raii::ze_command_list_t
46+ raii::ze_command_list_handle_t
4747command_list_cache_t::createCommandList (const command_list_descriptor_t &desc) {
4848 if (auto ImmCmdDesc =
4949 std::get_if<immediate_command_list_descriptor_t >(&desc)) {
@@ -61,7 +61,7 @@ command_list_cache_t::createCommandList(const command_list_descriptor_t &desc) {
6161 ZE2UR_CALL_THROWS (
6262 zeCommandListCreateImmediate,
6363 (ZeContext, ImmCmdDesc->ZeDevice , &QueueDesc, &ZeCommandList));
64- return raii::ze_command_list_t (ZeCommandList, &zeCommandListDestroy );
64+ return raii::ze_command_list_handle_t (ZeCommandList);
6565 } else {
6666 auto RegCmdDesc = std::get<regular_command_list_descriptor_t >(desc);
6767 ZeStruct<ze_command_list_desc_t > CmdListDesc;
@@ -72,7 +72,7 @@ command_list_cache_t::createCommandList(const command_list_descriptor_t &desc) {
7272 ze_command_list_handle_t ZeCommandList;
7373 ZE2UR_CALL_THROWS (zeCommandListCreate, (ZeContext, RegCmdDesc.ZeDevice ,
7474 &CmdListDesc, &ZeCommandList));
75- return raii::ze_command_list_t (ZeCommandList, &zeCommandListDestroy );
75+ return raii::ze_command_list_handle_t (ZeCommandList);
7676 }
7777}
7878
@@ -94,8 +94,7 @@ command_list_cache_t::getImmediateCommandList(
9494 auto CommandList = getCommandList (Desc).release ();
9595 return raii::cache_borrowed_command_list_t (
9696 CommandList, [Cache = this , Desc](ze_command_list_handle_t CmdList) {
97- Cache->addCommandList (
98- Desc, raii::ze_command_list_t (CmdList, &zeCommandListDestroy));
97+ Cache->addCommandList (Desc, raii::ze_command_list_handle_t (CmdList));
9998 });
10099}
101100
@@ -113,12 +112,11 @@ command_list_cache_t::getRegularCommandList(ze_device_handle_t ZeDevice,
113112
114113 return raii::cache_borrowed_command_list_t (
115114 CommandList, [Cache = this , Desc](ze_command_list_handle_t CmdList) {
116- Cache->addCommandList (
117- Desc, raii::ze_command_list_t (CmdList, &zeCommandListDestroy));
115+ Cache->addCommandList (Desc, raii::ze_command_list_handle_t (CmdList));
118116 });
119117}
120118
121- raii::ze_command_list_t
119+ raii::ze_command_list_handle_t
122120command_list_cache_t::getCommandList (const command_list_descriptor_t &desc) {
123121 std::unique_lock<ur_mutex> Lock (ZeCommandListCacheMutex);
124122 auto it = ZeCommandListCache.find (desc);
@@ -129,7 +127,8 @@ command_list_cache_t::getCommandList(const command_list_descriptor_t &desc) {
129127
130128 assert (!it->second .empty ());
131129
132- raii::ze_command_list_t CommandListHandle = std::move (it->second .top ());
130+ raii::ze_command_list_handle_t CommandListHandle =
131+ std::move (it->second .top ());
133132 it->second .pop ();
134133
135134 if (it->second .empty ())
@@ -138,8 +137,9 @@ command_list_cache_t::getCommandList(const command_list_descriptor_t &desc) {
138137 return CommandListHandle;
139138}
140139
141- void command_list_cache_t::addCommandList (const command_list_descriptor_t &desc,
142- raii::ze_command_list_t cmdList) {
140+ void command_list_cache_t::addCommandList (
141+ const command_list_descriptor_t &desc,
142+ raii::ze_command_list_handle_t cmdList) {
143143 // TODO: add a limit?
144144 std::unique_lock<ur_mutex> Lock (ZeCommandListCacheMutex);
145145 auto [it, _] = ZeCommandListCache.try_emplace (desc);
0 commit comments