Skip to content

Commit d1597dd

Browse files
authored
[UR] Remove unnecessary null pointer check in OpenCL command buffer code, and update declaration of filter lamba to avoid copies (#17615)
1 parent cac5982 commit d1597dd

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

unified-runtime/source/adapters/opencl/command_buffer.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferCreateExp(
3636
ur_queue_handle_t Queue = nullptr;
3737
ur_queue_properties_t QueueProperties = {UR_STRUCTURE_TYPE_QUEUE_PROPERTIES,
3838
nullptr, 0};
39-
const bool IsInOrder =
40-
pCommandBufferDesc ? pCommandBufferDesc->isInOrder : false;
39+
const bool IsInOrder = pCommandBufferDesc->isInOrder;
4140
if (!IsInOrder) {
4241
QueueProperties.flags = UR_QUEUE_FLAG_OUT_OF_ORDER_EXEC_MODE_ENABLE;
4342
}

unified-runtime/source/common/ur_util.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ inline std::optional<EnvVarMap> getenv_to_map(const char *env_var_name,
270270
if (map.find(key) != map.end()) {
271271
map[key].insert(map[key].end(), values_vec.begin(), values_vec.end());
272272
} else {
273-
map[key] = values_vec;
273+
map[key] = std::move(values_vec);
274274
}
275275
}
276276
return map;

unified-runtime/source/loader/ur_adapter_registry.hpp

+4-3
Original file line numberDiff line numberDiff line change
@@ -277,9 +277,9 @@ class AdapterRegistry {
277277
[](unsigned char c) { return std::tolower(c); });
278278

279279
if (PositiveFilter) {
280-
positiveFilters.push_back({backend, termPair.second});
280+
positiveFilters.push_back({std::move(backend), termPair.second});
281281
} else {
282-
negativeFilters.push_back({backend, termPair.second});
282+
negativeFilters.push_back({std::move(backend), termPair.second});
283283
}
284284
}
285285

@@ -294,7 +294,8 @@ class AdapterRegistry {
294294
for (const auto &device : manifest.device_types) {
295295
ur_device_tuple single_device = {manifest.backend, device};
296296

297-
auto matchesFilter = [single_device](const FilterTerm &f) -> bool {
297+
const auto matchesFilter =
298+
[single_device](const FilterTerm &f) -> bool {
298299
return f.matches(single_device);
299300
};
300301

0 commit comments

Comments
 (0)