Skip to content

Commit 210120d

Browse files
committed
Rename INVALID_FUNCTION_NAME to FUNCTION_ADDRESS_NOT_AVAILABLE.
This lines up better with the original PI error code and what it was meant to convey. Also clarify the spec around return codes for urProgramGetFunctionPointer and update the relevant CTS test.
1 parent 5e914c5 commit 210120d

File tree

17 files changed

+37
-23
lines changed

17 files changed

+37
-23
lines changed

include/ur.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,8 @@ class ur_result_v(IntEnum):
428428
ERROR_UNSUPPORTED_IMAGE_FORMAT = 56 ## [Validation] image format is not supported by the device
429429
ERROR_INVALID_NATIVE_BINARY = 57 ## [Validation] native binary is not supported by the device
430430
ERROR_INVALID_GLOBAL_NAME = 58 ## [Validation] global variable is not found in the program
431-
ERROR_INVALID_FUNCTION_NAME = 59 ## [Validation] function name is not found in the program
431+
ERROR_FUNCTION_ADDRESS_NOT_AVAILABLE = 59 ## [Validation] function name is in the program but its address could not
432+
## be determined
432433
ERROR_INVALID_GROUP_SIZE_DIMENSION = 60 ## [Validation] group size dimension is not valid for the kernel or
433434
## device
434435
ERROR_INVALID_GLOBAL_WIDTH_DIMENSION = 61 ## [Validation] global width dimension is not valid for the kernel or

include/ur_api.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,8 @@ typedef enum ur_result_t {
456456
UR_RESULT_ERROR_UNSUPPORTED_IMAGE_FORMAT = 56, ///< [Validation] image format is not supported by the device
457457
UR_RESULT_ERROR_INVALID_NATIVE_BINARY = 57, ///< [Validation] native binary is not supported by the device
458458
UR_RESULT_ERROR_INVALID_GLOBAL_NAME = 58, ///< [Validation] global variable is not found in the program
459-
UR_RESULT_ERROR_INVALID_FUNCTION_NAME = 59, ///< [Validation] function name is not found in the program
459+
UR_RESULT_ERROR_FUNCTION_ADDRESS_NOT_AVAILABLE = 59, ///< [Validation] function name is in the program but its address could not
460+
///< be determined
460461
UR_RESULT_ERROR_INVALID_GROUP_SIZE_DIMENSION = 60, ///< [Validation] group size dimension is not valid for the kernel or
461462
///< device
462463
UR_RESULT_ERROR_INVALID_GLOBAL_WIDTH_DIMENSION = 61, ///< [Validation] global width dimension is not valid for the kernel or
@@ -4153,6 +4154,10 @@ urProgramRelease(
41534154
/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER
41544155
/// + `NULL == pFunctionName`
41554156
/// + `NULL == ppFunctionPointer`
4157+
/// - ::UR_RESULT_ERROR_INVALID_KERNEL_NAME
4158+
/// + If `pFunctionName` couldn't be found in `hProgram`.
4159+
/// - ::UR_RESULT_ERROR_FUNCTION_ADDRESS_NOT_AVAILABLE
4160+
/// + If `pFunctionName` could be located, but its address couldn't be retrieved.
41564161
UR_APIEXPORT ur_result_t UR_APICALL
41574162
urProgramGetFunctionPointer(
41584163
ur_device_handle_t hDevice, ///< [in] handle of the device to retrieve pointer for.

scripts/core/common.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,8 +253,8 @@ etors:
253253
desc: "[Validation] native binary is not supported by the device"
254254
- name: ERROR_INVALID_GLOBAL_NAME
255255
desc: "[Validation] global variable is not found in the program"
256-
- name: ERROR_INVALID_FUNCTION_NAME
257-
desc: "[Validation] function name is not found in the program"
256+
- name: ERROR_FUNCTION_ADDRESS_NOT_AVAILABLE
257+
desc: "[Validation] function name is in the program but its address could not be determined"
258258
- name: ERROR_INVALID_GROUP_SIZE_DIMENSION
259259
desc: "[Validation] group size dimension is not valid for the kernel or device"
260260
- name: ERROR_INVALID_GLOBAL_WIDTH_DIMENSION

scripts/core/program.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,11 @@ params:
309309
name: ppFunctionPointer
310310
desc: |
311311
[out] Returns the pointer to the function if it is found in the program.
312+
returns:
313+
- $X_RESULT_ERROR_INVALID_KERNEL_NAME:
314+
- "If `pFunctionName` couldn't be found in `hProgram`."
315+
- $X_RESULT_ERROR_FUNCTION_ADDRESS_NOT_AVAILABLE:
316+
- "If `pFunctionName` could be located, but its address couldn't be retrieved."
312317
--- #--------------------------------------------------------------------------
313318
type: enum
314319
desc: "Get Program object information"

source/adapters/cuda/command_buffer.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,8 @@ static inline const char *getUrResultString(ur_result_t Result) {
135135
return "UR_RESULT_ERROR_INVALID_NATIVE_BINARY";
136136
case UR_RESULT_ERROR_INVALID_GLOBAL_NAME:
137137
return "UR_RESULT_ERROR_INVALID_GLOBAL_NAME";
138-
case UR_RESULT_ERROR_INVALID_FUNCTION_NAME:
139-
return "UR_RESULT_ERROR_INVALID_FUNCTION_NAME";
138+
case UR_RESULT_ERROR_FUNCTION_ADDRESS_NOT_AVAILABLE:
139+
return "UR_RESULT_ERROR_FUNCTION_ADDRESS_NOT_AVAILABLE";
140140
case UR_RESULT_ERROR_INVALID_GROUP_SIZE_DIMENSION:
141141
return "UR_RESULT_ERROR_INVALID_GROUP_SIZE_DIMENSION";
142142
case UR_RESULT_ERROR_INVALID_GLOBAL_WIDTH_DIMENSION:

source/adapters/cuda/program.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urProgramGetFunctionPointer(
482482
UR_CHECK_ERROR(Ret);
483483
if (Ret == CUDA_ERROR_NOT_FOUND) {
484484
*ppFunctionPointer = 0;
485-
Result = UR_RESULT_ERROR_INVALID_FUNCTION_NAME;
485+
Result = UR_RESULT_ERROR_FUNCTION_ADDRESS_NOT_AVAILABLE;
486486
}
487487

488488
return Result;

source/adapters/hip/program.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urProgramGetFunctionPointer(
481481
UR_CHECK_ERROR(Ret);
482482
if (Ret == hipErrorNotFound) {
483483
*ppFunctionPointer = 0;
484-
Result = UR_RESULT_ERROR_INVALID_FUNCTION_NAME;
484+
Result = UR_RESULT_ERROR_FUNCTION_ADDRESS_NOT_AVAILABLE;
485485
}
486486

487487
return Result;

source/adapters/level_zero/common.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ ur_result_t ze2urResult(ze_result_t ZeResult) {
4747
case ZE_RESULT_ERROR_INVALID_KERNEL_NAME:
4848
return UR_RESULT_ERROR_INVALID_KERNEL_NAME;
4949
case ZE_RESULT_ERROR_INVALID_FUNCTION_NAME:
50-
return UR_RESULT_ERROR_INVALID_FUNCTION_NAME;
50+
return UR_RESULT_ERROR_FUNCTION_ADDRESS_NOT_AVAILABLE;
5151
case ZE_RESULT_ERROR_OVERLAPPING_REGIONS:
5252
return UR_RESULT_ERROR_INVALID_OPERATION;
5353
case ZE_RESULT_ERROR_INVALID_GROUP_SIZE_DIMENSION:

source/adapters/level_zero/common.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,8 @@ static auto getUrResultString = [](ur_result_t Result) {
147147
return "UR_RESULT_ERROR_INVALID_NATIVE_BINARY";
148148
case UR_RESULT_ERROR_INVALID_GLOBAL_NAME:
149149
return "UR_RESULT_ERROR_INVALID_GLOBAL_NAME";
150-
case UR_RESULT_ERROR_INVALID_FUNCTION_NAME:
151-
return "UR_RESULT_ERROR_INVALID_FUNCTION_NAME";
150+
case UR_RESULT_ERROR_FUNCTION_ADDRESS_NOT_AVAILABLE:
151+
return "UR_RESULT_ERROR_FUNCTION_ADDRESS_NOT_AVAILABLE";
152152
case UR_RESULT_ERROR_INVALID_GROUP_SIZE_DIMENSION:
153153
return "UR_RESULT_ERROR_INVALID_GROUP_SIZE_DIMENSION";
154154
case UR_RESULT_ERROR_INVALID_GLOBAL_WIDTH_DIMENSION:

source/adapters/level_zero/program.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urProgramGetFunctionPointer(
521521
// exists
522522
ClResult.pop_back();
523523
if (is_in_separated_string(ClResult, ';', std::string(FunctionName)))
524-
return UR_RESULT_ERROR_INVALID_FUNCTION_NAME;
524+
return UR_RESULT_ERROR_FUNCTION_ADDRESS_NOT_AVAILABLE;
525525

526526
return UR_RESULT_ERROR_INVALID_KERNEL_NAME;
527527
}

0 commit comments

Comments
 (0)