# \[Guideline\] Relay AOT

**URL:** <https://discuss.tvm.apache.org/t/guideline-relay-aot/5977>\
**Category:** RFC\
**Created:** [March 13, 2020, 7:12pm UTC](https://discuss.tvm.apache.org/t/guideline-relay-aot/5977 "2020-03-13T19:12:30Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![aca88](https://discuss.tvm.apache.org/letter_avatar_proxy/v4/letter/a/ed8c4c/32.png) [@aca88](https://discuss.tvm.apache.org/u/aca88)\
**Post date:** [November 16, 2020, 2:09pm UTC](https://discuss.tvm.apache.org/t/guideline-relay-aot/5977/4 "2020-11-16T14:09:44Z")

</div>

Hey Andrew,

Thanks for sharing your progress.

Sadly I can’t get your branch to build

```auto
[77%] Building CXX object CMakeFiles/tvm_objs.dir/src/relay/backend/param_dict.cc.o
/home/areusch_tvm/src/relay/backend/graph_runtime_codegen.cc: In member function ‘void tvm::relay::backend::AotCodegen::FinishFunctionDecl(int, tvm::runtime::Array<tvm::Integer>)’:
/home/areusch_tvm/src/relay/backend/graph_runtime_codegen.cc:243:31: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i = nargs + 1; i < storage_token_sizes.size(); ++i) {
                             ~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/areusch_tvm/src/relay/backend/graph_runtime_codegen.cc:247:31: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i = nargs + 1; i < storage_token_sizes.size(); ++i) {
                             ~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/areusch_tvm/src/relay/backend/graph_runtime_codegen.cc: In member function ‘void tvm::relay::backend::AotCodegen::WriteDLTensor(std::ostream&, std:: __cxx11::string, std::__ cxx11::string, size_t, std::vector<long int>, std::__cxx11::string)’:
/home/areusch_tvm/src/relay/backend/graph_runtime_codegen.cc:257:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i = 0; i < ndim; ++i) {
                     ~~^~~~~~
/home/areusch_tvm/src/relay/backend/graph_runtime_codegen.cc: In member function ‘void tvm::relay::backend::AotCodegen::_SidToArg(int, const tvm::runtime::Array<tvm::runtime::Array<tvm::Integer> >&, tvm::relay::Expr, std::vector<std:: __cxx11::basic_string<char> >*, std::vector<std::__ cxx11::basic_string<char> >*)’:
/home/areusch_tvm/src/relay/backend/graph_runtime_codegen.cc:301:30: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     if (uint64_t(sids[0][0]) == return_sid_) {
         ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
/home/areusch_tvm/src/relay/backend/graph_runtime_codegen.cc:303:92: error: ‘class std::basic_ostream<char>’ has no member named ‘str’; did you mean ‘setf’?
       values->emplace_back((std::stringstream() << "values[" << return_value_index << "]").str());
                                                                                            ^~~
                                                                                            setf
/home/areusch_tvm/src/relay/backend/graph_runtime_codegen.cc:304:92: error: ‘class std::basic_ostream<char>’ has no member named ‘str’; did you mean ‘setf’?
       tcodes->emplace_back((std::stringstream() << "tcodes[" << return_value_index << "]").str());
                                                                                            ^~~
                                                                                            setf
[77%] Building CXX object CMakeFiles/tvm_objs.dir/src/relay/backend/vm/compiler.cc.o
/home/areusch_tvm/src/relay/backend/graph_runtime_codegen.cc:311:74: error: ‘std::ostream {aka class std::basic_ostream<char>}’ has no member named ‘str’; did you mean ‘setf’?
     std::string sid_name = (std::stringstream() << "sid_" << sids[0][0]).str();
                                                                          ^~~
                                                                          setf
/home/areusch_tvm/src/relay/backend/graph_runtime_codegen.cc: In member function ‘void tvm::relay::backend::AotCodegen::AddFunctionCall(std:: __cxx11::string, const tvm::relay::CallNode*, std::__ cxx11::string, const tvm::Map<tvm::RelayExpr, tvm::runtime::Array<tvm::runtime::Array<tvm::Integer> > >&)’:
/home/areusch_tvm/src/relay/backend/graph_runtime_codegen.cc:323:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i = 0; i < nargs; ++i) {
                     ~~^~~~~~~
/home/areusch_tvm/src/relay/backend/graph_runtime_codegen.cc:328:80: error: ‘class std::basic_ostream<char>’ has no member named ‘str’; did you mean ‘setf’?
         values.emplace_back((std::stringstream() << "values[" << index << "]").str());
                                                                                ^~~
                                                                                setf
/home/areusch_tvm/src/relay/backend/graph_runtime_codegen.cc:329:80: error: ‘class std::basic_ostream<char>’ has no member named ‘str’; did you mean ‘setf’?
         tcodes.emplace_back((std::stringstream() << "tcodes[" << index << "]").str());
                                                                                ^~~
                                                                                setf
/home/areusch_tvm/src/relay/backend/graph_runtime_codegen.cc:332:85: error: ‘class std::basic_ostream<char>’ has no member named ‘str’; did you mean ‘setf’?
         values.emplace_back((std::stringstream() << "&" << value.first << "_param").str());
                                                                                     ^~~
                                                                                     setf
/home/areusch_tvm/src/relay/backend/graph_runtime_codegen.cc:348:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i = 0; i < values.size(); i++) {
                     ~~^~~~~~~~~~~~~~~
/home/areusch_tvm/src/relay/backend/graph_runtime_codegen.cc:349:48: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       ss_ << " " << values[i] << (i < (values.size() - 1) ? ", " : "") << std::endl;
                                              ~~^~~~~~~~~~~~~~~~~~~~~
/home/areusch_tvm/src/relay/backend/graph_runtime_codegen.cc:353:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i = 0; i < tcodes.size(); ++i) {
                     ~~^~~~~~~~~~~~~~~
/home/areusch_tvm/src/relay/backend/graph_runtime_codegen.cc:354:48: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       ss_ << " " << tcodes[i] << (i < (tcodes.size() - 1) ? ", " : "") << std::endl;
                                              ~~^~~~~~~~~~~~~~~~~~~~~
[77%] Building CXX object CMakeFiles/tvm_objs.dir/src/relay/backend/vm/inline_primitives.cc.o

```

Also looking at the example output provided, I see [sid\_2 being allocated](https://github.com/areusch/incubator-tvm/blob/aot-experiment/sample-output.txt#L125) but never being used.

I have a question about the return values of the function calls. More specifically, the output of [`fused_layout_transform_2`](https://github.com/areusch/incubator-tvm/blob/aot-experiment/sample-output.txt#L139). Is the return tensor [`values[1]`](https://github.com/areusch/incubator-tvm/blob/aot-experiment/sample-output.txt#L130) or is it [`subcall_ret_value`](https://github.com/areusch/incubator-tvm/blob/aot-experiment/sample-output.txt#L136)?

- seeing line [156](https://github.com/areusch/incubator-tvm/blob/aot-experiment/sample-output.txt#L156), I would say its in `values[1]`, but then what is `subcall_ret_value`?

Again thanks for showing some of the progress 🙂

---

_[View the full topic](https://discuss.tvm.apache.org/t/guideline-relay-aot/5977)._
