// Collect matching devices
for (device &dev : platform) {
if (((device_type & CL_DEVICE_TYPE_DEFAULT) &&
- &dev == &platform.front()) ||
+ dev == platform.front()) ||
(device_type & dev.type()))
d_devs.push_back(desc(dev));
}
auto evs = objs(d_evs, num_evs);
for (auto &ev : evs) {
- if (&ev.ctx != &evs.front().ctx)
+ if (ev.ctx != evs.front().ctx)
throw error(CL_INVALID_CONTEXT);
if (ev.status() < 0)
auto evs = objs(d_evs, num_evs);
for (auto &ev : evs) {
- if (&ev.ctx != &q.ctx)
+ if (ev.ctx != q.ctx)
throw error(CL_INVALID_CONTEXT);
}
void
validate_common(command_queue &q, kernel &kern,
const ref_vector<event> &deps) {
- if (&kern.prog.ctx != &q.ctx ||
+ if (kern.prog.ctx != q.ctx ||
any_of([&](const event &ev) {
- return &ev.ctx != &q.ctx;
+ return ev.ctx != q.ctx;
}, deps))
throw error(CL_INVALID_CONTEXT);
return std::count(devs.begin(), devs.end(), &dev);
}
+bool
+context::operator==(const context &ctx) const {
+ return this == &ctx;
+}
+
+bool
+context::operator!=(const context &ctx) const {
+ return this != &ctx;
+}
+
const context::property_list &
context::props() const {
return _props;
bool has_device(device &dev) const;
+ bool
+ operator==(const context &ctx) const;
+ bool
+ operator!=(const context &ctx) const;
+
const property_list &
props() const;
return *this;
}
+bool
+device::operator==(const device &dev) const {
+ return this == &dev;
+}
+
cl_device_type
device::type() const {
switch (ldev->type) {
device &operator=(device dev);
+ bool
+ operator==(const device &dev) const;
+
cl_device_type type() const;
cl_uint vendor_id() const;
size_t max_images_read() const;
a.image_channel_data_type < b.image_channel_data_type);
}
+static inline bool
+operator==(const cl_image_format &a, const cl_image_format &b) {
+ return (a.image_channel_order == b.image_channel_order &&
+ a.image_channel_data_type == b.image_channel_data_type);
+}
+
+static inline bool
+operator!=(const cl_image_format &a, const cl_image_format &b) {
+ return !(a == b);
+}
+
#endif
_destroy_notify();
}
+bool
+memory_obj::operator==(const memory_obj &obj) const {
+ return this == &obj;
+}
+
void
memory_obj::destroy_notify(std::function<void ()> f) {
_destroy_notify = f;
public:
virtual ~memory_obj();
+ bool
+ operator==(const memory_obj &obj) const;
+
virtual cl_mem_object_type type() const = 0;
virtual clover::resource &resource(command_queue &q) = 0;