Skip to content

Commit f073b40

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

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

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

Lines changed: 1 addition & 2 deletions
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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ inline std::optional<EnvVarMap> getenv_to_map(const char *env_var_name,
278278
if (map.find(key) != map.end()) {
279279
map[key].insert(map[key].end(), values_vec.begin(), values_vec.end());
280280
} else {
281-
map[key] = values_vec;
281+
map[key] = std::move(values_vec);
282282
}
283283
}
284284
return map;

unified-runtime/source/loader/ur_adapter_registry.hpp

Lines changed: 4 additions & 3 deletions
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)