Skip to content

Commit 7089c92

Browse files
authored
Merge pull request #570 from aarongreig/aaron/kernelProgramTestFixes
A number of small fixes for the kernel and program CTS tests.
2 parents 8ab1e3e + 073cc87 commit 7089c92

13 files changed

+33
-34
lines changed

include/ur_api.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2984,6 +2984,7 @@ typedef struct ur_program_properties_t {
29842984
/// + `NULL != pProperties && pProperties->count > 0 && NULL == pProperties->pMetadatas`
29852985
/// - ::UR_RESULT_ERROR_INVALID_SIZE
29862986
/// + `NULL != pProperties && NULL != pProperties->pMetadatas && pProperties->count == 0`
2987+
/// + `length == 0`
29872988
/// - ::UR_RESULT_ERROR_INVALID_BINARY
29882989
/// + If `pIL` is not a valid IL binary for devices in `hContext`.
29892990
/// - ::UR_RESULT_ERROR_COMPILER_NOT_AVAILABLE

scripts/core/program.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@ returns:
109109
- "If `pIL` is not a valid IL binary for devices in `hContext`."
110110
- $X_RESULT_ERROR_COMPILER_NOT_AVAILABLE:
111111
- "If devices in `hContext` don't have the capability to compile an IL binary at runtime."
112+
- $X_RESULT_ERROR_INVALID_SIZE:
113+
- "`length == 0`"
112114
--- #--------------------------------------------------------------------------
113115
type: function
114116
desc: "Create a program object from device native binary."

source/loader/layers/validation/ur_valddi.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1886,6 +1886,10 @@ __urdlllocal ur_result_t UR_APICALL urProgramCreateWithIL(
18861886
pProperties->count == 0) {
18871887
return UR_RESULT_ERROR_INVALID_SIZE;
18881888
}
1889+
1890+
if (length == 0) {
1891+
return UR_RESULT_ERROR_INVALID_SIZE;
1892+
}
18891893
}
18901894

18911895
ur_result_t result =

source/loader/ur_libapi.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2075,6 +2075,7 @@ ur_result_t UR_APICALL urUSMPoolGetInfo(
20752075
/// + `NULL != pProperties && pProperties->count > 0 && NULL == pProperties->pMetadatas`
20762076
/// - ::UR_RESULT_ERROR_INVALID_SIZE
20772077
/// + `NULL != pProperties && NULL != pProperties->pMetadatas && pProperties->count == 0`
2078+
/// + `length == 0`
20782079
/// - ::UR_RESULT_ERROR_INVALID_BINARY
20792080
/// + If `pIL` is not a valid IL binary for devices in `hContext`.
20802081
/// - ::UR_RESULT_ERROR_COMPILER_NOT_AVAILABLE

source/ur_api.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1737,6 +1737,7 @@ ur_result_t UR_APICALL urUSMPoolGetInfo(
17371737
/// + `NULL != pProperties && pProperties->count > 0 && NULL == pProperties->pMetadatas`
17381738
/// - ::UR_RESULT_ERROR_INVALID_SIZE
17391739
/// + `NULL != pProperties && NULL != pProperties->pMetadatas && pProperties->count == 0`
1740+
/// + `length == 0`
17401741
/// - ::UR_RESULT_ERROR_INVALID_BINARY
17411742
/// + If `pIL` is not a valid IL binary for devices in `hContext`.
17421743
/// - ::UR_RESULT_ERROR_COMPILER_NOT_AVAILABLE

test/conformance/kernel/urKernelCreate.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ TEST_P(urKernelCreateTest, InvalidNullPointerKernel) {
4747
}
4848

4949
TEST_P(urKernelCreateTest, InvalidKernelName) {
50-
std::string invalid_name = "";
50+
std::string invalid_name = "incorrect_kernel_name";
5151
ASSERT_EQ_RESULT(UR_RESULT_ERROR_INVALID_KERNEL_NAME,
5252
urKernelCreate(program, invalid_name.data(), &kernel));
5353
}

test/conformance/kernel/urKernelGetGroupInfo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ TEST_P(urKernelGetGroupInfoTest, InvalidNullHandleDevice) {
4949
TEST_P(urKernelGetGroupInfoTest, InvalidEnumeration) {
5050
size_t bad_enum_length = 0;
5151
ASSERT_EQ_RESULT(UR_RESULT_ERROR_INVALID_ENUMERATION,
52-
urKernelGetGroupInfo(nullptr, device,
52+
urKernelGetGroupInfo(kernel, device,
5353
UR_KERNEL_GROUP_INFO_FORCE_UINT32, 0,
5454
nullptr, &bad_enum_length));
5555
}

test/conformance/kernel/urKernelGetSubGroupInfo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,6 @@ TEST_P(urKernelGetSubGroupInfoTest, InvalidEnumeration) {
5050
size_t bad_enum_length = 0;
5151
ASSERT_EQ_RESULT(UR_RESULT_ERROR_INVALID_ENUMERATION,
5252
urKernelGetSubGroupInfo(
53-
nullptr, device, UR_KERNEL_SUB_GROUP_INFO_FORCE_UINT32,
53+
kernel, device, UR_KERNEL_SUB_GROUP_INFO_FORCE_UINT32,
5454
0, nullptr, &bad_enum_length));
5555
}

test/conformance/kernel/urKernelSetArgValue.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ TEST_P(urKernelSetArgValueTest, InvalidNullHandleKernel) {
2828

2929
TEST_P(urKernelSetArgValueTest, InvalidNullPointerArgValue) {
3030
ASSERT_EQ_RESULT(
31-
UR_RESULT_ERROR_INVALID_NULL_HANDLE,
31+
UR_RESULT_ERROR_INVALID_NULL_POINTER,
3232
urKernelSetArgValue(kernel, 2, sizeof(arg_value), nullptr));
3333
}
3434

@@ -44,6 +44,6 @@ TEST_P(urKernelSetArgValueTest, InvalidKernelArgumentIndex) {
4444
}
4545

4646
TEST_P(urKernelSetArgValueTest, InvalidKernelArgumentSize) {
47-
ASSERT_EQ_RESULT(UR_RESULT_ERROR_INVALID_KERNEL_ARGUMENT_INDEX,
47+
ASSERT_EQ_RESULT(UR_RESULT_ERROR_INVALID_KERNEL_ARGUMENT_SIZE,
4848
urKernelSetArgValue(kernel, 2, 0, &arg_value));
4949
}

test/conformance/kernel/urKernelSetExecInfo.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,16 @@ TEST_P(urKernelSetExecInfoTest, InvalidNullHandleKernel) {
2626
TEST_P(urKernelSetExecInfoTest, InvalidEnumeration) {
2727
bool property_value = false;
2828
ASSERT_EQ_RESULT(
29-
UR_RESULT_ERROR_INVALID_NULL_HANDLE,
30-
urKernelSetExecInfo(nullptr, UR_KERNEL_EXEC_INFO_FORCE_UINT32,
29+
UR_RESULT_ERROR_INVALID_ENUMERATION,
30+
urKernelSetExecInfo(kernel, UR_KERNEL_EXEC_INFO_FORCE_UINT32,
3131
sizeof(property_value), &property_value));
3232
}
3333

3434
TEST_P(urKernelSetExecInfoTest, InvalidNullPointerPropValue) {
3535
bool property_value = false;
3636
ASSERT_EQ_RESULT(
3737
UR_RESULT_ERROR_INVALID_NULL_POINTER,
38-
urKernelSetExecInfo(nullptr, UR_KERNEL_EXEC_INFO_USM_INDIRECT_ACCESS,
38+
urKernelSetExecInfo(kernel, UR_KERNEL_EXEC_INFO_USM_INDIRECT_ACCESS,
3939
sizeof(property_value), nullptr));
4040
}
4141

0 commit comments

Comments
 (0)