Skip to content

Commit 18d229b

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 8d1486a commit 18d229b

File tree

16 files changed

+42
-36
lines changed

16 files changed

+42
-36
lines changed

include/ur_api.h

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,8 @@ typedef enum ur_result_t {
465465
UR_RESULT_ERROR_UNSUPPORTED_IMAGE_FORMAT = 56, ///< [Validation] image format is not supported by the device
466466
UR_RESULT_ERROR_INVALID_NATIVE_BINARY = 57, ///< [Validation] native binary is not supported by the device
467467
UR_RESULT_ERROR_INVALID_GLOBAL_NAME = 58, ///< [Validation] global variable is not found in the program
468-
UR_RESULT_ERROR_INVALID_FUNCTION_NAME = 59, ///< [Validation] function name is not found in the program
468+
UR_RESULT_ERROR_FUNCTION_ADDRESS_NOT_AVAILABLE = 59, ///< [Validation] function name is in the program but its address could not
469+
///< be determined
469470
UR_RESULT_ERROR_INVALID_GROUP_SIZE_DIMENSION = 60, ///< [Validation] group size dimension is not valid for the kernel or
470471
///< device
471472
UR_RESULT_ERROR_INVALID_GLOBAL_WIDTH_DIMENSION = 61, ///< [Validation] global width dimension is not valid for the kernel or
@@ -4228,8 +4229,8 @@ urProgramRelease(
42284229
/// @details
42294230
/// - Retrieves a pointer to the functions with the given name and defined
42304231
/// in the given program.
4231-
/// - ::UR_RESULT_ERROR_INVALID_FUNCTION_NAME is returned if the function
4232-
/// can not be obtained.
4232+
/// - RESULT_ERROR_INVALID_FUNCTION_NAME is returned if the function can not
4233+
/// be obtained.
42334234
/// - The application may call this function from simultaneous threads for
42344235
/// the same device.
42354236
/// - The implementation of this function should be thread-safe.
@@ -4249,6 +4250,10 @@ urProgramRelease(
42494250
/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER
42504251
/// + `NULL == pFunctionName`
42514252
/// + `NULL == ppFunctionPointer`
4253+
/// - ::UR_RESULT_ERROR_INVALID_KERNEL_NAME
4254+
/// + If `pFunctionName` couldn't be found in `hProgram`.
4255+
/// - ::UR_RESULT_ERROR_FUNCTION_ADDRESS_NOT_AVAILABLE
4256+
/// + If `pFunctionName` could be located, but its address couldn't be retrieved.
42524257
UR_APIEXPORT ur_result_t UR_APICALL
42534258
urProgramGetFunctionPointer(
42544259
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
@@ -1433,8 +1433,8 @@ inline std::ostream &operator<<(std::ostream &os, ur_result_t value) {
14331433
case UR_RESULT_ERROR_INVALID_GLOBAL_NAME:
14341434
os << "UR_RESULT_ERROR_INVALID_GLOBAL_NAME";
14351435
break;
1436-
case UR_RESULT_ERROR_INVALID_FUNCTION_NAME:
1437-
os << "UR_RESULT_ERROR_INVALID_FUNCTION_NAME";
1436+
case UR_RESULT_ERROR_FUNCTION_ADDRESS_NOT_AVAILABLE:
1437+
os << "UR_RESULT_ERROR_FUNCTION_ADDRESS_NOT_AVAILABLE";
14381438
break;
14391439
case UR_RESULT_ERROR_INVALID_GROUP_SIZE_DIMENSION:
14401440
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
@@ -287,7 +287,7 @@ analogue:
287287
- "**clGetDeviceFunctionPointerINTEL**"
288288
details:
289289
- "Retrieves a pointer to the functions with the given name and defined in the given program."
290-
- "$X_RESULT_ERROR_INVALID_FUNCTION_NAME is returned if the function can not be obtained."
290+
- "RESULT_ERROR_INVALID_FUNCTION_NAME is returned if the function can not be obtained."
291291
- "The application may call this function from simultaneous threads for the same device."
292292
- "The implementation of this function should be thread-safe."
293293
params:
@@ -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
@@ -483,7 +483,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urProgramGetFunctionPointer(
483483
UR_CHECK_ERROR(Ret);
484484
if (Ret == CUDA_ERROR_NOT_FOUND) {
485485
*ppFunctionPointer = 0;
486-
Result = UR_RESULT_ERROR_INVALID_FUNCTION_NAME;
486+
Result = UR_RESULT_ERROR_FUNCTION_ADDRESS_NOT_AVAILABLE;
487487
}
488488

489489
return Result;

source/adapters/hip/program.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urProgramGetFunctionPointer(
468468
UR_CHECK_ERROR(Ret);
469469
if (Ret == hipErrorNotFound) {
470470
*ppFunctionPointer = 0;
471-
Result = UR_RESULT_ERROR_INVALID_FUNCTION_NAME;
471+
Result = UR_RESULT_ERROR_FUNCTION_ADDRESS_NOT_AVAILABLE;
472472
}
473473

474474
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
@@ -545,7 +545,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urProgramGetFunctionPointer(
545545
// exists
546546
ClResult.pop_back();
547547
if (is_in_separated_string(ClResult, ';', std::string(FunctionName)))
548-
return UR_RESULT_ERROR_INVALID_FUNCTION_NAME;
548+
return UR_RESULT_ERROR_FUNCTION_ADDRESS_NOT_AVAILABLE;
549549

550550
return UR_RESULT_ERROR_INVALID_KERNEL_NAME;
551551
}

0 commit comments

Comments
 (0)