Repository navigation
[SYCL] Failing to compile SYCL code on C++ mode only #27
Copy link
Copy link
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
The following simplified application
#include <array>
#include <CL/sycl.hpp>
constexpr cl::sycl::access::mode sycl_read = cl::sycl::access::mode::read;
constexpr cl::sycl::access::mode sycl_write = cl::sycl::access::mode::write;
constexpr size_t N = 10u;
template<typename T>
class SimpleVadd;
int main() {
using T = int;
using array_type = std::array<T, N>;
array_type VA, VB, VC;
{
cl::sycl::queue deviceQueue;
cl::sycl::range<1> numOfItems{N};
cl::sycl::buffer<T, 1> bufferA(VA.data(), numOfItems);
cl::sycl::buffer<T, 1> bufferB(VB.data(), numOfItems);
cl::sycl::buffer<T, 1> bufferC(VC.data(), numOfItems);
deviceQueue.submit([&](cl::sycl::handler& cgh) {
auto accessorA = bufferA.template get_access<sycl_read>(cgh);
auto accessorB = bufferB.template get_access<sycl_read>(cgh);
auto accessorC = bufferC.template get_access<sycl_write>(cgh);
cgh.parallel_for<class SimpleVadd<T>>(numOfItems,
[=](cl::sycl::id<1> wiID) {
accessorC[wiID] = accessorA[wiID] + accessorB[wiID];
});
});
}
return VC[0] == (VA[0] + VB[0]);
}fails to compile when not passing the -fsycl option to the driver with the following error:
$ intel_sycl --std=c++11 k.cpp -lOpenCL -lsycl
In file included from k.cpp:3:
In file included from /home/ruyman/Projects/sycl/build/lib/clang/9.0.0/include/CL/sycl.hpp:11:
In file included from /home/ruyman/Projects/sycl/build/lib/clang/9.0.0/include/CL/sycl/accessor.hpp:14:
In file included from /home/ruyman/Projects/sycl/build/lib/clang/9.0.0/include/CL/sycl/buffer.hpp:10:
In file included from /home/ruyman/Projects/sycl/build/lib/clang/9.0.0/include/CL/sycl/detail/buffer_impl.hpp:15:
In file included from /home/ruyman/Projects/sycl/build/lib/clang/9.0.0/include/CL/sycl/detail/queue_impl.hpp:15:
/home/ruyman/Projects/sycl/build/lib/clang/9.0.0/include/CL/sycl/handler.hpp:363:13: error: implicit instantiation of
undefined template 'cl::sycl::detail::KernelInfo<SimpleVadd<int> >'
KI::getName(), KI::getNumParams(), &KI::getParamDesc(0),
^
k.cpp:30:8: note: in instantiation of function template specialization
'cl::sycl::handler::parallel_for<SimpleVadd<int>, (lambda at k.cpp:31:4), 1>' requested here
cgh.parallel_for<class SimpleVadd<T>>(numOfItems,
^
/home/ruyman/Projects/sycl/build/lib/clang/9.0.0/include/CL/sycl/detail/kernel_desc.hpp:38:40: note: template is
declared here
template <class KernelNameType> struct KernelInfo;
^
In file included from k.cpp:3:
In file included from /home/ruyman/Projects/sycl/build/lib/clang/9.0.0/include/CL/sycl.hpp:11:
In file included from /home/ruyman/Projects/sycl/build/lib/clang/9.0.0/include/CL/sycl/accessor.hpp:14:
In file included from /home/ruyman/Projects/sycl/build/lib/clang/9.0.0/include/CL/sycl/buffer.hpp:10:
In file included from /home/ruyman/Projects/sycl/build/lib/clang/9.0.0/include/CL/sycl/detail/buffer_impl.hpp:15:
In file included from /home/ruyman/Projects/sycl/build/lib/clang/9.0.0/include/CL/sycl/detail/queue_impl.hpp:15:
/home/ruyman/Projects/sycl/build/lib/clang/9.0.0/include/CL/sycl/handler.hpp:363:15: error: incomplete definition of
type 'cl::sycl::detail::KernelInfo<SimpleVadd<int> >'
KI::getName(), KI::getNumParams(), &KI::getParamDesc(0),
~~^~
2 errors generated.However, it works with when -fsycl is passed.
Looks like something in the handler header requires/expect the KernelInfo but is not there on non-SYCL mode
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working
Activity
[-]Failing to compile SYCL code on C++ mode only[/-][+][SYCL] Failing to compile SYCL code on C++ mode only[/+]bader commentedon Feb 13, 2019
Yep. "C++ mode only" hasn't been regularly tested.
wangliwei-intel commentedon Mar 25, 2019
@Ruyk
Where did you get sycl.hpp? I can't find it from Khronos or this source tree.
Thank you!
bader commentedon Mar 25, 2019
@wangliwei-intel you can find it here: https://github.com/intel/llvm/blob/sycl/sycl/include/CL/sycl.hpp
wangliwei-intel commentedon Mar 25, 2019
@bader
Thank you very much. I found I made a stupid mistake: git clone without -b, so it defaults to branch 'intel', not 'sycl', so I couldn't find the headers relating to SYCL.
Remove a useless assertion in clang-check.
Revert rL357915 from cfe/trunk: Remove a useless assertion in clang-c…
Remove a useless assertion in clang-check.
bader commentedon Apr 24, 2019
@romanovvlad, please, verify if this issue is resolved by #101 and close.
wangliwei-intel commentedon May 22, 2019
I tried the latest build, it's fixed. @bader
bader commentedon Jun 20, 2019
I verified that problem is fixed.
@Ruyk, let me know if it doesn't work for you.
Revert "[Concepts] Placeholder constraints and abbreviated templates"
4 remaining items
[SYCL] Update devicelib tests with latest changes in intel/llvm (inte…
[lldb][TypeSystem] ForEach: Don't hold the TypeSystemMap lock across …
Revert "[Coro] [async] Disable inlining in async coroutine splitting …
Revert "[mlir][loops] Reland Refactor LoopFuseSiblingOp and support p…
Fix for codegen Crash in Clang when using locator omp_all_memory with…
Revert "[Clang][analyzer] replace Stmt* with ConstCFGElementRef in Sy…
[Driver] Reject -mcmodel=tiny on X86 (#125643)
[clang][bytecode] Classify variable initializer, not the decl (#146338)
Revert "[clang][bytecode] Check if block is initialized before invoki…
[LifetimeSafety] Read lifetimebound attribute on implicit 'this' from…
[LAA] Fix type mismatch in getStartAndEndForAccess. (#183116)
[lldb] Fix stale Symbol pointer crash in statusline after 'target sym…
[clang][AArch64] Use B-key for -msign-return-address= on Windows (#22…
[SYCL][ESIMD] Fix leak of the demangler output buffer in `ESIMDRemove…