aboutsummaryrefslogtreecommitdiff
path: root/test_conformance/images/kernel_read_write/test_cl_ext_image_requirements_info.cpp
blob: 9212fcbc9af638cf5489f4780375e044c9e57742 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
//
// Copyright (c) 2022 The Khronos Group Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//    http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#include "../testBase.h"
#include "../common.h"
#include "test_cl_ext_image_buffer.hpp"

/**
 * Negative tests for {CL_IMAGE_REQUIREMENTS_SIZE_EXT}
 * Check that attempting to perform the {CL_IMAGE_REQUIREMENTS_SIZE_EXT} query
 *  without specifying the _image_format_ results in {CL_INVALID_VALUE} being
 * returned. Check that attempting to perform the
 * {CL_IMAGE_REQUIREMENTS_SIZE_EXT} query without specifying the _image_desc_
 * results in {CL_INVALID_VALUE} being returned.
 */
int cl_image_requirements_size_ext_negative(cl_device_id device,
                                            cl_context context,
                                            cl_command_queue queue)
{
    if (!is_extension_available(device, "cl_ext_image_requirements_info"))
    {
        printf("Extension cl_ext_image_requirements_info not available");
        return TEST_SKIPPED_ITSELF;
    }

    cl_platform_id platform = getPlatformFromDevice(device);
    GET_EXTENSION_FUNC(platform, clGetImageRequirementsInfoEXT);

    size_t max_size = 0;
    size_t param_val_size = 0;

    cl_image_desc image_desc = { 0 };
    image_desc_init(&image_desc, CL_MEM_OBJECT_IMAGE2D);

    cl_image_format format = { CL_RGBA, CL_UNSIGNED_INT16 };

    /* Check image_format null results in CL_INVALID_VALUE */
    cl_int err = clGetImageRequirementsInfoEXT(
        context, nullptr, CL_MEM_READ_WRITE, nullptr, &image_desc,
        CL_IMAGE_REQUIREMENTS_SIZE_EXT, sizeof(max_size), &max_size,
        &param_val_size);
    test_failure_error(err, CL_INVALID_VALUE,
                       "Unexpected clGetImageRequirementsInfoEXT return");

    /* Check image_desc null results in CL_INVALID_VALUE */
    err = clGetImageRequirementsInfoEXT(
        context, nullptr, CL_MEM_READ_WRITE, &format, nullptr,
        CL_IMAGE_REQUIREMENTS_SIZE_EXT, sizeof(max_size), &max_size,
        &param_val_size);
    test_failure_error(err, CL_INVALID_VALUE,
                       "Unexpected clGetImageRequirementsInfoEXT return");

    return TEST_PASS;
}

/**
 * Consistency checks for CL_IMAGE_REQUIREMENTS_SIZE_EXT
 * When creating 2D images from a buffer is supported
 * Check that the CL_IMAGE_REQUIREMENTS_SIZE_EXT query can be performed
 * successfully. Create a buffer with the size returned and check that an image
 * can successfully be created from the buffer. Check that the value returned
 * for CL_MEM_SIZE for the image is the same as the value returned for
 * CL_IMAGE_REQUIREMENTS_SIZE_EXT.
 */
int cl_image_requirements_size_ext_consistency(cl_device_id device,
                                               cl_context context,
                                               cl_command_queue queue)
{
    if (!is_extension_available(device, "cl_ext_image_requirements_info"))
    {
        printf("Extension cl_ext_image_requirements_info not available");
        return TEST_SKIPPED_ITSELF;
    }

    if (!is_extension_available(device, "cl_ext_image_from_buffer"))
    {
        printf("Extension cl_ext_image_from_buffer not available");
        return TEST_SKIPPED_ITSELF;
    }

    cl_platform_id platform = getPlatformFromDevice(device);
    GET_EXTENSION_FUNC(platform, clGetImageRequirementsInfoEXT);

    size_t max_size = 0;
    size_t param_val_size = 0;

    std::vector<cl_mem_object_type> imageTypes{
        CL_MEM_OBJECT_IMAGE1D,       CL_MEM_OBJECT_IMAGE2D,
        CL_MEM_OBJECT_IMAGE3D,       CL_MEM_OBJECT_IMAGE1D_BUFFER,
        CL_MEM_OBJECT_IMAGE1D_ARRAY, CL_MEM_OBJECT_IMAGE2D_ARRAY
    };

    std::vector<cl_mem_flags> flagTypes{ CL_MEM_READ_ONLY, CL_MEM_WRITE_ONLY,
                                         CL_MEM_READ_WRITE,
                                         CL_MEM_KERNEL_READ_AND_WRITE };

    for (auto flag : flagTypes)
    {
        for (auto imageType : imageTypes)
        {
            /* Get the list of supported image formats */
            std::vector<cl_image_format> formatList;
            if (TEST_PASS
                    != get_format_list(context, imageType, formatList, flag)
                || formatList.size() == 0)
            {
                test_fail("Failure to get supported formats list");
            }

            for (auto format : formatList)
            {
                cl_image_desc image_desc = { 0 };
                image_desc_init(&image_desc, imageType);

                flag = (flag == CL_MEM_KERNEL_READ_AND_WRITE)
                    ? CL_MEM_READ_WRITE
                    : flag;

                cl_int err = clGetImageRequirementsInfoEXT(
                    context, nullptr, flag, &format, &image_desc,
                    CL_IMAGE_REQUIREMENTS_SIZE_EXT, sizeof(max_size), &max_size,
                    &param_val_size);
                test_error(err, "Error clGetImageRequirementsInfoEXT");

                /* Create buffer */
                cl_mem buffer =
                    clCreateBuffer(context, flag, max_size, nullptr, &err);
                test_error(err, "Unable to create buffer");

                image_desc.buffer = buffer;

                /* 2D Image from buffer */
                cl_mem image_buffer = clCreateImage(context, flag, &format,
                                                    &image_desc, nullptr, &err);
                test_error(err, "Unable to create image");

                size_t size = 0;
                err = clGetMemObjectInfo(image_buffer, CL_MEM_SIZE,
                                         sizeof(size_t), &size, NULL);
                test_error(err, "Error clGetMemObjectInfo");

                if (max_size != size)
                {
                    test_fail("CL_IMAGE_REQUIREMENTS_SIZE_EXT different from "
                              "CL_MEM_SIZE");
                }

                err = clReleaseMemObject(image_buffer);
                test_error(err, "Error clReleaseMemObject");

                err = clReleaseMemObject(buffer);
                test_error(err, "Error clReleaseMemObject");
            }
        }
    }

    return TEST_PASS;
}

/**
 * Negative testing for all testable error codes returned by
 * clGetImageFormatInfoKHR
 */
int clGetImageRequirementsInfoEXT_negative(cl_device_id device,
                                           cl_context context,
                                           cl_command_queue queue)
{
    if (!is_extension_available(device, "cl_ext_image_requirements_info"))
    {
        printf("Extension cl_ext_image_requirements_info not available");
        return TEST_SKIPPED_ITSELF;
    }

    cl_platform_id platform = getPlatformFromDevice(device);
    GET_EXTENSION_FUNC(platform, clGetImageRequirementsInfoEXT);

    cl_image_desc image_desc = { 0 };
    image_desc_init(&image_desc, CL_MEM_OBJECT_IMAGE3D);

    cl_image_format format = { CL_RGBA, CL_UNSIGNED_INT16 };

    /* Check that CL_INVALID_CONTEXT is returned when passing nullptr as context
     */
    size_t row_pitch_alignment = 0;
    cl_int err = clGetImageRequirementsInfoEXT(
        nullptr, nullptr, CL_MEM_READ_WRITE, &format, &image_desc,
        CL_IMAGE_REQUIREMENTS_ROW_PITCH_ALIGNMENT_EXT,
        sizeof(row_pitch_alignment), &row_pitch_alignment, nullptr);
    test_failure_error(err, CL_INVALID_CONTEXT,
                       "Unexpected clGetImageRequirementsInfoEXT return");

    /* Check that CL_INVALID_VALUE is returned when passing an invalid
     * image_type */
    cl_image_desc invalid_desc = { CL_MEM_OBJECT_BUFFER, TEST_IMAGE_SIZE };
    err = clGetImageRequirementsInfoEXT(
        context, nullptr, CL_MEM_READ_WRITE, &format, &invalid_desc,
        CL_IMAGE_REQUIREMENTS_ROW_PITCH_ALIGNMENT_EXT,
        sizeof(row_pitch_alignment), &row_pitch_alignment, nullptr);
    test_failure_error(err, CL_INVALID_IMAGE_DESCRIPTOR,
                       "Unexpected clGetImageRequirementsInfoEXT return");

    /* Check that CL_INVALID_VALUE is returned when passing invalid flags */
    err = clGetImageRequirementsInfoEXT(
        context, nullptr, -1, &format, &image_desc,
        CL_IMAGE_REQUIREMENTS_ROW_PITCH_ALIGNMENT_EXT,
        sizeof(row_pitch_alignment), &row_pitch_alignment, nullptr);
    test_failure_error(err, CL_INVALID_VALUE,
                       "Unexpected clGetImageRequirementsInfoEXT return");

    /* Check that CL_INVALID_IMAGE_FORMAT_DESCRIPTOR is returned when passing a
     * nullptr image_format */
    cl_image_format invalid_format = { CL_INTENSITY, CL_UNORM_SHORT_555 };
    err = clGetImageRequirementsInfoEXT(
        context, nullptr, CL_MEM_READ_WRITE, &invalid_format, &image_desc,
        CL_IMAGE_REQUIREMENTS_ROW_PITCH_ALIGNMENT_EXT,
        sizeof(row_pitch_alignment), &row_pitch_alignment, nullptr);
    test_failure_error(err, CL_INVALID_IMAGE_FORMAT_DESCRIPTOR,
                       "Unexpected clGetImageRequirementsInfoEXT return");

    /* Check that CL_INVALID_IMAGE_DESCRIPTOR is returned when passing an
     * image_desc with invalid values */
    cl_image_desc invalid_desc_size = { CL_MEM_OBJECT_IMAGE1D, 0 };
    err = clGetImageRequirementsInfoEXT(
        context, nullptr, CL_MEM_READ_WRITE, &format, &invalid_desc_size,
        CL_IMAGE_REQUIREMENTS_ROW_PITCH_ALIGNMENT_EXT,
        sizeof(row_pitch_alignment), &row_pitch_alignment, nullptr);
    test_failure_error(err, CL_INVALID_IMAGE_DESCRIPTOR,
                       "Unexpected clGetImageRequirementsInfoEXT return");

    /* Check that CL_INVALID_VALUE is returned when passing an invalid
     * param_name */
    cl_image_requirements_info_ext invalid_info = CL_IMAGE_FORMAT;
    err = clGetImageRequirementsInfoEXT(
        context, nullptr, CL_MEM_READ_WRITE, &format, &image_desc, invalid_info,
        sizeof(row_pitch_alignment), &row_pitch_alignment, nullptr);
    test_failure_error(err, CL_INVALID_VALUE,
                       "Unexpected clGetImageRequirementsInfoEXT return");

    /* Check that CL_INVALID_VALUE is returned when passing a param_value_size
     * value smaller than the size of the return type */
    err = clGetImageRequirementsInfoEXT(
        context, nullptr, CL_MEM_READ_WRITE, &format, &image_desc,
        CL_IMAGE_REQUIREMENTS_ROW_PITCH_ALIGNMENT_EXT,
        sizeof(row_pitch_alignment) - 1, &row_pitch_alignment, nullptr);
    test_failure_error(err, CL_INVALID_VALUE,
                       "Unexpected clGetImageRequirementsInfoEXT return");

    /* Check that CL_INVALID_VALUE is returned when passing a param_value_size
     * value smaller than the size of the return type */
    uint32_t max_height = 0;
    err = clGetImageRequirementsInfoEXT(
        context, nullptr, CL_MEM_READ_WRITE, &format, &image_desc,
        CL_IMAGE_REQUIREMENTS_MAX_HEIGHT_EXT, sizeof(max_height) - 1,
        &max_height, nullptr);
    test_failure_error(err, CL_INVALID_VALUE,
                       "Unexpected clGetImageRequirementsInfoEXT return");

    return TEST_PASS;
}

/**
 * Negative tests for {CL_IMAGE_REQUIREMENTS_MAX_HEIGHT_EXT}
 * Attempt to perform the {CL_IMAGE_REQUIREMENTS_MAX_HEIGHT_EXT} query on all
 * image types for which it is not valid Check that
 * {CL_INVALID_IMAGE_DESCRIPTOR} is returned in all cases.
 *
 * Negative testing for {CL_IMAGE_REQUIREMENTS_MAX_DEPTH_EXT}
 * Attempt to perform the {CL_IMAGE_REQUIREMENTS_MAX_DEPTH_EXT} query on all
 * image types for which it is not valid Check that
 * {CL_INVALID_IMAGE_DESCRIPTOR} is returned in all cases.
 *
 * Negative testing for {CL_IMAGE_REQUIREMENTS_MAX_ARRAY_SIZE_EXT}
 * Attempt to perform the {CL_IMAGE_REQUIREMENTS_MAX_ARRAY_SIZE_EXT} query on
 * all image types for which it is not valid Check that
 * {CL_INVALID_IMAGE_DESCRIPTOR} is returned in all cases.
 */
int cl_image_requirements_max_val_ext_negative(cl_device_id device,
                                               cl_context context,
                                               cl_command_queue queue)
{
    if (!is_extension_available(device, "cl_ext_image_requirements_info"))
    {
        printf("Extension cl_ext_image_requirements_info not available");
        return TEST_SKIPPED_ITSELF;
    }

    cl_platform_id platform = getPlatformFromDevice(device);
    GET_EXTENSION_FUNC(platform, clGetImageRequirementsInfoEXT);

    size_t value = 0;

    std::vector<cl_mem_object_type> imageTypes_height{
        CL_MEM_OBJECT_IMAGE1D_ARRAY, CL_MEM_OBJECT_IMAGE1D_BUFFER,
        CL_MEM_OBJECT_IMAGE1D
    };

    cl_image_format format = { CL_RGBA, CL_UNSIGNED_INT16 };

    for (auto imageType : imageTypes_height)
    {
        cl_image_desc image_desc = { 0 };
        image_desc_init(&image_desc, imageType);

        /* Check image_format null results in CL_INVALID_VALUE */
        cl_int err = clGetImageRequirementsInfoEXT(
            context, nullptr, CL_MEM_READ_WRITE, &format, &image_desc,
            CL_IMAGE_REQUIREMENTS_MAX_HEIGHT_EXT, sizeof(value), &value,
            nullptr);
        test_failure_error(err, CL_INVALID_IMAGE_DESCRIPTOR,
                           "Unexpected clGetImageRequirementsInfoEXT return");
    }

    std::vector<cl_mem_object_type> imageTypes_depth{
        CL_MEM_OBJECT_IMAGE2D, CL_MEM_OBJECT_IMAGE2D_ARRAY,
        CL_MEM_OBJECT_IMAGE1D_ARRAY, CL_MEM_OBJECT_IMAGE1D_BUFFER,
        CL_MEM_OBJECT_IMAGE1D
    };

    for (auto imageType : imageTypes_depth)
    {
        cl_image_desc image_desc = { 0 };
        image_desc_init(&image_desc, imageType);

        /* Check image_format null results in CL_INVALID_VALUE */
        cl_int err = clGetImageRequirementsInfoEXT(
            context, nullptr, CL_MEM_READ_WRITE, &format, &image_desc,
            CL_IMAGE_REQUIREMENTS_MAX_DEPTH_EXT, sizeof(value), &value,
            nullptr);
        test_failure_error(err, CL_INVALID_IMAGE_DESCRIPTOR,
                           "Unexpected clGetImageRequirementsInfoEXT return");
    }

    std::vector<cl_mem_object_type> imageTypes_array_size{
        CL_MEM_OBJECT_IMAGE3D, CL_MEM_OBJECT_IMAGE2D,
        CL_MEM_OBJECT_IMAGE1D_BUFFER, CL_MEM_OBJECT_IMAGE1D
    };

    for (auto imageType : imageTypes_array_size)
    {
        cl_image_desc image_desc = { 0 };
        image_desc_init(&image_desc, imageType);

        /* Check image_format null results in CL_INVALID_VALUE */
        cl_int err = clGetImageRequirementsInfoEXT(
            context, nullptr, CL_MEM_READ_WRITE, &format, &image_desc,
            CL_IMAGE_REQUIREMENTS_MAX_ARRAY_SIZE_EXT, sizeof(value), &value,
            nullptr);
        test_failure_error(err, CL_INVALID_IMAGE_DESCRIPTOR,
                           "Unexpected clGetImageRequirementsInfoEXT return");
    }

    return TEST_PASS;
}

/**
 * Consistency checks for {CL_IMAGE_REQUIREMENTS_MAX_WIDTH_EXT}
 ** Check that the {CL_IMAGE_REQUIREMENTS_MAX_WIDTH_EXT} query can be performed
 *successfully
 *
 * Consistency checks for {CL_IMAGE_REQUIREMENTS_MAX_HEIGHT_EXT}
 ** Check that the {CL_IMAGE_REQUIREMENTS_MAX_HEIGHT_EXT} query can be performed
 *successfully
 *
 * Consistency checks for {CL_IMAGE_REQUIREMENTS_MAX_DEPTH_EXT}
 ** Check that the {CL_IMAGE_REQUIREMENTS_MAX_DEPTH_EXT} query can be performed
 *successfully
 *
 * Consistency checks for {CL_IMAGE_REQUIREMENTS_MAX_ARRAY_SIZE_EXT}
 ** Check that the {CL_IMAGE_REQUIREMENTS_MAX_ARRAY_SIZE_EXT} query can be
 *performed successfully
 */
int cl_image_requirements_max_val_ext_positive(cl_device_id device,
                                               cl_context context,
                                               cl_command_queue queue)
{
    if (!is_extension_available(device, "cl_ext_image_requirements_info"))
    {
        printf("Extension cl_ext_image_requirements_info not available");
        return TEST_SKIPPED_ITSELF;
    }

    cl_platform_id platform = getPlatformFromDevice(device);
    GET_EXTENSION_FUNC(platform, clGetImageRequirementsInfoEXT);

    /* CL_IMAGE_REQUIREMENTS_MAX_WIDTH_EXT */
    cl_image_desc image_desc_1d = { 0 };
    image_desc_init(&image_desc_1d, CL_MEM_OBJECT_IMAGE1D);

    uint32_t max_width = 0;
    cl_int err = clGetImageRequirementsInfoEXT(
        context, nullptr, CL_MEM_READ_WRITE, nullptr, &image_desc_1d,
        CL_IMAGE_REQUIREMENTS_MAX_WIDTH_EXT, sizeof(max_width), &max_width,
        nullptr);
    test_error(err, "Error clGetImageRequirementsInfoEXT");

    size_t width_1d = 0;
    err = clGetDeviceInfo(device, CL_DEVICE_IMAGE_MAX_BUFFER_SIZE,
                          sizeof(width_1d), &width_1d, NULL);
    test_error(err, "Error clGetDeviceInfo");

    if (!(max_width <= width_1d && max_width > 0))
    {
        test_fail("Unexpected CL_IMAGE_REQUIREMENTS_MAX_WIDTH_EXT value");
    }

    /* CL_IMAGE_REQUIREMENTS_MAX_HEIGHT_EXT */
    cl_image_desc image_desc_2d = { 0 };
    image_desc_init(&image_desc_2d, CL_MEM_OBJECT_IMAGE2D);

    uint32_t max_height = 0;
    err = clGetImageRequirementsInfoEXT(
        context, nullptr, CL_MEM_READ_WRITE, nullptr, &image_desc_2d,
        CL_IMAGE_REQUIREMENTS_MAX_HEIGHT_EXT, sizeof(max_height), &max_height,
        nullptr);
    test_error(err, "Error clGetImageRequirementsInfoEXT");

    size_t height_2d = 0;
    err = clGetDeviceInfo(device, CL_DEVICE_IMAGE2D_MAX_HEIGHT,
                          sizeof(height_2d), &height_2d, NULL);
    test_error(err, "Error clGetDeviceInfo");

    if (!(max_height <= height_2d && max_height > 0))
    {
        test_fail("Unexpected CL_IMAGE_REQUIREMENTS_MAX_HEIGHT_EXT value");
    }

    /* CL_IMAGE_REQUIREMENTS_MAX_DEPTH_EXT */
    cl_image_desc image_desc_3d = { 0 };
    image_desc_init(&image_desc_3d, CL_MEM_OBJECT_IMAGE3D);

    uint32_t max_depth = 0;
    err = clGetImageRequirementsInfoEXT(context, nullptr, CL_MEM_READ_WRITE,
                                        nullptr, &image_desc_3d,
                                        CL_IMAGE_REQUIREMENTS_MAX_DEPTH_EXT,
                                        sizeof(max_depth), &max_depth, nullptr);
    test_error(err, "Error clGetImageRequirementsInfoEXT");

    size_t depth_3d = 0;
    err = clGetDeviceInfo(device, CL_DEVICE_IMAGE3D_MAX_DEPTH, sizeof(depth_3d),
                          &depth_3d, NULL);
    test_error(err, "Error clGetDeviceInfo");

    if (!(max_depth <= depth_3d && max_depth > 0))
    {
        test_fail("Unexpected CL_IMAGE_REQUIREMENTS_MAX_DEPTH_EXT value");
    }

    /* CL_IMAGE_REQUIREMENTS_MAX_ARRAY_SIZE_EXT */
    cl_image_desc image_desc_array = { 0 };
    image_desc_init(&image_desc_array, CL_MEM_OBJECT_IMAGE2D_ARRAY);

    uint32_t max_array_size = 0;
    err = clGetImageRequirementsInfoEXT(
        context, nullptr, CL_MEM_READ_WRITE, nullptr, &image_desc_array,
        CL_IMAGE_REQUIREMENTS_MAX_ARRAY_SIZE_EXT, sizeof(max_array_size),
        &max_array_size, nullptr);
    test_error(err, "Error clGetImageRequirementsInfoEXT");

    size_t array_size = 0;
    err = clGetDeviceInfo(device, CL_DEVICE_IMAGE_MAX_ARRAY_SIZE,
                          sizeof(array_size), &array_size, NULL);
    test_error(err, "Error clGetDeviceInfo");

    if (!(max_array_size <= array_size && max_array_size > 0))
    {
        test_fail("Unexpected CL_IMAGE_REQUIREMENTS_MAX_ARRAY_SIZE_EXT value");
    }

    return TEST_PASS;
}