A few bugs to report

A few bugs to report

Imagen de blazt

When running (and developing) the OpenCL part of Piglit testing framework (http://piglit.freedesktop.org/) I've stumbled across a few bugs on Intel OpenCL SDK.
In this post I try to provide as much info on how to reproduce each reported bug. Most of the bugs (but not all of them) are wrongly reported error codes and they don't affect the application when the SDK is used properly. If you need more details on each bug you can run Piglit or ask me about each particular bug.

I apologize in advance for any errors in this post, especially in the copied code. If you find any errors in this post or tests please inform me.

Hardware:
    Intel(R) Core(TM) i5 CPU       M 460  @ 2.53GHz
Software:
    Linux 64-bit (Archlinux)
    OpenCL SDK 2012 (http://registrationcenter.intel.com/irc_nas/2563/intel_sdk_for_ocl_appli...)

Bugs:
    1. Crashes (mostly segfaults):

        1.1. clBuildProgram should return CL_INVALID_VALUE if device_list is NULL and num_devices is greater than zero. Example:
            clBuildProgram(program, 1, NULL, "", NULL, NULL)

        1.2. clCreateBuffer should return CL_INVALID_VALUE if values specified in flags are not valid. Example:
            clCreateBuffer(context, CL_MEM_READ_ONLY|CL_MEM_READ_WRITE, 512, NULL, NULL)

        1.3. clCreateContextFromType should return CL_INVALID_PLATFORM if platform value specified in properties is not a valid platform. Example:
            clCreateContextFromType({CL_CONTEXT_PLATFORM, (cl_context_properties)1, 0}, CL_DEVICE_TYPE_ALL, NULL, NULL, NULL)

        1.4. clCreateKernel should return CL_INVALID_KERNEL_NAME if kernel_name is not found in program. Reported error:
                terminate called after throwing an instance of 'Intel::OpenCL::DeviceBackend::Exceptions::DeviceBackendExceptionBase'
                what():  No kernel found for given name
            Example:
                clCreateKernel(program, "nonexistent_name", NULL)

        1.5 clCreateProgramWithSource should return CL_INVALID_VALUE if any entry in strings is NULL. Example:
                clCreateProgramWithSource(context, 1, &null_string, NULL, NULL)

        1.6 clEnqueueReadBuffer should return CL_INVALID_EVENT_WAIT_LIST event objects in event_wait_list are not valid events. Example:
                clEnqueueReadBuffer(cq, buffer, true, 0, size, data_ptr, 1, &invalid_event, NULL)

        1.7. clGetDeviceIDs should return CL_INVALID_PLATFORM if platform is not a valid platform. Example:
            clGetDeviceIDs((cl_platform_id)1, CL_DEVICE_TYPE_ALL, 0, NULL, &num_devices)

        1.8. clGetPLatformInfo should return CL_INVALID_PLATFORM if platform is not a valid platform. Example:
            clGetPlatformInfo((cl_platform_id)1, CL_PLATFORM_PROFILE, 0, NULL, &param_size)

    2. Invalid returned error codes:
        Most of descriptions have this format:
            (expected error code) action to produce an error code

        2.1. clCreateContext:
            - (error code: CL_SUCCESS): Trigger CL_INVALID_PLATFORM if platform value specified in properties is not a valid platform. Example:
                clCreateContext({CL_CONTEXT_PLATFORM, (cl_context_properties)1, 0}, num_devices, devices, NULL, NULL, NULL)

            - (error code: (unrecognized error)): Trigger CL_INVALID_VALUE if devices is NULL. Example:
                clCreateContext({CL_CONTEXT_PLATFORM, (cl_context_properties)platform_id, 0}, num_devices, NULL, NULL, NULL, NULL)

            - (error code: CL_SUCCESS): Trigger CL_INVALID_PROPERTY if context property name in poperties is not a supported property name. Example:
                clCreateContext({CL_DEVICE_NAME, (cl_context_properties)platform_id, 0}, num_devices, devices, NULL, NULL, NULL)

            - (error code: CL_SUCCESS): Trigger CL_INVALID_PROPERTY if the same property is specified more than once. Example:
                clCreateContext({CL_CONTEXT_PLATFORM, (cl_context_properties)platform_id, CL_CONTEXT_PLATFORM, (cl_context_properties)platform_id, 0}, num_devices, devices, NULL, NULL, NULL)

        2.2 clCreateProgramWithSource:
            - (error code: CL_SUCCESS): Trigger CL_INVALID_VALUE when count is zero. Example:
                clCreateProgramWithSource(context, 0, strings, NULL, NULL)

            - (error code: CL_SUCCESS): Trigger CL_INVALID_VALUE when strings is NULL. Example:
                clCreateProgramWithSource(context, 0, NULL, NULL, NULL)

        2.3. clGetKernelWorkGroupInfo:
            - (error code: CL_INVALID_KERNEL): Trigger CL_INVALID_DEVICE if device is NULL but there is more than one device associated with kernel. Example:
                clGetKernelWorkGroupInfo(kernel, NULL, CL_KERNEL_WORK_GROUP_SIZE, 0, NULL, &param_size)

        2.4 clGetMemObjectInfo:
            - (error code: CL_INVALID_VALUE): Get size of CL_MEM_TYPE.
            - (error code: CL_INVALID_VALUE): Get size of CL_MEM_FLAGS.
            - (error code: CL_INVALID_VALUE): Get size of CL_MEM_SIZE.
            - (error code: CL_INVALID_VALUE): Get size of CL_MEM_HOST_PTR.
            - (error code: CL_INVALID_VALUE): Get size of CL_MEM_MAP_COUNT.
            - (error code: CL_INVALID_VALUE): Get size of CL_MEM_REFERENCE_COUNT.
            - (error code: CL_INVALID_VALUE): Get size of CL_MEM_CONTEXT.
            - (error code: CL_INVALID_VALUE): Get size of CL_MEM_ASSOCIATED_MEMOBJECT.
            - (error code: CL_INVALID_VALUE): Get size of CL_MEM_OFFSET. Example:
                clGetMemObjectInfo(mem_obj, CL_MEM_OFFSET, 0, NULL, &param_size)

    3. Other:

        3.1. clCreateBuffer does not initialize buffer data properly when using CL_MEM_WRITE_ONLY|CL_MEM_USE_HOST_PTR. When reading with clEnqueueReadBuffer from the created buffer we get different data than the data passed to clCreateBuffer. Example:
            buffer = clCreateBuffer(context, CL_MEM_WRITE_ONLY|CL_MEM_USE_HOST_PTR, 512, data_ptr, NULL)
            clEnqueueReadBuffer(com_queue, buffer, true, 0, 512, read_data_ptr, 0, NULL, NULL)

        3.2. clGetDeviceInfo doesn't return CL_SUCCESS (and appropriate data) when requesting CL_DEVICE_PLATFORM, but instead it returns CL_INVALID_VALUE. Example:
            clGetDeviceInfo(device, CL_INVALID_DEVICE, 0, NULL, &param_size)

        3.3 clSetKernelArg doesn't return CL_INVALID_ARG_SIZE if arg_size is zero and the argument is declared with the __local qualifier, instead it return CL_SUCCESS. Example:
            kernel_source = "kernel void ker(__local int* int_ptr){}"
            clSetKernelArg(kernel, 0, 0, NULL)

    4. Programs that fail to build:
        http://cgit.freedesktop.org/piglit/plain/tests/cl/program/execute/scalar...
        http://cgit.freedesktop.org/piglit/plain/tests/cl/program/execute/scalar...
        http://cgit.freedesktop.org/piglit/plain/tests/cl/program/execute/scalar...

publicaciones de 4 / 0 nuevos
Último envío
Para obtener más información sobre las optimizaciones del compilador, consulte el aviso sobre la optimización.
Imagen de blazt

This post did not appear in the forum topics, trying if a comment will fix that...

Imagen de Raghu Muthyalampalli (Intel)

If its not too much, can you add simple reproducers to this thread. I am in the process of reproducing them but I have to build a system from scratch and it might take some time.

Thanks,
Raghu

Imagen de blazt

The simplest way to reproduce the bugs would be tu run the Piglit test suite. I am running the suite on Linux, but haven't tried it on Windows (if you'll run it on Windows and you run into any build or test errors please inform me). The steps to build the project on WIndows are written in README file in the sources if you need them. Here are the steps on how to build and run it on Linux:

Getting sources and building:
git clone git://anongit.freedesktop.org/git/piglit
cd piglit
ccmake .
(A menu should apper. Press 'c' to generate config, then set BUILD_CL_TESTS to ON. Then press 'c' two more times and finally press 'q'. The menu should now close and return you to the console)
make
(this should now build the suite including the OpenGL tests, which are built by default)

Running all the OpenCL tests:
python2 piglit-run.py tests/all_cl.tests results/cl (Or just python if this runs Python 2)
(Now you should see some output of the OpenCL tests that are being run. Wait for the tests to finish. There were some tests that freezed but I don't remember on which platform, so if any test is taking to much time, just kill it with Ctrl-c)
python2 piglit-summary-html.py summary/cl results/cl
(Now the parsed results should be in the summary/cl/ directory. You can open the summary/cl/index.html with a browser and see which tests failed and why.)

Tests are built in the bin/ directory, you can run each test separately since each test is its own executable. OpenCL tests have the "cl-" prefix, so for example an API test for clBuildProgram is bin/cl-api-build-program (which tries to test all the functionality written in the spec). Source code for each test is located at tests/cl/ in appropriate subdirectory.
Program/kernel tests are run by bin/cl-program-tester and are located at tests/cl/program/.

The OpenCL framework which creates contexes and similar things is located in tests/util/piglit-framework-cl*. More info about the whole framework is located in README and tests/cl/README. Tomorrow if I'll have time I'll check exactly which tests fail and report the binaries and sources.

P.S: On the webpage I cannot see your (and my) response to the original post.

Inicie sesión para dejar un comentario.