Skip to content

Commit ed85c3e

Browse files
authored
Merge pull request #2106 from winstonzhang-intel/URLZA-391
[L0] Fix urEnqueueDeviceGlobalVariableRead to use device specific modules
2 parents 77187f6 + bb93a8f commit ed85c3e

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

source/adapters/level_zero/kernel.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -556,11 +556,19 @@ ur_result_t urEnqueueDeviceGlobalVariableRead(
556556
) {
557557
std::scoped_lock<ur_shared_mutex> lock(Queue->Mutex);
558558

559+
ze_module_handle_t ZeModule{};
560+
auto It = Program->ZeModuleMap.find(Queue->Device->ZeDevice);
561+
if (It != Program->ZeModuleMap.end()) {
562+
ZeModule = It->second;
563+
} else {
564+
ZeModule = Program->ZeModule;
565+
}
566+
559567
// Find global variable pointer
560568
size_t GlobalVarSize = 0;
561569
void *GlobalVarPtr = nullptr;
562570
ZE2UR_CALL(zeModuleGetGlobalPointer,
563-
(Program->ZeModule, Name, &GlobalVarSize, &GlobalVarPtr));
571+
(ZeModule, Name, &GlobalVarSize, &GlobalVarPtr));
564572
if (GlobalVarSize < Offset + Count) {
565573
setErrorMessage("Read from device global variable is out of range.",
566574
UR_RESULT_ERROR_INVALID_VALUE,

0 commit comments

Comments
 (0)