Skip to content

Commit 4b4624f

Browse files
author
Fábio
authored
Add urMemImageCreateTests (#332)
1 parent d160006 commit 4b4624f

File tree

9 files changed

+199
-16
lines changed

9 files changed

+199
-16
lines changed

include/ur_api.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1487,14 +1487,15 @@ typedef struct ur_image_desc_t {
14871487
/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER
14881488
/// + `NULL == pImageFormat`
14891489
/// + `NULL == pImageDesc`
1490-
/// + `NULL == pHost`
14911490
/// + `NULL == phMem`
14921491
/// - ::UR_RESULT_ERROR_INVALID_CONTEXT
14931492
/// - ::UR_RESULT_ERROR_INVALID_VALUE
14941493
/// - ::UR_RESULT_ERROR_INVALID_IMAGE_FORMAT_DESCRIPTOR
14951494
/// - ::UR_RESULT_ERROR_INVALID_IMAGE_SIZE
14961495
/// - ::UR_RESULT_ERROR_INVALID_OPERATION
14971496
/// - ::UR_RESULT_ERROR_INVALID_HOST_PTR
1497+
/// + `pHost == NULL && (flags & (UR_MEM_FLAG_USE_HOST_POINTER | UR_MEM_FLAG_ALLOC_COPY_HOST_POINTER)) != 0`
1498+
/// + `pHost != NULL && (flags & (UR_MEM_FLAG_USE_HOST_POINTER | UR_MEM_FLAG_ALLOC_COPY_HOST_POINTER)) == 0`
14981499
/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY
14991500
/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES
15001501
UR_APIEXPORT ur_result_t UR_APICALL
@@ -1503,7 +1504,7 @@ urMemImageCreate(
15031504
ur_mem_flags_t flags, ///< [in] allocation and usage information flags
15041505
const ur_image_format_t *pImageFormat, ///< [in] pointer to image format specification
15051506
const ur_image_desc_t *pImageDesc, ///< [in] pointer to image description
1506-
void *pHost, ///< [in] pointer to the buffer data
1507+
void *pHost, ///< [in][optional] pointer to the buffer data
15071508
ur_mem_handle_t *phMem ///< [out] pointer to handle of image object created
15081509
);
15091510

@@ -1528,6 +1529,8 @@ urMemImageCreate(
15281529
/// - ::UR_RESULT_ERROR_INVALID_VALUE
15291530
/// - ::UR_RESULT_ERROR_INVALID_BUFFER_SIZE
15301531
/// - ::UR_RESULT_ERROR_INVALID_HOST_PTR
1532+
/// + `pHost == NULL && (flags & (UR_MEM_FLAG_USE_HOST_POINTER | UR_MEM_FLAG_ALLOC_COPY_HOST_POINTER)) != 0`
1533+
/// + `pHost != NULL && (flags & (UR_MEM_FLAG_USE_HOST_POINTER | UR_MEM_FLAG_ALLOC_COPY_HOST_POINTER)) == 0`
15311534
/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY
15321535
/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES
15331536
UR_APIEXPORT ur_result_t UR_APICALL

scripts/core/memory.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ params:
222222
desc: "[in] pointer to image description"
223223
- type: "void*"
224224
name: pHost
225-
desc: "[in] pointer to the buffer data"
225+
desc: "[in][optional] pointer to the buffer data"
226226
- type: $x_mem_handle_t*
227227
name: phMem
228228
desc: "[out] pointer to handle of image object created"
@@ -232,7 +232,9 @@ returns:
232232
- $X_RESULT_ERROR_INVALID_IMAGE_FORMAT_DESCRIPTOR
233233
- $X_RESULT_ERROR_INVALID_IMAGE_SIZE
234234
- $X_RESULT_ERROR_INVALID_OPERATION
235-
- $X_RESULT_ERROR_INVALID_HOST_PTR
235+
- $X_RESULT_ERROR_INVALID_HOST_PTR:
236+
- "`pHost == NULL && (flags & (UR_MEM_FLAG_USE_HOST_POINTER | UR_MEM_FLAG_ALLOC_COPY_HOST_POINTER)) != 0`"
237+
- "`pHost != NULL && (flags & (UR_MEM_FLAG_USE_HOST_POINTER | UR_MEM_FLAG_ALLOC_COPY_HOST_POINTER)) == 0`"
236238
- $X_RESULT_ERROR_OUT_OF_HOST_MEMORY
237239
- $X_RESULT_ERROR_OUT_OF_RESOURCES
238240
--- #--------------------------------------------------------------------------
@@ -263,7 +265,9 @@ returns:
263265
- $X_RESULT_ERROR_INVALID_CONTEXT
264266
- $X_RESULT_ERROR_INVALID_VALUE
265267
- $X_RESULT_ERROR_INVALID_BUFFER_SIZE
266-
- $X_RESULT_ERROR_INVALID_HOST_PTR
268+
- $X_RESULT_ERROR_INVALID_HOST_PTR:
269+
- "`pHost == NULL && (flags & (UR_MEM_FLAG_USE_HOST_POINTER | UR_MEM_FLAG_ALLOC_COPY_HOST_POINTER)) != 0`"
270+
- "`pHost != NULL && (flags & (UR_MEM_FLAG_USE_HOST_POINTER | UR_MEM_FLAG_ALLOC_COPY_HOST_POINTER)) == 0`"
267271
- $X_RESULT_ERROR_OUT_OF_HOST_MEMORY
268272
- $X_RESULT_ERROR_OUT_OF_RESOURCES
269273
--- #--------------------------------------------------------------------------

source/drivers/null/ur_nullddi.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ urMemImageCreate(
563563
ur_mem_flags_t flags, ///< [in] allocation and usage information flags
564564
const ur_image_format_t *pImageFormat, ///< [in] pointer to image format specification
565565
const ur_image_desc_t *pImageDesc, ///< [in] pointer to image description
566-
void *pHost, ///< [in] pointer to the buffer data
566+
void *pHost, ///< [in][optional] pointer to the buffer data
567567
ur_mem_handle_t *phMem ///< [out] pointer to handle of image object created
568568
) {
569569
ur_result_t result = UR_RESULT_SUCCESS;

source/loader/layers/tracing/ur_trcddi.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,7 @@ urMemImageCreate(
622622
ur_mem_flags_t flags, ///< [in] allocation and usage information flags
623623
const ur_image_format_t *pImageFormat, ///< [in] pointer to image format specification
624624
const ur_image_desc_t *pImageDesc, ///< [in] pointer to image description
625-
void *pHost, ///< [in] pointer to the buffer data
625+
void *pHost, ///< [in][optional] pointer to the buffer data
626626
ur_mem_handle_t *phMem ///< [out] pointer to handle of image object created
627627
) {
628628
auto pfnImageCreate = context.urDdiTable.Mem.pfnImageCreate;

source/loader/layers/validation/ur_valddi.cpp

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -664,7 +664,7 @@ urMemImageCreate(
664664
ur_mem_flags_t flags, ///< [in] allocation and usage information flags
665665
const ur_image_format_t *pImageFormat, ///< [in] pointer to image format specification
666666
const ur_image_desc_t *pImageDesc, ///< [in] pointer to image description
667-
void *pHost, ///< [in] pointer to the buffer data
667+
void *pHost, ///< [in][optional] pointer to the buffer data
668668
ur_mem_handle_t *phMem ///< [out] pointer to handle of image object created
669669
) {
670670
auto pfnImageCreate = context.urDdiTable.Mem.pfnImageCreate;
@@ -694,12 +694,16 @@ urMemImageCreate(
694694
return UR_RESULT_ERROR_INVALID_NULL_POINTER;
695695
}
696696

697-
if (NULL == pHost) {
697+
if (NULL == phMem) {
698698
return UR_RESULT_ERROR_INVALID_NULL_POINTER;
699699
}
700700

701-
if (NULL == phMem) {
702-
return UR_RESULT_ERROR_INVALID_NULL_POINTER;
701+
if (pHost == NULL && (flags & (UR_MEM_FLAG_USE_HOST_POINTER | UR_MEM_FLAG_ALLOC_COPY_HOST_POINTER)) != 0) {
702+
return UR_RESULT_ERROR_INVALID_HOST_PTR;
703+
}
704+
705+
if (pHost != NULL && (flags & (UR_MEM_FLAG_USE_HOST_POINTER | UR_MEM_FLAG_ALLOC_COPY_HOST_POINTER)) == 0) {
706+
return UR_RESULT_ERROR_INVALID_HOST_PTR;
703707
}
704708
}
705709

@@ -734,6 +738,14 @@ urMemBufferCreate(
734738
if (NULL == phBuffer) {
735739
return UR_RESULT_ERROR_INVALID_NULL_POINTER;
736740
}
741+
742+
if (pHost == NULL && (flags & (UR_MEM_FLAG_USE_HOST_POINTER | UR_MEM_FLAG_ALLOC_COPY_HOST_POINTER)) != 0) {
743+
return UR_RESULT_ERROR_INVALID_HOST_PTR;
744+
}
745+
746+
if (pHost != NULL && (flags & (UR_MEM_FLAG_USE_HOST_POINTER | UR_MEM_FLAG_ALLOC_COPY_HOST_POINTER)) == 0) {
747+
return UR_RESULT_ERROR_INVALID_HOST_PTR;
748+
}
737749
}
738750

739751
return pfnBufferCreate(hContext, flags, size, pHost, phBuffer);

source/loader/ur_ldrddi.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -824,7 +824,7 @@ urMemImageCreate(
824824
ur_mem_flags_t flags, ///< [in] allocation and usage information flags
825825
const ur_image_format_t *pImageFormat, ///< [in] pointer to image format specification
826826
const ur_image_desc_t *pImageDesc, ///< [in] pointer to image description
827-
void *pHost, ///< [in] pointer to the buffer data
827+
void *pHost, ///< [in][optional] pointer to the buffer data
828828
ur_mem_handle_t *phMem ///< [out] pointer to handle of image object created
829829
) {
830830
ur_result_t result = UR_RESULT_SUCCESS;

source/loader/ur_libapi.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -886,14 +886,15 @@ urContextSetExtendedDeleter(
886886
/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER
887887
/// + `NULL == pImageFormat`
888888
/// + `NULL == pImageDesc`
889-
/// + `NULL == pHost`
890889
/// + `NULL == phMem`
891890
/// - ::UR_RESULT_ERROR_INVALID_CONTEXT
892891
/// - ::UR_RESULT_ERROR_INVALID_VALUE
893892
/// - ::UR_RESULT_ERROR_INVALID_IMAGE_FORMAT_DESCRIPTOR
894893
/// - ::UR_RESULT_ERROR_INVALID_IMAGE_SIZE
895894
/// - ::UR_RESULT_ERROR_INVALID_OPERATION
896895
/// - ::UR_RESULT_ERROR_INVALID_HOST_PTR
896+
/// + `pHost == NULL && (flags & (UR_MEM_FLAG_USE_HOST_POINTER | UR_MEM_FLAG_ALLOC_COPY_HOST_POINTER)) != 0`
897+
/// + `pHost != NULL && (flags & (UR_MEM_FLAG_USE_HOST_POINTER | UR_MEM_FLAG_ALLOC_COPY_HOST_POINTER)) == 0`
897898
/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY
898899
/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES
899900
ur_result_t UR_APICALL
@@ -902,7 +903,7 @@ urMemImageCreate(
902903
ur_mem_flags_t flags, ///< [in] allocation and usage information flags
903904
const ur_image_format_t *pImageFormat, ///< [in] pointer to image format specification
904905
const ur_image_desc_t *pImageDesc, ///< [in] pointer to image description
905-
void *pHost, ///< [in] pointer to the buffer data
906+
void *pHost, ///< [in][optional] pointer to the buffer data
906907
ur_mem_handle_t *phMem ///< [out] pointer to handle of image object created
907908
) {
908909
auto pfnImageCreate = ur_lib::context->urDdiTable.Mem.pfnImageCreate;
@@ -934,6 +935,8 @@ urMemImageCreate(
934935
/// - ::UR_RESULT_ERROR_INVALID_VALUE
935936
/// - ::UR_RESULT_ERROR_INVALID_BUFFER_SIZE
936937
/// - ::UR_RESULT_ERROR_INVALID_HOST_PTR
938+
/// + `pHost == NULL && (flags & (UR_MEM_FLAG_USE_HOST_POINTER | UR_MEM_FLAG_ALLOC_COPY_HOST_POINTER)) != 0`
939+
/// + `pHost != NULL && (flags & (UR_MEM_FLAG_USE_HOST_POINTER | UR_MEM_FLAG_ALLOC_COPY_HOST_POINTER)) == 0`
937940
/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY
938941
/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES
939942
ur_result_t UR_APICALL

source/ur_api.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -778,14 +778,15 @@ urContextSetExtendedDeleter(
778778
/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER
779779
/// + `NULL == pImageFormat`
780780
/// + `NULL == pImageDesc`
781-
/// + `NULL == pHost`
782781
/// + `NULL == phMem`
783782
/// - ::UR_RESULT_ERROR_INVALID_CONTEXT
784783
/// - ::UR_RESULT_ERROR_INVALID_VALUE
785784
/// - ::UR_RESULT_ERROR_INVALID_IMAGE_FORMAT_DESCRIPTOR
786785
/// - ::UR_RESULT_ERROR_INVALID_IMAGE_SIZE
787786
/// - ::UR_RESULT_ERROR_INVALID_OPERATION
788787
/// - ::UR_RESULT_ERROR_INVALID_HOST_PTR
788+
/// + `pHost == NULL && (flags & (UR_MEM_FLAG_USE_HOST_POINTER | UR_MEM_FLAG_ALLOC_COPY_HOST_POINTER)) != 0`
789+
/// + `pHost != NULL && (flags & (UR_MEM_FLAG_USE_HOST_POINTER | UR_MEM_FLAG_ALLOC_COPY_HOST_POINTER)) == 0`
789790
/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY
790791
/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES
791792
ur_result_t UR_APICALL
@@ -794,7 +795,7 @@ urMemImageCreate(
794795
ur_mem_flags_t flags, ///< [in] allocation and usage information flags
795796
const ur_image_format_t *pImageFormat, ///< [in] pointer to image format specification
796797
const ur_image_desc_t *pImageDesc, ///< [in] pointer to image description
797-
void *pHost, ///< [in] pointer to the buffer data
798+
void *pHost, ///< [in][optional] pointer to the buffer data
798799
ur_mem_handle_t *phMem ///< [out] pointer to handle of image object created
799800
) {
800801
ur_result_t result = UR_RESULT_SUCCESS;
@@ -822,6 +823,8 @@ urMemImageCreate(
822823
/// - ::UR_RESULT_ERROR_INVALID_VALUE
823824
/// - ::UR_RESULT_ERROR_INVALID_BUFFER_SIZE
824825
/// - ::UR_RESULT_ERROR_INVALID_HOST_PTR
826+
/// + `pHost == NULL && (flags & (UR_MEM_FLAG_USE_HOST_POINTER | UR_MEM_FLAG_ALLOC_COPY_HOST_POINTER)) != 0`
827+
/// + `pHost != NULL && (flags & (UR_MEM_FLAG_USE_HOST_POINTER | UR_MEM_FLAG_ALLOC_COPY_HOST_POINTER)) == 0`
825828
/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY
826829
/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES
827830
ur_result_t UR_APICALL
Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,160 @@
11
// Copyright (C) 2023 Intel Corporation
22
// SPDX-License-Identifier: MIT
3+
#include <uur/fixtures.h>
4+
5+
using urMemImageCreateTest = uur::urContextTest;
6+
UUR_INSTANTIATE_DEVICE_TEST_SUITE_P(urMemImageCreateTest);
7+
8+
static ur_image_format_t image_format{
9+
UR_IMAGE_CHANNEL_ORDER_A,
10+
UR_IMAGE_CHANNEL_TYPE_SIGNED_INT32};
11+
12+
static ur_image_desc_t image_desc{
13+
UR_STRUCTURE_TYPE_IMAGE_DESC, ///< [in] type of this structure
14+
nullptr, ///< [in][optional] pointer to extension-specific structure
15+
UR_MEM_TYPE_IMAGE3D, ///< [in] memory object type
16+
1, ///< [in] image width
17+
1, ///< [in] image height
18+
1, ///< [in] image depth
19+
1, ///< [in] image array size
20+
0, ///< [in] image row pitch
21+
0, ///< [in] image slice pitch
22+
0, ///< [in] number of MIP levels
23+
0 ///< [in] number of samples
24+
};
25+
26+
TEST_P(urMemImageCreateTest, Success) {
27+
ur_mem_handle_t image_handle = nullptr;
28+
ASSERT_SUCCESS(
29+
urMemImageCreate(context, UR_MEM_FLAG_READ_WRITE, &image_format,
30+
&image_desc, nullptr, &image_handle));
31+
ASSERT_NE(nullptr, image_handle);
32+
ASSERT_SUCCESS(urMemRelease(image_handle));
33+
}
34+
35+
TEST_P(urMemImageCreateTest, InvalidNullHandleContext) {
36+
ur_mem_handle_t image_handle = nullptr;
37+
ASSERT_EQ_RESULT(UR_RESULT_ERROR_INVALID_NULL_HANDLE,
38+
urMemImageCreate(nullptr, UR_MEM_FLAG_READ_WRITE,
39+
&image_format,
40+
&image_desc, nullptr, &image_handle));
41+
}
42+
43+
TEST_P(urMemImageCreateTest, InvalidEnumerationFlags) {
44+
ur_mem_handle_t image_handle = nullptr;
45+
ASSERT_EQ_RESULT(UR_RESULT_ERROR_INVALID_ENUMERATION,
46+
urMemImageCreate(context, UR_MEM_FLAG_FORCE_UINT32,
47+
&image_format,
48+
&image_desc, nullptr, &image_handle));
49+
}
50+
51+
TEST_P(urMemImageCreateTest, InvalidNullPointerBuffer) {
52+
ASSERT_EQ_RESULT(UR_RESULT_ERROR_INVALID_NULL_POINTER,
53+
urMemImageCreate(context, UR_MEM_FLAG_READ_WRITE,
54+
&image_format, &image_desc, nullptr,
55+
nullptr));
56+
}
57+
58+
TEST_P(urMemImageCreateTest, InvalidSize) {
59+
60+
ur_mem_handle_t image_handle = nullptr;
61+
62+
ur_image_desc_t invalid_image_desc = image_desc;
63+
invalid_image_desc.width = std::numeric_limits<size_t>::max();
64+
65+
ASSERT_EQ_RESULT(UR_RESULT_ERROR_INVALID_IMAGE_SIZE,
66+
urMemImageCreate(context, UR_MEM_FLAG_READ_WRITE,
67+
&image_format, &invalid_image_desc, nullptr,
68+
&image_handle));
69+
70+
invalid_image_desc = image_desc;
71+
invalid_image_desc.height = std::numeric_limits<size_t>::max();
72+
73+
ASSERT_EQ_RESULT(UR_RESULT_ERROR_INVALID_IMAGE_SIZE,
74+
urMemImageCreate(context, UR_MEM_FLAG_READ_WRITE,
75+
&image_format, &invalid_image_desc, nullptr,
76+
&image_handle));
77+
78+
invalid_image_desc = image_desc;
79+
invalid_image_desc.depth = std::numeric_limits<size_t>::max();
80+
81+
ASSERT_EQ_RESULT(UR_RESULT_ERROR_INVALID_IMAGE_SIZE,
82+
urMemImageCreate(context, UR_MEM_FLAG_READ_WRITE,
83+
&image_format, &invalid_image_desc, nullptr,
84+
&image_handle));
85+
}
86+
87+
TEST_P(urMemImageCreateTest, InvalidImageDesc) {
88+
89+
ur_mem_handle_t image_handle = nullptr;
90+
91+
ASSERT_EQ_RESULT(UR_RESULT_ERROR_INVALID_IMAGE_FORMAT_DESCRIPTOR,
92+
urMemImageCreate(context, UR_MEM_FLAG_READ_WRITE,
93+
&image_format, nullptr, nullptr,
94+
&image_handle));
95+
96+
ur_image_desc_t invalid_image_desc = image_desc;
97+
invalid_image_desc.stype = UR_STRUCTURE_TYPE_FORCE_UINT32;
98+
99+
ASSERT_EQ_RESULT(UR_RESULT_ERROR_INVALID_IMAGE_FORMAT_DESCRIPTOR,
100+
urMemImageCreate(context, UR_MEM_FLAG_READ_WRITE,
101+
&image_format, &invalid_image_desc,
102+
nullptr, &image_handle));
103+
104+
invalid_image_desc = image_desc;
105+
invalid_image_desc.type = UR_MEM_TYPE_FORCE_UINT32;
106+
107+
ASSERT_EQ_RESULT(UR_RESULT_ERROR_INVALID_IMAGE_FORMAT_DESCRIPTOR,
108+
urMemImageCreate(context, UR_MEM_FLAG_READ_WRITE,
109+
&image_format, &invalid_image_desc,
110+
nullptr, &image_handle));
111+
112+
invalid_image_desc = image_desc;
113+
invalid_image_desc.numMipLevel = 1; /* Must be 0 */
114+
115+
ASSERT_EQ_RESULT(UR_RESULT_ERROR_INVALID_IMAGE_FORMAT_DESCRIPTOR,
116+
urMemImageCreate(context, UR_MEM_FLAG_READ_WRITE,
117+
&image_format, &invalid_image_desc,
118+
nullptr, &image_handle));
119+
120+
invalid_image_desc = image_desc;
121+
invalid_image_desc.numSamples = 1; /* Must be 0 */
122+
123+
ASSERT_EQ_RESULT(UR_RESULT_ERROR_INVALID_IMAGE_FORMAT_DESCRIPTOR,
124+
urMemImageCreate(context, UR_MEM_FLAG_READ_WRITE,
125+
&image_format, &invalid_image_desc,
126+
nullptr, &image_handle));
127+
128+
invalid_image_desc = image_desc;
129+
invalid_image_desc.rowPitch = 1; /* Must be 0 if pHost is NULL */
130+
131+
ASSERT_EQ_RESULT(UR_RESULT_ERROR_INVALID_IMAGE_FORMAT_DESCRIPTOR,
132+
urMemImageCreate(context, UR_MEM_FLAG_READ_WRITE,
133+
&image_format, &invalid_image_desc,
134+
nullptr, &image_handle));
135+
136+
invalid_image_desc = image_desc;
137+
invalid_image_desc.slicePitch = 1; /* Must be 0 if pHost is NULL */
138+
139+
ASSERT_EQ_RESULT(UR_RESULT_ERROR_INVALID_IMAGE_FORMAT_DESCRIPTOR,
140+
urMemImageCreate(context, UR_MEM_FLAG_READ_WRITE,
141+
&image_format, &invalid_image_desc,
142+
nullptr, &image_handle));
143+
}
144+
145+
using urMemImageCreateWithHostPtrFlagsTest = uur::urContextTestWithParam<
146+
ur_mem_flag_t>;
147+
148+
UUR_TEST_SUITE_P(urMemImageCreateWithHostPtrFlagsTest,
149+
::testing::Values(UR_MEM_FLAG_ALLOC_COPY_HOST_POINTER,
150+
UR_MEM_FLAG_ALLOC_HOST_POINTER,
151+
UR_MEM_FLAG_USE_HOST_POINTER),
152+
uur::deviceTestWithParamPrinter<ur_mem_flag_t>);
153+
154+
TEST_P(urMemImageCreateWithHostPtrFlagsTest, InvalidHostPtr) {
155+
ur_mem_handle_t image_handle = nullptr;
156+
ASSERT_EQ_RESULT(UR_RESULT_ERROR_INVALID_HOST_PTR,
157+
urMemImageCreate(context, UR_MEM_FLAG_READ_WRITE,
158+
&image_format,
159+
&image_desc, nullptr, &image_handle));
160+
}

0 commit comments

Comments
 (0)