From f337e0b6f9878c2e8f3c3fdad3ba712f2f88be14 Mon Sep 17 00:00:00 2001 From: Nikhil Joshi Date: Fri, 29 Jan 2021 19:43:54 +0530 Subject: [PATCH] Fix command-line function range for bruteforce (#1127) * Fix enqueue_flags test to use correct barrier type. Currently, enqueue_flags test uses CLK_LOCAL_MEM_FENCE. Use CLK_GLOBAL_MEM_FENCE instead as all threads across work-groups need to wait here. * Add check for support for Read-Wrie images Read-Write images have required OpenCL 2.x. Read-Write image tests are already being skipped for 1.x devices. With OpenCL 3.0, read-write images being optional, the tests should be run or skipped depending on the implementation support. Add a check to decide if Read-Write images are supported or required to be supported depending on OpenCL version and decide if the tests should be run on skipped. Fixes issue #894 * Fix formatting in case of Read-Write image checks. Fix formatting in case of Read-write image checks. Also, combine two ifs into one in case of kerne_read_write tests * Fix some more formatting for RW-image checks Remove unnecessary spaces at various places. Also, fix lengthy lines. * Fix malloc-size calculation in test imagedim unsigned char size is silently assumed to be 1 in imagedim test of test_basic. Pass sizeof(type) in malloc size calculation. Also, change loop variable from signed to unsigned. Add checks for null pointer for malloced memory. * Fix command-line function range for bruteforce Runnning "test_bruteforce N M" is expected to skip first N functions and test M functions after it. When N is 0, the test currently skips M functions and run all functions thereafter. Fix the test to honor semantics of these command-line options to correctly test first M functions when N is 0. --- test_conformance/math_brute_force/main.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test_conformance/math_brute_force/main.cpp b/test_conformance/math_brute_force/main.cpp index ca58f2e5..254b22aa 100644 --- a/test_conformance/math_brute_force/main.cpp +++ b/test_conformance/math_brute_force/main.cpp @@ -56,8 +56,8 @@ char appName[MAXPATHLEN] = ""; cl_device_id gDevice = NULL; cl_context gContext = NULL; cl_command_queue gQueue = NULL; -static int32_t gStartTestNumber; -static int32_t gEndTestNumber; +static int32_t gStartTestNumber = -1; +static int32_t gEndTestNumber = -1; int gSkipCorrectnessTesting = 0; int gStopOnError = 0; static bool gSkipRestOfTests; @@ -1005,7 +1005,7 @@ static int ParseArgs(int argc, const char **argv) long number = strtol(arg, &t, 0); if (t != arg) { - if (0 == gStartTestNumber) + if (-1 == gStartTestNumber) gStartTestNumber = (int32_t)number; else gEndTestNumber = gStartTestNumber + (int32_t)number;