Skip to content

[SYCL][SPEC] Tricked by spec example code, really need some one tell me what happened. :) #2704

@CaoZhongZ

Description

@CaoZhongZ

I got an example in SYCL spec.

class MyKernel; // Forward declaration of the name of the lambda functor cl::sycl::queue myQueue;
cl::sycl::program MyProgram(myQueue.get_context());
/* use the name of the kernel to obtain the associated program */
MyProgram.build_from_name<MyKernel>();
myQueue.submit([&](handler& commandGroup) { commandgroup.parallel_for<class MyKernel>(
cl::sycl::nd_range<2>(4, 4),
MyProgram.get_kernel<MyKernel>(), // execute the kernel as compiled in MyProgram
([=](cl::sycl::nd_item<2> index) {
//[kernel code]
})); });

Could anyone tell me what just happened about above code? What is the signature of the parallel_for?

parallel_for(range r, kernel k, MyKernel (lambda)), I'm I correct?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions