Intel® High Level Design
Support for Intel® High Level Synthesis Compiler, DSP Builder, OneAPI for Intel® FPGAs, Intel® FPGA SDK for OpenCL™
674 Discussions

Passing PipeArray as template in functor

JSYOO
Beginner
561 Views

Hi, I am trying to pass pipeArray through template in a functor.

The pipeArray code in the following oneAPI sample directory was used: 

oneAPI-samples/DirectProgramming/C++SYCL_FPGA/include/pipe_utils.hpp

 

The pipe array definition:

 

// pipe array
using testPipeArray = fpga_tools::PipeArray<class testPipeArrayId, Data_t, kDepth, kWidth>;

 

Functor code:

 

template <typename inPipe>
class tileReadData{
public:
  Data_t *inMatPtr;
  unsigned total_reads;
  unsigned mem_base_addr;
  void operator()() const{
    Data_t * inMatLocated(inMatPtr);
    [[intel::initiation_interval(1)]]
    for (unsigned mem_idx = 0; mem_idx < total_reads; mem_idx++) {
      fpga_tools::UnrolledLoop<kWidth>([&](auto jdx) {
        inPipe::PipeAt<jdx>::write(inMatLocated[mem_base_addr + mem_idx * kWidth + jdx]);
      });
    }
  }
};

 

 

Used in code:

 

  // data read
  auto tileReadData_event = q.single_task<tileReadDataId>(
          tileReadData<testPipeArray>{inMat, total_reads, mem_base_addr});

 

 

This code makes the following error messages:

error: no member named 'write' in the global namespace; did you mean 'fwrite'?
50 | inPipe::pipeAt<jdx>::write(inMatLocated[mem_base_addr + mem_idx * kWidth + jdx]);

 

error: use of alias template 'PipeAt' requires template arguments

 

error: SYCL kernel cannot call an undefined function without SYCL_EXTERNAL attribute

 

These error message does not come up when using pipe instead of pipearray (also without the unrolled loop). Is there a way that I can pass pipeArray in functor through template?

Thanks

 

0 Kudos
7 Replies
BoonBengT_Intel
Moderator
483 Views

Hi @JSYOO,


Thank you for posting in Intel community forum, hope all is well and apologies for the delayed in response.

Noted on the error message, may I know what oneAPI version that you are using to compile the mention example? Also what are the compilation command used?

Hope to hear from you soon.


Best Wishes

BB


0 Kudos
JSYOO
Beginner
466 Views

Hi I attached the CMakeLists and the sample source code.

 

I run the code on linux and it is running on oneAPI 2024.0 version because this is the only version I download for this machine.

 

the commands were:

$ mkdir build
$ cd build
$ cmake ..
$ make fpga_emu

 

The CMakeLists is based on the CmakeList from this repo:

https://github.com/oneapi-src/oneAPI-samples/tree/master/DirectProgramming/C%2B%2BSYCL_FPGA/Tutorials/GettingStarted/fpga_template 

 

Thanks

0 Kudos
BoonBengT_Intel
Moderator
395 Views

Hi @JSYOO,


Noted on the version involved and code repo referred as well as shared sample code.

Please do allow us some time to emulate the provided code and get back to you shortly.

Thank you for the patients


Best Wishes

BB



0 Kudos
BoonBengT_Intel
Moderator
270 Views

Hi @JSYOO,


Thank you for the wait, this is to let you know that your request are still being worked on.

Will get back to you sometime within this week.


Appreciate the patients.


Best Wishes

BB



0 Kudos
BoonBengT_Intel
Moderator
183 Views

Hi @JSYOO,


The compilation from our end seems to be working and we are able to generate the emulation files for the fpga template.


Based on the error message seen per my understanding you are trying to use the pipe for IO and are facing some issues, there are example design available in the path below:

- https://github.com/oneapi-src/oneAPI-samples/tree/master/DirectProgramming/C%2B%2BSYCL_FPGA/Tutorials/DesignPatterns/pipe_array


Perhaps there seems to be some declaration gaps for the pipe, hence would suggest to refer to the sample as a references.

Hope that clarify


Best Wishes

BB


0 Kudos
BoonBengT_Intel
Moderator
140 Views

Hi @JSYOO,


Greetings, as we do not receive any further clarification/updates on the matter, hence would assume challenge are overcome. Please login to ‘https://supporttickets.intel.com’, view details of the desire request, and post a feed/response within the next 15 days to allow me to continue to support you. After 15 days, this thread will be transitioned to community support. For new queries, please feel free to open a new thread and we will be right with you. Pleasure having you here.


Best Wishes

BB



0 Kudos
JSYOO
Beginner
117 Views

Hi, I tried running the code in couple other environments, but I am still having the same error with the code.

 

I am trying to pass the pipe array to a function or a functor.

I do not want to define the pipe array globally as in the sample above.

I have checked some of the samples using pipes as my intention (such as: https://github.com/oneapi-src/oneAPI-samples/blob/master/DirectProgramming/C%2B%2BSYCL_FPGA/ReferenceDesigns/matmul/src/matmul.hpp )

The pipe defined in line 93 is the type of pipe I want to implement, but in pipe array instead of pipe.

 

Is there any samples that defines and passes pipe array instead of pipe to another function or a functor?

0 Kudos
Reply