@@ -43,7 +43,7 @@ inline size_t command_list_descriptor_hash_t::operator()(
43
43
command_list_cache_t::command_list_cache_t (ze_context_handle_t ZeContext)
44
44
: ZeContext{ZeContext} {}
45
45
46
- raii::ze_command_list_t
46
+ raii::ze_command_list_handle_t
47
47
command_list_cache_t::createCommandList (const command_list_descriptor_t &desc) {
48
48
if (auto ImmCmdDesc =
49
49
std::get_if<immediate_command_list_descriptor_t >(&desc)) {
@@ -61,7 +61,7 @@ command_list_cache_t::createCommandList(const command_list_descriptor_t &desc) {
61
61
ZE2UR_CALL_THROWS (
62
62
zeCommandListCreateImmediate,
63
63
(ZeContext, ImmCmdDesc->ZeDevice , &QueueDesc, &ZeCommandList));
64
- return raii::ze_command_list_t (ZeCommandList, &zeCommandListDestroy );
64
+ return raii::ze_command_list_handle_t (ZeCommandList);
65
65
} else {
66
66
auto RegCmdDesc = std::get<regular_command_list_descriptor_t >(desc);
67
67
ZeStruct<ze_command_list_desc_t > CmdListDesc;
@@ -72,7 +72,7 @@ command_list_cache_t::createCommandList(const command_list_descriptor_t &desc) {
72
72
ze_command_list_handle_t ZeCommandList;
73
73
ZE2UR_CALL_THROWS (zeCommandListCreate, (ZeContext, RegCmdDesc.ZeDevice ,
74
74
&CmdListDesc, &ZeCommandList));
75
- return raii::ze_command_list_t (ZeCommandList, &zeCommandListDestroy );
75
+ return raii::ze_command_list_handle_t (ZeCommandList);
76
76
}
77
77
}
78
78
@@ -94,8 +94,7 @@ command_list_cache_t::getImmediateCommandList(
94
94
auto CommandList = getCommandList (Desc).release ();
95
95
return raii::cache_borrowed_command_list_t (
96
96
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));
99
98
});
100
99
}
101
100
@@ -113,12 +112,11 @@ command_list_cache_t::getRegularCommandList(ze_device_handle_t ZeDevice,
113
112
114
113
return raii::cache_borrowed_command_list_t (
115
114
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));
118
116
});
119
117
}
120
118
121
- raii::ze_command_list_t
119
+ raii::ze_command_list_handle_t
122
120
command_list_cache_t::getCommandList (const command_list_descriptor_t &desc) {
123
121
std::unique_lock<ur_mutex> Lock (ZeCommandListCacheMutex);
124
122
auto it = ZeCommandListCache.find (desc);
@@ -129,7 +127,8 @@ command_list_cache_t::getCommandList(const command_list_descriptor_t &desc) {
129
127
130
128
assert (!it->second .empty ());
131
129
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 ());
133
132
it->second .pop ();
134
133
135
134
if (it->second .empty ())
@@ -138,8 +137,9 @@ command_list_cache_t::getCommandList(const command_list_descriptor_t &desc) {
138
137
return CommandListHandle;
139
138
}
140
139
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) {
143
143
// TODO: add a limit?
144
144
std::unique_lock<ur_mutex> Lock (ZeCommandListCacheMutex);
145
145
auto [it, _] = ZeCommandListCache.try_emplace (desc);
0 commit comments