Skip to content

Commit e721953

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 5006b4a commit e721953

20 files changed

+48
-36
lines changed

include/ur_api.h

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,8 @@ typedef enum ur_result_t {
477477
UR_RESULT_ERROR_UNSUPPORTED_IMAGE_FORMAT = 56, ///< [Validation] image format is not supported by the device
478478
UR_RESULT_ERROR_INVALID_NATIVE_BINARY = 57, ///< [Validation] native binary is not supported by the device
479479
UR_RESULT_ERROR_INVALID_GLOBAL_NAME = 58, ///< [Validation] global variable is not found in the program
480-
UR_RESULT_ERROR_INVALID_FUNCTION_NAME = 59, ///< [Validation] function name is not found in the program
480+
UR_RESULT_ERROR_FUNCTION_ADDRESS_NOT_AVAILABLE = 59, ///< [Validation] function name is in the program but its address could not
481+
///< be determined
481482
UR_RESULT_ERROR_INVALID_GROUP_SIZE_DIMENSION = 60, ///< [Validation] group size dimension is not valid for the kernel or
482483
///< device
483484
UR_RESULT_ERROR_INVALID_GLOBAL_WIDTH_DIMENSION = 61, ///< [Validation] global width dimension is not valid for the kernel or
@@ -4332,8 +4333,8 @@ urProgramRelease(
43324333
/// @details
43334334
/// - Retrieves a pointer to the functions with the given name and defined
43344335
/// in the given program.
4335-
/// - ::UR_RESULT_ERROR_INVALID_FUNCTION_NAME is returned if the function
4336-
/// can not be obtained.
4336+
/// - ::UR_RESULT_ERROR_FUNCTION_ADDRESS_NOT_AVAILABLE is returned if the
4337+
/// function can not be obtained.
43374338
/// - The application may call this function from simultaneous threads for
43384339
/// the same device.
43394340
/// - The implementation of this function should be thread-safe.
@@ -4353,6 +4354,10 @@ urProgramRelease(
43534354
/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER
43544355
/// + `NULL == pFunctionName`
43554356
/// + `NULL == ppFunctionPointer`
4357+
/// - ::UR_RESULT_ERROR_INVALID_KERNEL_NAME
4358+
/// + If `pFunctionName` couldn't be found in `hProgram`.
4359+
/// - ::UR_RESULT_ERROR_FUNCTION_ADDRESS_NOT_AVAILABLE
4360+
/// + If `pFunctionName` could be located, but its address couldn't be retrieved.
43564361
UR_APIEXPORT ur_result_t UR_APICALL
43574362
urProgramGetFunctionPointer(
43584363
ur_device_handle_t hDevice, ///< [in] handle of the device to retrieve pointer for.

include/ur_print.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1510,8 +1510,8 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_result_t value) {
15101510
case UR_RESULT_ERROR_INVALID_GLOBAL_NAME:
15111511
os << "UR_RESULT_ERROR_INVALID_GLOBAL_NAME";
15121512
break;
1513-
case UR_RESULT_ERROR_INVALID_FUNCTION_NAME:
1514-
os << "UR_RESULT_ERROR_INVALID_FUNCTION_NAME";
1513+
case UR_RESULT_ERROR_FUNCTION_ADDRESS_NOT_AVAILABLE:
1514+
os << "UR_RESULT_ERROR_FUNCTION_ADDRESS_NOT_AVAILABLE";
15151515
break;
15161516
case UR_RESULT_ERROR_INVALID_GROUP_SIZE_DIMENSION:
15171517
os << "UR_RESULT_ERROR_INVALID_GROUP_SIZE_DIMENSION";

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: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ analogue:
291291
- "**clGetDeviceFunctionPointerINTEL**"
292292
details:
293293
- "Retrieves a pointer to the functions with the given name and defined in the given program."
294-
- "$X_RESULT_ERROR_INVALID_FUNCTION_NAME is returned if the function can not be obtained."
294+
- "$X_RESULT_ERROR_FUNCTION_ADDRESS_NOT_AVAILABLE is returned if the function can not be obtained."
295295
- "The application may call this function from simultaneous threads for the same device."
296296
- "The implementation of this function should be thread-safe."
297297
params:
@@ -313,6 +313,11 @@ params:
313313
name: ppFunctionPointer
314314
desc: |
315315
[out] Returns the pointer to the function if it is found in the program.
316+
returns:
317+
- $X_RESULT_ERROR_INVALID_KERNEL_NAME:
318+
- "If `pFunctionName` couldn't be found in `hProgram`."
319+
- $X_RESULT_ERROR_FUNCTION_ADDRESS_NOT_AVAILABLE:
320+
- "If `pFunctionName` could be located, but its address couldn't be retrieved."
316321
--- #--------------------------------------------------------------------------
317322
type: function
318323
desc: "Retrieves a pointer to a device global variable."

source/adapters/cuda/command_buffer.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,8 @@ static inline const char *getUrResultString(ur_result_t Result) {
136136
return "UR_RESULT_ERROR_INVALID_NATIVE_BINARY";
137137
case UR_RESULT_ERROR_INVALID_GLOBAL_NAME:
138138
return "UR_RESULT_ERROR_INVALID_GLOBAL_NAME";
139-
case UR_RESULT_ERROR_INVALID_FUNCTION_NAME:
140-
return "UR_RESULT_ERROR_INVALID_FUNCTION_NAME";
139+
case UR_RESULT_ERROR_FUNCTION_ADDRESS_NOT_AVAILABLE:
140+
return "UR_RESULT_ERROR_FUNCTION_ADDRESS_NOT_AVAILABLE";
141141
case UR_RESULT_ERROR_INVALID_GROUP_SIZE_DIMENSION:
142142
return "UR_RESULT_ERROR_INVALID_GROUP_SIZE_DIMENSION";
143143
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
@@ -503,7 +503,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urProgramGetFunctionPointer(
503503
UR_CHECK_ERROR(Ret);
504504
if (Ret == CUDA_ERROR_NOT_FOUND) {
505505
*ppFunctionPointer = 0;
506-
Result = UR_RESULT_ERROR_INVALID_FUNCTION_NAME;
506+
Result = UR_RESULT_ERROR_INVALID_KERNEL_NAME;
507507
}
508508

509509
return Result;

source/adapters/hip/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/hip/program.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urProgramGetFunctionPointer(
509509
UR_CHECK_ERROR(Ret);
510510
if (Ret == hipErrorNotFound) {
511511
*ppFunctionPointer = 0;
512-
Result = UR_RESULT_ERROR_INVALID_FUNCTION_NAME;
512+
Result = UR_RESULT_ERROR_INVALID_KERNEL_NAME;
513513
}
514514

515515
return Result;

source/adapters/level_zero/common.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,8 @@ ur_result_t ze2urResult(ze_result_t ZeResult) {
4646
case ZE_RESULT_ERROR_INVALID_NATIVE_BINARY:
4747
return UR_RESULT_ERROR_INVALID_BINARY;
4848
case ZE_RESULT_ERROR_INVALID_KERNEL_NAME:
49-
return UR_RESULT_ERROR_INVALID_KERNEL_NAME;
5049
case ZE_RESULT_ERROR_INVALID_FUNCTION_NAME:
51-
return UR_RESULT_ERROR_INVALID_FUNCTION_NAME;
50+
return UR_RESULT_ERROR_INVALID_KERNEL_NAME;
5251
case ZE_RESULT_ERROR_OVERLAPPING_REGIONS:
5352
return UR_RESULT_ERROR_INVALID_OPERATION;
5453
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:

0 commit comments

Comments
 (0)