Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions unified-runtime/examples/codegen/codegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,14 @@ get_platforms(std::vector<ur_adapter_handle_t> &adapters) {
uint32_t adapterPlatformCount = 0;
urPlatformGet(adapter, 0, nullptr, &adapterPlatformCount);

platforms.reserve(platformCount + adapterPlatformCount);
platforms.resize(platformCount + adapterPlatformCount);
urPlatformGet(adapter, adapterPlatformCount, &platforms[platformCount],
&adapterPlatformCount);
platformCount += adapterPlatformCount;
}
if (!platformCount) {
throw std::runtime_error("No platforms available.");
}
platforms.resize(platformCount);

return platforms;
}
Expand Down
3 changes: 1 addition & 2 deletions unified-runtime/examples/hello_world/hello_world.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ int main(int, char *[]) {
goto out;
}

platforms.reserve(platformCount + adapterPlatformCount);
platforms.resize(platformCount + adapterPlatformCount);
status = urPlatformGet(adapter, adapterPlatformCount,
&platforms[platformCount], &adapterPlatformCount);
if (status != UR_RESULT_SUCCESS) {
Expand All @@ -66,7 +66,6 @@ int main(int, char *[]) {
}
platformCount += adapterPlatformCount;
}
platforms.resize(platformCount);

for (auto p : platforms) {
ur_api_version_t api_version = {};
Expand Down
2 changes: 1 addition & 1 deletion unified-runtime/test/loader/platforms/no_platforms.test
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
RUN: UR_ADAPTERS_FORCE_LOAD="" UR_LOG_TEST="level:info;output:stdout;flush:debug" platforms-test
RUN: UR_ADAPTERS_FORCE_LOAD="invalid.so" UR_LOG_TEST="level:info;output:stdout;flush:debug" platforms-test

REQUIRES: linux

Expand Down
5 changes: 2 additions & 3 deletions unified-runtime/test/loader/platforms/platforms.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ int main(int, char *[]) {
out.error("urPlatformGet failed with return code: {}", status);
goto out;
}
out.info("urPlatformGet found {} platforms", platformCount);
out.info("urPlatformGet found {} platforms", adapterPlatformCount);

platforms.reserve(platformCount + adapterPlatformCount);
platforms.resize(platformCount + adapterPlatformCount);
status = urPlatformGet(adapter, adapterPlatformCount,
&platforms[platformCount], &adapterPlatformCount);
if (status != UR_RESULT_SUCCESS) {
Expand All @@ -67,7 +67,6 @@ int main(int, char *[]) {
}
platformCount += adapterPlatformCount;
}
platforms.resize(platformCount);

for (auto p : platforms) {
size_t name_len;
Expand Down
4 changes: 2 additions & 2 deletions unified-runtime/test/unit/print.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ struct UrPlatformGet {
struct UrPlatformGetEmptyArray : UrPlatformGet {
UrPlatformGetEmptyArray() : UrPlatformGet() {}
const char *get_expected() {
return ".phAdapters = nullptr, .NumAdapters = 0, .NumEntries = 0, "
return ".hAdapter = nullptr, .NumEntries = 0, "
".phPlatforms = nullptr, .pNumPlatforms = "
"nullptr";
};
Expand All @@ -86,7 +86,7 @@ struct UrPlatformGetTwoPlatforms : UrPlatformGet {
pNumPlatforms = &num_platforms;
}
const char *get_expected() {
return ".phAdapters = nullptr, .NumAdapters = 0, .NumEntries = 2, "
return ".hAdapter = nullptr, .NumEntries = 2, "
".phPlatforms = .+ \\{.+, .+\\}, "
".pNumPlatforms = .+ \\(2\\)";
};
Expand Down