Skip to content

Commit

Permalink
Merge pull request #1611 from nrspruit/fix_interop_wg_max_size
Browse files Browse the repository at this point in the history
[L0] ensure a valid kernel handle for the device when reading max wg
  • Loading branch information
kbenzie authored May 16, 2024
2 parents 09467b8 + f67122c commit 65c39c8
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions source/adapters/level_zero/kernel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -586,15 +586,26 @@ UR_APIEXPORT ur_result_t UR_APICALL urKernelGetGroupInfo(

ZeStruct<ze_kernel_properties_t> kernelProperties;
kernelProperties.pNext = &workGroupProperties;

auto ZeResult = ZE_CALL_NOCHECK(
zeKernelGetProperties,
(Kernel->ZeKernelMap[Device->ZeDevice], &kernelProperties));
if (ZeResult || workGroupProperties.maxGroupSize == 0) {
// Set the Kernel to use as the ZeKernel initally for native handle support.
// This makes the assumption that this device is the same device where this
// kernel was created.
auto ZeKernelDevice = Kernel->ZeKernel;
auto It = Kernel->ZeKernelMap.find(Device->ZeDevice);
if (It != Kernel->ZeKernelMap.end()) {
ZeKernelDevice = Kernel->ZeKernelMap[Device->ZeDevice];
}
if (ZeKernelDevice) {
auto ZeResult = ZE_CALL_NOCHECK(zeKernelGetProperties,
(ZeKernelDevice, &kernelProperties));
if (ZeResult || workGroupProperties.maxGroupSize == 0) {
return ReturnValue(
uint64_t{Device->ZeDeviceComputeProperties->maxTotalGroupSize});
}
return ReturnValue(workGroupProperties.maxGroupSize);
} else {
return ReturnValue(
uint64_t{Device->ZeDeviceComputeProperties->maxTotalGroupSize});
}
return ReturnValue(workGroupProperties.maxGroupSize);
}
case UR_KERNEL_GROUP_INFO_COMPILE_WORK_GROUP_SIZE: {
struct {
Expand Down

0 comments on commit 65c39c8

Please sign in to comment.