Skip to content

Commit 5f3597d

Browse files
committed
Add UR_KERNEL_INFO_SPILL_MEM_SIZE kernel info prop
1 parent 1b530de commit 5f3597d

File tree

7 files changed

+26
-4
lines changed

7 files changed

+26
-4
lines changed

include/ur_api.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5997,6 +5997,9 @@ typedef enum ur_kernel_info_t {
59975997
/// [uint32_t][optional-query] Return the number of registers used by the
59985998
/// compiled kernel.
59995999
UR_KERNEL_INFO_NUM_REGS = 6,
6000+
/// [uint32_t][optional-query] Return the spill memory size allocated by
6001+
/// the compiler.
6002+
UR_KERNEL_INFO_SPILL_MEM_SIZE = 7,
60006003
/// @cond
60016004
UR_KERNEL_INFO_FORCE_UINT32 = 0x7fffffff
60026005
/// @endcond
@@ -6097,7 +6100,7 @@ typedef enum ur_kernel_exec_info_t {
60976100
/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE
60986101
/// + `NULL == hKernel`
60996102
/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION
6100-
/// + `::UR_KERNEL_INFO_NUM_REGS < propName`
6103+
/// + `::UR_KERNEL_INFO_SPILL_MEM_SIZE < propName`
61016104
/// - ::UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION
61026105
/// + If `propName` is not supported by the adapter.
61036106
/// - ::UR_RESULT_ERROR_INVALID_SIZE

include/ur_print.hpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8780,6 +8780,9 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_kernel_info_t value) {
87808780
case UR_KERNEL_INFO_NUM_REGS:
87818781
os << "UR_KERNEL_INFO_NUM_REGS";
87828782
break;
8783+
case UR_KERNEL_INFO_SPILL_MEM_SIZE:
8784+
os << "UR_KERNEL_INFO_SPILL_MEM_SIZE";
8785+
break;
87838786
default:
87848787
os << "unknown enumerator";
87858788
break;
@@ -8872,6 +8875,19 @@ inline ur_result_t printTagged(std::ostream &os, const void *ptr,
88728875

88738876
os << ")";
88748877
} break;
8878+
case UR_KERNEL_INFO_SPILL_MEM_SIZE: {
8879+
const uint32_t *tptr = (const uint32_t *)ptr;
8880+
if (sizeof(uint32_t) > size) {
8881+
os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t)
8882+
<< ")";
8883+
return UR_RESULT_ERROR_INVALID_SIZE;
8884+
}
8885+
os << (const void *)(tptr) << " (";
8886+
8887+
os << *tptr;
8888+
8889+
os << ")";
8890+
} break;
88758891
default:
88768892
os << "unknown enumerator";
88778893
return UR_RESULT_ERROR_INVALID_ENUMERATION;

scripts/core/kernel.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,8 @@ etors:
125125
desc: "[char[]] Return null-terminated kernel attributes string."
126126
- name: NUM_REGS
127127
desc: "[uint32_t][optional-query] Return the number of registers used by the compiled kernel."
128+
- name: SPILL_MEM_SIZE
129+
desc: "[uint32_t][optional-query] Return the spill memory size allocated by the compiler."
128130
--- #--------------------------------------------------------------------------
129131
type: enum
130132
desc: "Get Kernel Work Group information"

source/loader/layers/validation/ur_valddi.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3315,7 +3315,7 @@ __urdlllocal ur_result_t UR_APICALL urKernelGetInfo(
33153315
if (pPropValue == NULL && pPropSizeRet == NULL)
33163316
return UR_RESULT_ERROR_INVALID_NULL_POINTER;
33173317

3318-
if (UR_KERNEL_INFO_NUM_REGS < propName)
3318+
if (UR_KERNEL_INFO_SPILL_MEM_SIZE < propName)
33193319
return UR_RESULT_ERROR_INVALID_ENUMERATION;
33203320

33213321
if (propSize == 0 && pPropValue != NULL)

source/loader/ur_libapi.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3798,7 +3798,7 @@ ur_result_t UR_APICALL urKernelSetArgLocal(
37983798
/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE
37993799
/// + `NULL == hKernel`
38003800
/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION
3801-
/// + `::UR_KERNEL_INFO_NUM_REGS < propName`
3801+
/// + `::UR_KERNEL_INFO_SPILL_MEM_SIZE < propName`
38023802
/// - ::UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION
38033803
/// + If `propName` is not supported by the adapter.
38043804
/// - ::UR_RESULT_ERROR_INVALID_SIZE

source/ur_api.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3330,7 +3330,7 @@ ur_result_t UR_APICALL urKernelSetArgLocal(
33303330
/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE
33313331
/// + `NULL == hKernel`
33323332
/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION
3333-
/// + `::UR_KERNEL_INFO_NUM_REGS < propName`
3333+
/// + `::UR_KERNEL_INFO_SPILL_MEM_SIZE < propName`
33343334
/// - ::UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION
33353335
/// + If `propName` is not supported by the adapter.
33363336
/// - ::UR_RESULT_ERROR_INVALID_SIZE

test/conformance/testing/include/uur/optional_queries.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ template <> inline bool isQueryOptional(ur_program_info_t query) {
8686

8787
constexpr std::array optional_ur_kernel_info_t = {
8888
UR_KERNEL_INFO_NUM_REGS,
89+
UR_KERNEL_INFO_SPILL_MEM_SIZE,
8990
};
9091

9192
template <> inline bool isQueryOptional(ur_kernel_info_t query) {

0 commit comments

Comments
 (0)