2
// Copyright 2013 Francisco Jerez
4
// Permission is hereby granted, free of charge, to any person obtaining a
5
// copy of this software and associated documentation files (the "Software"),
6
// to deal in the Software without restriction, including without limitation
7
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
8
// and/or sell copies of the Software, and to permit persons to whom the
9
// Software is furnished to do so, subject to the following conditions:
11
// The above copyright notice and this permission notice shall be included in
12
// all copies or substantial portions of the Software.
14
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
18
// OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20
// OTHER DEALINGS IN THE SOFTWARE.
23
#ifndef CLOVER_CORE_ERROR_HPP
24
#define CLOVER_CORE_ERROR_HPP
27
#if defined(__ALTIVEC__) && !defined(__APPLE_ALTIVEC__)
56
/// Class that represents an error that can be converted to an
57
/// OpenCL status code.
59
class error : public std::runtime_error {
61
error(cl_int code, std::string what = "") :
62
std::runtime_error(what), code(code) {
73
class invalid_build_options_error : public error {
75
invalid_build_options_error(const std::string &what = "") :
76
error(CL_INVALID_BUILD_OPTIONS, what) {}
79
class build_error : public error {
81
build_error(const std::string &what = "") :
82
error(CL_BUILD_PROGRAM_FAILURE, what) {}
86
class invalid_object_error;
89
class invalid_object_error<command_queue> : public error {
91
invalid_object_error(std::string what = "") :
92
error(CL_INVALID_COMMAND_QUEUE, what) {}
96
class invalid_object_error<context> : public error {
98
invalid_object_error(std::string what = "") :
99
error(CL_INVALID_CONTEXT, what) {}
103
class invalid_object_error<device> : public error {
105
invalid_object_error(std::string what = "") :
106
error(CL_INVALID_DEVICE, what) {}
110
class invalid_object_error<event> : public error {
112
invalid_object_error(std::string what = "") :
113
error(CL_INVALID_EVENT, what) {}
117
class invalid_object_error<soft_event> : public error {
119
invalid_object_error(std::string what = "") :
120
error(CL_INVALID_EVENT, what) {}
124
class invalid_object_error<kernel> : public error {
126
invalid_object_error(std::string what = "") :
127
error(CL_INVALID_KERNEL, what) {}
131
class invalid_object_error<memory_obj> : public error {
133
invalid_object_error(std::string what = "") :
134
error(CL_INVALID_MEM_OBJECT, what) {}
138
class invalid_object_error<buffer> : public error {
140
invalid_object_error(std::string what = "") :
141
error(CL_INVALID_MEM_OBJECT, what) {}
145
class invalid_object_error<root_buffer> : public error {
147
invalid_object_error(std::string what = "") :
148
error(CL_INVALID_MEM_OBJECT, what) {}
152
class invalid_object_error<sub_buffer> : public error {
154
invalid_object_error(std::string what = "") :
155
error(CL_INVALID_MEM_OBJECT, what) {}
159
class invalid_object_error<image> : public error {
161
invalid_object_error(std::string what = "") :
162
error(CL_INVALID_MEM_OBJECT, what) {}
166
class invalid_object_error<image2d> : public error {
168
invalid_object_error(std::string what = "") :
169
error(CL_INVALID_MEM_OBJECT, what) {}
173
class invalid_object_error<image3d> : public error {
175
invalid_object_error(std::string what = "") :
176
error(CL_INVALID_MEM_OBJECT, what) {}
180
class invalid_object_error<platform> : public error {
182
invalid_object_error(std::string what = "") :
183
error(CL_INVALID_PLATFORM, what) {}
187
class invalid_object_error<program> : public error {
189
invalid_object_error(std::string what = "") :
190
error(CL_INVALID_PROGRAM, what) {}
194
class invalid_object_error<sampler> : public error {
196
invalid_object_error(std::string what = "") :
197
error(CL_INVALID_SAMPLER, what) {}
200
class invalid_wait_list_error : public error {
202
invalid_wait_list_error(std::string what = "") :
203
error(CL_INVALID_EVENT_WAIT_LIST, what) {}