Skip to content

Commit

Permalink
Merge pull request #1183 from al42and/fix-uninit-platforms
Browse files Browse the repository at this point in the history
Fix crash in urAdapterGet with non-initialized platforms
  • Loading branch information
kbenzie authored Apr 22, 2024
2 parents ce78e15 + 200e628 commit 2eea85f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions scripts/templates/ldrddi.cpp.mako
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ namespace ur_loader
{
for( auto& platform : context->platforms )
{
if(platform.initStatus != ${X}_RESULT_SUCCESS)
continue;
platform.dditable.${n}.${th.get_table_name(n, tags, obj)}.${th.make_pfn_name(n, tags, obj)}( 1, &${obj['params'][1]['name']}[adapterIndex], nullptr );
try
{
Expand Down
3 changes: 3 additions & 0 deletions source/loader/ur_ldrddi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ __urdlllocal ur_result_t UR_APICALL urAdapterGet(
size_t adapterIndex = 0;
if (nullptr != phAdapters && NumEntries != 0) {
for (auto &platform : context->platforms) {
if (platform.initStatus != UR_RESULT_SUCCESS) {
continue;
}
platform.dditable.ur.Global.pfnAdapterGet(
1, &phAdapters[adapterIndex], nullptr);
try {
Expand Down

0 comments on commit 2eea85f

Please sign in to comment.