RAJA::kernel_param ambiguous when arg tuple has a complex in it
Open
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 598
- Forks
- 118
- Avg merge
- 21h 29m
- Merged PRs (30d)
- 1
Description
Here is a simple example:
#include <complex>
#include <RAJA/RAJA.hpp>
using Example = RAJA::KernelPolicy<
RAJA::statement::For<0, RAJA::seq_exec,
RAJA::statement::Lambda<0>,
RAJA::statement::For<1,RAJA::loop_exec,
RAJA::statement::Lambda<1>
>>>;
int main(int argc, char **argv)
{
RAJA::kernel_param<Example>(
RAJA::make_tuple(RAJA::RangeSegment(0, 4),
RAJA::RangeSegment(0, 8)),
RAJA::make_tuple<std::complex<double>, double>(std::complex<double>{0,0}, 0),
[=] (int, int, std::complex<double> &a, double &b) { },
[=] (int, int, std::complex<double> &a, double &b) { });
}
If I compile this with g++ 8.3.1 20190223 (Red hat 8.3.1-2), I get the following complaints:
g++ -fopenmp -g -I../RAJA/include simple.cpp -L../RAJA/lib -lRAJA
In file included from ../RAJA/include/RAJA/util/camp_aliases.hpp:28,
from ../RAJA/include/RAJA/RAJA.hpp:33,
from simple.cpp:2:
../RAJA/include/camp/tuple.hpp: In instantiation of 'constexpr camp::tuple<Rest>::tuple(camp::tuple<Rest>&&) [with Elements = {std::complex<double>, double}]':
../RAJA/include/camp/tuple.hpp:414:79: required from 'constexpr camp::tuple<camp::internal::special_decay_t<Args>...> camp::make_tuple(Args&& ...) [with Args = {std::complex<double>, double}]'
simple.cpp:22:80: required from here
../RAJA/include/camp/tuple.hpp:217:58: error: call of overloaded 'move(camp::tuple<std::complex<double>, double>::Base&)' is ambiguous
CAMP_HOST_DEVICE constexpr tuple(tuple&& o) : base(move(o.base)) {}
~~~~^~~~~~~~
In file included from ../RAJA/include/camp/concepts.hpp:17,
from ../RAJA/include/RAJA/util/concepts.hpp:26,
from ../RAJA/include/RAJA/util/Operators.hpp:33,
from ../RAJA/include/RAJA/RAJA.hpp:31,
from simple.cpp:2:
../RAJA/include/camp/helpers.hpp:173:48: note: candidate: 'constexpr camp::type::ref::rem<T>&& camp::move(T&&) [with T = camp::internal::tuple_helper<camp::int_seq<long int, 0, 1>, camp::list<std::complex<double>, double> >&; camp::type::ref::rem<T> = camp::internal::tuple_helper<camp::int_seq<long int, 0, 1>, camp::list<std::complex<double>, double> >]'
CAMP_HOST_DEVICE constexpr type::ref::rem<T>&& move(T&& t) noexcept
^~~~
In file included from /usr/include/c++/8/bits/nested_exception.h:40,
from /usr/include/c++/8/exception:144,
from /usr/include/c++/8/ios:39,
from /usr/include/c++/8/istream:38,
from /usr/include/c++/8/sstream:38,
from /usr/include/c++/8/complex:45,
from simple.cpp:1:
/usr/include/c++/8/bits/move.h:99:5: note: candidate: 'constexpr typename std::remove_reference<_Tp>::type&& std::move(_Tp&&) [with _Tp = camp::internal::tuple_helper<camp::int_seq<long int, 0, 1>, camp::list<std::complex<double>, double> >&; typename std::remove_reference<_Tp>::type = camp::internal::tuple_helper<camp::int_seq<long int, 0, 1>, camp::list<std::complex<double>, double> >]'
move(_Tp&& __t) noexcept
^~~~
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the reproducer in simple.cpp and inspect the tuple move construction at camp/tuple.hpp:217. Compare the camp::move declaration in camp/helpers.hpp with the std::move candidate shown by the compiler. Done means the provided C++ example compiles without the ambiguous-call error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- hpc
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100