[Piglit] [RFC PATCH] Only specify -cl-std when test hasn't explicitly overridden -cl-std

Aaron Watry awatry at gmail.com
Mon Dec 3 07:41:33 PST 2012


Hi Tom/Blaz/Piglit,

Recently, when I've been working on changes to the piglit CL tests, I've
usually had to run with a modified version of piglit-framework-cl-program.c

In general, I've had to comment out all of the following code in order to
get the Nvidia and Apple implementations to run things for many tests.

Around line 225:
    if(env.clc_version <= 10) {
        char* template = "-D CL_VERSION_1_0=100 ";
        char* old = build_options;
        build_options = malloc((strlen(old) + strlen(template) + 1) *
sizeof(char));
        strcpy(build_options, old);
        sprintf(build_options+strlen(old), template);
        free(old);
    }
    if(env.clc_version <= 11) {
        char* template = "-D __OPENCL_C_VERSION__=1%d0 ";
        char* old = build_options;
        build_options = malloc((strlen(old) + strlen(template) + 1) *
sizeof(char));
        strcpy(build_options, old);
        sprintf(build_options+strlen(old), template, env.clc_version%10);
        free(old);
    }


I'm of the opinion that we should remove these two IF blocks altogether.
When the CL version is 1.0, these macros are not required to be defined (at
least they weren't in CL 1.0). Also, by defining CL_VERSION_1_0 here, we
actually redefine the existing macro on the Apple implementation, which
makes ALL tests fail to build with an error.  Part of me says that we
should only be overriding the version declarations through "-cl-std=" in
the test's build options.

At that point, we can add tests to make sure that the implementation
respects the requested version, and we can stop assuming that redefining
those macros actually does what we want.

Additionally, I've attached a patch to the piglit-framework-cl-program.c
which only inserts " -cl-std=CL%d.%d" when the test's build_options
configuration hasn't explicitly overridden the -cl-std value already.
Without this, it is possible to have a build_options line that looks like
"-cl-std=CL1.1 -cl-std=CL1.2", which is very likely wrong.

Anyway, let me know what you think.  I'd like to come to some sort of
conclusion on whether Apple/Nvidia are wrong, or whether piglit needs some
tweaks.

--Aaron
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20121203/5013923f/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Only-specify-cl-std-when-test-hasn-t-explicitly-over.patch
Type: application/octet-stream
Size: 1840 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20121203/5013923f/attachment.obj>


More information about the Piglit mailing list