-
Notifications
You must be signed in to change notification settings - Fork 2
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
DFCxx kernel instantiation #52
Draft
Muxianesty
wants to merge
5
commits into
master
Choose a base branch
from
dfcxx_instances
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
0671cee
DFCxx: kernel instantiation was added (ver. 1).
28916c7
DFCxx: kernel instantiation was added (ver. 2).
a087161
DFCxx: kernel instantiation was added (ver.3).
8f9118a
DFCxx: kernel instantiation was added (ver. 4).
5444424
Graph::rebind_output: nested levels were decreased.
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"ADD_INT": 2, | ||
"MUL_INT": 3 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// Part of the Utopia HLS Project, under the Apache License v2.0 | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// Copyright 2024 ISP RAS (http://www.ispras.ru) | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#include "polynomial2_inst.h" | ||
|
||
#include <memory> | ||
|
||
std::unique_ptr<dfcxx::Kernel> start() { | ||
Polynomial2Inst *kernel = new Polynomial2Inst(); | ||
return std::unique_ptr<dfcxx::Kernel>(kernel); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// Part of the Utopia HLS Project, under the Apache License v2.0 | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// Copyright 2024 ISP RAS (http://www.ispras.ru) | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#include "dfcxx/DFCXX.h" | ||
|
||
class Polynomial2 : public dfcxx::Kernel { | ||
public: | ||
std::string_view getName() const override { | ||
return "Polynomial2"; | ||
} | ||
|
||
~Polynomial2() override = default; | ||
|
||
Polynomial2() : dfcxx::Kernel() { | ||
using dfcxx::DFType; | ||
using dfcxx::DFVariable; | ||
|
||
const DFType &type = dfUInt(32); | ||
DFVariable x = io.input("x", type); | ||
DFVariable squared = x * x; | ||
DFVariable squaredPlusX = squared + x; | ||
DFVariable result = squaredPlusX + x; | ||
DFVariable out = io.output("out", type); | ||
out.connect(result); | ||
} | ||
}; | ||
|
||
class Polynomial2Inst : public dfcxx::Kernel { | ||
public: | ||
std::string_view getName() const override { | ||
return "Polynomial2Inst"; | ||
} | ||
|
||
~Polynomial2Inst() override = default; | ||
|
||
Polynomial2Inst() : dfcxx::Kernel() { | ||
using dfcxx::DFType; | ||
using dfcxx::DFVariable; | ||
|
||
const DFType &type = dfUInt(32); | ||
DFVariable x = io.input("x", type); | ||
DFVariable intermediate = io.hollow(type); | ||
instance<Polynomial2>({ | ||
{x, "x"}, | ||
{intermediate, "out"} | ||
}); | ||
DFVariable out = io.output("out", type); | ||
out.connect(intermediate); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
x 0x32 | ||
|
||
x 0x45 | ||
|
||
x 0x56 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
What is "hollow" synonym here? What does this method do exactly?
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.
It's an unconnected node without specific operation behind it. Currently it can only be used to be bound to another kernel's output. By the end of kernel's construction there mustn't be any nodes like that.
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.
hollow -> unconnected?
hollow -> dummy?
It would be good to have more describing name for the method here
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 get it, but
Unconnected
- too long;Dummy
- too confusing. I am going to check MaxCompiler docs on how they call such things.UPD: MaxCompiler has
DFEType::newInstance
methods which do the same. I do not want to associate this functionality (at least now) with types, and instead treat them as kernel methods. Perhaps justnewStream
andnewScalar
?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.
Yeah,
newStream
andnewScalar
look better