-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
[LANG] Generalize compute to tensor region #1476
Merged
Merged
Changes from 6 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
da6a07c
[TensorOp] Interface of TensorOp.
97b3f65
[TensorOp] Support for intrin(..) and rename to TensorComputeOp.
753cb03
[TensorOp] Add testcase for reduction.
cf0134d
[TensorOp] Add testcase for scheduling tensor_compute_op.
81ffb68
[TensorOp] Fix.
ZihengJiang 58aff04
[TensorOp] Merge with the master.
ZihengJiang 2cd02e0
[TensorOp] Remove 'out_axis', 'tensor_axis' fields.
ZihengJiang 714e6f1
[TensorOp] Update doc.
ZihengJiang 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
Submodule dmlc-core
updated
12 files
+1 −0 | .gitignore | |
+10 −2 | CMakeLists.txt | |
+11 −0 | cmake/build_config.h.in | |
+2 −8 | include/dmlc/base.h | |
+17 −0 | include/dmlc/build_config.h | |
+36 −0 | include/dmlc/common.h | |
+19 −30 | src/data/text_parser.h | |
+15 −16 | src/io/input_split_base.cc | |
+1 −4 | src/io/local_filesys.cc | |
+1 −3 | src/io/single_file_split.h | |
+103 −43 | test/unittest/unittest_inputsplit.cc | |
+4 −3 | test/unittest/unittest_parser.cc |
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 |
---|---|---|
|
@@ -49,7 +49,7 @@ class OperationNode : public FunctionBaseNode { | |
} | ||
/*! | ||
* \return The list of iteration variable at root | ||
* \note root_iter_vars dedides the shape of the outputs. | ||
* \note root_iter_vars decides the shape of the outputs. | ||
*/ | ||
virtual Array<IterVar> root_iter_vars() const = 0; | ||
/*! | ||
|
@@ -182,6 +182,80 @@ class PlaceholderOpNode : public OperationNode { | |
TVM_DECLARE_NODE_TYPE_INFO(PlaceholderOpNode, OperationNode); | ||
}; | ||
|
||
class TensorComputeOpNode : public OperationNode { | ||
public: | ||
Array<IterVar> axis; | ||
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. again, document each field |
||
|
||
Array<IterVar> out_axis; | ||
|
||
Array<IterVar> tensor_axis; | ||
|
||
Array<IterVar> reduce_axis; | ||
|
||
Array<Tensor> inputs; | ||
|
||
Array<Region> input_regions; | ||
|
||
TensorIntrin intrin; | ||
|
||
/*! \brief constructor */ | ||
TensorComputeOpNode() {} | ||
|
||
// override functions | ||
int num_outputs() const final; | ||
Array<IterVar> root_iter_vars() const final; | ||
Type output_dtype(size_t i) const final; | ||
Array<Expr> output_shape(size_t i) const final; | ||
Array<Tensor> InputTensors() const final; | ||
Operation ReplaceInputs( | ||
const Operation& self, | ||
const std::unordered_map<Tensor, Tensor>& rmap) const final; | ||
void PropBoundToInputs( | ||
const Operation& self, | ||
const std::unordered_map<const Variable*, IntSet>& dom_map, | ||
std::unordered_map<Tensor, TensorDom>* out_dom_map) const final; | ||
void GatherBound( | ||
const Operation& self, | ||
const std::unordered_map<Tensor, TensorDom>& tensor_dom, | ||
std::unordered_map<IterVar, Range>* out_dom_map) const final; | ||
Stmt BuildRealize( | ||
const Stage& stage, | ||
const std::unordered_map<IterVar, Range>& realize_map, | ||
const Stmt& body) const final; | ||
Stmt BuildProvide( | ||
const Stage& stage, | ||
const std::unordered_map<IterVar, Range>& dom_map, | ||
bool debug_keep_trivial_loop) const final; | ||
|
||
void VisitAttrs(AttrVisitor* v) final { | ||
v->Visit("name", &name); | ||
v->Visit("tag", &tag); | ||
v->Visit("axis", &axis); | ||
v->Visit("out_axis", &out_axis); | ||
v->Visit("tensor_axis", &tensor_axis); | ||
v->Visit("reduce_axis", &reduce_axis); | ||
v->Visit("inputs", &inputs); | ||
} | ||
|
||
static Operation make(std::string name, | ||
std::string tag, | ||
Array<IterVar> out_axis, | ||
Array<IterVar> tensor_axis, | ||
TensorIntrinCall intrin_call); | ||
|
||
static Operation make(std::string name, | ||
std::string tag, | ||
Array<IterVar> out_axis, | ||
Array<IterVar> tensor_axis, | ||
Array<IterVar> reduce_axis, | ||
Array<Tensor> tensors, | ||
Array<Region> regions, | ||
TensorIntrin intrin); | ||
|
||
static constexpr const char* _type_key = "TensorComputeOp"; | ||
TVM_DECLARE_NODE_TYPE_INFO(TensorComputeOpNode, OperationNode); | ||
}; | ||
|
||
/*! | ||
* \brief A Compute op that compute a tensor on certain domain. | ||
*/ | ||
|
@@ -326,7 +400,7 @@ class ExternOpNode : public OperationNode { | |
public: | ||
/*! \brief The input tensors */ | ||
Array<Tensor> inputs; | ||
/*! \brief Symbolic placeholder representationinputs */ | ||
/*! \brief Symbolic placeholder representation of inputs */ | ||
Array<Buffer> input_placeholders; | ||
/*! \brief Symbolic placeholder representation of outputs */ | ||
Array<Buffer> output_placeholders; | ||
|
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.
document the fields