-
Notifications
You must be signed in to change notification settings - Fork 6
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
Feature/ python graph API and strongly typed ID #252
Merged
Merged
Changes from 6 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
b5355e3
graph api
d858f1b
minimum test to reproduce the error
91358a9
add graph id when generating instance
07e06c6
change test
5695991
fix halide buffer input
9b7dbe3
modify test
fe7411c
delete createvector
acc6dd5
change ion_graph_multipe
061372e
update id
8a3957c
node_id
d5717bf
update NodeID
c79ceaf
change node.cc
da6d6d1
change graph_multiple
64df606
change ion_graph_create_with_multiple
ea91ff6
update python-binding
415f584
add Graph.py
42d5caa
delete print
4e48349
replace NodeId to string
0ce4b70
replace string with NodeId
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,14 +22,15 @@ class Node { | |
struct Impl { | ||
std::string id; | ||
std::string name; | ||
std::string graph_id; | ||
Halide::Target target; | ||
std::vector<Param> params; | ||
std::vector<Port> ports; | ||
std::vector<Halide::Internal::AbstractGenerator::ArgInfo> arginfos; | ||
|
||
Impl(): id(), name(), target(), params(), ports() {} | ||
|
||
Impl(const std::string& id_, const std::string& name_, const Halide::Target& target_); | ||
Impl(const std::string& id_, const std::string& name_, const Halide::Target& target_, const std::string& graph_id_); | ||
}; | ||
|
||
public: | ||
|
@@ -76,7 +77,7 @@ class Node { | |
*/ | ||
template<typename... Args> | ||
Node operator()(Args ...args) { | ||
set_iport(std::vector<Port>{args...}); | ||
set_iport(create_ports_vector(args...)); | ||
return *this; | ||
} | ||
|
||
|
@@ -126,6 +127,31 @@ class Node { | |
{ | ||
} | ||
|
||
Node(const std::string& id, const std::string& name, const Halide::Target& target, const std::string& graph_id) | ||
: impl_(new Impl{id, name, target, graph_id}) | ||
{ | ||
} | ||
|
||
|
||
template<typename... Args> | ||
std::vector<Port> create_ports_vector(Args... args) const { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you please clarify necessity of the wrapper function? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry for the confusion, this is unnecessary and I delete it |
||
return {get_iport(args)...}; | ||
} | ||
|
||
Port get_iport(Port arg) const { | ||
// if input is port | ||
return arg; | ||
} | ||
|
||
template<typename T> | ||
Port get_iport(Halide::Buffer<T>& arg) const { | ||
// if input is halide buffer | ||
if (impl_->graph_id.empty()) | ||
return Port(arg); | ||
else | ||
return Port(arg, impl_->graph_id); | ||
} | ||
|
||
std::shared_ptr<Impl> impl_; | ||
}; | ||
|
||
|
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.
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.
I'm considering more straitforward naming. e.g.
ion_graph_create_from_2
? Do you have any better idea?