Skip to content

Commit

Permalink
Merge pull request #2106 from winstonzhang-intel/URLZA-391
Browse files Browse the repository at this point in the history
[L0] Fix urEnqueueDeviceGlobalVariableRead to use device specific modules
  • Loading branch information
kbenzie committed Sep 20, 2024
1 parent 672ac18 commit cbb1935
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion source/adapters/level_zero/kernel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -661,11 +661,19 @@ ur_result_t ur_queue_handle_legacy_t_::enqueueDeviceGlobalVariableRead(

std::scoped_lock<ur_shared_mutex> lock(Queue->Mutex);

ze_module_handle_t ZeModule{};
auto It = Program->ZeModuleMap.find(Queue->Device->ZeDevice);
if (It != Program->ZeModuleMap.end()) {
ZeModule = It->second;
} else {
ZeModule = Program->ZeModule;
}

// Find global variable pointer
size_t GlobalVarSize = 0;
void *GlobalVarPtr = nullptr;
ZE2UR_CALL(zeModuleGetGlobalPointer,
(Program->ZeModule, Name, &GlobalVarSize, &GlobalVarPtr));
(ZeModule, Name, &GlobalVarSize, &GlobalVarPtr));
if (GlobalVarSize < Offset + Count) {
setErrorMessage("Read from device global variable is out of range.",
UR_RESULT_ERROR_INVALID_VALUE,
Expand Down

0 comments on commit cbb1935

Please sign in to comment.