areusch commented on a change in pull request #7518:
URL: https://github.com/apache/tvm/pull/7518#discussion_r604192779
##########
File path: src/relay/backend/graph_runtime_codegen.cc
##########
@@ -181,23 +186,56 @@ class GraphOpNode : public GraphNode {
const std::string op_type_name_{"tvm_op"};
};
-/*! \brief Code generator for graph runtime */
+/*! \brief Code generator for the graph runtime, produces a module containing
the graph JSON,
+ * module, and parameters.
+ */
class GraphRuntimeCodegen : public
backend::MemoizedExprTranslator<std::vector<GraphNodeRef>> {
public:
GraphRuntimeCodegen(runtime::Module* mod, const TargetsMap& targets) :
mod_(mod) {
- compile_engine_ = CompileEngine::Global();
targets_ = targets;
}
LoweredOutput Codegen(relay::Function func) {
- auto pf = GetPackedFunc("relay.backend.GraphPlanMemory");
- storage_device_map_ = (*pf)(func);
+ // Jared: why do we do this? just call C++ API.
Review comment:
I don't think it makes sense to allow people to overload GraphPlanMemory
with its current implementation. If GraphPlanMemory were to support memory
pools and tensor pinning, then I think there will be cases where people want to
implement custom algorithms to place tensors in different memory pools.
I also think the reason this "seems bad" is that there is no good
interface/data structure defined here. There's no reason we can't define
one--in fact, I think we are hurting compiler readability by not doing so. Here
we are keeping the interface to a sort of Pythonic "informal set of lists" in
place of a proper data structure. Here and downstream of here, there are many
instances where both TVM code and people trying to integrate with TVM code
would benefit from effectively exporting StorageToken as a user-facing data
structure and clearly defining its meaning.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]