Skip to content

Commit 79f35f7

Browse files
committed
[UR] Return spills for all ZE kernels in UR kernel via v1 level_zero plugin.
1 parent 3cf5c72 commit 79f35f7

File tree

1 file changed

+18
-4
lines changed
  • unified-runtime/source/adapters/level_zero

1 file changed

+18
-4
lines changed

unified-runtime/source/adapters/level_zero/kernel.cpp

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -752,10 +752,24 @@ ur_result_t urKernelGetInfo(
752752
case UR_KERNEL_INFO_NUM_ARGS:
753753
return ReturnValue(uint32_t{Kernel->ZeKernelProperties->numKernelArgs});
754754
case UR_KERNEL_INFO_SPILL_MEM_SIZE: {
755-
std::vector<uint32_t> spills = {
756-
uint32_t{Kernel->ZeKernelProperties->spillMemSize}};
757-
return ReturnValue(static_cast<const uint32_t *>(spills.data()),
758-
spills.size());
755+
try {
756+
std::vector<uint32_t> Spills;
757+
Spills.reserve(Kernel->ZeKernels.size());
758+
for (auto &ZeKernel : Kernel->ZeKernels) {
759+
ze_kernel_properties_t props;
760+
props.stype = ZE_STRUCTURE_TYPE_KERNEL_PROPERTIES;
761+
props.pNext = nullptr;
762+
ZE2UR_CALL(zeKernelGetProperties, (ZeKernel, &props));
763+
uint32_t spillMemSize = props.spillMemSize;
764+
Spills.push_back(spillMemSize);
765+
}
766+
return ReturnValue(static_cast<const uint32_t *>(Spills.data()),
767+
Spills.size());
768+
} catch (const std::bad_alloc &) {
769+
return UR_RESULT_ERROR_OUT_OF_HOST_MEMORY;
770+
} catch (...) {
771+
return UR_RESULT_ERROR_UNKNOWN;
772+
}
759773
}
760774
case UR_KERNEL_INFO_REFERENCE_COUNT:
761775
return ReturnValue(uint32_t{Kernel->RefCount.load()});

0 commit comments

Comments
 (0)