Skip to content

Commit 11f7093

Browse files
Early exit optimization to close #431
1 parent 6c60acd commit 11f7093

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

dpctl-capi/helper/source/dpctl_utils_helper.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,8 +438,10 @@ int64_t DPCTL_GetRelativeDeviceId(const device &Device)
438438
auto dev_vec = device::get_devices(dt);
439439
int64_t id = 0;
440440
for (const auto &d_i : dev_vec) {
441-
if (Device == d_i)
441+
if (Device == d_i) {
442442
relid = id;
443+
break;
444+
}
443445
if (d_i.get_platform().get_backend() == be)
444446
++id;
445447
}

0 commit comments

Comments
 (0)