Skip to content

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

Merged
merged 4 commits into from
Sep 23, 2020

Conversation

jessicadavies-intel
Copy link
Contributor

Description

This tutorial shows how to make multiple copies of kernels, called compute_units.

Type of Change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

  • Command Line

@jessicadavies-intel
Copy link
Contributor Author

@akertesz @AlbyB @pmpeter1 @tomlenth please review.

@akertesz
Copy link
Contributor

Your commit includes several superfluous files -- a.out in the src directory, and a bunch of binary files. Please remove these.

Copy link

@pmpeter1 pmpeter1 left a 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.

@akertesz
Copy link
Contributor

@pmpeter1 -- The README contains text indicating where to find the dpc_common.hpp file. You want to see this in the *cpp as well?

@pmpeter1
Copy link

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.

JoeOster
JoeOster previously approved these changes Sep 18, 2020
@jessicadavies-intel
Copy link
Contributor Author

@akertesz thank you for pointing me to the unrelated binary files that got deleted accidentally. I used a hard rebase to clean up the branch, which closed this PR automatically.

The new commit includes the dpc_common.h comment requested by @pmpeter1

pmpeter1
pmpeter1 previously approved these changes Sep 18, 2020
@tomlenth
Copy link
Contributor

Readme looks fine. thank you

@akertesz
Copy link
Contributor

Shouldn't merge this until Paul approves, and we sort out why CI isn't running.

pmpeter1
pmpeter1 previously approved these changes Sep 18, 2020
Copy link
Contributor

@JoeOster JoeOster left a 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>;

AlbyB
AlbyB previously approved these changes Sep 21, 2020
akertesz
akertesz previously approved these changes Sep 22, 2020
Copy link

@keryell keryell left a 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... :-)


template <class Id, typename BaseTy, size_t depth, size_t... dims>
struct PipeArray {
PipeArray() = delete;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Explain

Copy link
Contributor Author

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.

Copy link

@keryell keryell Sep 24, 2020

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.

Copy link
Contributor

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?

Copy link

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? :-)

Copy link
Contributor

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 {
Copy link

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... ;-)

Copy link
Contributor Author

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.

@keryell
Copy link

keryell commented Sep 22, 2020

You could remove a + in the PR title Add compute_units DPC+++ FPGA tutorial and also talk about "pipe array"?

@jessicadavies-intel jessicadavies-intel changed the title Add compute_units DPC+++ FPGA tutorial Add compute_units DPC++ FPGA tutorial Sep 23, 2020
@jessicadavies-intel jessicadavies-intel dismissed stale reviews from akertesz and AlbyB via ff8621a September 23, 2020 20:32
Copy link
Contributor

@akertesz akertesz left a 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

@akertesz akertesz merged commit 41415dd into oneapi-src:master Sep 23, 2020
Copy link

@keryell keryell left a 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...

Copy link

@keryell keryell left a 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. :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants