diff options
author | Gil Pitney <gil.pitney@linaro.org> | 2015-05-29 20:50:42 +0000 |
---|---|---|
committer | Gil Pitney <gil.pitney@linaro.org> | 2015-05-29 20:50:42 +0000 |
commit | fbf7f378ca49bbad15148ffcb893aa3ce49c11f9 (patch) | |
tree | 171dc829a303f4d2ef31e4b47d8c99152dbc4e7d | |
parent | d66a8c9a34eb654e6a63ea577654e1e557871291 (diff) |
relaxed comparison of Args objects in Kenrel objects
Previously, comparison of Args objects between Kernel objects returned
false if the Args this pointers were not the same.
For two different devices with two separate kernels, it is still possible the
Args are the same, if their data members are the same.
So, replaced the != operator with an comparison method, which avoids
inheriting the C++ != operator which was comparing this pointers.
Signed-off-by: Gil Pitney <gil.pitney@linaro.org>
-rw-r--r-- | src/core/kernel.cpp | 12 | ||||
-rw-r--r-- | src/core/kernel.h | 6 |
2 files changed, 9 insertions, 9 deletions
diff --git a/src/core/kernel.cpp b/src/core/kernel.cpp index 81904bf..6e9cc76 100644 --- a/src/core/kernel.cpp +++ b/src/core/kernel.cpp @@ -274,7 +274,7 @@ cl_int Kernel::addFunction(DeviceInterface *device, llvm::Function *function, Arg *a= new Arg(vec_dim, file, kind, target_align, target_size); // If we also have a function registered, check for signature compliance - if (!append && (a) != p_args[i]) + if (!append && !a->sameSignature(p_args[i])) return CL_INVALID_KERNEL_DEFINITION; // Append arg if needed @@ -827,13 +827,13 @@ void Kernel::Arg::refineKind (Kernel::Arg::Kind kind) p_kind = kind; } -bool Kernel::Arg::operator!=(const Arg &b) +bool Kernel::Arg::sameSignature(Arg *b) { - bool same = (p_vec_dim == b.p_vec_dim) && - (p_file == b.p_file) && - (p_kind == b.p_kind); + bool same = (p_vec_dim == b->p_vec_dim) && + (p_file == b->p_file) && + (p_kind == b->p_kind); - return !same; + return same; } size_t Kernel::Arg::valueSize() const diff --git a/src/core/kernel.h b/src/core/kernel.h index a6e6455..47fd0a2 100644 --- a/src/core/kernel.h +++ b/src/core/kernel.h @@ -174,13 +174,13 @@ class Kernel : public Object /** * \brief Compares this argument with another * - * They are different if they \c vec_dim, \c file or \c kind are - * not the same. + * They are same if the \c vec_dim, \c file or \c kind are + * the same. * * \param b other argument to compare * \return true if the this arguments doesn't match \p b */ - bool operator !=(const Arg &b); + bool sameSignature(Arg *b); /** * \brief Size of a field of this arg |