Skip to content

Commit a8a492a

Browse files
committed
[L0] Fix urEnqueueDeviceGlobalVariableWrite to use device specific modules
- Fixed urEnqueueDeviceGlobalVariableWrite to check the map for a device specific module for the device used by the queue if it exists, otherwise use the ZeModule in the Program handle. Signed-off-by: Neil R. Spruit <neil.r.spruit@intel.com>
1 parent 06c4cd0 commit a8a492a

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
@@ -494,11 +494,19 @@ ur_result_t urEnqueueDeviceGlobalVariableWrite(
494494
) {
495495
std::scoped_lock<ur_shared_mutex> lock(Queue->Mutex);
496496

497+
ze_module_handle_t ZeModule{};
498+
auto It = Program->ZeModuleMap.find(Queue->Device->ZeDevice);
499+
if (It != Program->ZeModuleMap.end()) {
500+
ZeModule = It->second;
501+
} else {
502+
ZeModule = Program->ZeModule;
503+
}
504+
497505
// Find global variable pointer
498506
size_t GlobalVarSize = 0;
499507
void *GlobalVarPtr = nullptr;
500508
ZE2UR_CALL(zeModuleGetGlobalPointer,
501-
(Program->ZeModule, Name, &GlobalVarSize, &GlobalVarPtr));
509+
(ZeModule, Name, &GlobalVarSize, &GlobalVarPtr));
502510
if (GlobalVarSize < Offset + Count) {
503511
setErrorMessage("Write device global variable is out of range.",
504512
UR_RESULT_ERROR_INVALID_VALUE,

0 commit comments

Comments
 (0)