-
Notifications
You must be signed in to change notification settings - Fork 727
Add compute_units DPC++ FPGA tutorial #167
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Your commit includes several superfluous files -- a.out in the src directory, and a bunch of binary files. Please remove these. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The #include "dpc_common.hpp" needs a comment showing the location in the basetoolkit for this file.
@pmpeter1 -- The README contains text indicating where to find the dpc_common.hpp file. You want to see this in the *cpp as well? |
Yes, the coding guidelines recommend a 1-line comment showing the path to the directory. The way we are delivering shared headers is a bit awkward so having it in both places is recommended. |
da855e8
to
8af7dfa
Compare
DirectProgramming/DPC++FPGA/Tutorials/DesignPatterns/compute_units/src/compute_units.cpp
Show resolved
Hide resolved
Readme looks fine. thank you |
Shouldn't merge this until Paul approves, and we sort out why CI isn't running. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to figure out ci failure, here are a part of the error logs
Note: We should be targeting c++17
.
dpcpp /GX -fintelfpga -DFPGA_EMULATOR -std=c++14 compute_units.cpp -o compute_units.fpga_emu.exe
dpcpp: warning: unknown argument ignored in clang-cl '-std=c++14'; did you mean '-Qstd=c++14'? [-Wunknown-argument]
In file included from compute_units.cpp:13:
./pipe_array.hpp(38,19): error: 'INTEL' is not a class, namespace, or enumeration
cl::sycl::INTEL::pipe<StructId<idxs...>, BaseTy, depth>;
DirectProgramming/DPC++FPGA/Tutorials/DesignPatterns/compute_units/README.md
Show resolved
Hide resolved
DirectProgramming/DPC++FPGA/Tutorials/DesignPatterns/compute_units/src/pipe_array.hpp
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice to have a more complex FPGA example.
Please explain more the code with some comments, since this is a tutorial.
In intel/llvm#2395 I have already reviewed this code with some suggestions about some syntax simplification for your pipe_array
.
@mkinsner @jbrodman I would love simpler code when this is about FPGA... :-)
DirectProgramming/DPC++FPGA/Tutorials/DesignPatterns/compute_units/CMakeLists.txt
Show resolved
Hide resolved
DirectProgramming/DPC++FPGA/Tutorials/DesignPatterns/compute_units/src/build.ninja
Show resolved
Hide resolved
DirectProgramming/DPC++FPGA/Tutorials/DesignPatterns/compute_units/README.md
Outdated
Show resolved
Hide resolved
|
||
template <class Id, typename BaseTy, size_t depth, size_t... dims> | ||
struct PipeArray { | ||
PipeArray() = delete; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Explain
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Objects of type PipeArray should never be created. This line makes it impossible to accidentally construct PipeArrays, by disabling the default constructor for PipeArray. Since we didn't add any other constructors, it won't be possible to construct PipeArray at all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. But what I mean is: explain this in a comment. :-) Keep it for your next improvement. This is a tutorial, so anyone interested by FPGA (usually not super C++-savvy) should be able to understand this code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this the definition of a singleton class?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. Just that this class is only used as a meta-function for meta-programming and its instantiation has no usage.
The problem here is that since nothing is explained, a user trying to create such an object could not, but not knowing why, since there is no static_assert
or comment to clarify the reason.
On the other hand, creating such an object has no effect, so at the end this is a lot of work to just add some smoke curtain... Perhaps just removing this line is good? :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree this is confusing. Having a class called PipeArray
but you cannot make an object seems, at best, counterintuitive. I would think I could make as many of these as I want... Maybe we can figure something cleaner out later @jessicadavies-intel
template <size_t dim1, size_t... dims> | ||
struct VerifierDimLayer { | ||
template <size_t idx1, size_t... idxs> | ||
struct VerifierIdxLayer { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ask a random colleague or customer to explain this code. If there are some hesitations, there might be some comments lacking... ;-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I will add comments here, in the separate change I'm planning to make for pipe array improvements.
DirectProgramming/DPC++FPGA/Tutorials/DesignPatterns/compute_units/README.md
Outdated
Show resolved
Hide resolved
DirectProgramming/DPC++FPGA/Tutorials/DesignPatterns/compute_units/src/compute_units.cpp
Outdated
Show resolved
Hide resolved
DirectProgramming/DPC++FPGA/Tutorials/DesignPatterns/compute_units/src/compute_units.cpp
Outdated
Show resolved
Hide resolved
DirectProgramming/DPC++FPGA/Tutorials/DesignPatterns/compute_units/src/compute_units.cpp
Outdated
Show resolved
Hide resolved
DirectProgramming/DPC++FPGA/Tutorials/DesignPatterns/compute_units/src/compute_units.cpp
Show resolved
Hide resolved
You could remove a + in the PR title |
DirectProgramming/DPC++FPGA/Tutorials/DesignPatterns/compute_units/src/compute_units.cpp
Show resolved
Hide resolved
ff8621a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving to re-trigger the CI tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few other clarifications...
DirectProgramming/DPC++FPGA/Tutorials/DesignPatterns/compute_units/src/compute_units.cpp
Show resolved
Hide resolved
DirectProgramming/DPC++FPGA/Tutorials/DesignPatterns/compute_units/src/compute_units.hpp
Show resolved
Hide resolved
DirectProgramming/DPC++FPGA/Tutorials/DesignPatterns/compute_units/src/compute_units.hpp
Show resolved
Hide resolved
DirectProgramming/DPC++FPGA/Tutorials/DesignPatterns/compute_units/src/compute_units.hpp
Show resolved
Hide resolved
DirectProgramming/DPC++FPGA/Tutorials/DesignPatterns/compute_units/src/pipe_array.hpp
Show resolved
Hide resolved
DirectProgramming/DPC++FPGA/Tutorials/DesignPatterns/compute_units/src/compute_units.hpp
Show resolved
Hide resolved
DirectProgramming/DPC++FPGA/Tutorials/DesignPatterns/compute_units/src/compute_units.hpp
Show resolved
Hide resolved
DirectProgramming/DPC++FPGA/Tutorials/DesignPatterns/compute_units/src/compute_units.hpp
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please express yourself in a lot of comments in the code. :-)
Description
This tutorial shows how to make multiple copies of kernels, called compute_units.
Type of Change
How Has This Been Tested?