Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions include/ur_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,8 @@ typedef enum ur_result_t {
UR_RESULT_ERROR_UNSUPPORTED_IMAGE_FORMAT = 56, ///< [Validation] image format is not supported by the device
UR_RESULT_ERROR_INVALID_NATIVE_BINARY = 57, ///< [Validation] native binary is not supported by the device
UR_RESULT_ERROR_INVALID_GLOBAL_NAME = 58, ///< [Validation] global variable is not found in the program
UR_RESULT_ERROR_INVALID_FUNCTION_NAME = 59, ///< [Validation] function name is not found in the program
UR_RESULT_ERROR_FUNCTION_ADDRESS_NOT_AVAILABLE = 59, ///< [Validation] function name is in the program but its address could not
///< be determined
UR_RESULT_ERROR_INVALID_GROUP_SIZE_DIMENSION = 60, ///< [Validation] group size dimension is not valid for the kernel or
///< device
UR_RESULT_ERROR_INVALID_GLOBAL_WIDTH_DIMENSION = 61, ///< [Validation] global width dimension is not valid for the kernel or
Expand Down Expand Up @@ -4233,8 +4234,8 @@ urProgramRelease(
/// @details
/// - Retrieves a pointer to the functions with the given name and defined
/// in the given program.
/// - ::UR_RESULT_ERROR_INVALID_FUNCTION_NAME is returned if the function
/// can not be obtained.
/// - ::UR_RESULT_ERROR_FUNCTION_ADDRESS_NOT_AVAILABLE is returned if the
/// function can not be obtained.
/// - The application may call this function from simultaneous threads for
/// the same device.
/// - The implementation of this function should be thread-safe.
Expand All @@ -4254,6 +4255,10 @@ urProgramRelease(
/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER
/// + `NULL == pFunctionName`
/// + `NULL == ppFunctionPointer`
/// - ::UR_RESULT_ERROR_INVALID_KERNEL_NAME
/// + If `pFunctionName` couldn't be found in `hProgram`.
/// - ::UR_RESULT_ERROR_FUNCTION_ADDRESS_NOT_AVAILABLE
/// + If `pFunctionName` could be located, but its address couldn't be retrieved.
UR_APIEXPORT ur_result_t UR_APICALL
urProgramGetFunctionPointer(
ur_device_handle_t hDevice, ///< [in] handle of the device to retrieve pointer for.
Expand Down
4 changes: 2 additions & 2 deletions include/ur_print.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1433,8 +1433,8 @@ inline std::ostream &operator<<(std::ostream &os, ur_result_t value) {
case UR_RESULT_ERROR_INVALID_GLOBAL_NAME:
os << "UR_RESULT_ERROR_INVALID_GLOBAL_NAME";
break;
case UR_RESULT_ERROR_INVALID_FUNCTION_NAME:
os << "UR_RESULT_ERROR_INVALID_FUNCTION_NAME";
case UR_RESULT_ERROR_FUNCTION_ADDRESS_NOT_AVAILABLE:
os << "UR_RESULT_ERROR_FUNCTION_ADDRESS_NOT_AVAILABLE";
break;
case UR_RESULT_ERROR_INVALID_GROUP_SIZE_DIMENSION:
os << "UR_RESULT_ERROR_INVALID_GROUP_SIZE_DIMENSION";
Expand Down
4 changes: 2 additions & 2 deletions scripts/core/common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,8 @@ etors:
desc: "[Validation] native binary is not supported by the device"
- name: ERROR_INVALID_GLOBAL_NAME
desc: "[Validation] global variable is not found in the program"
- name: ERROR_INVALID_FUNCTION_NAME
desc: "[Validation] function name is not found in the program"
- name: ERROR_FUNCTION_ADDRESS_NOT_AVAILABLE
desc: "[Validation] function name is in the program but its address could not be determined"
- name: ERROR_INVALID_GROUP_SIZE_DIMENSION
desc: "[Validation] group size dimension is not valid for the kernel or device"
- name: ERROR_INVALID_GLOBAL_WIDTH_DIMENSION
Expand Down
7 changes: 6 additions & 1 deletion scripts/core/program.yml
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ analogue:
- "**clGetDeviceFunctionPointerINTEL**"
details:
- "Retrieves a pointer to the functions with the given name and defined in the given program."
- "$X_RESULT_ERROR_INVALID_FUNCTION_NAME is returned if the function can not be obtained."
- "$X_RESULT_ERROR_FUNCTION_ADDRESS_NOT_AVAILABLE is returned if the function can not be obtained."
- "The application may call this function from simultaneous threads for the same device."
- "The implementation of this function should be thread-safe."
params:
Expand All @@ -310,6 +310,11 @@ params:
name: ppFunctionPointer
desc: |
[out] Returns the pointer to the function if it is found in the program.
returns:
- $X_RESULT_ERROR_INVALID_KERNEL_NAME:
- "If `pFunctionName` couldn't be found in `hProgram`."
- $X_RESULT_ERROR_FUNCTION_ADDRESS_NOT_AVAILABLE:
- "If `pFunctionName` could be located, but its address couldn't be retrieved."
--- #--------------------------------------------------------------------------
type: enum
desc: "Get Program object information"
Expand Down
4 changes: 2 additions & 2 deletions source/adapters/cuda/command_buffer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@ static inline const char *getUrResultString(ur_result_t Result) {
return "UR_RESULT_ERROR_INVALID_NATIVE_BINARY";
case UR_RESULT_ERROR_INVALID_GLOBAL_NAME:
return "UR_RESULT_ERROR_INVALID_GLOBAL_NAME";
case UR_RESULT_ERROR_INVALID_FUNCTION_NAME:
return "UR_RESULT_ERROR_INVALID_FUNCTION_NAME";
case UR_RESULT_ERROR_FUNCTION_ADDRESS_NOT_AVAILABLE:
return "UR_RESULT_ERROR_FUNCTION_ADDRESS_NOT_AVAILABLE";
case UR_RESULT_ERROR_INVALID_GROUP_SIZE_DIMENSION:
return "UR_RESULT_ERROR_INVALID_GROUP_SIZE_DIMENSION";
case UR_RESULT_ERROR_INVALID_GLOBAL_WIDTH_DIMENSION:
Expand Down
2 changes: 1 addition & 1 deletion source/adapters/cuda/program.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urProgramGetFunctionPointer(
UR_CHECK_ERROR(Ret);
if (Ret == CUDA_ERROR_NOT_FOUND) {
*ppFunctionPointer = 0;
Result = UR_RESULT_ERROR_INVALID_FUNCTION_NAME;
Result = UR_RESULT_ERROR_INVALID_KERNEL_NAME;
}

return Result;
Expand Down
2 changes: 1 addition & 1 deletion source/adapters/hip/program.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urProgramGetFunctionPointer(
UR_CHECK_ERROR(Ret);
if (Ret == hipErrorNotFound) {
*ppFunctionPointer = 0;
Result = UR_RESULT_ERROR_INVALID_FUNCTION_NAME;
Result = UR_RESULT_ERROR_INVALID_KERNEL_NAME;
}

return Result;
Expand Down
3 changes: 1 addition & 2 deletions source/adapters/level_zero/common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,8 @@ ur_result_t ze2urResult(ze_result_t ZeResult) {
case ZE_RESULT_ERROR_INVALID_NATIVE_BINARY:
return UR_RESULT_ERROR_INVALID_BINARY;
case ZE_RESULT_ERROR_INVALID_KERNEL_NAME:
return UR_RESULT_ERROR_INVALID_KERNEL_NAME;
case ZE_RESULT_ERROR_INVALID_FUNCTION_NAME:
return UR_RESULT_ERROR_INVALID_FUNCTION_NAME;
return UR_RESULT_ERROR_INVALID_KERNEL_NAME;
case ZE_RESULT_ERROR_OVERLAPPING_REGIONS:
return UR_RESULT_ERROR_INVALID_OPERATION;
case ZE_RESULT_ERROR_INVALID_GROUP_SIZE_DIMENSION:
Expand Down
4 changes: 2 additions & 2 deletions source/adapters/level_zero/common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,8 @@ static auto getUrResultString = [](ur_result_t Result) {
return "UR_RESULT_ERROR_INVALID_NATIVE_BINARY";
case UR_RESULT_ERROR_INVALID_GLOBAL_NAME:
return "UR_RESULT_ERROR_INVALID_GLOBAL_NAME";
case UR_RESULT_ERROR_INVALID_FUNCTION_NAME:
return "UR_RESULT_ERROR_INVALID_FUNCTION_NAME";
case UR_RESULT_ERROR_FUNCTION_ADDRESS_NOT_AVAILABLE:
return "UR_RESULT_ERROR_FUNCTION_ADDRESS_NOT_AVAILABLE";
case UR_RESULT_ERROR_INVALID_GROUP_SIZE_DIMENSION:
return "UR_RESULT_ERROR_INVALID_GROUP_SIZE_DIMENSION";
case UR_RESULT_ERROR_INVALID_GLOBAL_WIDTH_DIMENSION:
Expand Down
2 changes: 1 addition & 1 deletion source/adapters/level_zero/program.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urProgramGetFunctionPointer(
// exists
ClResult.pop_back();
if (is_in_separated_string(ClResult, ';', std::string(FunctionName)))
return UR_RESULT_ERROR_INVALID_FUNCTION_NAME;
return UR_RESULT_ERROR_FUNCTION_ADDRESS_NOT_AVAILABLE;

return UR_RESULT_ERROR_INVALID_KERNEL_NAME;
}
Expand Down
2 changes: 1 addition & 1 deletion source/adapters/native_cpu/kernel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urKernelGetInfo(ur_kernel_handle_t hKernel,
if (hKernel->_name) {
return ReturnValue(hKernel->_name);
}
return UR_RESULT_ERROR_INVALID_FUNCTION_NAME;
return UR_RESULT_ERROR_INVALID_KERNEL;
// case UR_KERNEL_INFO_NUM_ARGS:
// return ReturnValue(uint32_t{ Kernel->ZeKernelProperties->numKernelArgs
// });
Expand Down
6 changes: 1 addition & 5 deletions source/adapters/opencl/program.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -444,10 +444,6 @@ UR_APIEXPORT ur_result_t UR_APICALL urProgramGetFunctionPointer(
CLContext, cl_ext::ExtFuncPtrCache->clGetDeviceFunctionPointerCache,
cl_ext::GetDeviceFunctionPointerName, &FuncT));

if (!FuncT) {
return UR_RESULT_ERROR_INVALID_FUNCTION_NAME;
}

// Check if the kernel name exists to prevent the OpenCL runtime from throwing
// an exception with the cpu runtime.
// TODO: Use fallback search method if the clGetDeviceFunctionPointerINTEL
Expand Down Expand Up @@ -481,7 +477,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urProgramGetFunctionPointer(
// that the function name is invalid.
if (CLResult == CL_INVALID_ARG_VALUE) {
*ppFunctionPointer = 0;
return UR_RESULT_ERROR_INVALID_FUNCTION_NAME;
return UR_RESULT_ERROR_FUNCTION_ADDRESS_NOT_AVAILABLE;
}

CL_RETURN_ON_FAILURE(CLResult);
Expand Down
8 changes: 6 additions & 2 deletions source/loader/ur_libapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3141,8 +3141,8 @@ ur_result_t UR_APICALL urProgramRelease(
/// @details
/// - Retrieves a pointer to the functions with the given name and defined
/// in the given program.
/// - ::UR_RESULT_ERROR_INVALID_FUNCTION_NAME is returned if the function
/// can not be obtained.
/// - ::UR_RESULT_ERROR_FUNCTION_ADDRESS_NOT_AVAILABLE is returned if the
/// function can not be obtained.
/// - The application may call this function from simultaneous threads for
/// the same device.
/// - The implementation of this function should be thread-safe.
Expand All @@ -3162,6 +3162,10 @@ ur_result_t UR_APICALL urProgramRelease(
/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER
/// + `NULL == pFunctionName`
/// + `NULL == ppFunctionPointer`
/// - ::UR_RESULT_ERROR_INVALID_KERNEL_NAME
/// + If `pFunctionName` couldn't be found in `hProgram`.
/// - ::UR_RESULT_ERROR_FUNCTION_ADDRESS_NOT_AVAILABLE
/// + If `pFunctionName` could be located, but its address couldn't be retrieved.
ur_result_t UR_APICALL urProgramGetFunctionPointer(
ur_device_handle_t
hDevice, ///< [in] handle of the device to retrieve pointer for.
Expand Down
8 changes: 6 additions & 2 deletions source/ur_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2668,8 +2668,8 @@ ur_result_t UR_APICALL urProgramRelease(
/// @details
/// - Retrieves a pointer to the functions with the given name and defined
/// in the given program.
/// - ::UR_RESULT_ERROR_INVALID_FUNCTION_NAME is returned if the function
/// can not be obtained.
/// - ::UR_RESULT_ERROR_FUNCTION_ADDRESS_NOT_AVAILABLE is returned if the
/// function can not be obtained.
/// - The application may call this function from simultaneous threads for
/// the same device.
/// - The implementation of this function should be thread-safe.
Expand All @@ -2689,6 +2689,10 @@ ur_result_t UR_APICALL urProgramRelease(
/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER
/// + `NULL == pFunctionName`
/// + `NULL == ppFunctionPointer`
/// - ::UR_RESULT_ERROR_INVALID_KERNEL_NAME
/// + If `pFunctionName` couldn't be found in `hProgram`.
/// - ::UR_RESULT_ERROR_FUNCTION_ADDRESS_NOT_AVAILABLE
/// + If `pFunctionName` could be located, but its address couldn't be retrieved.
ur_result_t UR_APICALL urProgramGetFunctionPointer(
ur_device_handle_t
hDevice, ///< [in] handle of the device to retrieve pointer for.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ urProgramCreateWithNativeHandleTest.Success/Intel_R__oneAPI_Unified_Runtime_over
urProgramCreateWithNativeHandleTest.InvalidNullHandleContext/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_
urProgramCreateWithNativeHandleTest.InvalidNullPointerProgram/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_
urProgramGetBuildInfoTest.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_UR_PROGRAM_BUILD_INFO_STATUS
urProgramGetFunctionPointerTest.InvalidFunctionName/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_
urProgramGetFunctionPointerTest.InvalidKernelName/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_
Aborted
1 change: 0 additions & 1 deletion test/conformance/program/program_adapter_opencl.match
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
urProgramGetFunctionPointerTest.InvalidFunctionName/Intel_R__OpenCL___{{.*}}_
urProgramGetInfoTest.Success/Intel_R__OpenCL___{{.*}}___UR_PROGRAM_INFO_SOURCE
urProgramGetInfoTest.Success/Intel_R__OpenCL___{{.*}}___UR_PROGRAM_INFO_BINARIES
4 changes: 2 additions & 2 deletions test/conformance/program/urProgramGetFunctionPointer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ TEST_P(urProgramGetFunctionPointerTest, Success) {
ASSERT_NE(function_pointer, nullptr);
}

TEST_P(urProgramGetFunctionPointerTest, InvalidFunctionName) {
TEST_P(urProgramGetFunctionPointerTest, InvalidKernelName) {
void *function_pointer = nullptr;
std::string missing_function = "aFakeFunctionName";
ASSERT_EQ_RESULT(UR_RESULT_ERROR_INVALID_FUNCTION_NAME,
ASSERT_EQ_RESULT(UR_RESULT_ERROR_INVALID_KERNEL_NAME,
urProgramGetFunctionPointer(device, program,
missing_function.data(),
&function_pointer));
Expand Down