Skip to content

Commit 69ddf01

Browse files
committed
Merge branch 'aaron/clarifyProgramGetFunctionPointer' into aaron/specMotivatedRefactors
2 parents 43313b0 + a5fc0de commit 69ddf01

File tree

17 files changed

+43
-31
lines changed

17 files changed

+43
-31
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
@@ -4247,8 +4248,8 @@ urProgramRelease(
42474248
/// @details
42484249
/// - Retrieves a pointer to the functions with the given name and defined
42494250
/// in the given program.
4250-
/// - ::UR_RESULT_ERROR_INVALID_FUNCTION_NAME is returned if the function
4251-
/// can not be obtained.
4251+
/// - ::UR_RESULT_ERROR_FUNCTION_ADDRESS_NOT_AVAILABLE is returned if the
4252+
/// function can not be obtained.
42524253
/// - The application may call this function from simultaneous threads for
42534254
/// the same device.
42544255
/// - The implementation of this function should be thread-safe.
@@ -4268,6 +4269,10 @@ urProgramRelease(
42684269
/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER
42694270
/// + `NULL == pFunctionName`
42704271
/// + `NULL == ppFunctionPointer`
4272+
/// - ::UR_RESULT_ERROR_INVALID_KERNEL_NAME
4273+
/// + If `pFunctionName` couldn't be found in `hProgram`.
4274+
/// - ::UR_RESULT_ERROR_FUNCTION_ADDRESS_NOT_AVAILABLE
4275+
/// + If `pFunctionName` could be located, but its address couldn't be retrieved.
42714276
UR_APIEXPORT ur_result_t UR_APICALL
42724277
urProgramGetFunctionPointer(
42734278
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
@@ -288,7 +288,7 @@ analogue:
288288
- "**clGetDeviceFunctionPointerINTEL**"
289289
details:
290290
- "Retrieves a pointer to the functions with the given name and defined in the given program."
291-
- "$X_RESULT_ERROR_INVALID_FUNCTION_NAME is returned if the function can not be obtained."
291+
- "$X_RESULT_ERROR_FUNCTION_ADDRESS_NOT_AVAILABLE is returned if the function can not be obtained."
292292
- "The application may call this function from simultaneous threads for the same device."
293293
- "The implementation of this function should be thread-safe."
294294
params:
@@ -310,6 +310,11 @@ params:
310310
name: ppFunctionPointer
311311
desc: |
312312
[out] Returns the pointer to the function if it is found in the program.
313+
returns:
314+
- $X_RESULT_ERROR_INVALID_KERNEL_NAME:
315+
- "If `pFunctionName` couldn't be found in `hProgram`."
316+
- $X_RESULT_ERROR_FUNCTION_ADDRESS_NOT_AVAILABLE:
317+
- "If `pFunctionName` could be located, but its address couldn't be retrieved."
313318
--- #--------------------------------------------------------------------------
314319
type: enum
315320
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
@@ -484,7 +484,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urProgramGetFunctionPointer(
484484
UR_CHECK_ERROR(Ret);
485485
if (Ret == CUDA_ERROR_NOT_FOUND) {
486486
*ppFunctionPointer = 0;
487-
Result = UR_RESULT_ERROR_INVALID_FUNCTION_NAME;
487+
Result = UR_RESULT_ERROR_INVALID_KERNEL_NAME;
488488
}
489489

490490
return Result;

source/adapters/hip/program.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urProgramGetFunctionPointer(
490490
UR_CHECK_ERROR(Ret);
491491
if (Ret == hipErrorNotFound) {
492492
*ppFunctionPointer = 0;
493-
Result = UR_RESULT_ERROR_INVALID_FUNCTION_NAME;
493+
Result = UR_RESULT_ERROR_INVALID_KERNEL_NAME;
494494
}
495495

496496
return Result;

source/adapters/level_zero/common.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,8 @@ ur_result_t ze2urResult(ze_result_t ZeResult) {
4545
case ZE_RESULT_ERROR_INVALID_NATIVE_BINARY:
4646
return UR_RESULT_ERROR_INVALID_BINARY;
4747
case ZE_RESULT_ERROR_INVALID_KERNEL_NAME:
48-
return UR_RESULT_ERROR_INVALID_KERNEL_NAME;
4948
case ZE_RESULT_ERROR_INVALID_FUNCTION_NAME:
50-
return UR_RESULT_ERROR_INVALID_FUNCTION_NAME;
49+
return UR_RESULT_ERROR_INVALID_KERNEL_NAME;
5150
case ZE_RESULT_ERROR_OVERLAPPING_REGIONS:
5251
return UR_RESULT_ERROR_INVALID_OPERATION;
5352
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
@@ -568,7 +568,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urProgramGetFunctionPointer(
568568
// exists
569569
ClResult.pop_back();
570570
if (is_in_separated_string(ClResult, ';', std::string(FunctionName)))
571-
return UR_RESULT_ERROR_INVALID_FUNCTION_NAME;
571+
return UR_RESULT_ERROR_FUNCTION_ADDRESS_NOT_AVAILABLE;
572572

573573
return UR_RESULT_ERROR_INVALID_KERNEL_NAME;
574574
}

0 commit comments

Comments
 (0)