Skip to content

Commit f5fa624

Browse files
committed
[UR] Add urPlatformGetBackendOption invalid value check
1 parent 6687f35 commit f5fa624

File tree

5 files changed

+16
-0
lines changed

5 files changed

+16
-0
lines changed

include/ur_api.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -544,6 +544,8 @@ urPlatformCreateWithNativeHandle(
544544
/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER
545545
/// + `NULL == pFrontendOption`
546546
/// + `NULL == ppAdapterOption`
547+
/// - ::UR_RESULT_ERROR_INVALID_VALUE
548+
/// + If `pFrontendOption` is not a valid frontend option.
547549
UR_APIEXPORT ur_result_t UR_APICALL
548550
urPlatformGetBackendOption(
549551
ur_platform_handle_t hPlatform, ///< [in] handle of the platform instance.

scripts/core/platform.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,9 @@ params:
188188
- type: const char**
189189
name: ppAdapterOption
190190
desc: "[out] returns the correct adapter specific option based on the frontend option."
191+
returns:
192+
- $X_RESULT_ERROR_INVALID_VALUE:
193+
- "If `pFrontendOption` is not a valid frontend option."
191194
--- #--------------------------------------------------------------------------
192195
type: function
193196
desc: "Retrieve string representation of the underlying adapter specific result

source/loader/ur_libapi.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,8 @@ ur_result_t UR_APICALL urPlatformCreateWithNativeHandle(
273273
/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER
274274
/// + `NULL == pFrontendOption`
275275
/// + `NULL == ppAdapterOption`
276+
/// - ::UR_RESULT_ERROR_INVALID_VALUE
277+
/// + If `pFrontendOption` is not a valid frontend option.
276278
ur_result_t UR_APICALL urPlatformGetBackendOption(
277279
ur_platform_handle_t hPlatform, ///< [in] handle of the platform instance.
278280
const char

source/ur_api.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,8 @@ ur_result_t UR_APICALL urPlatformCreateWithNativeHandle(
229229
/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER
230230
/// + `NULL == pFrontendOption`
231231
/// + `NULL == ppAdapterOption`
232+
/// - ::UR_RESULT_ERROR_INVALID_VALUE
233+
/// + If `pFrontendOption` is not a valid frontend option.
232234
ur_result_t UR_APICALL urPlatformGetBackendOption(
233235
ur_platform_handle_t hPlatform, ///< [in] handle of the platform instance.
234236
const char

test/conformance/platform/urPlatformGetBackendOption.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,10 @@ TEST_F(urPlatfromGetBackendOptionTest, InvalidNullPointerAdapterOption) {
3939
ASSERT_EQ_RESULT(UR_RESULT_ERROR_INVALID_NULL_POINTER,
4040
urPlatformGetBackendOption(platform, "-O0", nullptr));
4141
}
42+
43+
TEST_F(urPlatfromGetBackendOptionTest, InvalidValueFrontendOption) {
44+
const char *adapterOption = nullptr;
45+
ASSERT_EQ_RESULT(
46+
UR_RESULT_ERROR_INVALID_VALUE,
47+
urPlatformGetBackendOption(platform, "-sycl-sucks", &adapterOption));
48+
}

0 commit comments

Comments
 (0)