Skip to content

Commit 8089d80

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 2a669ff commit 8089d80

File tree

18 files changed

+44
-32
lines changed

18 files changed

+44
-32
lines changed

include/ur_api.h

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,8 @@ typedef enum ur_result_t {
478478
UR_RESULT_ERROR_UNSUPPORTED_IMAGE_FORMAT = 56, ///< [Validation] image format is not supported by the device
479479
UR_RESULT_ERROR_INVALID_NATIVE_BINARY = 57, ///< [Validation] native binary is not supported by the device
480480
UR_RESULT_ERROR_INVALID_GLOBAL_NAME = 58, ///< [Validation] global variable is not found in the program
481-
UR_RESULT_ERROR_INVALID_FUNCTION_NAME = 59, ///< [Validation] function name is not found in the program
481+
UR_RESULT_ERROR_FUNCTION_ADDRESS_NOT_AVAILABLE = 59, ///< [Validation] function name is in the program but its address could not
482+
///< be determined
482483
UR_RESULT_ERROR_INVALID_GROUP_SIZE_DIMENSION = 60, ///< [Validation] group size dimension is not valid for the kernel or
483484
///< device
484485
UR_RESULT_ERROR_INVALID_GLOBAL_WIDTH_DIMENSION = 61, ///< [Validation] global width dimension is not valid for the kernel or
@@ -4334,8 +4335,8 @@ urProgramRelease(
43344335
/// @details
43354336
/// - Retrieves a pointer to the functions with the given name and defined
43364337
/// in the given program.
4337-
/// - ::UR_RESULT_ERROR_INVALID_FUNCTION_NAME is returned if the function
4338-
/// can not be obtained.
4338+
/// - ::UR_RESULT_ERROR_FUNCTION_ADDRESS_NOT_AVAILABLE is returned if the
4339+
/// function can not be obtained.
43394340
/// - The application may call this function from simultaneous threads for
43404341
/// the same device.
43414342
/// - The implementation of this function should be thread-safe.
@@ -4355,6 +4356,10 @@ urProgramRelease(
43554356
/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER
43564357
/// + `NULL == pFunctionName`
43574358
/// + `NULL == ppFunctionPointer`
4359+
/// - ::UR_RESULT_ERROR_INVALID_KERNEL_NAME
4360+
/// + If `pFunctionName` couldn't be found in `hProgram`.
4361+
/// - ::UR_RESULT_ERROR_FUNCTION_ADDRESS_NOT_AVAILABLE
4362+
/// + If `pFunctionName` could be located, but its address couldn't be retrieved.
43584363
UR_APIEXPORT ur_result_t UR_APICALL
43594364
urProgramGetFunctionPointer(
43604365
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
@@ -1513,8 +1513,8 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_result_t value) {
15131513
case UR_RESULT_ERROR_INVALID_GLOBAL_NAME:
15141514
os << "UR_RESULT_ERROR_INVALID_GLOBAL_NAME";
15151515
break;
1516-
case UR_RESULT_ERROR_INVALID_FUNCTION_NAME:
1517-
os << "UR_RESULT_ERROR_INVALID_FUNCTION_NAME";
1516+
case UR_RESULT_ERROR_FUNCTION_ADDRESS_NOT_AVAILABLE:
1517+
os << "UR_RESULT_ERROR_FUNCTION_ADDRESS_NOT_AVAILABLE";
15181518
break;
15191519
case UR_RESULT_ERROR_INVALID_GROUP_SIZE_DIMENSION:
15201520
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/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/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:

source/adapters/level_zero/program.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urProgramGetFunctionPointer(
570570
// exists
571571
ClResult.pop_back();
572572
if (is_in_separated_string(ClResult, ';', std::string(FunctionName)))
573-
return UR_RESULT_ERROR_INVALID_FUNCTION_NAME;
573+
return UR_RESULT_ERROR_FUNCTION_ADDRESS_NOT_AVAILABLE;
574574

575575
return UR_RESULT_ERROR_INVALID_KERNEL_NAME;
576576
}

source/adapters/native_cpu/kernel.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urKernelGetInfo(ur_kernel_handle_t hKernel,
8787
if (hKernel->_name) {
8888
return ReturnValue(hKernel->_name);
8989
}
90-
return UR_RESULT_ERROR_INVALID_FUNCTION_NAME;
90+
return UR_RESULT_ERROR_INVALID_KERNEL;
9191
// case UR_KERNEL_INFO_NUM_ARGS:
9292
// return ReturnValue(uint32_t{ Kernel->ZeKernelProperties->numKernelArgs
9393
// });

0 commit comments

Comments
 (0)