-
Notifications
You must be signed in to change notification settings - Fork 281
General Layout Support #447
Changes from 2 commits
fed37f4
ec54d21
5cf39b5
96b361b
9d73b0a
341f9f0
dbe54ca
0596771
63d8667
9e1f18d
170ea55
7e905da
44e9241
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,7 @@ | |
#include <nnvm/graph.h> | ||
#include <vector> | ||
#include <string> | ||
#include "packed_func_ext.h" | ||
|
||
namespace nnvm { | ||
namespace compiler { | ||
|
@@ -73,19 +74,17 @@ using FTVMSchedule = std::function< | |
const Array<Tensor>& outs, | ||
const std::string& target)>; | ||
|
||
/*! \brief Layout Information about an entry */ | ||
using TLayoutInfo = std::string; | ||
|
||
/*! | ||
* \brief The producer consumer function of node layout | ||
* \param attrs The attribute of the node. | ||
* \param ilayouts The input layouts that the node request. | ||
* \param olayouts The output layouts that the node produce. | ||
* \return bool The success flag. | ||
* \brief Modify the op node to alter its input layout. | ||
* it is invoked in AlterOpLayout pass. | ||
* \param attrs The attribute of the original node. | ||
* \param inputs The input symbols of the original node. | ||
* \param tinfos The inferred shape and dtype of the inputs. | ||
*/ | ||
using FTVMLayoutRequest = std::function<bool (const NodeAttrs& attrs, | ||
std::vector<TLayoutInfo> *ilayouts, | ||
std::vector<TLayoutInfo> *olayouts)>; | ||
using FTVMAlterOpLayout = std::function< | ||
Symbol(const NodeAttrs& attrs, | ||
const SymbolArray& inputs, | ||
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. do we really need the input symbols, or is tinfo enough for now? 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. ignore this comment, I now get what is going on |
||
const Array<Tensor>& tinfos)>; | ||
|
||
/*! | ||
* \brief Transform from normal operator to vectorized operator | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ | |
#include <nnvm/graph.h> | ||
#include <nnvm/symbolic.h> | ||
#include <string> | ||
#include <vector> | ||
#include <unordered_map> | ||
|
||
namespace nnvm { | ||
|
@@ -19,6 +20,7 @@ namespace compiler { | |
using tvm::runtime::PackedFunc; | ||
|
||
using AttrDict = std::unordered_map<std::string, std::string>; | ||
using SymbolArray = std::vector<const Symbol*>; | ||
|
||
/*! | ||
* \brief Get PackedFunction from global registry and | ||
|
@@ -52,6 +54,12 @@ template<> | |
struct extension_class_info<nnvm::compiler::AttrDict> { | ||
static const int code = 18; | ||
}; | ||
|
||
template<> | ||
struct extension_class_info<nnvm::compiler::SymbolArray> { | ||
static const int code = 19; | ||
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. cannot use 19, because it is taken by mxnet tvm bridge https://github.com/apache/incubator-mxnet/blob/master/include/mxnet/tensor_blob.h#L49 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. It seems to be quite dangerous to expose a vector of pointers here. |
||
}; | ||
|
||
} // namespace runtime | ||
} // namespace tvm | ||
#endif // NNVM_COMPILER_PACKED_FUNC_EXT_H_ |
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.
Can we just return the result output layout as vector of string?
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.
ignore this