[Piglit] [PATCH 3/3] cl: Add quick_cl.py test profile

Dylan Baker baker.dylan.c at gmail.com
Wed Jan 22 13:28:29 PST 2014


On Wednesday, January 22, 2014 10:19:29 AM Tom Stellard wrote:
> From: Tom Stellard <thomas.stellard at amd.com>
> 
> all_cl.py will now run each OpenCV sub-test individually, and quick_cl.py
> will run only the OpenCV parent tests.  Both profiles run the exact same
> tests, but all_cl.py gives finer-grained results and also takes longer
> due to the overhead of running each sub-test individually.
> 
> For example:
> 
> ./piglit-run.py tests/all_cl.py -t Lut results/lut
> [Wed Jan 15 12:08:05 2014] ::  running :: opencv/Arithm/Lut/Mat/2
> [Wed Jan 15 12:08:06 2014] ::     pass :: opencv/Arithm/Lut/Mat/2
> [Wed Jan 15 12:08:06 2014] ::  running :: opencv/Arithm/Lut/Mat/0
> [Wed Jan 15 12:08:06 2014] ::     pass :: opencv/Arithm/Lut/Mat/0
> [Wed Jan 15 12:08:06 2014] ::  running :: opencv/Arithm/Lut/Mat/1
> [Wed Jan 15 12:08:08 2014] ::     pass :: opencv/Arithm/Lut/Mat/1
> 
> ./piglit-run.py tests/quick_cl.py -t Lut results/lut-quick
> [Wed Jan 15 12:08:14 2014] ::  running :: opencv/Arithm/Lut
> [Wed Jan 15 12:08:16 2014] ::     pass :: opencv/Arithm/Lut
> ---
>  tests/all_cl.py   | 152
> ++++++++++-------------------------------------------- tests/cl.py       |
> 126 ++++++++++++++++++++++++++++++++++++++++++++ tests/quick_cl.py |  30
> +++++++++++
>  3 files changed, 183 insertions(+), 125 deletions(-)
>  create mode 100644 tests/cl.py
>  create mode 100644 tests/quick_cl.py
> 
> diff --git a/tests/all_cl.py b/tests/all_cl.py
> index d45036a..b62b6c1 100644
> --- a/tests/all_cl.py
> +++ b/tests/all_cl.py
> @@ -1,128 +1,30 @@
>  #!/usr/bin/env python
> -# -*- coding: utf-8 -*-
> -# All OpenCL tests that come with piglit, using default settings
> -
> -__all__ = ['profile']
> -
> -import os
> -import os.path as path
> -
> +#
> +# Copyright 2014 Advanced Micro Devices, Inc.
> +#
> +# Permission is hereby granted, free of charge, to any person obtaining a
> +# copy of this software and associated documentation files (the
> "Software"), +# to deal in the Software without restriction, including
> without limitation +# the rights to use, copy, modify, merge, publish,
> distribute, sublicense, +# and/or sell copies of the Software, and to
> permit persons to whom the +# Software is furnished to do so, subject to
> the following conditions: +#
> +# The above copyright notice and this permission notice (including the next
> +# paragraph) shall be included in all copies or substantial portions of
> the +# Software.
> +#
> +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
> OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
> MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 
> IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
> CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
> TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE
> SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE.
> +#
> +# Authors: Tom Stellard <thomas.stellard at amd.com>
> +#
> +
> +from tests.cl import profile
>  from framework.opencv import add_opencv_tests
> 
> -from framework.core import Group, TestProfile
> -from framework.exectest import PlainExecTest
> -
> -######
> -# Helper functions
> -
> -def add_plain_test(group, name, args):
> -	group[name] = PlainExecTest(args)
> -
> -def add_concurrent_test(group, name, args):
> -	test = PlainExecTest(args)
> -	test.runConcurrent = true;
> -	group[name] = PlainExecTest(args)
> -
> -def add_plain_program_tester_test(group, name, path):
> -	add_plain_test(group, name, ['cl-program-tester', path])
> -
> -######
> -# Collecting all tests
> -profile = TestProfile()
> -
> -custom = Group()
> -api = Group()
> -program = Group()
> -profile.tests['Custom'] = custom
> -profile.tests['API'] = api
> -profile.tests['Program'] = program
> -
> -######
> -# Tests
> -
> -# Custom
> -add_plain_test(custom, 'Run simple kernel',
> ['cl-custom-run-simple-kernel']) -add_plain_test(custom, 'Flush after
> enqueue kernel', ['cl-custom-flush-after-enqueue-kernel'])
> -add_plain_test(custom, 'r600 create release buffer bug',
> ['cl-custom-r600-create-release-buffer-bug']) -add_plain_test(custom,
> 'Buffer flags', ['cl-custom-buffer-flags']) -
> -# API
> -#  Platform
> -add_plain_test(api, 'clGetPlatformIDs', ['cl-api-get-platform-ids'])
> -add_plain_test(api, 'clGetPlatformInfo', ['cl-api-get-platform-info'])
> -#  Device
> -add_plain_test(api, 'clGetDeviceIDs', ['cl-api-get-device-ids'])
> -add_plain_test(api, 'clGetDeviceInfo', ['cl-api-get-device-info'])
> -#  Context
> -add_plain_test(api, 'clCreateContext', ['cl-api-create-context'])
> -add_plain_test(api, 'clCreateContextFromType',
> ['cl-api-create-context-from-type']) -add_plain_test(api,
> 'clGetContextInfo', ['cl-api-get-context-info']) -add_plain_test(api,
> 'clRetainContext and clReleaseContext', ['cl-api-retain_release-context'])
> -#  Command Queues
> -add_plain_test(api, 'clCreateCommandQueue',
> ['cl-api-create-command-queue']) -add_plain_test(api, 'clRetainComandQueue
> and clReleaseCommandQueue', ['cl-api-retain_release-command-queue'])
> -add_plain_test(api, 'clGetCommandQueueInfo',
> ['cl-api-get-command-queue-info']) -#  Memory objects
> -add_plain_test(api, 'clCreateBuffer', ['cl-api-create-buffer'])
> -add_plain_test(api, 'clEnqueueCopyBuffer', ['cl-api-enqueue-copy-buffer'])
> -add_plain_test(api, 'clEnqueueReadBuffer and clEnqueueWriteBuffer',
> ['cl-api-enqueue-read_write-buffer']) -add_plain_test(api,
> 'clGetMemObjectInfo', ['cl-api-get-mem-object-info']) -add_plain_test(api,
> 'clGetImageInfo', ['cl-api-get-image-info'])
> -add_plain_test(api, 'clRetainMemObject and clReleaseMemObject',
> ['cl-api-retain_release-mem-object']) -#  Program
> -add_plain_test(api, 'clCreateProgramWithSource',
> ['cl-api-create-program-with-source']) -add_plain_test(api,
> 'clBuildProgram', ['cl-api-build-program'])
> -add_plain_test(api, 'clCreateKernelsInProgram',
> ['cl-api-create-kernels-in-program']) -add_plain_test(api,
> 'clGetProgramInfo', ['cl-api-get-program-info']) -add_plain_test(api,
> 'clGetProgramBuildInfo', ['cl-api-get-program-build-info'])
> -add_plain_test(api, 'clRetainProgram and clReleaseProgram',
> ['cl-api-retain_release-program']) -add_plain_test(api, 'clUnloadCompiler',
> ['cl-api-unload-compiler']) -#  Kernel
> -add_plain_test(api, 'clCreateKernel', ['cl-api-create-kernel'])
> -add_plain_test(api, 'clCreateKernelsInProgram',
> ['cl-api-create-kernels-in-program']) -add_plain_test(api,
> 'clGetKernelInfo', ['cl-api-get-kernel-info']) -add_plain_test(api,
> 'clGetKernelWorkGroupInfo', ['cl-api-get-kernel-work-group-info'])
> -add_plain_test(api, 'clRetainKernel and clReleaseKernel',
> ['cl-api-retain_release-kernel']) -add_plain_test(api, 'clSetKernelArg',
> ['cl-api-set-kernel-arg'])
> -#  Event
> -add_plain_test(api, 'clGetEventInfo', ['cl-api-get-event-info'])
> -add_plain_test(api, 'clRetainEvent and clReleaseEvent',
> ['cl-api-retain_release-event']) -
> -# Program
> -add_plain_test(program, 'Run kernel with max work item sizes',
> ['cl-program-max-work-item-sizes']) -add_plain_test(program, 'Bitcoin:
> phatk kernel', ['cl-program-bitcoin-phatk']) -
> -# Program tester
> -
> -def add_program_test_dir(group, dirpath):
> -	for filename in os.listdir(dirpath):
> -		filepath = path.join(dirpath, filename)
> -		ext = filename.rsplit('.')[-1]
> -		if ext != 'cl' and ext != 'program_test':
> -			continue
> -		testname = filename[0:-(len(ext) + 1)]
> -		add_plain_program_tester_test(group, testname, filepath)
> -
> -program_build = Group()
> -program_build_fail = Group()
> -program_execute = Group()
> -program["Build"] = program_build
> -program["Build"]["Fail"] = program_build_fail
> -program["Execute"] = program_execute
> -
> -add_program_test_dir(program_build, 'tests/cl/program/build')
> -add_program_test_dir(program_build_fail, 'tests/cl/program/build/fail')
> -add_program_test_dir(program_execute, 'tests/cl/program/execute')
> -add_program_test_dir(program_execute,
> 'tests/cl/program/execute/builtin/atomic') -
> -#Run generated built-in tests
> -program_execute_builtin = Group()
> -program["Execute"]["Builtin"] = program_execute_builtin
> -add_program_test_dir(program_execute_builtin,
> 'generated_tests/cl/builtin/int')
> -add_program_test_dir(program_execute_builtin,
> 'generated_tests/cl/builtin/math')
> -add_program_test_dir(program_execute_builtin,
> 'generated_tests/cl/builtin/relational') -program_execute_store = Group()
> -program["Execute"]["Store"] = program_execute_store
> -add_program_test_dir(program_execute_store, 'generated_tests/cl/store')
> -
> -add_opencv_tests(profile)
> +add_opencv_tests(profile, True)
> diff --git a/tests/cl.py b/tests/cl.py
> new file mode 100644
> index 0000000..057dbfb
> --- /dev/null
> +++ b/tests/cl.py
> @@ -0,0 +1,126 @@
> +#!/usr/bin/env python
> +# -*- coding: utf-8 -*-
> +# All OpenCL tests that come with piglit, using default settings
> +
> +__all__ = ['profile']
> +
> +import os
> +import os.path as path
> +
> +from framework.opencv import add_opencv_tests
> +
> +from framework.core import Group, TestProfile
> +from framework.exectest import PlainExecTest
> +
> +######
> +# Helper functions
> +
> +def add_plain_test(group, name, args):
> +	group[name] = PlainExecTest(args)
> +
> +def add_concurrent_test(group, name, args):
> +	test = PlainExecTest(args)
> +	test.runConcurrent = true;
> +	group[name] = PlainExecTest(args)
> +
> +def add_plain_program_tester_test(group, name, path):
> +	add_plain_test(group, name, ['cl-program-tester', path])
> +
> +######
> +# Collecting all tests
> +profile = TestProfile()
> +
> +custom = Group()
> +api = Group()
> +program = Group()
> +profile.tests['Custom'] = custom
> +profile.tests['API'] = api
> +profile.tests['Program'] = program
> +
> +######
> +# Tests
> +
> +# Custom
> +add_plain_test(custom, 'Run simple kernel',
> ['cl-custom-run-simple-kernel']) +add_plain_test(custom, 'Flush after
> enqueue kernel', ['cl-custom-flush-after-enqueue-kernel'])
> +add_plain_test(custom, 'r600 create release buffer bug',
> ['cl-custom-r600-create-release-buffer-bug']) +add_plain_test(custom,
> 'Buffer flags', ['cl-custom-buffer-flags']) +
> +# API
> +#  Platform
> +add_plain_test(api, 'clGetPlatformIDs', ['cl-api-get-platform-ids'])
> +add_plain_test(api, 'clGetPlatformInfo', ['cl-api-get-platform-info'])
> +#  Device
> +add_plain_test(api, 'clGetDeviceIDs', ['cl-api-get-device-ids'])
> +add_plain_test(api, 'clGetDeviceInfo', ['cl-api-get-device-info'])
> +#  Context
> +add_plain_test(api, 'clCreateContext', ['cl-api-create-context'])
> +add_plain_test(api, 'clCreateContextFromType',
> ['cl-api-create-context-from-type']) +add_plain_test(api,
> 'clGetContextInfo', ['cl-api-get-context-info']) +add_plain_test(api,
> 'clRetainContext and clReleaseContext', ['cl-api-retain_release-context'])
> +#  Command Queues
> +add_plain_test(api, 'clCreateCommandQueue',
> ['cl-api-create-command-queue']) +add_plain_test(api, 'clRetainComandQueue
> and clReleaseCommandQueue', ['cl-api-retain_release-command-queue'])
> +add_plain_test(api, 'clGetCommandQueueInfo',
> ['cl-api-get-command-queue-info']) +#  Memory objects
> +add_plain_test(api, 'clCreateBuffer', ['cl-api-create-buffer'])
> +add_plain_test(api, 'clEnqueueCopyBuffer', ['cl-api-enqueue-copy-buffer'])
> +add_plain_test(api, 'clEnqueueReadBuffer and clEnqueueWriteBuffer',
> ['cl-api-enqueue-read_write-buffer']) +add_plain_test(api,
> 'clGetMemObjectInfo', ['cl-api-get-mem-object-info']) +add_plain_test(api,
> 'clGetImageInfo', ['cl-api-get-image-info'])
> +add_plain_test(api, 'clRetainMemObject and clReleaseMemObject',
> ['cl-api-retain_release-mem-object']) +#  Program
> +add_plain_test(api, 'clCreateProgramWithSource',
> ['cl-api-create-program-with-source']) +add_plain_test(api,
> 'clBuildProgram', ['cl-api-build-program'])
> +add_plain_test(api, 'clCreateKernelsInProgram',
> ['cl-api-create-kernels-in-program']) +add_plain_test(api,
> 'clGetProgramInfo', ['cl-api-get-program-info']) +add_plain_test(api,
> 'clGetProgramBuildInfo', ['cl-api-get-program-build-info'])
> +add_plain_test(api, 'clRetainProgram and clReleaseProgram',
> ['cl-api-retain_release-program']) +add_plain_test(api, 'clUnloadCompiler',
> ['cl-api-unload-compiler']) +#  Kernel
> +add_plain_test(api, 'clCreateKernel', ['cl-api-create-kernel'])
> +add_plain_test(api, 'clCreateKernelsInProgram',
> ['cl-api-create-kernels-in-program']) +add_plain_test(api,
> 'clGetKernelInfo', ['cl-api-get-kernel-info']) +add_plain_test(api,
> 'clGetKernelWorkGroupInfo', ['cl-api-get-kernel-work-group-info'])
> +add_plain_test(api, 'clRetainKernel and clReleaseKernel',
> ['cl-api-retain_release-kernel']) +add_plain_test(api, 'clSetKernelArg',
> ['cl-api-set-kernel-arg'])
> +#  Event
> +add_plain_test(api, 'clGetEventInfo', ['cl-api-get-event-info'])
> +add_plain_test(api, 'clRetainEvent and clReleaseEvent',
> ['cl-api-retain_release-event']) +
> +# Program
> +add_plain_test(program, 'Run kernel with max work item sizes',
> ['cl-program-max-work-item-sizes']) +add_plain_test(program, 'Bitcoin:
> phatk kernel', ['cl-program-bitcoin-phatk']) +
> +# Program tester
> +
> +def add_program_test_dir(group, dirpath):
> +	for filename in os.listdir(dirpath):
> +		filepath = path.join(dirpath, filename)
> +		ext = filename.rsplit('.')[-1]
> +		if ext != 'cl' and ext != 'program_test':
> +			continue
> +		testname = filename[0:-(len(ext) + 1)]
> +		add_plain_program_tester_test(group, testname, filepath)
> +
> +program_build = Group()
> +program_build_fail = Group()
> +program_execute = Group()
> +program["Build"] = program_build
> +program["Build"]["Fail"] = program_build_fail
> +program["Execute"] = program_execute
> +
> +add_program_test_dir(program_build, 'tests/cl/program/build')
> +add_program_test_dir(program_build_fail, 'tests/cl/program/build/fail')
> +add_program_test_dir(program_execute, 'tests/cl/program/execute')
> +add_program_test_dir(program_execute,
> 'tests/cl/program/execute/builtin/atomic') +
> +#Run generated built-in tests
> +program_execute_builtin = Group()
> +program["Execute"]["Builtin"] = program_execute_builtin
> +add_program_test_dir(program_execute_builtin,
> 'generated_tests/cl/builtin/int')
> +add_program_test_dir(program_execute_builtin,
> 'generated_tests/cl/builtin/math')
> +add_program_test_dir(program_execute_builtin,
> 'generated_tests/cl/builtin/relational') +program_execute_store = Group()
> +program["Execute"]["Store"] = program_execute_store
> +add_program_test_dir(program_execute_store, 'generated_tests/cl/store')
> diff --git a/tests/quick_cl.py b/tests/quick_cl.py
> new file mode 100644
> index 0000000..17729b2
> --- /dev/null
> +++ b/tests/quick_cl.py
> @@ -0,0 +1,30 @@
> +#!/usr/bin/env python
> +#
> +# Copyright 2014 Advanced Micro Devices, Inc.
> +#
> +# Permission is hereby granted, free of charge, to any person obtaining a
> +# copy of this software and associated documentation files (the
> "Software"), +# to deal in the Software without restriction, including
> without limitation +# the rights to use, copy, modify, merge, publish,
> distribute, sublicense, +# and/or sell copies of the Software, and to
> permit persons to whom the +# Software is furnished to do so, subject to
> the following conditions: +#
> +# The above copyright notice and this permission notice (including the next
> +# paragraph) shall be included in all copies or substantial portions of
> the +# Software.
> +#
> +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
> OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
> MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 
> IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
> CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
> TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE
> SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE.
> +#
> +# Authors: Tom Stellard <thomas.stellard at amd.com>
> +#
> +
> +from tests.cl import profile
> +from framework.opencv import add_opencv_tests
> +
> +add_opencv_tests(profile)

for all patches:
At this point it looks pretty good to me. I don't have access to my radeon 
system right now and wont for a while, so it's unlikely that I'll be able to 
test this. However, it doesn't crash so, seems good.

Reviewed-by: Dylan Baker <baker.dylan.c at gmail.com>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20140122/7087bdfb/attachment.pgp>


More information about the Piglit mailing list