MCPcopy Create free account
hub / github.com/KhronosGroup/OpenCL-CTS / run_image_tests

Function run_image_tests

test_conformance/api/test_kernel_arg_info.cpp:802–868  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

800}
801
802static int run_image_tests(cl_context context, cl_device_id device)
803{
804 int failed_tests = 0;
805 bool supports_3d_image_writes =
806 is_extension_available(device, "cl_khr_3d_image_writes");
807 bool is_pointer = false;
808 cl_kernel_arg_type_qualifier type_qualifier = CL_KERNEL_ARG_TYPE_NONE;
809 cl_kernel_arg_address_qualifier address_qualifier =
810 CL_KERNEL_ARG_ADDRESS_GLOBAL;
811
812 Version version = get_device_cl_version(device);
813 bool supports_read_write_images = false;
814 if (version >= Version(3, 0))
815 {
816 cl_uint maxReadWriteImageArgs = 0;
817 cl_int error = clGetDeviceInfo(
818 device, CL_DEVICE_MAX_READ_WRITE_IMAGE_ARGS,
819 sizeof(maxReadWriteImageArgs), &maxReadWriteImageArgs, NULL);
820 test_error(error,
821 "Unable to query "
822 "CL_DEVICE_MAX_READ_WRITE_IMAGE_ARGS");
823
824 // read-write images are supported if MAX_READ_WRITE_IMAGE_ARGS is
825 // nonzero
826 supports_read_write_images = maxReadWriteImageArgs != 0;
827 }
828 else if (version >= Version(2, 0))
829 {
830 // read-write images are required for OpenCL 2.x
831 supports_read_write_images = true;
832 }
833
834 for (auto access_qualifier : access_qualifiers)
835 {
836 if (access_qualifier == CL_KERNEL_ARG_ACCESS_READ_WRITE
837 && !supports_read_write_images)
838 continue;
839
840 bool is_write =
841 (access_qualifier == CL_KERNEL_ARG_ACCESS_WRITE_ONLY
842 || access_qualifier == CL_KERNEL_ARG_ACCESS_READ_WRITE);
843 for (auto image_type : image_arguments)
844 {
845 bool is_3d_image = image_type == "image3d_t";
846 /* We can only test 3d image writes if our device supports it */
847 if (is_3d_image && is_write)
848 {
849 if (!supports_3d_image_writes)
850 {
851 continue;
852 }
853 }
854 KernelArgInfo kernel_argument(address_qualifier, access_qualifier,
855 type_qualifier, image_type,
856 SINGLE_KERNEL_ARG_NUMBER);
857 KernelArgInfo expected =
858 create_expected_arg_info(kernel_argument, is_pointer);
859 const std::string kernel_src =

Callers 1

run_all_testsFunction · 0.85

Calls 7

is_extension_availableFunction · 0.85
get_device_cl_versionFunction · 0.85
VersionClass · 0.85
create_expected_arg_infoFunction · 0.85
generate_kernelFunction · 0.85
run_sampler_testFunction · 0.85

Tested by

no test coverage detected