Skip to content

Commit 2e3ad8e

Browse files
committed
Fix review comments
1 parent d897ceb commit 2e3ad8e

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

include/ur_api.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5999,6 +5999,10 @@ typedef enum ur_kernel_info_t {
59995999
UR_KERNEL_INFO_NUM_REGS = 6,
60006000
/// [uint32_t[]][optional-query] Return the spill memory size allocated by
60016001
/// the compiler.
6002+
/// The returned values correspond to the associated devices.
6003+
/// The order of the devices is guaranteed (i.e., the same as queried by
6004+
/// `urDeviceGet`) by the UR within a single application even if the runtime
6005+
/// is reinitialized.
60026006
UR_KERNEL_INFO_SPILL_MEM_SIZE = 7,
60036007
/// @cond
60046008
UR_KERNEL_INFO_FORCE_UINT32 = 0x7fffffff

source/adapters/level_zero/kernel.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -751,10 +751,12 @@ ur_result_t urKernelGetInfo(
751751
case UR_KERNEL_INFO_NUM_REGS:
752752
case UR_KERNEL_INFO_NUM_ARGS:
753753
return ReturnValue(uint32_t{Kernel->ZeKernelProperties->numKernelArgs});
754-
case UR_KERNEL_INFO_SPILL_MEM_SIZE:
755-
return ReturnValue(static_cast<const uint32_t *>(
756-
&(Kernel->ZeKernelProperties->spillMemSize)),
757-
1ul);
754+
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());
759+
}
758760
case UR_KERNEL_INFO_REFERENCE_COUNT:
759761
return ReturnValue(uint32_t{Kernel->RefCount.load()});
760762
case UR_KERNEL_INFO_ATTRIBUTES:

test/conformance/kernel/urKernelGetInfo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ TEST_P(urKernelGetInfoTest, SuccessSpillMemSize) {
147147
property_name);
148148
ASSERT_EQ(property_size, sizeof(uint32_t));
149149

150-
std::vector<char> property_value(property_size);
150+
std::vector<uint32_t> property_value(property_size / sizeof(uint32_t));
151151
ASSERT_SUCCESS(urKernelGetInfo(kernel, property_name, property_size,
152152
property_value.data(), nullptr));
153153
}

0 commit comments

Comments
 (0)