[GitHub] [tvm] FrozenGene commented on a change in pull request #6972: [AutoScheduler] Print the time used for measurement
FrozenGene commented on a change in pull request #6972: URL: https://github.com/apache/tvm/pull/6972#discussion_r530168355 ## File path: src/auto_scheduler/utils.h ## @@ -253,6 +254,16 @@ inline std::string Chars(const char& str, int times) { return ret.str(); } +/*! \brief Print the time elapsed */ +inline void PrintTimeElapsed(std::chrono::time_point t_begin, Review comment: How about we define one macro to help the readability? ```cpp #define duration(x) std::chrono::duration_cast>(x).count() #define now() std::chrono::high_resolution_clock::now() auto elapsed_time = duration(now() - t_begin) PrintElapsedTime(elapsed_time, verbose); inline void PrintElapsedTime(double elapsed_time, int verbose) { StdCout(verbose) << "Time elapsed: " << std::fixed << std::setprecision(2) << elapsed_time << " s" << std::endl; } ``` ## File path: src/auto_scheduler/utils.h ## @@ -253,6 +254,16 @@ inline std::string Chars(const char& str, int times) { return ret.str(); } +/*! \brief Print the time elapsed */ +inline void PrintTimeElapsed(std::chrono::time_point t_begin, Review comment: How about we define one macro to help the readability? ```cpp #define duration(x) std::chrono::duration_cast>(x).count() #define now() std::chrono::high_resolution_clock::now() auto elapsed_time = duration(now() - t_begin); PrintElapsedTime(elapsed_time, verbose); inline void PrintElapsedTime(double elapsed_time, int verbose) { StdCout(verbose) << "Time elapsed: " << std::fixed << std::setprecision(2) << elapsed_time << " s" << std::endl; } ``` 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: us...@infra.apache.org
[GitHub] [tvm] merrymercy commented on a change in pull request #6972: [AutoScheduler] Print the time used for measurement
merrymercy commented on a change in pull request #6972: URL: https://github.com/apache/tvm/pull/6972#discussion_r530163560 ## File path: src/auto_scheduler/utils.h ## @@ -253,6 +254,16 @@ inline std::string Chars(const char& str, int times) { return ret.str(); } +/*! \brief Print the time elapsed */ +inline void PrintTimeElapsed(std::chrono::time_point t_begin, Review comment: I feel that ```c++ double duration = std::chrono::duration_cast>( std::chrono::high_resolution_clock::now() - t_begin) .count(); ``` is too long and harms the readbility. So I created `PrintElapsedTime`. 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: us...@infra.apache.org
[GitHub] [tvm] merrymercy commented on a change in pull request #6972: [AutoScheduler] Print the time used for measurement
merrymercy commented on a change in pull request #6972: URL: https://github.com/apache/tvm/pull/6972#discussion_r530163560 ## File path: src/auto_scheduler/utils.h ## @@ -253,6 +254,16 @@ inline std::string Chars(const char& str, int times) { return ret.str(); } +/*! \brief Print the time elapsed */ +inline void PrintTimeElapsed(std::chrono::time_point t_begin, Review comment: I feel that ``` double duration = std::chrono::duration_cast>( std::chrono::high_resolution_clock::now() - t_begin) .count(); ``` is too long and harms the readbility. So I created `PrintElapsedTime`. 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: us...@infra.apache.org
[GitHub] [tvm] merrymercy commented on a change in pull request #6972: [AutoScheduler] Print the time used for measurement
merrymercy commented on a change in pull request #6972: URL: https://github.com/apache/tvm/pull/6972#discussion_r530163560 ## File path: src/auto_scheduler/utils.h ## @@ -253,6 +254,16 @@ inline std::string Chars(const char& str, int times) { return ret.str(); } +/*! \brief Print the time elapsed */ +inline void PrintTimeElapsed(std::chrono::time_point t_begin, Review comment: I feel that ``` double duration = std::chrono::duration_cast>( std::chrono::high_resolution_clock::now() - t_begin) .count(); ``` is too long and makes the readbility worse. This is the reason for creating `PrintElapsedTime` 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: us...@infra.apache.org
[GitHub] [tvm] merrymercy commented on a change in pull request #6972: [AutoScheduler] Print the time used for measurement
merrymercy commented on a change in pull request #6972: URL: https://github.com/apache/tvm/pull/6972#discussion_r530163560 ## File path: src/auto_scheduler/utils.h ## @@ -253,6 +254,16 @@ inline std::string Chars(const char& str, int times) { return ret.str(); } +/*! \brief Print the time elapsed */ +inline void PrintTimeElapsed(std::chrono::time_point t_begin, Review comment: I feel that ` double duration = std::chrono::duration_cast>( std::chrono::high_resolution_clock::now() - t_begin) .count(); ` is too long and makes the readbility worse. This is the reason for creating `PrintElapsedTime` 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: us...@infra.apache.org
[GitHub] [tvm] FrozenGene commented on a change in pull request #6972: [AutoScheduler] Print the time used for measurement
FrozenGene commented on a change in pull request #6972: URL: https://github.com/apache/tvm/pull/6972#discussion_r530162124 ## File path: src/auto_scheduler/utils.h ## @@ -253,6 +254,16 @@ inline std::string Chars(const char& str, int times) { return ret.str(); } +/*! \brief Print the time elapsed */ +inline void PrintTimeElapsed(std::chrono::time_point t_begin, Review comment: I think it is a little strange to pass the `t_begin` and elapse the duration time. I would suggest we pass the `duration` to `PrintElapsedTime` (this name should be better, but current fn name is ok too). i.e. ```cpp double duration = std::chrono::duration_cast>( std::chrono::high_resolution_clock::now() - t_begin) .count(); inline void PrintElapsedTime(double duration, int verbose) { StdCout(verbose) << "Time elapsed: " << std::fixed << std::setprecision(2) << duration << " s" << std::endl; } ``` 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: us...@infra.apache.org
[GitHub] [tvm] merrymercy opened a new pull request #6973: [AutoScheduler] Check duplicated names in the compute dag
merrymercy opened a new pull request #6973: URL: https://github.com/apache/tvm/pull/6973 Some analysis in auto scheduler depends on the fact that all iterators have different names. We should check this when creating the compute dag. 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: us...@infra.apache.org
[GitHub] [tvm] merrymercy opened a new pull request #6972: [AutoScheduler] Print the time used for measurement
merrymercy opened a new pull request #6972: URL: https://github.com/apache/tvm/pull/6972 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: us...@infra.apache.org
[GitHub] [tvm] hypercubestart commented on a change in pull request #6963: [Frontend][Relay][Parser] fix unparsable yolo formals
hypercubestart commented on a change in pull request #6963: URL: https://github.com/apache/tvm/pull/6963#discussion_r530127434 ## File path: tests/python/frontend/darknet/test_forward.py ## @@ -59,6 +70,10 @@ def _get_tvm_output(net, data, build_dtype="float32", states=None): """Compute TVM output""" dtype = "float32" mod, params = relay.frontend.from_darknet(net, data.shape, dtype) +# verify that from_darknet creates a valid, parsable relay program +mod = relay.transform.InferType()(mod) +astext(mod) Review comment: I'm not quite sure what you mean? This is the test file, so a try block would prevent a test from failing? 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: us...@infra.apache.org
[GitHub] [tvm] zhiics commented on a change in pull request #6963: [Frontend][Relay][Parser] fix unparsable yolo formals
zhiics commented on a change in pull request #6963: URL: https://github.com/apache/tvm/pull/6963#discussion_r530091401 ## File path: tests/python/frontend/darknet/test_forward.py ## @@ -59,6 +70,10 @@ def _get_tvm_output(net, data, build_dtype="float32", states=None): """Compute TVM output""" dtype = "float32" mod, params = relay.frontend.from_darknet(net, data.shape, dtype) +# verify that from_darknet creates a valid, parsable relay program +mod = relay.transform.InferType()(mod) +astext(mod) Review comment: ahh, I see. then should we put it in a try block? otherwise ppl might be confused when trapped in astext 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: us...@infra.apache.org
[GitHub] [tvm] zhiics commented on a change in pull request #6963: [Frontend][Relay][Parser] fix unparsable yolo formals
zhiics commented on a change in pull request #6963: URL: https://github.com/apache/tvm/pull/6963#discussion_r530091401 ## File path: tests/python/frontend/darknet/test_forward.py ## @@ -59,6 +70,10 @@ def _get_tvm_output(net, data, build_dtype="float32", states=None): """Compute TVM output""" dtype = "float32" mod, params = relay.frontend.from_darknet(net, data.shape, dtype) +# verify that from_darknet creates a valid, parsable relay program +mod = relay.transform.InferType()(mod) +astext(mod) Review comment: ahh, I see. then should we put it in a try block? otherwise ppl might be confused when we get trapped in astext 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: us...@infra.apache.org
[GitHub] [tvm] hypercubestart commented on a change in pull request #6963: [Frontend][Relay][Parser] fix unparsable yolo formals
hypercubestart commented on a change in pull request #6963: URL: https://github.com/apache/tvm/pull/6963#discussion_r530076006 ## File path: tests/python/frontend/darknet/test_forward.py ## @@ -59,6 +70,10 @@ def _get_tvm_output(net, data, build_dtype="float32", states=None): """Compute TVM output""" dtype = "float32" mod, params = relay.frontend.from_darknet(net, data.shape, dtype) +# verify that from_darknet creates a valid, parsable relay program +mod = relay.transform.InferType()(mod) +astext(mod) Review comment: this is a general problem that variable names aren't normalized in the frontend code 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: us...@infra.apache.org
[GitHub] [tvm] hypercubestart commented on a change in pull request #6963: [Frontend][Relay][Parser] fix unparsable yolo formals
hypercubestart commented on a change in pull request #6963: URL: https://github.com/apache/tvm/pull/6963#discussion_r530074597 ## File path: tests/python/frontend/darknet/test_forward.py ## @@ -59,6 +70,10 @@ def _get_tvm_output(net, data, build_dtype="float32", states=None): """Compute TVM output""" dtype = "float32" mod, params = relay.frontend.from_darknet(net, data.shape, dtype) +# verify that from_darknet creates a valid, parsable relay program +mod = relay.transform.InferType()(mod) +astext(mod) Review comment: I think we're missing each other. The bug is because the IRModule generated using `from_darknet` is invalid to the parser, so parsing from the text representation back to an IRModule using `tvm.parser.parse` fails. astext() checks that works `tvm.parser.parse(mod.astext())` ## File path: tests/python/frontend/darknet/test_forward.py ## @@ -59,6 +70,10 @@ def _get_tvm_output(net, data, build_dtype="float32", states=None): """Compute TVM output""" dtype = "float32" mod, params = relay.frontend.from_darknet(net, data.shape, dtype) +# verify that from_darknet creates a valid, parsable relay program +mod = relay.transform.InferType()(mod) +astext(mod) Review comment: I think we're missing each other. The bug is because the IRModule generated using `from_darknet` is invalid to the parser, so parsing from the text representation back to an IRModule using `tvm.parser.parse` fails. astext() checks that `tvm.parser.parse(mod.astext())` works 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: us...@infra.apache.org
[GitHub] [tvm] zhiics commented on a change in pull request #6963: [Frontend][Relay][Parser] fix unparsable yolo formals
zhiics commented on a change in pull request #6963: URL: https://github.com/apache/tvm/pull/6963#discussion_r530062657 ## File path: tests/python/frontend/darknet/test_forward.py ## @@ -59,6 +70,10 @@ def _get_tvm_output(net, data, build_dtype="float32", states=None): """Compute TVM output""" dtype = "float32" mod, params = relay.frontend.from_darknet(net, data.shape, dtype) +# verify that from_darknet creates a valid, parsable relay program +mod = relay.transform.InferType()(mod) +astext(mod) Review comment: remove astext 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: us...@infra.apache.org
[GitHub] [tvm] vegaluisjose opened a new pull request #6971: [Hardware][Verilator] Integrating and simulating hardware accelerators in TVM
vegaluisjose opened a new pull request #6971: URL: https://github.com/apache/tvm/pull/6971 # Integrating and simulating hardware accelerators in TVM This RFC proposes support for integrating hardware designs in TVM, specifically before they are manufactured in silicon or prototyped in an FPGA. Regardless of the hardware target, ML accelerators are built today, using the *waterfall* approach described in the following [figure](https://github.com/vegaluisjose/figures/blob/main/tvm/rfc_verilator/today.png): ![today](https://github.com/vegaluisjose/figures/blob/main/tvm/rfc_verilator/today.png) Starting from an accelerator idea, hardware is built incrementally until is manufactured after several weeks or in most cases months of engineering. Once this happens, software teams start working on integrating the new piece of hardware to a particular ML framework of choice i.e., TVM. One challenge of this approach is the fact that hardware-design decisions are evaluated too late, which turns out to be counterproductive. Additionally, there are higher probabilities that the target ML model gets updated along the way, which makes critical the efficiency of this process. Motivated by this reality, we believe ML accelerators should be integrated, and more importantly evaluated once the hardware design process begins. Concretely, this approach allows engineers to have design feedback and hardware-software continuous integration, since the first day as shown in the following [figure](https://github.com/vegaluisjose/figures/blob/main/tvm/rfc_verilator/idea.png): ![idea](https://github.com/vegaluisjose/figures/blob/main/tvm/rfc_verilator/idea.png) We achieved this integration by leveraging the fact that most ML accelerators are funnel down to a hardware language i.e., Verilog, regardless of the source language. Moreover, we have today efficient Verilog-to-C++ open-source compilers i.e., Verilator that can be used to interoperate via a simple C interface (CFFI) with TVM. This RFC proposes a simple codegen using BYOC, and an *opaque* kernel library, runtime, and device interface that can be implemented by engineers to efficiently integrate ML accelerators with TVM early in the design process. Also, we provide a small example (demo) that shows how to offload an `add` instruction from a Relay program to a simple hardware implementation (scalar adder) written in Verilog. @tmoreau89 @liangfu @jroesch 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: us...@infra.apache.org
[GitHub] [tvm] areusch commented on pull request #6953: Add retry to sockets on EINTR error
areusch commented on pull request #6953: URL: https://github.com/apache/tvm/pull/6953#issuecomment-733295806 @rkimball from my investigations into handling Ctrl+C I remember the windows model for forwarding Ctrl+C from terminal to program is much more invasive than the linux (but also a little more intuitive): it spins up a new thread inside the process and dispatches to that thread. on linux, any system call is interrupted, returns EINTR (I believe) and then jumps to the signal handler. In CPython, the signal handler merely sets a flag reminding Python to run the SIGINT handler defined with the `signal` module next time the interpreter is looking for a new instruction. Unfortunately, "next time" while a C extension is running is after the C extension returns. So I think committing this would mean you have to press Ctrl+C 8 times to bail out of TVM on not-windows. I don't think we can do that--anyhow, at least someone should test this before submitting. 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: us...@infra.apache.org
[GitHub] [tvm] rkimball commented on pull request #6953: Add retry to sockets on EINTR error
rkimball commented on pull request #6953: URL: https://github.com/apache/tvm/pull/6953#issuecomment-733293441 @areusch I saw this happen periodically when I was running cpp_rpc on either Linux or Windows (I can't remember which now, but I am pretty sure it was linux). If you run cpp_rpc from the command line then it will sometimes print out `Socket SockChannel::Recv Error:Interrupted system call` in the middle of tuning with no interaction. Everything seems to continue. 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: us...@infra.apache.org
[GitHub] [tvm] zhiics commented on a change in pull request #6963: [Frontend][Relay][Parser] fix unparsable yolo formals
zhiics commented on a change in pull request #6963: URL: https://github.com/apache/tvm/pull/6963#discussion_r530005554 ## File path: tests/python/relay/test_ir_text_printer.py ## @@ -46,6 +48,46 @@ def show(text): print(text) +def get_darknet(model_name): Review comment: yeah, that is what I was referring to 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: us...@infra.apache.org
[GitHub] [tvm] d-smirnov opened a new pull request #6970: [TFLite] added scalar axis value handling in reduce
d-smirnov opened a new pull request #6970: URL: https://github.com/apache/tvm/pull/6970 This PR adds an ability to handle axis as scalar value in reduce 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: us...@infra.apache.org
[GitHub] [tvm] codeislife99 commented on pull request #6955: Dynamic Batch Support for TRT
codeislife99 commented on pull request #6955: URL: https://github.com/apache/tvm/pull/6955#issuecomment-733276428 cc : @anijain2305 @trevor-m 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: us...@infra.apache.org
[tvm-site] branch asf-site updated: Update from_source.html
This is an automated email from the ASF dual-hosted git repository. tqchen pushed a commit to branch asf-site in repository https://gitbox.apache.org/repos/asf/tvm-site.git The following commit(s) were added to refs/heads/asf-site by this push: new 6016888 Update from_source.html 6016888 is described below commit 601688875d16886ae7153bb3778f025a0030d0a1 Author: Tianqi Chen AuthorDate: Tue Nov 24 16:58:33 2020 -0500 Update from_source.html --- docs/install/from_source.html | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/docs/install/from_source.html b/docs/install/from_source.html index 0ee6733..a908e95 100644 --- a/docs/install/from_source.html +++ b/docs/install/from_source.html @@ -1,9 +1,6 @@ - - - @@ -631,4 +628,4 @@ sudo make install - \ No newline at end of file +
[GitHub] [tvm] areusch commented on a change in pull request #6917: Add Relay option to link parameters into runtime Modules
areusch commented on a change in pull request #6917: URL: https://github.com/apache/tvm/pull/6917#discussion_r529909675 ## File path: src/target/source/codegen_params.cc ## @@ -0,0 +1,218 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/*! + * \file codegen_params.cc + */ + +#include "codegen_params.h" + +#include + +#include +#include +#include +#include + +namespace tvm { +namespace codegen { + +namespace { +class DLManagedTensorDeleter { + public: + void operator()(DLManagedTensor* ptr) { ptr->deleter(ptr); } +}; +} // namespace + +static constexpr const int kMaxLineLength = 80; + +template ::value>> +void PrintArray(void* data, size_t num_elements, int elements_per_row, std::string indent_str, +std::ostream& os) { + for (size_t i = 0; i < num_elements; i++) { +int64_t elem = static_cast(data)[i]; +if (std::is_signed::value) { + uint64_t to_print; + if (elem < 0) { +os << "-"; +to_print = -elem; + } else { +os << "+"; +to_print = elem; + } + os << "0x" << std::setw(sizeof(T) * 8 / 4) << static_cast(to_print); +} else { + os << "0x" << std::setw(sizeof(T) * 8 / 4) << static_cast(elem); +} +if (i < num_elements - 1) { + os << ", "; +} +if (((i + 1) % elements_per_row) == 0) { + os << "\n" << indent_str; +} + } +} + +template ::value>> +void PrintArray(void* data, size_t num_elements, int one_element_size_bytes, int elements_per_row, +std::string indent_str, std::ostream& os) { + std::stringstream ss; + if (std::is_signed::value) { +ss.setf(std::ios::hex | std::ios::showbase | std::ios::fixed | std::ios::scientific, +std::ios::basefield | std::ios::showbase | std::ios::floatfield); + } else { +ss.setf(std::ios::hex | std::ios::fixed | std::ios::scientific, +std::ios::basefield | std::ios::showbase | std::ios::floatfield); + } + for (size_t i = 0; i < num_elements; i++) { +T elem = static_cast(data)[i]; +if (std::isinf(elem)) { + // C99 standard. + os << (elem < 0 ? "-" : " ") << std::setw(one_element_size_bytes - 1) << "INFINITY"; +} else if (std::isnan(elem)) { + // GNU extension, implemenatation-dependent. + os << std::setw(one_element_size_bytes) << "NAN"; +} else { + ss << elem; + os << std::setw(one_element_size_bytes) << ss.str(); + ss.str(""); +} +if (i < num_elements - 1) { + os << ", "; +} +if (((i + 1) % elements_per_row) == 0) { + os << "\n" << indent_str; +} + } +} + +void NDArrayDataToC(::tvm::runtime::NDArray arr, int indent_chars, std::ostream& os) { + auto arr_type = arr.DataType(); + CHECK_EQ(arr_type.lanes(), 1) << "CodegenParams: only support generating 1-lane parameters; saw " +<< arr_type.lanes(); + + int one_element_size_bytes = (arr_type.bits() / 4) + (2 /* "0x" */) + (2 /* ", " */); + if (arr_type.code() == runtime::DataType::TypeCode::kInt) { +one_element_size_bytes += 1; // sign character +if (arr_type.bits() > 32) { + one_element_size_bytes += 2; // "LL" +} + } else if (arr_type.code() == runtime::DataType::TypeCode::kUInt) { +if (arr_type.bits() > 32) { + one_element_size_bytes += 3; // "ULL" +} + } else if (arr_type.code() == runtime::DataType::TypeCode::kFloat) { +// Floats and doubles are printed as hex but casted. +one_element_size_bytes += 1 /* sign */ + 1 /* decimal point */ + 1 /* exponent sign */; +if (arr_type.bits() == 64) { + one_element_size_bytes += 2; /* 4 decimal digits in exponent, relative to bits / 4 */ +} else if (arr_type.bits() == 32) { + one_element_size_bytes += 1; /* extra decimal digit in exponent, relative to bits / 4 */ +} + } + + int elements_per_row = 16; + while (elements_per_row > 1 && + (elements_per_row * one_element_size_bytes) > (kMaxLineLength - indent_chars)) { +elements_per_row /= 2; + } + + std::string indent_str(indent_chars, ' '); + os << indent_str; + + auto shape = arr.Shape(); + int num_elements = 1; + for (auto shape_elem : shape) { +num_elements *=
[GitHub] [tvm] areusch commented on a change in pull request #6917: Add Relay option to link parameters into runtime Modules
areusch commented on a change in pull request #6917: URL: https://github.com/apache/tvm/pull/6917#discussion_r529909292 ## File path: src/target/source/codegen_params.cc ## @@ -0,0 +1,218 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/*! + * \file codegen_params.cc + */ + +#include "codegen_params.h" + +#include + +#include +#include +#include +#include + +namespace tvm { +namespace codegen { + +namespace { +class DLManagedTensorDeleter { + public: + void operator()(DLManagedTensor* ptr) { ptr->deleter(ptr); } +}; +} // namespace + +static constexpr const int kMaxLineLength = 80; + +template ::value>> +void PrintArray(void* data, size_t num_elements, int elements_per_row, std::string indent_str, +std::ostream& os) { + for (size_t i = 0; i < num_elements; i++) { +int64_t elem = static_cast(data)[i]; +if (std::is_signed::value) { + uint64_t to_print; + if (elem < 0) { +os << "-"; +to_print = -elem; + } else { +os << "+"; +to_print = elem; + } + os << "0x" << std::setw(sizeof(T) * 8 / 4) << static_cast(to_print); +} else { + os << "0x" << std::setw(sizeof(T) * 8 / 4) << static_cast(elem); +} +if (i < num_elements - 1) { + os << ", "; +} +if (((i + 1) % elements_per_row) == 0) { + os << "\n" << indent_str; +} + } +} + +template ::value>> +void PrintArray(void* data, size_t num_elements, int one_element_size_bytes, int elements_per_row, +std::string indent_str, std::ostream& os) { + std::stringstream ss; + if (std::is_signed::value) { +ss.setf(std::ios::hex | std::ios::showbase | std::ios::fixed | std::ios::scientific, +std::ios::basefield | std::ios::showbase | std::ios::floatfield); + } else { +ss.setf(std::ios::hex | std::ios::fixed | std::ios::scientific, +std::ios::basefield | std::ios::showbase | std::ios::floatfield); + } + for (size_t i = 0; i < num_elements; i++) { +T elem = static_cast(data)[i]; +if (std::isinf(elem)) { + // C99 standard. + os << (elem < 0 ? "-" : " ") << std::setw(one_element_size_bytes - 1) << "INFINITY"; +} else if (std::isnan(elem)) { + // GNU extension, implemenatation-dependent. + os << std::setw(one_element_size_bytes) << "NAN"; +} else { + ss << elem; + os << std::setw(one_element_size_bytes) << ss.str(); + ss.str(""); +} +if (i < num_elements - 1) { + os << ", "; +} +if (((i + 1) % elements_per_row) == 0) { + os << "\n" << indent_str; +} + } +} + +void NDArrayDataToC(::tvm::runtime::NDArray arr, int indent_chars, std::ostream& os) { Review comment: documented this function in codegen_params.h and added an example there. 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: us...@infra.apache.org
[GitHub] [tvm] areusch commented on a change in pull request #6917: Add Relay option to link parameters into runtime Modules
areusch commented on a change in pull request #6917: URL: https://github.com/apache/tvm/pull/6917#discussion_r529908385 ## File path: src/target/source/codegen_params.cc ## @@ -0,0 +1,214 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/*! + * \file codegen_params.cc + */ + +#include "codegen_params.h" + +#include + +#include +#include +#include +#include + +namespace tvm { +namespace codegen { + +namespace { +class DLManagedTensorDeleter { + public: + void operator()(DLManagedTensor* ptr) { ptr->deleter(ptr); } +}; +} // namespace + +static constexpr const int kMaxLineLength = 80; + +template ::value>> +void PrintArray(void* data, size_t num_elements, int elements_per_row, std::string indent_str, +std::ostream& os) { + for (size_t i = 0; i < num_elements; i++) { +int64_t elem = static_cast(data)[i]; +if (std::is_signed::value) { + uint64_t to_print; + if (elem < 0) { +os << "-"; +to_print = -elem; + } else { +os << "+"; +to_print = elem; + } + os << "0x" << std::setw(sizeof(T) * 8 / 4) << static_cast(to_print); +} else { + os << "0x" << std::setw(sizeof(T) * 8 / 4) << static_cast(elem); +} +if (i < num_elements - 1) { + os << ", "; +} +if (((i + 1) % elements_per_row) == 0) { + os << "\n" << indent_str; +} + } +} + +template ::value>> +void PrintArray(void* data, size_t num_elements, int one_element_size_bytes, int elements_per_row, +std::string indent_str, std::ostream& os) { + std::stringstream ss; + if (std::is_signed::value) { +ss.setf(std::ios::hex | std::ios::showbase | std::ios::fixed | std::ios::scientific, +std::ios::basefield | std::ios::showbase | std::ios::floatfield); + } else { +ss.setf(std::ios::hex | std::ios::fixed | std::ios::scientific, +std::ios::basefield | std::ios::showbase | std::ios::floatfield); + } + for (size_t i = 0; i < num_elements; i++) { +T elem = static_cast(data)[i]; +if (std::isinf(elem)) { + // C99 standard. + os << (elem < 0 ? "-" : " ") << std::setw(one_element_size_bytes - 1) << "INFINITY"; +} else if (std::isnan(elem)) { + // GNU extension, implemenatation-dependent. + os << std::setw(one_element_size_bytes) << "NAN"; +} else { + ss << elem; + os << std::setw(one_element_size_bytes) << ss.str(); + ss.str(""); +} +if (i < num_elements - 1) { + os << ", "; +} +if (((i + 1) % elements_per_row) == 0) { + os << "\n" << indent_str; +} + } +} + +void NDArrayDataToC(::tvm::runtime::NDArray arr, int indent_chars, std::ostream& os) { + auto arr_type = arr.DataType(); + CHECK_EQ(arr_type.lanes(), 1) << "CodegenParams: only support generating 1-lane parameters; saw " +<< arr_type.lanes(); + + int one_element_size_bytes = (arr_type.bits() / 4) + (2 /* "0x" */) + (2 /* ", " */); + if (arr_type.code() == runtime::DataType::TypeCode::kInt) { +one_element_size_bytes += 1; // sign character +if (arr_type.bits() > 32) { + one_element_size_bytes += 2; // "LL" +} + } else if (arr_type.code() == runtime::DataType::TypeCode::kUInt) { +if (arr_type.bits() > 32) { + one_element_size_bytes += 3; // "ULL" +} + } else if (arr_type.code() == runtime::DataType::TypeCode::kFloat) { +// Floats and doubles are printed as hex but casted. +one_element_size_bytes += 1 /* sign */ + 1 /* decimal point */ + 1 /* exponent sign */ + + 1 /* extra decimal digit in exponent */; + } + + int elements_per_row = 16; + while (elements_per_row > 1 && + (elements_per_row * one_element_size_bytes) > (kMaxLineLength - indent_chars)) { +elements_per_row /= 2; + } + + std::string indent_str(indent_chars, ' '); + os << indent_str; + + auto shape = arr.Shape(); + int num_elements = 1; + for (auto shape_elem : shape) { +num_elements *= shape_elem; + } + + std::unique_ptr tensor(arr.ToDLPack()); + auto old_fmtflags = os.flags(); + os.setf(std::ios::internal | std::ios::hex, + std::ios::adjustfield | std::ios::basefield
[GitHub] [tvm] areusch commented on a change in pull request #6917: Add Relay option to link parameters into runtime Modules
areusch commented on a change in pull request #6917: URL: https://github.com/apache/tvm/pull/6917#discussion_r529907378 ## File path: src/target/llvm/codegen_params.cc ## @@ -0,0 +1,151 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/*! + * \file codegen_params.cc + */ +#ifdef TVM_LLVM_VERSION + +#include "codegen_params.h" + +#include +#include + +namespace tvm { +namespace codegen { + +namespace { +class DLManagedTensorDeleter { + public: + void operator()(DLManagedTensor* ptr) { ptr->deleter(ptr); } +}; +} // namespace + +llvm::ConstantArray* NDArrayToLLVMArray(llvm::LLVMContext* ctx, ::tvm::runtime::NDArray arr) { + llvm::Type* element_type = nullptr; + Review comment: added support for float16 and bfloat16 as discussed. 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: us...@infra.apache.org
[tvm] branch main updated (4ef9bb9 -> 448278d)
This is an automated email from the ASF dual-hosted git repository. tqchen pushed a change to branch main in repository https://gitbox.apache.org/repos/asf/tvm.git. from 4ef9bb9 Raise ImportError for XGBoost (#6969) add 448278d Bug fix for debug builds in micro_session.cc (#6968) No new revisions were added by this update. Summary of changes: src/runtime/micro/micro_session.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
[GitHub] [tvm] tqchen merged pull request #6968: Bug fix for debug builds in micro_session.cc
tqchen merged pull request #6968: URL: https://github.com/apache/tvm/pull/6968 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: us...@infra.apache.org
[tvm] branch main updated (926a315 -> 4ef9bb9)
This is an automated email from the ASF dual-hosted git repository. tqchen pushed a change to branch main in repository https://gitbox.apache.org/repos/asf/tvm.git. from 926a315 [DOCS] Update to reflect the repo name change (#6967) add 4ef9bb9 Raise ImportError for XGBoost (#6969) No new revisions were added by this update. Summary of changes: python/tvm/auto_scheduler/cost_model/xgb_model.py | 2 +- python/tvm/autotvm/tuner/xgboost_cost_model.py| 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
[GitHub] [tvm] tqchen merged pull request #6969: Raise ImportError for XGBoost
tqchen merged pull request #6969: URL: https://github.com/apache/tvm/pull/6969 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: us...@infra.apache.org
[tvm-site] branch asf-site updated: Build at Tue Nov 24 16:29:27 EST 2020
This is an automated email from the ASF dual-hosted git repository. tqchen pushed a commit to branch asf-site in repository https://gitbox.apache.org/repos/asf/tvm-site.git The following commit(s) were added to refs/heads/asf-site by this push: new 7e42623 Build at Tue Nov 24 16:29:27 EST 2020 7e42623 is described below commit 7e426231880f7a58e57d028dabd8dd80e8314bec Author: tqchen AuthorDate: Tue Nov 24 16:29:27 2020 -0500 Build at Tue Nov 24 16:29:27 EST 2020 --- atom.xml | 2 +- download.html | 2 +- feed.xml | 2 +- rss.xml | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/atom.xml b/atom.xml index 4104e9f..752096d 100644 --- a/atom.xml +++ b/atom.xml @@ -4,7 +4,7 @@ TVM https://tvm.apache.org; rel="self"/> https://tvm.apache.org"/> - 2020-11-24T09:08:31-05:00 + 2020-11-24T16:29:25-05:00 https://tvm.apache.org diff --git a/download.html b/download.html index d5e0f35..ea3637d 100644 --- a/download.html +++ b/download.html @@ -142,7 +142,7 @@ Download Apache TVM Source Code These source archives are generated from tagged releases. -For any updates refer to the corresponding branches in the https://github.com/apache/incubator-tvm/;>GitHub repository. +For any updates refer to the corresponding branches in the https://github.com/apache/tvm/;>GitHub repository. Choose your flavor of download from the following links: diff --git a/feed.xml b/feed.xml index c640799..61535b9 100644 --- a/feed.xml +++ b/feed.xml @@ -1,4 +1,4 @@ -http://www.w3.org/2005/Atom; >https://jekyllrb.com/; version="4.1.1">Jekyll2020-11-24T09:08:31-05:00/feed.xmlTVM{name=nil}Bring Your Own Datatypes: Enabling Custom Datatype [...] +http://www.w3.org/2005/Atom; >https://jekyllrb.com/; version="4.1.1">Jekyll2020-11-24T16:29:25-05:00/feed.xmlTVM{name=nil}Bring Your Own Datatypes: Enabling Custom Datatype [...] h2 id=introductionIntroduction/h2 diff --git a/rss.xml b/rss.xml index a638def..6108999 100644 --- a/rss.xml +++ b/rss.xml @@ -5,8 +5,8 @@ TVM - https://tvm.apache.org https://tvm.apache.org; rel="self" type="application/rss+xml" /> -Tue, 24 Nov 2020 09:08:31 -0500 -Tue, 24 Nov 2020 09:08:31 -0500 +Tue, 24 Nov 2020 16:29:25 -0500 +Tue, 24 Nov 2020 16:29:25 -0500 60
[tvm-site] branch main updated: Update link
This is an automated email from the ASF dual-hosted git repository. tqchen pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tvm-site.git The following commit(s) were added to refs/heads/main by this push: new 74be39f Update link 74be39f is described below commit 74be39f2b30a93c43c4638ec7260588e2f95d1d3 Author: tqchen AuthorDate: Tue Nov 24 16:28:48 2020 -0500 Update link --- download.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/download.md b/download.md index a29a2c7..0e8448b 100644 --- a/download.md +++ b/download.md @@ -12,7 +12,7 @@ description: "Download Apache TVM" # Download Apache TVM Source Code These source archives are generated from tagged releases. -For any updates refer to the corresponding branches in the [GitHub repository](https://github.com/apache/incubator-tvm/). +For any updates refer to the corresponding branches in the [GitHub repository](https://github.com/apache/tvm/). Choose your flavor of download from the following links: | Version | Source | PGP | SHA |
[GitHub] [tvm] areusch commented on a change in pull request #6917: Add Relay option to link parameters into runtime Modules
areusch commented on a change in pull request #6917: URL: https://github.com/apache/tvm/pull/6917#discussion_r529873199 ## File path: src/target/source/codegen_c_host.cc ## @@ -57,6 +60,48 @@ void CodeGenCHost::AddFunction(const PrimFunc& f) { CodeGenC::AddFunction(f); } +void CodeGenCHost::LinkParameters(Map params) { + PrintFuncPrefix(); + stream << " " << tvm::runtime::symbol::tvm_lookup_linked_param + << "(void* args, int* arg_type_ids, int num_args, void* out_ret_value, " + << "int* out_ret_tcode, void* resource_handle) {\n"; + ICHECK_EQ(GetUniqueName(tvm::runtime::symbol::tvm_lookup_linked_param), +tvm::runtime::symbol::tvm_lookup_linked_param) + << "builtin PackedFunc name already taken: " << tvm::runtime::symbol::tvm_lookup_linked_param; + stream << "switch (((int64_t*) args)[0]) {\n" + << "default:\n" + << "out_ret_tcode[0] = " << kTVMNullptr << ";\n" + << "return 0;\n"; + + function_names_.emplace_back(tvm::runtime::symbol::tvm_lookup_linked_param); + for (auto kv : params) { +decl_stream << "\n" +<< "#ifdef __cplusplus\n" +<< "extern \"C\" {\n" +<< "#endif\n" +<< "static const "; +int64_t num_elements = 1; +for (int64_t dim : kv.second->param.Shape()) { + num_elements *= dim; +} +PrintType(kv.second->param.DataType(), decl_stream); +decl_stream << " " << ::tvm::runtime::symbol::tvm_param_prefix << kv.first << "[" +<< num_elements << "] = {\n"; +NDArrayDataToC(kv.second->param, 4, decl_stream); +decl_stream << "};\n" +<< "#ifdef __cplusplus\n" +<< "} // extern \"C\"\n" +<< "#endif\n"; +stream << "case " << kv.second->id << ":\n" + << "((uint64_t*)out_ret_value)[0] = (uint64_t) (uintptr_t) " Review comment: correct. ordinarily we would cast to void*, but since void* may be less than 64 bits, we cast to uint64_t which is the largest type stored in TVMValue. 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: us...@infra.apache.org
[GitHub] [tvm-vta] huajsj commented on pull request #15: scripts: update processor core ip version
huajsj commented on pull request #15: URL: https://github.com/apache/tvm-vta/pull/15#issuecomment-733206100 @liangfu @tmoreau89 , could you hep for a review? 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: us...@infra.apache.org
[GitHub] [tvm] rkimball commented on a change in pull request #6961: Fixes #6960 - strncpy destination size warning
rkimball commented on a change in pull request #6961: URL: https://github.com/apache/tvm/pull/6961#discussion_r529838485 ## File path: src/runtime/crt/common/crt_runtime_api.c ## @@ -38,7 +38,7 @@ static char g_last_error[1024]; -void TVMAPISetLastError(const char* msg) { strncpy(g_last_error, msg, sizeof(g_last_error)); } +void TVMAPISetLastError(const char* msg) { strncpy(g_last_error, msg, (sizeof(g_last_error)-1)); } Review comment: This won't null-terminate the string if msg >= g_last_error in size. You can just add g_last_error[sizeof(g_last_error)-1] = 0; to make sure the target string is always null-terminated. 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: us...@infra.apache.org
[GitHub] [tvm-vta] tqchen merged pull request #16: Update to reflect repo name change
tqchen merged pull request #16: URL: https://github.com/apache/tvm-vta/pull/16 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: us...@infra.apache.org
[tvm-vta] branch main updated: Update to reflect repo name change (#16)
This is an automated email from the ASF dual-hosted git repository. tqchen pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tvm-vta.git The following commit(s) were added to refs/heads/main by this push: new ce8efad Update to reflect repo name change (#16) ce8efad is described below commit ce8efad0312b6ab55319f96b9512bcda4b19a234 Author: Tianqi Chen AuthorDate: Tue Nov 24 14:40:45 2020 -0500 Update to reflect repo name change (#16) --- apps/tsim_example/README.md| 2 +- tests/scripts/task_tvm_checkout.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/tsim_example/README.md b/apps/tsim_example/README.md index c1cfae6..f2c4c0a 100644 --- a/apps/tsim_example/README.md +++ b/apps/tsim_example/README.md @@ -62,7 +62,7 @@ https://www.veripool.org/projects/verilator/wiki/Installing ## Setup in TVM 1. Install `verilator` and `sbt` as described above -2. Get tvm `git clone https://github.com/apache/incubator-tvm.git tvm --recursive` +2. Get tvm `git clone https://github.com/apache/tvm.git tvm --recursive` 3. Build [tvm](https://tvm.apache.org/docs/install/from_source.html#build-the-shared-library) ## How to run VTA TSIM examples diff --git a/tests/scripts/task_tvm_checkout.sh b/tests/scripts/task_tvm_checkout.sh index fb6636b..6f2fbdd 100755 --- a/tests/scripts/task_tvm_checkout.sh +++ b/tests/scripts/task_tvm_checkout.sh @@ -21,7 +21,7 @@ set -u if [ ! -d tvm ]; then echo "Checking out TVM" -git clone https://github.com/apache/incubator-tvm tvm +git clone https://github.com/apache/tvm tvm fi cd tvm
[GitHub] [tvm] hypercubestart commented on a change in pull request #6963: [Frontend][Relay][Parser] fix unparsable yolo formals
hypercubestart commented on a change in pull request #6963: URL: https://github.com/apache/tvm/pull/6963#discussion_r529785787 ## File path: tests/python/relay/test_ir_text_printer.py ## @@ -46,6 +48,46 @@ def show(text): print(text) +def get_darknet(model_name): Review comment: We can move it into ./tests/python/frontend/darknet/test_forward.py which I think will also fix the ci-cpu issue Could you elaborate on what you mean by "the same should probably be present in the tutorial"? You may be referring to this one: https://tvm.apache.org/docs/tutorials/frontend/from_darknet.html 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: us...@infra.apache.org
[GitHub] [tvm] areusch commented on a change in pull request #6950: [uTVM] Initial BYOC support with c-source module
areusch commented on a change in pull request #6950: URL: https://github.com/apache/tvm/pull/6950#discussion_r529785970 ## File path: python/tvm/micro/build.py ## @@ -162,7 +158,12 @@ def build_static_runtime( libs.append(compiler.library(lib_build_dir, lib_srcs, lib_opts)) -libs.append(compiler.library(mod_build_dir, [mod_src_path], generated_lib_opts)) +libs.append( Review comment: I agree that we should discuss with an RFC. however, I don't want to break support for GDB debugging with source now. regarding the target_kind attribute--we do need to be a bit careful with those, because they serve as keys to the autotuning logs. I don't know that a debug source directory should be part of identifying an autotuning result. it seems like perhaps `export_library` could just allow you to specify the tempdir as a kwarg? 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: us...@infra.apache.org
[GitHub] [tvm] hypercubestart commented on a change in pull request #6963: [Frontend][Relay][Parser] fix unparsable yolo formals
hypercubestart commented on a change in pull request #6963: URL: https://github.com/apache/tvm/pull/6963#discussion_r529785787 ## File path: tests/python/relay/test_ir_text_printer.py ## @@ -46,6 +48,46 @@ def show(text): print(text) +def get_darknet(model_name): Review comment: I think the test makes more sense here, since we want to test darknet IRModule -> text -> IRModule, and this test file is solely dedicated to this pattern. Could you elaborate on what you mean by "the same should probably be present in the tutorial"? You may be referring to this one: https://tvm.apache.org/docs/tutorials/frontend/from_darknet.html 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: us...@infra.apache.org
[GitHub] [tvm] areusch commented on a change in pull request #6950: [uTVM] Initial BYOC support with c-source module
areusch commented on a change in pull request #6950: URL: https://github.com/apache/tvm/pull/6950#discussion_r529781778 ## File path: src/relay/backend/contrib/codegen_c/codegen_c.h ## @@ -235,14 +289,14 @@ class CodegenCBase { continue; } this->PrintIndents(); - code_stream_ << "std::memcpy(out" << i << ", " << outs[i].name << ", 4 * " << outs[i].size + code_stream_ << "memcpy(out" << i << ", " << outs[i].name << ", 4 * " << outs[i].size Review comment: I think this explicitly avoids use of compiler builtins, which are sometimes perhaps broken? 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: us...@infra.apache.org
[GitHub] [tvm] comaniac opened a new pull request #6969: Raise ImportError for XGBoost
comaniac opened a new pull request #6969: URL: https://github.com/apache/tvm/pull/6969 Based on #6939. 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: us...@infra.apache.org
[GitHub] [tvm] manupa-arm commented on a change in pull request #6950: [uTVM] Initial BYOC support with c-source module
manupa-arm commented on a change in pull request #6950: URL: https://github.com/apache/tvm/pull/6950#discussion_r529395842 ## File path: python/tvm/micro/build.py ## @@ -162,7 +158,12 @@ def build_static_runtime( libs.append(compiler.library(lib_build_dir, lib_srcs, lib_opts)) -libs.append(compiler.library(mod_build_dir, [mod_src_path], generated_lib_opts)) +libs.append( Review comment: No, the export_library will create a temporary directory to save source files and it will not live beyond the scope of the function. So it did not occur to me saving the sources is a feature (I thought it was a side-effect of this flow). Thus, I ll just say what I generally do: use pdb and do get_source to see the c-source created. Anyhow, do we think this would be a user-facing feature ? if so we can do two things : A1 : Traverse module hierarchy and dump the sources here independently of export library, here. A2 : More generally we can introduce an attr to target_kind "c" in the lines of something like "-dbgdir=" and make the export_library to use that directory to dump the intermediary sources. I think A2 would be more generic, but would be beyond the scope of this PR. Thus if people agree, I could just do A1 here for now with a TODO for A2 at some point. What do you think ? 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: us...@infra.apache.org
[GitHub] [tvm] manupa-arm commented on a change in pull request #6950: [uTVM] Initial BYOC support with c-source module
manupa-arm commented on a change in pull request #6950: URL: https://github.com/apache/tvm/pull/6950#discussion_r529751671 ## File path: python/tvm/micro/build.py ## @@ -162,7 +158,12 @@ def build_static_runtime( libs.append(compiler.library(lib_build_dir, lib_srcs, lib_opts)) -libs.append(compiler.library(mod_build_dir, [mod_src_path], generated_lib_opts)) +libs.append( Review comment: In order to satisfy that requirement, we could still make the export_library create the artifacts in a user given workspace directory. Thus, we would not have this split flow of exporting the IRModules in tvm vs utvm and thats what I meant by A2. On other hand of generating projects, I think we should discuss it in a RFC. My personal feeling it should be a layer above the TVM stack (similiar to tvmc) to collect the artifacts produced out of tvm to generate such projects rather than making tvm a project generator. However, I dont have a strong opinion on either. Thoughts ? : @tqchen 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: us...@infra.apache.org
[tvm] branch main updated: [DOCS] Update to reflect the repo name change (#6967)
This is an automated email from the ASF dual-hosted git repository. tqchen pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tvm.git The following commit(s) were added to refs/heads/main by this push: new 926a315 [DOCS] Update to reflect the repo name change (#6967) 926a315 is described below commit 926a3153721882121522deee06e8c67fa1aaf689 Author: Tianqi Chen AuthorDate: Tue Nov 24 12:28:36 2020 -0500 [DOCS] Update to reflect the repo name change (#6967) --- CONTRIBUTORS.md| 2 +- README.md | 4 +- apps/android_deploy/README.md | 4 +- apps/android_rpc/README.md | 6 +- apps/benchmark/README.md | 4 +- apps/microtvm/reference-vm/zephyr/pyproject.toml | 2 +- apps/wasm-standalone/wasm-graph/Cargo.toml | 2 +- apps/wasm-standalone/wasm-runtime/Cargo.toml | 2 +- docker/Dockerfile.demo_android | 2 +- docker/Dockerfile.demo_opencl | 2 +- docker/install/install_tvm_cpu.sh | 2 +- docker/install/install_tvm_gpu.sh | 2 +- docs/conf.py | 10 +- docs/contribute/community.rst | 2 +- docs/contribute/document.rst | 4 +- docs/contribute/release_process.rst| 49 docs/deploy/android.rst| 4 +- docs/deploy/cpp_deploy.rst | 10 +- docs/deploy/index.rst | 2 +- docs/deploy/vitis_ai.rst | 128 ++--- docs/dev/convert_layout.rst| 4 +- docs/dev/frontend/tensorflow.rst | 4 +- docs/dev/inferbound.rst| 8 +- docs/dev/pass_infra.rst| 20 ++-- docs/dev/relay_add_pass.rst| 6 +- docs/dev/relay_bring_your_own_codegen.rst | 2 +- docs/dev/runtime.rst | 22 ++-- docs/dev/virtual_machine.rst | 16 +-- docs/install/docker.rst| 4 +- docs/install/from_source.rst | 2 +- docs/install/nnpack.rst| 2 +- docs/langref/relay_adt.rst | 2 +- docs/langref/relay_pattern.rst | 2 +- docs/vta/install.rst | 4 +- jvm/README.md | 2 +- jvm/pom.xml| 8 +- python/setup.py| 2 +- python/tvm/relay/qnn/op/legalizations.py | 2 +- python/tvm/topi/x86/conv2d.py | 2 +- python/tvm/topi/x86/conv2d_avx_1x1.py | 2 +- rust/tvm-graph-rt/Cargo.toml | 2 +- rust/tvm-macros/Cargo.toml | 2 +- rust/tvm-rt/Cargo.toml | 4 +- rust/tvm-rt/README.md | 2 +- rust/tvm-rt/src/lib.rs | 2 +- rust/tvm-sys/src/context.rs| 2 +- rust/tvm/Cargo.toml| 4 +- rust/tvm/README.md | 4 +- rust/tvm/src/lib.rs| 2 +- src/parser/tokenizer.h | 2 +- tests/python/frontend/tflite/test_forward.py | 2 +- tests/python/relay/test_op_level2.py | 2 +- .../topi/python/test_topi_conv2d_nhwc_pack_int8.py | 2 +- tests/python/topi/python/test_topi_vision.py | 2 +- .../unittest/test_autotvm_graph_tuner_core.py | 2 +- .../unittest/test_autotvm_graph_tuner_utils.py | 2 +- tutorials/autotvm/tune_relay_arm.py| 4 +- tutorials/autotvm/tune_relay_cuda.py | 2 +- tutorials/autotvm/tune_relay_mobile_gpu.py | 4 +- tutorials/dev/bring_your_own_datatypes.py | 4 +- tutorials/dev/use_pass_infra.py| 2 +- tutorials/frontend/deploy_model_on_android.py | 6 +- tutorials/frontend/deploy_model_on_rasp.py | 4 +- tutorials/frontend/from_mxnet.py | 2 +- tutorials/get_started/cross_compilation_and_rpc.py | 2 +- web/README.md | 4 +- 66 files changed, 209 insertions(+), 222 deletions(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 5f01340..650d1bc 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -139,7 +139,7 @@ We do encourage everyone to work anything they are interested in. - [Lianmin Zheng](https://github.com/merrymercy): @merrymercy ## List of Contributors -- [Full List of
[GitHub] [tvm] tqchen merged pull request #6967: [DOCS] Update to reflect the repo name change
tqchen merged pull request #6967: URL: https://github.com/apache/tvm/pull/6967 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: us...@infra.apache.org
[GitHub] [tvm] manupa-arm commented on a change in pull request #6950: [uTVM] Initial BYOC support with c-source module
manupa-arm commented on a change in pull request #6950: URL: https://github.com/apache/tvm/pull/6950#discussion_r529751671 ## File path: python/tvm/micro/build.py ## @@ -162,7 +158,12 @@ def build_static_runtime( libs.append(compiler.library(lib_build_dir, lib_srcs, lib_opts)) -libs.append(compiler.library(mod_build_dir, [mod_src_path], generated_lib_opts)) +libs.append( Review comment: In order to satisfy that requirement, we could still make the export_library create the artifacts in a user given workspace directory. Thus, we would not have this split flow of exporting the IRModules in tvm vs utvm and thats what I meant by A2. On other hand of generating projects, I think we should discuss it in a RFC. My personal feeling it should be a layer above the TVM stack (similiar tvmc) to collect the artifacts produced out of tvm to generate such projects rather than making tvm a project generator. However, I dont have a strong opinion on either. Thoughts ? : @tqchen 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: us...@infra.apache.org
[GitHub] [tvm] manupa-arm commented on a change in pull request #6950: [uTVM] Initial BYOC support with c-source module
manupa-arm commented on a change in pull request #6950: URL: https://github.com/apache/tvm/pull/6950#discussion_r529746674 ## File path: include/tvm/ir/module.h ## @@ -56,11 +56,14 @@ class IRModuleNode : public Object { Map type_definitions; /*! \brief The source map for the module. */ parser::SourceMap source_map; + /*! \brief The names of external functions for func registry */ + Array ext_func_names; Review comment: IIUC, by the time IRModule reaches codegen_c_host (See line 311), all the functions are PrimFunc s. Thus, it will not include the relay external functions that were taken out early in the compilation flow. However, when creating the system-lib those function names should be included in the func registry as they are also sort of "primitive" but externally compiled. 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: us...@infra.apache.org
[GitHub] [tvm] manupa-arm commented on a change in pull request #6917: Add Relay option to link parameters into runtime Modules
manupa-arm commented on a change in pull request #6917: URL: https://github.com/apache/tvm/pull/6917#discussion_r529726938 ## File path: src/target/source/codegen_c_host.cc ## @@ -57,6 +60,48 @@ void CodeGenCHost::AddFunction(const PrimFunc& f) { CodeGenC::AddFunction(f); } +void CodeGenCHost::LinkParameters(Map params) { + PrintFuncPrefix(); + stream << " " << tvm::runtime::symbol::tvm_lookup_linked_param + << "(void* args, int* arg_type_ids, int num_args, void* out_ret_value, " + << "int* out_ret_tcode, void* resource_handle) {\n"; + ICHECK_EQ(GetUniqueName(tvm::runtime::symbol::tvm_lookup_linked_param), +tvm::runtime::symbol::tvm_lookup_linked_param) + << "builtin PackedFunc name already taken: " << tvm::runtime::symbol::tvm_lookup_linked_param; + stream << "switch (((int64_t*) args)[0]) {\n" + << "default:\n" + << "out_ret_tcode[0] = " << kTVMNullptr << ";\n" + << "return 0;\n"; + + function_names_.emplace_back(tvm::runtime::symbol::tvm_lookup_linked_param); + for (auto kv : params) { +decl_stream << "\n" +<< "#ifdef __cplusplus\n" +<< "extern \"C\" {\n" +<< "#endif\n" +<< "static const "; +int64_t num_elements = 1; +for (int64_t dim : kv.second->param.Shape()) { + num_elements *= dim; +} +PrintType(kv.second->param.DataType(), decl_stream); +decl_stream << " " << ::tvm::runtime::symbol::tvm_param_prefix << kv.first << "[" +<< num_elements << "] = {\n"; +NDArrayDataToC(kv.second->param, 4, decl_stream); +decl_stream << "};\n" +<< "#ifdef __cplusplus\n" +<< "} // extern \"C\"\n" +<< "#endif\n"; +stream << "case " << kv.second->id << ":\n" + << "((uint64_t*)out_ret_value)[0] = (uint64_t) (uintptr_t) " Review comment: Oh ok. So kv,first is the array's name, right ? Any reason why is it casted to uint64_t ? 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: us...@infra.apache.org
[GitHub] [tvm] manupa-arm commented on a change in pull request #6917: Add Relay option to link parameters into runtime Modules
manupa-arm commented on a change in pull request #6917: URL: https://github.com/apache/tvm/pull/6917#discussion_r529726938 ## File path: src/target/source/codegen_c_host.cc ## @@ -57,6 +60,48 @@ void CodeGenCHost::AddFunction(const PrimFunc& f) { CodeGenC::AddFunction(f); } +void CodeGenCHost::LinkParameters(Map params) { + PrintFuncPrefix(); + stream << " " << tvm::runtime::symbol::tvm_lookup_linked_param + << "(void* args, int* arg_type_ids, int num_args, void* out_ret_value, " + << "int* out_ret_tcode, void* resource_handle) {\n"; + ICHECK_EQ(GetUniqueName(tvm::runtime::symbol::tvm_lookup_linked_param), +tvm::runtime::symbol::tvm_lookup_linked_param) + << "builtin PackedFunc name already taken: " << tvm::runtime::symbol::tvm_lookup_linked_param; + stream << "switch (((int64_t*) args)[0]) {\n" + << "default:\n" + << "out_ret_tcode[0] = " << kTVMNullptr << ";\n" + << "return 0;\n"; + + function_names_.emplace_back(tvm::runtime::symbol::tvm_lookup_linked_param); + for (auto kv : params) { +decl_stream << "\n" +<< "#ifdef __cplusplus\n" +<< "extern \"C\" {\n" +<< "#endif\n" +<< "static const "; +int64_t num_elements = 1; +for (int64_t dim : kv.second->param.Shape()) { + num_elements *= dim; +} +PrintType(kv.second->param.DataType(), decl_stream); +decl_stream << " " << ::tvm::runtime::symbol::tvm_param_prefix << kv.first << "[" +<< num_elements << "] = {\n"; +NDArrayDataToC(kv.second->param, 4, decl_stream); +decl_stream << "};\n" +<< "#ifdef __cplusplus\n" +<< "} // extern \"C\"\n" +<< "#endif\n"; +stream << "case " << kv.second->id << ":\n" + << "((uint64_t*)out_ret_value)[0] = (uint64_t) (uintptr_t) " Review comment: Oh ok. So kv,first is the array's name, right ? Any reason why is it casted to uint64_t ? Im thinking of a non 64 bit platform usecase. 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: us...@infra.apache.org
[GitHub] [tvm] manupa-arm opened a new pull request #6968: Bug fix for debug builds in micro_session.cc
manupa-arm opened a new pull request #6968: URL: https://github.com/apache/tvm/pull/6968 * kReceiveBufferSizeBytes is declared but not defined (as it is a static constexpr) * If the build decides not to inline kReceiveBufferSizeBytes, we will encounter a linking error. * This was seen as an issue in the Debug builds. Discuss : https://discuss.tvm.apache.org/t/ci-c-standard-for-the-tvm-project/8508/3 cc: @areusch @tqchen 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: us...@infra.apache.org
[GitHub] [tvm] tqchen commented on a change in pull request #6917: Add Relay option to link parameters into runtime Modules
tqchen commented on a change in pull request #6917: URL: https://github.com/apache/tvm/pull/6917#discussion_r529696620 ## File path: src/target/source/codegen_params.cc ## @@ -0,0 +1,218 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/*! + * \file codegen_params.cc + */ + +#include "codegen_params.h" + +#include + +#include +#include +#include +#include + +namespace tvm { +namespace codegen { + +namespace { +class DLManagedTensorDeleter { + public: + void operator()(DLManagedTensor* ptr) { ptr->deleter(ptr); } +}; +} // namespace + +static constexpr const int kMaxLineLength = 80; + +template ::value>> +void PrintArray(void* data, size_t num_elements, int elements_per_row, std::string indent_str, +std::ostream& os) { + for (size_t i = 0; i < num_elements; i++) { +int64_t elem = static_cast(data)[i]; +if (std::is_signed::value) { + uint64_t to_print; + if (elem < 0) { +os << "-"; +to_print = -elem; + } else { +os << "+"; +to_print = elem; + } + os << "0x" << std::setw(sizeof(T) * 8 / 4) << static_cast(to_print); +} else { + os << "0x" << std::setw(sizeof(T) * 8 / 4) << static_cast(elem); +} +if (i < num_elements - 1) { + os << ", "; +} +if (((i + 1) % elements_per_row) == 0) { + os << "\n" << indent_str; +} + } +} + +template ::value>> +void PrintArray(void* data, size_t num_elements, int one_element_size_bytes, int elements_per_row, +std::string indent_str, std::ostream& os) { + std::stringstream ss; + if (std::is_signed::value) { +ss.setf(std::ios::hex | std::ios::showbase | std::ios::fixed | std::ios::scientific, +std::ios::basefield | std::ios::showbase | std::ios::floatfield); + } else { +ss.setf(std::ios::hex | std::ios::fixed | std::ios::scientific, +std::ios::basefield | std::ios::showbase | std::ios::floatfield); + } + for (size_t i = 0; i < num_elements; i++) { +T elem = static_cast(data)[i]; +if (std::isinf(elem)) { + // C99 standard. + os << (elem < 0 ? "-" : " ") << std::setw(one_element_size_bytes - 1) << "INFINITY"; +} else if (std::isnan(elem)) { + // GNU extension, implemenatation-dependent. + os << std::setw(one_element_size_bytes) << "NAN"; +} else { + ss << elem; + os << std::setw(one_element_size_bytes) << ss.str(); + ss.str(""); +} +if (i < num_elements - 1) { + os << ", "; +} +if (((i + 1) % elements_per_row) == 0) { + os << "\n" << indent_str; +} + } +} + +void NDArrayDataToC(::tvm::runtime::NDArray arr, int indent_chars, std::ostream& os) { + auto arr_type = arr.DataType(); + CHECK_EQ(arr_type.lanes(), 1) << "CodegenParams: only support generating 1-lane parameters; saw " +<< arr_type.lanes(); + + int one_element_size_bytes = (arr_type.bits() / 4) + (2 /* "0x" */) + (2 /* ", " */); + if (arr_type.code() == runtime::DataType::TypeCode::kInt) { +one_element_size_bytes += 1; // sign character +if (arr_type.bits() > 32) { + one_element_size_bytes += 2; // "LL" +} + } else if (arr_type.code() == runtime::DataType::TypeCode::kUInt) { +if (arr_type.bits() > 32) { + one_element_size_bytes += 3; // "ULL" +} + } else if (arr_type.code() == runtime::DataType::TypeCode::kFloat) { +// Floats and doubles are printed as hex but casted. +one_element_size_bytes += 1 /* sign */ + 1 /* decimal point */ + 1 /* exponent sign */; +if (arr_type.bits() == 64) { + one_element_size_bytes += 2; /* 4 decimal digits in exponent, relative to bits / 4 */ +} else if (arr_type.bits() == 32) { + one_element_size_bytes += 1; /* extra decimal digit in exponent, relative to bits / 4 */ +} + } + + int elements_per_row = 16; + while (elements_per_row > 1 && + (elements_per_row * one_element_size_bytes) > (kMaxLineLength - indent_chars)) { +elements_per_row /= 2; + } + + std::string indent_str(indent_chars, ' '); + os << indent_str; + + auto shape = arr.Shape(); + int num_elements = 1; + for (auto shape_elem : shape) { +num_elements *=
[GitHub] [tvm] areusch commented on a change in pull request #6950: [uTVM] Initial BYOC support with c-source module
areusch commented on a change in pull request #6950: URL: https://github.com/apache/tvm/pull/6950#discussion_r529707962 ## File path: python/tvm/micro/build.py ## @@ -162,7 +158,12 @@ def build_static_runtime( libs.append(compiler.library(lib_build_dir, lib_srcs, lib_opts)) -libs.append(compiler.library(mod_build_dir, [mod_src_path], generated_lib_opts)) +libs.append( Review comment: I think in the future we should consider generating full projects (I.e. zephyr projects) at which point we should have a defined way to describe module and library sources to the generators. saving generated code to the workspace tree means that (if the Workspace is operating with debug=True, you get source included in your debugger. that can come in handy when the thing causing a CHECK-fail is memory overflow from a TVMBackendAllocWorkspace inside an operator function. So I think we want A1 but we also want to compile the library from the user-accessible source files. 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: us...@infra.apache.org
[GitHub] [tvm] zhiics commented on a change in pull request #6950: [uTVM] Initial BYOC support with c-source module
zhiics commented on a change in pull request #6950: URL: https://github.com/apache/tvm/pull/6950#discussion_r529679545 ## File path: include/tvm/ir/module.h ## @@ -56,11 +56,14 @@ class IRModuleNode : public Object { Map type_definitions; /*! \brief The source map for the module. */ parser::SourceMap source_map; + /*! \brief The names of external functions for func registry */ + Array ext_func_names; Review comment: why is this needed? I think external functions should be able to get from the IRModule as well. 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: us...@infra.apache.org
[GitHub] [tvm] mbaret commented on a change in pull request #6655: [BYOC] Added "include_non_call_ops" parameter to AnnotateTarget pass
mbaret commented on a change in pull request #6655: URL: https://github.com/apache/tvm/pull/6655#discussion_r529678285 ## File path: src/relay/transforms/annotate_target.cc ## @@ -61,20 +67,27 @@ class AnnotateTargetRewriter : public ExprRewriter { std::pair> AnnotateArgs(const Array& args, const std::string& target = "") { std::string ref_target = ""; +Array compiler_begins; Array compiler_ends; for (auto arg : args) { - std::string arg_target = "default"; + std::string arg_target = default_target; const CallNode* call = arg.as(); if (call && call->op == CompilerBeginOp()) { // Argument is already compiler begin node meaning that this is not the first time // running this pass, so we simply remove it and will add a new one later. ICHECK_EQ(call->args.size(), 1U); +// Do not alter existing annotation if not default +if (default_target != call->attrs.as()->compiler) { + compiler_begins.push_back(arg); +} else { + // Remove default + compiler_ends.push_back(call->args[0]); +} Review comment: I think we need to separate the (valid) concerns about the design and overall maintainability of AnnotateTarget from the intention of this PR. Currently, we have user facing errors with ACL because of this tuple annotation bug and so I think our first priority should be merging something which fixes that. We can discuss possible refactors/redesigns of AnnotateTarget separately with an RFC on the forum where more people can see it and participate. 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: us...@infra.apache.org
[GitHub] [tvm] zhiics commented on a change in pull request #6963: [Frontend][Relay][Parser] fix unparsable yolo formals
zhiics commented on a change in pull request #6963: URL: https://github.com/apache/tvm/pull/6963#discussion_r529674782 ## File path: tests/python/relay/test_ir_text_printer.py ## @@ -46,6 +48,46 @@ def show(text): print(text) +def get_darknet(model_name): Review comment: BTW, we have a darknet parser. We may want to move the test there. I remember we have yolov3 tutorial as well. Should the same probably be present in the tutorial? 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: us...@infra.apache.org
[GitHub] [tvm] areusch commented on a change in pull request #6917: Add Relay option to link parameters into runtime Modules
areusch commented on a change in pull request #6917: URL: https://github.com/apache/tvm/pull/6917#discussion_r529663829 ## File path: src/target/source/codegen_params.cc ## @@ -0,0 +1,218 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/*! + * \file codegen_params.cc + */ + +#include "codegen_params.h" + +#include + +#include +#include +#include +#include + +namespace tvm { +namespace codegen { + +namespace { +class DLManagedTensorDeleter { + public: + void operator()(DLManagedTensor* ptr) { ptr->deleter(ptr); } +}; +} // namespace + +static constexpr const int kMaxLineLength = 80; + +template ::value>> +void PrintArray(void* data, size_t num_elements, int elements_per_row, std::string indent_str, +std::ostream& os) { + for (size_t i = 0; i < num_elements; i++) { +int64_t elem = static_cast(data)[i]; +if (std::is_signed::value) { + uint64_t to_print; + if (elem < 0) { +os << "-"; +to_print = -elem; + } else { +os << "+"; +to_print = elem; + } + os << "0x" << std::setw(sizeof(T) * 8 / 4) << static_cast(to_print); +} else { + os << "0x" << std::setw(sizeof(T) * 8 / 4) << static_cast(elem); +} +if (i < num_elements - 1) { + os << ", "; +} +if (((i + 1) % elements_per_row) == 0) { + os << "\n" << indent_str; +} + } +} + +template ::value>> +void PrintArray(void* data, size_t num_elements, int one_element_size_bytes, int elements_per_row, +std::string indent_str, std::ostream& os) { + std::stringstream ss; + if (std::is_signed::value) { +ss.setf(std::ios::hex | std::ios::showbase | std::ios::fixed | std::ios::scientific, +std::ios::basefield | std::ios::showbase | std::ios::floatfield); + } else { +ss.setf(std::ios::hex | std::ios::fixed | std::ios::scientific, +std::ios::basefield | std::ios::showbase | std::ios::floatfield); + } + for (size_t i = 0; i < num_elements; i++) { +T elem = static_cast(data)[i]; +if (std::isinf(elem)) { + // C99 standard. + os << (elem < 0 ? "-" : " ") << std::setw(one_element_size_bytes - 1) << "INFINITY"; +} else if (std::isnan(elem)) { + // GNU extension, implemenatation-dependent. + os << std::setw(one_element_size_bytes) << "NAN"; +} else { + ss << elem; + os << std::setw(one_element_size_bytes) << ss.str(); + ss.str(""); +} +if (i < num_elements - 1) { + os << ", "; +} +if (((i + 1) % elements_per_row) == 0) { + os << "\n" << indent_str; +} + } +} + +void NDArrayDataToC(::tvm::runtime::NDArray arr, int indent_chars, std::ostream& os) { Review comment: we could. the main thing this drags in is whether we should be determining things like the byte order and alignment of the target machine, or leave that to the compiler (LLVM or in this case, external C). i've been so far arguing not to do any of this--I don't really see a tangible benefit and it adds considerable complexity at this level that's hard to test. also, it makes it quite easy to inspect the generated parameters, which will often differ from the parameters originally supplied to relay.build(). 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: us...@infra.apache.org
[GitHub] [tvm] areusch commented on a change in pull request #6917: Add Relay option to link parameters into runtime Modules
areusch commented on a change in pull request #6917: URL: https://github.com/apache/tvm/pull/6917#discussion_r529660813 ## File path: src/target/source/codegen_c_host.cc ## @@ -57,6 +60,48 @@ void CodeGenCHost::AddFunction(const PrimFunc& f) { CodeGenC::AddFunction(f); } +void CodeGenCHost::LinkParameters(Map params) { + PrintFuncPrefix(); + stream << " " << tvm::runtime::symbol::tvm_lookup_linked_param + << "(void* args, int* arg_type_ids, int num_args, void* out_ret_value, " + << "int* out_ret_tcode, void* resource_handle) {\n"; + ICHECK_EQ(GetUniqueName(tvm::runtime::symbol::tvm_lookup_linked_param), +tvm::runtime::symbol::tvm_lookup_linked_param) + << "builtin PackedFunc name already taken: " << tvm::runtime::symbol::tvm_lookup_linked_param; + stream << "switch (((int64_t*) args)[0]) {\n" + << "default:\n" + << "out_ret_tcode[0] = " << kTVMNullptr << ";\n" + << "return 0;\n"; + + function_names_.emplace_back(tvm::runtime::symbol::tvm_lookup_linked_param); + for (auto kv : params) { +decl_stream << "\n" +<< "#ifdef __cplusplus\n" +<< "extern \"C\" {\n" +<< "#endif\n" +<< "static const "; +int64_t num_elements = 1; +for (int64_t dim : kv.second->param.Shape()) { + num_elements *= dim; +} +PrintType(kv.second->param.DataType(), decl_stream); +decl_stream << " " << ::tvm::runtime::symbol::tvm_param_prefix << kv.first << "[" +<< num_elements << "] = {\n"; +NDArrayDataToC(kv.second->param, 4, decl_stream); +decl_stream << "};\n" +<< "#ifdef __cplusplus\n" +<< "} // extern \"C\"\n" +<< "#endif\n"; +stream << "case " << kv.second->id << ":\n" + << "((uint64_t*)out_ret_value)[0] = (uint64_t) (uintptr_t) " Review comment: it's just copying the pointer here. I believe that should be ok? 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: us...@infra.apache.org
[GitHub] [tvm] areusch commented on a change in pull request #6917: Add Relay option to link parameters into runtime Modules
areusch commented on a change in pull request #6917: URL: https://github.com/apache/tvm/pull/6917#discussion_r529659051 ## File path: src/target/source/codegen_c_host.cc ## @@ -57,6 +60,48 @@ void CodeGenCHost::AddFunction(const PrimFunc& f) { CodeGenC::AddFunction(f); } +void CodeGenCHost::LinkParameters(Map params) { + PrintFuncPrefix(); + stream << " " << tvm::runtime::symbol::tvm_lookup_linked_param + << "(void* args, int* arg_type_ids, int num_args, void* out_ret_value, " + << "int* out_ret_tcode, void* resource_handle) {\n"; + ICHECK_EQ(GetUniqueName(tvm::runtime::symbol::tvm_lookup_linked_param), +tvm::runtime::symbol::tvm_lookup_linked_param) + << "builtin PackedFunc name already taken: " << tvm::runtime::symbol::tvm_lookup_linked_param; + stream << "switch (((int64_t*) args)[0]) {\n" + << "default:\n" + << "out_ret_tcode[0] = " << kTVMNullptr << ";\n" + << "return 0;\n"; + + function_names_.emplace_back(tvm::runtime::symbol::tvm_lookup_linked_param); + for (auto kv : params) { +decl_stream << "\n" +<< "#ifdef __cplusplus\n" +<< "extern \"C\" {\n" +<< "#endif\n" +<< "static const "; +int64_t num_elements = 1; +for (int64_t dim : kv.second->param.Shape()) { + num_elements *= dim; +} +PrintType(kv.second->param.DataType(), decl_stream); +decl_stream << " " << ::tvm::runtime::symbol::tvm_param_prefix << kv.first << "[" +<< num_elements << "] = {\n"; +NDArrayDataToC(kv.second->param, 4, decl_stream); +decl_stream << "};\n" +<< "#ifdef __cplusplus\n" +<< "} // extern \"C\"\n" +<< "#endif\n"; +stream << "case " << kv.second->id << ":\n" + << "((uint64_t*)out_ret_value)[0] = (uint64_t) (uintptr_t) " + << ::tvm::runtime::symbol::tvm_param_prefix << kv.first << ";\n" + << "out_ret_tcode[0] = " << kTVMOpaqueHandle << ";\n" + << "return 0;\n"; Review comment: it would be nice to return a specific error code here (this was my original implementation), but unfortunately it's not easy to catch on the other side. we need to do a bit more legwork to be able to catch specific function return values in c++/python. as it stands, returning nullptr from this function is specific enough, and has the benefit that an exception flow isn't triggered by default for non-parameters. 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: us...@infra.apache.org
[tvm] branch main updated (28b1577 -> 0c92772)
This is an automated email from the ASF dual-hosted git repository. tqchen pushed a change to branch main in repository https://gitbox.apache.org/repos/asf/tvm.git. from 28b1577 [AutoScheduler] Fix task extraction (#6965) add 0c92772 Fix #6954 uTVM, fix when building the runtime for native hardware (#6957) No new revisions were added by this update. Summary of changes: python/tvm/micro/compiler.py | 4 +++- python/tvm/target/target.py | 2 +- src/target/target_kind.cc| 1 + 3 files changed, 5 insertions(+), 2 deletions(-)
[GitHub] [tvm] tqchen commented on pull request #6957: Fix #6954 uTVM, fix when building the runtime for native hardware
tqchen commented on pull request #6957: URL: https://github.com/apache/tvm/pull/6957#issuecomment-733025238 Thanks @tom-gall ! 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: us...@infra.apache.org
[GitHub] [tvm] tqchen merged pull request #6957: Fix #6954 uTVM, fix when building the runtime for native hardware
tqchen merged pull request #6957: URL: https://github.com/apache/tvm/pull/6957 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: us...@infra.apache.org
[GitHub] [tvm] tqchen closed issue #6954: uTVM fails to build runtime for Arm Target
tqchen closed issue #6954: URL: https://github.com/apache/tvm/issues/6954 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: us...@infra.apache.org
[GitHub] [tvm] giuseros commented on a change in pull request #6949: [TF frontend] add support for StridedSlice to input a single constant
giuseros commented on a change in pull request #6949: URL: https://github.com/apache/tvm/pull/6949#discussion_r529593591 ## File path: python/tvm/relay/frontend/tensorflow.py ## @@ -1599,6 +1599,9 @@ def _impl(inputs, attr, params, mod): data_shape = get_const_tuple(in_type.checked_type.shape) data_dim = len(data_shape) stride_dim = len(stride) +if data_dim == 0 and isinstance(inputs[0], _expr.Constant): Review comment: Cool, I didn't know that! I would still add a test to show when this situation arises (just to make sure that branch is covered). What do you think? 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: us...@infra.apache.org
svn commit: r44665 - in /dev/tvm: KEYS tvm/
Author: tqchen Date: Tue Nov 24 14:30:39 2020 New Revision: 44665 Log: Update Added: dev/tvm/KEYS - copied unchanged from r44664, dev/tvm/tvm/KEYS Removed: dev/tvm/tvm/
[GitHub] [tvm-vta] tqchen opened a new pull request #16: Update to reflect repo name change
tqchen opened a new pull request #16: URL: https://github.com/apache/tvm-vta/pull/16 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: us...@infra.apache.org
[GitHub] [tvm] tqchen opened a new pull request #6967: [DOCS] Update to reflect the repo name change
tqchen opened a new pull request #6967: URL: https://github.com/apache/tvm/pull/6967 cc @yzhliu @zhiics @tmoreau89 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: us...@infra.apache.org
[tvm-site] 01/03: prep for tlp
This is an automated email from the ASF dual-hosted git repository. tqchen pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tvm-site.git commit b869489fb79c319f6196dada0242f75014111ad2 Author: tqchen AuthorDate: Thu Nov 19 20:23:42 2020 -0500 prep for tlp --- _includes/header_index.html | 4 ++-- _layouts/default.html | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/_includes/header_index.html b/_includes/header_index.html index f68a7fd..f22abdc 100644 --- a/_includes/header_index.html +++ b/_includes/header_index.html @@ -5,12 +5,12 @@ -Apache TVM (incubating) +Apache TVM An End to End Deep Learning Compiler Stack for CPUs, GPUs and accelerators Learn More -Apache TVM (incubating) is an open source deep learning compiler stack for CPUs, +Apache TVM is an open source deep learning compiler stack for CPUs, GPUs, and machine learning accelerators. It aims to enable machine learning engineers to optimize and run computations efficiently on any hardware backend. diff --git a/_layouts/default.html b/_layouts/default.html index af1ac92..0d04a55 100644 --- a/_layouts/default.html +++ b/_layouts/default.html @@ -42,7 +42,8 @@ -Apache TVM is an effort undergoing incubation at The Apache Software Foundation (ASF), sponsored by the Apache Incubator. Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and decision making process have stabilized in a manner consistent with other successful ASF projects. While incubation status is not necessarily a reflection of the completeness or stability of the code, it does in [...] + + Copyright © 2020 The Apache Software Foundation. Apache TVM, Apache, the Apache feather, and the Apache TVM project logo are either trademarks or registered trademarks of the Apache Software Foundation.
[tvm-site] 03/03: Update download
This is an automated email from the ASF dual-hosted git repository. tqchen pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tvm-site.git commit 0dd2485ce0a0ef2bf58d4d498648504bf5e755cc Author: tqchen AuthorDate: Tue Nov 24 09:08:19 2020 -0500 Update download --- download.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/download.md b/download.md index d508d51..a29a2c7 100644 --- a/download.md +++ b/download.md @@ -17,9 +17,9 @@ Choose your flavor of download from the following links: | Version | Source | PGP | SHA | | --- | -- | --- | --- | -| 0.7.0 | [apache-tvm-src-v0.7.0-incubating.tar.gz](https://dist.apache.org/repos/dist/release/incubator/tvm/tvm-v0.7.0/apache-tvm-src-v0.7.0-incubating.tar.gz) | [.asc](https://dist.apache.org/repos/dist/release/incubator/tvm/tvm-v0.7.0/apache-tvm-src-v0.7.0-incubating.tar.gz.asc) | [.sha512](https://dist.apache.org/repos/dist/release/incubator/tvm/tvm-v0.7.0/apache-tvm-src-v0.7.0-incubating.tar.gz.sha512) | -| 0.6.1 | [apache-tvm-src-v0.6.1-incubating.tar.gz](https://dist.apache.org/repos/dist/release/incubator/tvm/tvm-v0.6.1/apache-tvm-src-v0.6.1-incubating.tar.gz) | [.asc](https://dist.apache.org/repos/dist/release/incubator/tvm/tvm-v0.6.1/apache-tvm-src-v0.6.1-incubating.tar.gz.asc) | [.sha512](https://dist.apache.org/repos/dist/release/incubator/tvm/tvm-v0.6.1/apache-tvm-src-v0.6.1-incubating.tar.gz.sha512) | -| 0.6.0 | [apache-tvm-src-v0.6.0-incubating.tar.gz](https://dist.apache.org/repos/dist/release/incubator/tvm/tvm-v0.6.0/apache-tvm-src-v0.6.0-incubating.tar.gz) | [.asc](https://dist.apache.org/repos/dist/release/incubator/tvm/tvm-v0.6.0/apache-tvm-src-v0.6.0-incubating.tar.gz.asc) | [.sha512](https://dist.apache.org/repos/dist/release/incubator/tvm/tvm-v0.6.0/apache-tvm-src-v0.6.0-incubating.tar.gz.sha512) | +| 0.7.0 | [apache-tvm-src-v0.7.0-incubating.tar.gz](https://dist.apache.org/repos/dist/release/tvm/tvm-v0.7.0/apache-tvm-src-v0.7.0-incubating.tar.gz) | [.asc](https://dist.apache.org/repos/dist/release/tvm/tvm-v0.7.0/apache-tvm-src-v0.7.0-incubating.tar.gz.asc) | [.sha512](https://dist.apache.org/repos/dist/release/tvm/tvm-v0.7.0/apache-tvm-src-v0.7.0-incubating.tar.gz.sha512) | +| 0.6.1 | [apache-tvm-src-v0.6.1-incubating.tar.gz](https://dist.apache.org/repos/dist/release/tvm/tvm-v0.6.1/apache-tvm-src-v0.6.1-incubating.tar.gz) | [.asc](https://dist.apache.org/repos/dist/release/tvm/tvm-v0.6.1/apache-tvm-src-v0.6.1-incubating.tar.gz.asc) | [.sha512](https://dist.apache.org/repos/dist/release/tvm/tvm-v0.6.1/apache-tvm-src-v0.6.1-incubating.tar.gz.sha512) | +| 0.6.0 | [apache-tvm-src-v0.6.0-incubating.tar.gz](https://dist.apache.org/repos/dist/release/tvm/tvm-v0.6.0/apache-tvm-src-v0.6.0-incubating.tar.gz) | [.asc](https://dist.apache.org/repos/dist/release/tvm/tvm-v0.6.0/apache-tvm-src-v0.6.0-incubating.tar.gz.asc) | [.sha512](https://dist.apache.org/repos/dist/release/tvm/tvm-v0.6.0/apache-tvm-src-v0.6.0-incubating.tar.gz.sha512) |
[tvm-site] 02/03: Update download link
This is an automated email from the ASF dual-hosted git repository. tqchen pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tvm-site.git commit 1a24f47c2616fbb2c48b18a8d887e709fb9b719c Author: tqchen AuthorDate: Thu Nov 19 20:33:45 2020 -0500 Update download link --- download.md | 9 - 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/download.md b/download.md index 6a96589..d508d51 100644 --- a/download.md +++ b/download.md @@ -17,9 +17,9 @@ Choose your flavor of download from the following links: | Version | Source | PGP | SHA | | --- | -- | --- | --- | -| 0.7.0 | [apache-tvm-src-v0.7.0-incubating.tar.gz](https://dist.apache.org/repos/dist/release/incubator/tvm/tvm-v0.7.0/apache-tvm-src-v0.7.0-incubating.tar.gz) | [.asc](https://dist.apache.org/repos/dist/release/incubator/tvm/tvm-v0.7.0/apache-tvm-src-v0.7.0-incubating.tar.gz.asc) | [.sha512](https://dist.apache.org/repos/dist/release/incubator/tvm/tvm-v0.7.0/apache-tvm-src-v0.7.0-incubating.tar.gz.sha512) | -| 0.6.1 | [apache-tvm-src-v0.6.1-incubating.tar.gz](https://dist.apache.org/repos/dist/release/incubator/tvm/tvm-v0.6.1/apache-tvm-src-v0.6.1-incubating.tar.gz) | [.asc](https://dist.apache.org/repos/dist/release/incubator/tvm/tvm-v0.6.1/apache-tvm-src-v0.6.1-incubating.tar.gz.asc) | [.sha512](https://dist.apache.org/repos/dist/release/incubator/tvm/tvm-v0.6.1/apache-tvm-src-v0.6.1-incubating.tar.gz.sha512) | -| 0.6.0 | [apache-tvm-src-v0.6.0-incubating.tar.gz](https://dist.apache.org/repos/dist/release/incubator/tvm/tvm-v0.6.0/apache-tvm-src-v0.6.0-incubating.tar.gz) | [.asc](https://dist.apache.org/repos/dist/release/incubator/tvm/tvm-v0.6.0/apache-tvm-src-v0.6.0-incubating.tar.gz.asc) | [.sha512](https://dist.apache.org/repos/dist/release/incubator/tvm/tvm-v0.6.0/apache-tvm-src-v0.6.0-incubating.tar.gz.sha512) | +| 0.7.0 | [apache-tvm-src-v0.7.0-incubating.tar.gz](https://dist.apache.org/repos/dist/release/incubator/tvm/tvm-v0.7.0/apache-tvm-src-v0.7.0-incubating.tar.gz) | [.asc](https://dist.apache.org/repos/dist/release/incubator/tvm/tvm-v0.7.0/apache-tvm-src-v0.7.0-incubating.tar.gz.asc) | [.sha512](https://dist.apache.org/repos/dist/release/incubator/tvm/tvm-v0.7.0/apache-tvm-src-v0.7.0-incubating.tar.gz.sha512) | +| 0.6.1 | [apache-tvm-src-v0.6.1-incubating.tar.gz](https://dist.apache.org/repos/dist/release/incubator/tvm/tvm-v0.6.1/apache-tvm-src-v0.6.1-incubating.tar.gz) | [.asc](https://dist.apache.org/repos/dist/release/incubator/tvm/tvm-v0.6.1/apache-tvm-src-v0.6.1-incubating.tar.gz.asc) | [.sha512](https://dist.apache.org/repos/dist/release/incubator/tvm/tvm-v0.6.1/apache-tvm-src-v0.6.1-incubating.tar.gz.sha512) | +| 0.6.0 | [apache-tvm-src-v0.6.0-incubating.tar.gz](https://dist.apache.org/repos/dist/release/incubator/tvm/tvm-v0.6.0/apache-tvm-src-v0.6.0-incubating.tar.gz) | [.asc](https://dist.apache.org/repos/dist/release/incubator/tvm/tvm-v0.6.0/apache-tvm-src-v0.6.0-incubating.tar.gz.asc) | [.sha512](https://dist.apache.org/repos/dist/release/incubator/tvm/tvm-v0.6.0/apache-tvm-src-v0.6.0-incubating.tar.gz.sha512) | @@ -28,7 +28,7 @@ Choose your flavor of download from the following links: It is essential that you verify the integrity of the downloaded file using the PGP signature (.asc file) or a hash (.md5 or .sha file). Please read [Verifying Apache Software Foundation Releases](https://www.apache.org/info/verification.html) for more information on why you should verify our releases. -The PGP signature can be verified using PGP or GPG. First download the [KEYS](https://downloads.apache.org/incubator/tvm/KEYS) as well as the .asc signature file for the relevant distribution. Make sure you get these files from the main distribution site, rather than from a mirror. Then verify the signatures using one of the following alternatives: +The PGP signature can be verified using PGP or GPG. First download the [KEYS](https://downloads.apache.org/tvm/KEYS) as well as the .asc signature file for the relevant distribution. Make sure you get these files from the main distribution site, rather than from a mirror. Then verify the signatures using one of the following alternatives: ```bash $ gpg --import KEYS @@ -62,4 +62,3 @@ $ certUtil -hashfile pathToFileToCheck ``` Unix-like systems (and macOS) will have a utility called `md5`, `md5sum` or `shasum`. -
[tvm-site] branch main updated (d42aba8 -> 0dd2485)
This is an automated email from the ASF dual-hosted git repository. tqchen pushed a change to branch main in repository https://gitbox.apache.org/repos/asf/tvm-site.git. from d42aba8 Fix new b869489 prep for tlp new 1a24f47 Update download link new 0dd2485 Update download The 3 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: _includes/header_index.html | 4 ++-- _layouts/default.html | 3 ++- download.md | 9 - 3 files changed, 8 insertions(+), 8 deletions(-)
[tvm-site] branch asf-site updated: Build at Tue Nov 24 09:08:43 EST 2020
This is an automated email from the ASF dual-hosted git repository. tqchen pushed a commit to branch asf-site in repository https://gitbox.apache.org/repos/asf/tvm-site.git The following commit(s) were added to refs/heads/asf-site by this push: new 087edc2 Build at Tue Nov 24 09:08:43 EST 2020 087edc2 is described below commit 087edc2f95f20bdcf16ffe9bcbb0737e129abe49 Author: tqchen AuthorDate: Tue Nov 24 09:08:43 2020 -0500 Build at Tue Nov 24 09:08:43 EST 2020 --- atom.xml | 2 +- download.html | 18 +- feed.xml | 2 +- rss.xml | 4 ++-- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/atom.xml b/atom.xml index 95fb71d..4104e9f 100644 --- a/atom.xml +++ b/atom.xml @@ -4,7 +4,7 @@ TVM https://tvm.apache.org; rel="self"/> https://tvm.apache.org"/> - 2020-11-19T20:33:51-05:00 + 2020-11-24T09:08:31-05:00 https://tvm.apache.org diff --git a/download.html b/download.html index 5d24822..d5e0f35 100644 --- a/download.html +++ b/download.html @@ -157,21 +157,21 @@ Choose your flavor of download from the following links: 0.7.0 - https://dist.apache.org/repos/dist/release/incubator/tvm/tvm-v0.7.0/apache-tvm-src-v0.7.0-incubating.tar.gz;>apache-tvm-src-v0.7.0-incubating.tar.gz - https://dist.apache.org/repos/dist/release/incubator/tvm/tvm-v0.7.0/apache-tvm-src-v0.7.0-incubating.tar.gz.asc;>.asc - https://dist.apache.org/repos/dist/release/incubator/tvm/tvm-v0.7.0/apache-tvm-src-v0.7.0-incubating.tar.gz.sha512;>.sha512 + https://dist.apache.org/repos/dist/release/tvm/tvm-v0.7.0/apache-tvm-src-v0.7.0-incubating.tar.gz;>apache-tvm-src-v0.7.0-incubating.tar.gz + https://dist.apache.org/repos/dist/release/tvm/tvm-v0.7.0/apache-tvm-src-v0.7.0-incubating.tar.gz.asc;>.asc + https://dist.apache.org/repos/dist/release/tvm/tvm-v0.7.0/apache-tvm-src-v0.7.0-incubating.tar.gz.sha512;>.sha512 0.6.1 - https://dist.apache.org/repos/dist/release/incubator/tvm/tvm-v0.6.1/apache-tvm-src-v0.6.1-incubating.tar.gz;>apache-tvm-src-v0.6.1-incubating.tar.gz - https://dist.apache.org/repos/dist/release/incubator/tvm/tvm-v0.6.1/apache-tvm-src-v0.6.1-incubating.tar.gz.asc;>.asc - https://dist.apache.org/repos/dist/release/incubator/tvm/tvm-v0.6.1/apache-tvm-src-v0.6.1-incubating.tar.gz.sha512;>.sha512 + https://dist.apache.org/repos/dist/release/tvm/tvm-v0.6.1/apache-tvm-src-v0.6.1-incubating.tar.gz;>apache-tvm-src-v0.6.1-incubating.tar.gz + https://dist.apache.org/repos/dist/release/tvm/tvm-v0.6.1/apache-tvm-src-v0.6.1-incubating.tar.gz.asc;>.asc + https://dist.apache.org/repos/dist/release/tvm/tvm-v0.6.1/apache-tvm-src-v0.6.1-incubating.tar.gz.sha512;>.sha512 0.6.0 - https://dist.apache.org/repos/dist/release/incubator/tvm/tvm-v0.6.0/apache-tvm-src-v0.6.0-incubating.tar.gz;>apache-tvm-src-v0.6.0-incubating.tar.gz - https://dist.apache.org/repos/dist/release/incubator/tvm/tvm-v0.6.0/apache-tvm-src-v0.6.0-incubating.tar.gz.asc;>.asc - https://dist.apache.org/repos/dist/release/incubator/tvm/tvm-v0.6.0/apache-tvm-src-v0.6.0-incubating.tar.gz.sha512;>.sha512 + https://dist.apache.org/repos/dist/release/tvm/tvm-v0.6.0/apache-tvm-src-v0.6.0-incubating.tar.gz;>apache-tvm-src-v0.6.0-incubating.tar.gz + https://dist.apache.org/repos/dist/release/tvm/tvm-v0.6.0/apache-tvm-src-v0.6.0-incubating.tar.gz.asc;>.asc + https://dist.apache.org/repos/dist/release/tvm/tvm-v0.6.0/apache-tvm-src-v0.6.0-incubating.tar.gz.sha512;>.sha512 diff --git a/feed.xml b/feed.xml index ae5e3d1..c640799 100644 --- a/feed.xml +++ b/feed.xml @@ -1,4 +1,4 @@ -http://www.w3.org/2005/Atom; >https://jekyllrb.com/; version="4.1.1">Jekyll2020-11-19T20:33:51-05:00/feed.xmlTVM{name=nil}Bring Your Own Datatypes: Enabling Custom Datatype [...] +http://www.w3.org/2005/Atom; >https://jekyllrb.com/; version="4.1.1">Jekyll2020-11-24T09:08:31-05:00/feed.xmlTVM{name=nil}Bring Your Own Datatypes: Enabling Custom Datatype [...] h2 id=introductionIntroduction/h2 diff --git a/rss.xml b/rss.xml index 1c826e2..a638def 100644 --- a/rss.xml +++ b/rss.xml @@ -5,8 +5,8 @@ TVM - https://tvm.apache.org https://tvm.apache.org; rel="self" type="application/rss+xml" /> -Thu, 19 Nov 2020 20:33:51 -0500 -Thu, 19 Nov 2020 20:33:51 -0500 +Tue, 24 Nov 2020 09:08:31 -0500 +Tue, 24 Nov 2020 09:08:31 -0500 60
svn commit: r44664 - in /release/tvm: tvm-v0.6.0/ tvm-v0.6.1/ tvm-v0.7.0/ tvm/
Author: tqchen Date: Tue Nov 24 14:05:35 2020 New Revision: 44664 Log: Update files Added: release/tvm/tvm-v0.6.0/ - copied from r44663, release/tvm/tvm/tvm-v0.6.0/ release/tvm/tvm-v0.6.1/ - copied from r44663, release/tvm/tvm/tvm-v0.6.1/ release/tvm/tvm-v0.7.0/ - copied from r44663, release/tvm/tvm/tvm-v0.7.0/ Removed: release/tvm/tvm/
[GitHub] [tvm] tqchen commented on issue #6966: "Realy VM for dynamic input" can export a lib for "C++" runtime just as "relay.build" ?
tqchen commented on issue #6966: URL: https://github.com/apache/tvm/issues/6966#issuecomment-732992328 Please open a new discussion thread on https://discuss.tvm.apache.org/ 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: us...@infra.apache.org
[GitHub] [tvm] tqchen closed issue #6966: "Realy VM for dynamic input" can export a lib for "C++" runtime just as "relay.build" ?
tqchen closed issue #6966: URL: https://github.com/apache/tvm/issues/6966 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: us...@infra.apache.org
svn commit: r44662 - /dev/tvm/tvm/
Author: christ Date: Tue Nov 24 13:37:01 2020 New Revision: 44662 Log: tvm has graduated Added: dev/tvm/tvm/ - copied from r44661, dev/incubator/tvm/
svn commit: r44662 - /dev/incubator/tvm/
Author: christ Date: Tue Nov 24 13:37:01 2020 New Revision: 44662 Log: tvm has graduated Removed: dev/incubator/tvm/
svn commit: r44661 - /release/incubator/tvm/
Author: christ Date: Tue Nov 24 13:36:52 2020 New Revision: 44661 Log: tvm has graduated Removed: release/incubator/tvm/
svn commit: r44661 - /release/tvm/tvm/
Author: christ Date: Tue Nov 24 13:36:52 2020 New Revision: 44661 Log: tvm has graduated Added: release/tvm/tvm/ - copied from r44660, release/incubator/tvm/
[GitHub] [incubator-tvm] manupa-arm commented on a change in pull request #6917: Add Relay option to link parameters into runtime Modules
manupa-arm commented on a change in pull request #6917: URL: https://github.com/apache/incubator-tvm/pull/6917#discussion_r529509308 ## File path: src/target/source/codegen_params.cc ## @@ -0,0 +1,218 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/*! + * \file codegen_params.cc + */ + +#include "codegen_params.h" + +#include + +#include +#include +#include +#include + +namespace tvm { +namespace codegen { + +namespace { +class DLManagedTensorDeleter { + public: + void operator()(DLManagedTensor* ptr) { ptr->deleter(ptr); } +}; +} // namespace + +static constexpr const int kMaxLineLength = 80; + +template ::value>> +void PrintArray(void* data, size_t num_elements, int elements_per_row, std::string indent_str, +std::ostream& os) { + for (size_t i = 0; i < num_elements; i++) { +int64_t elem = static_cast(data)[i]; +if (std::is_signed::value) { + uint64_t to_print; + if (elem < 0) { +os << "-"; +to_print = -elem; + } else { +os << "+"; +to_print = elem; + } + os << "0x" << std::setw(sizeof(T) * 8 / 4) << static_cast(to_print); +} else { + os << "0x" << std::setw(sizeof(T) * 8 / 4) << static_cast(elem); +} +if (i < num_elements - 1) { + os << ", "; +} +if (((i + 1) % elements_per_row) == 0) { + os << "\n" << indent_str; +} + } +} + +template ::value>> +void PrintArray(void* data, size_t num_elements, int one_element_size_bytes, int elements_per_row, +std::string indent_str, std::ostream& os) { + std::stringstream ss; + if (std::is_signed::value) { +ss.setf(std::ios::hex | std::ios::showbase | std::ios::fixed | std::ios::scientific, +std::ios::basefield | std::ios::showbase | std::ios::floatfield); + } else { +ss.setf(std::ios::hex | std::ios::fixed | std::ios::scientific, +std::ios::basefield | std::ios::showbase | std::ios::floatfield); + } + for (size_t i = 0; i < num_elements; i++) { +T elem = static_cast(data)[i]; +if (std::isinf(elem)) { + // C99 standard. + os << (elem < 0 ? "-" : " ") << std::setw(one_element_size_bytes - 1) << "INFINITY"; +} else if (std::isnan(elem)) { + // GNU extension, implemenatation-dependent. + os << std::setw(one_element_size_bytes) << "NAN"; +} else { + ss << elem; + os << std::setw(one_element_size_bytes) << ss.str(); + ss.str(""); +} +if (i < num_elements - 1) { + os << ", "; +} +if (((i + 1) % elements_per_row) == 0) { + os << "\n" << indent_str; +} + } +} + +void NDArrayDataToC(::tvm::runtime::NDArray arr, int indent_chars, std::ostream& os) { Review comment: [Clarification] Can we use a raw binary string (e.g. "\xeb\x2a) to represent the content here ? Do we need to show the element wise break down? I would reckon DLTensors would anyway take it as a void* right ? 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: us...@infra.apache.org
[GitHub] [incubator-tvm] manupa-arm commented on a change in pull request #6917: Add Relay option to link parameters into runtime Modules
manupa-arm commented on a change in pull request #6917: URL: https://github.com/apache/incubator-tvm/pull/6917#discussion_r529494048 ## File path: src/target/source/codegen_params.cc ## @@ -0,0 +1,218 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/*! + * \file codegen_params.cc + */ + +#include "codegen_params.h" + +#include + +#include +#include +#include +#include + +namespace tvm { +namespace codegen { + +namespace { +class DLManagedTensorDeleter { + public: + void operator()(DLManagedTensor* ptr) { ptr->deleter(ptr); } +}; +} // namespace + +static constexpr const int kMaxLineLength = 80; + +template ::value>> +void PrintArray(void* data, size_t num_elements, int elements_per_row, std::string indent_str, +std::ostream& os) { + for (size_t i = 0; i < num_elements; i++) { +int64_t elem = static_cast(data)[i]; +if (std::is_signed::value) { + uint64_t to_print; + if (elem < 0) { +os << "-"; +to_print = -elem; + } else { +os << "+"; +to_print = elem; + } + os << "0x" << std::setw(sizeof(T) * 8 / 4) << static_cast(to_print); +} else { + os << "0x" << std::setw(sizeof(T) * 8 / 4) << static_cast(elem); +} +if (i < num_elements - 1) { + os << ", "; +} +if (((i + 1) % elements_per_row) == 0) { + os << "\n" << indent_str; +} + } +} + +template ::value>> +void PrintArray(void* data, size_t num_elements, int one_element_size_bytes, int elements_per_row, +std::string indent_str, std::ostream& os) { + std::stringstream ss; + if (std::is_signed::value) { +ss.setf(std::ios::hex | std::ios::showbase | std::ios::fixed | std::ios::scientific, +std::ios::basefield | std::ios::showbase | std::ios::floatfield); + } else { +ss.setf(std::ios::hex | std::ios::fixed | std::ios::scientific, +std::ios::basefield | std::ios::showbase | std::ios::floatfield); + } + for (size_t i = 0; i < num_elements; i++) { +T elem = static_cast(data)[i]; +if (std::isinf(elem)) { + // C99 standard. + os << (elem < 0 ? "-" : " ") << std::setw(one_element_size_bytes - 1) << "INFINITY"; +} else if (std::isnan(elem)) { + // GNU extension, implemenatation-dependent. + os << std::setw(one_element_size_bytes) << "NAN"; +} else { + ss << elem; + os << std::setw(one_element_size_bytes) << ss.str(); + ss.str(""); +} +if (i < num_elements - 1) { + os << ", "; +} +if (((i + 1) % elements_per_row) == 0) { + os << "\n" << indent_str; +} + } +} + +void NDArrayDataToC(::tvm::runtime::NDArray arr, int indent_chars, std::ostream& os) { Review comment: Do we need to have this ASCII encoded as such ? Im thinking of why this cant be a raw binary string and get rid of "0x", commas and brackets. IIUC, the DLTensor just needs a void* and would be casted to appropriate data type in the function in which it consumes the constant data. If the reasoning is for debugging then probably we should have a debug flag and do this if required and default could be a raw binary string (if thats possible), I think it will save compilation time. 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: us...@infra.apache.org
[GitHub] [incubator-tvm] manupa-arm commented on a change in pull request #6917: Add Relay option to link parameters into runtime Modules
manupa-arm commented on a change in pull request #6917: URL: https://github.com/apache/incubator-tvm/pull/6917#discussion_r529487825 ## File path: src/target/source/codegen_c_host.cc ## @@ -57,6 +60,48 @@ void CodeGenCHost::AddFunction(const PrimFunc& f) { CodeGenC::AddFunction(f); } +void CodeGenCHost::LinkParameters(Map params) { + PrintFuncPrefix(); + stream << " " << tvm::runtime::symbol::tvm_lookup_linked_param + << "(void* args, int* arg_type_ids, int num_args, void* out_ret_value, " + << "int* out_ret_tcode, void* resource_handle) {\n"; + ICHECK_EQ(GetUniqueName(tvm::runtime::symbol::tvm_lookup_linked_param), +tvm::runtime::symbol::tvm_lookup_linked_param) + << "builtin PackedFunc name already taken: " << tvm::runtime::symbol::tvm_lookup_linked_param; + stream << "switch (((int64_t*) args)[0]) {\n" + << "default:\n" + << "out_ret_tcode[0] = " << kTVMNullptr << ";\n" + << "return 0;\n"; + + function_names_.emplace_back(tvm::runtime::symbol::tvm_lookup_linked_param); + for (auto kv : params) { +decl_stream << "\n" +<< "#ifdef __cplusplus\n" +<< "extern \"C\" {\n" +<< "#endif\n" +<< "static const "; +int64_t num_elements = 1; +for (int64_t dim : kv.second->param.Shape()) { + num_elements *= dim; +} +PrintType(kv.second->param.DataType(), decl_stream); +decl_stream << " " << ::tvm::runtime::symbol::tvm_param_prefix << kv.first << "[" +<< num_elements << "] = {\n"; +NDArrayDataToC(kv.second->param, 4, decl_stream); +decl_stream << "};\n" +<< "#ifdef __cplusplus\n" +<< "} // extern \"C\"\n" +<< "#endif\n"; +stream << "case " << kv.second->id << ":\n" + << "((uint64_t*)out_ret_value)[0] = (uint64_t) (uintptr_t) " + << ::tvm::runtime::symbol::tvm_param_prefix << kv.first << ";\n" + << "out_ret_tcode[0] = " << kTVMOpaqueHandle << ";\n" + << "return 0;\n"; Review comment: Don't we need a default here ? prolly to give a meaningful error ? ## File path: src/target/source/codegen_c_host.cc ## @@ -57,6 +60,48 @@ void CodeGenCHost::AddFunction(const PrimFunc& f) { CodeGenC::AddFunction(f); } +void CodeGenCHost::LinkParameters(Map params) { + PrintFuncPrefix(); + stream << " " << tvm::runtime::symbol::tvm_lookup_linked_param + << "(void* args, int* arg_type_ids, int num_args, void* out_ret_value, " + << "int* out_ret_tcode, void* resource_handle) {\n"; + ICHECK_EQ(GetUniqueName(tvm::runtime::symbol::tvm_lookup_linked_param), +tvm::runtime::symbol::tvm_lookup_linked_param) + << "builtin PackedFunc name already taken: " << tvm::runtime::symbol::tvm_lookup_linked_param; + stream << "switch (((int64_t*) args)[0]) {\n" + << "default:\n" + << "out_ret_tcode[0] = " << kTVMNullptr << ";\n" + << "return 0;\n"; + + function_names_.emplace_back(tvm::runtime::symbol::tvm_lookup_linked_param); + for (auto kv : params) { +decl_stream << "\n" +<< "#ifdef __cplusplus\n" +<< "extern \"C\" {\n" +<< "#endif\n" +<< "static const "; +int64_t num_elements = 1; +for (int64_t dim : kv.second->param.Shape()) { + num_elements *= dim; +} +PrintType(kv.second->param.DataType(), decl_stream); +decl_stream << " " << ::tvm::runtime::symbol::tvm_param_prefix << kv.first << "[" +<< num_elements << "] = {\n"; +NDArrayDataToC(kv.second->param, 4, decl_stream); +decl_stream << "};\n" +<< "#ifdef __cplusplus\n" +<< "} // extern \"C\"\n" +<< "#endif\n"; +stream << "case " << kv.second->id << ":\n" + << "((uint64_t*)out_ret_value)[0] = (uint64_t) (uintptr_t) " Review comment: Looks like a copy is introduced (Correct me if Im wrong), which is something we would want to avoid if possible in memory constrained devices. ## File path: src/target/source/codegen_params.cc ## @@ -0,0 +1,218 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either
[incubator-tvm] branch main updated: [AutoScheduler] Fix task extraction (#6965)
This is an automated email from the ASF dual-hosted git repository. lmzheng pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/incubator-tvm.git The following commit(s) were added to refs/heads/main by this push: new 28b1577 [AutoScheduler] Fix task extraction (#6965) 28b1577 is described below commit 28b157727206d05bfdfb5571656ee3239360b59d Author: Lianmin Zheng AuthorDate: Tue Nov 24 03:22:13 2020 -0800 [AutoScheduler] Fix task extraction (#6965) * [AutoScheduler] Fix task extraction * fix * fix * trigger CI --- python/tvm/relay/backend/compile_engine.py | 10 ++ python/tvm/relay/op/strategy/cuda.py | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/python/tvm/relay/backend/compile_engine.py b/python/tvm/relay/backend/compile_engine.py index a3108a7..32affe7 100644 --- a/python/tvm/relay/backend/compile_engine.py +++ b/python/tvm/relay/backend/compile_engine.py @@ -186,6 +186,11 @@ def select_implementation(op, attrs, inputs, out_type, target, use_autotvm=True) all_impls = get_valid_implementations(op, attrs, inputs, out_type, target) best_plevel_impl = max(all_impls, key=lambda x: x.plevel) +# Disable autotvm if auto_scheduler is enabled. +# (i.e., always return the implementation with the highest priority for auto-scheduler). +if PassContext.current().config.get("relay.backend.use_auto_scheduler", False): +use_autotvm = False + # If not use autotvm, always return the implementation with the highest priority if not use_autotvm: logger.info( @@ -288,10 +293,7 @@ def lower_call(call, inputs, target): env.tracing = False reenable_tracing = True -# check if auto_scheduler is enabled, and use pevel to select the implementation if so -use_auto_scheduler = PassContext.current().config.get("relay.backend.use_auto_scheduler", False) - -if not is_dyn and not use_auto_scheduler: +if not is_dyn: best_impl, outputs = select_implementation(op, call.attrs, inputs, ret_type, target) else: # TODO(@icemelon9): Allow tvm to generate multiple kernels for dynamic shapes. diff --git a/python/tvm/relay/op/strategy/cuda.py b/python/tvm/relay/op/strategy/cuda.py index ceaf9dd..f37fc2a 100644 --- a/python/tvm/relay/op/strategy/cuda.py +++ b/python/tvm/relay/op/strategy/cuda.py @@ -107,7 +107,7 @@ def naive_schedule(_, outs, target): # For GPU, we at least need thread binding to make a valid schedule. # So the naive schedule cannot be compiled. raise RuntimeError( -"Cannot compile for GPU targets if no tuned schedule is found." +"Cannot compile for GPU targets if no tuned schedule is found. " "Please see the warning messages above for more information about the failed workloads." ) return tvm.te.create_schedule(outs[-1].op)
[GitHub] [incubator-tvm] merrymercy merged pull request #6965: [AutoScheduler] Fix task extraction
merrymercy merged pull request #6965: URL: https://github.com/apache/incubator-tvm/pull/6965 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: us...@infra.apache.org
[GitHub] [incubator-tvm] manupa-arm commented on a change in pull request #6917: Add Relay option to link parameters into runtime Modules
manupa-arm commented on a change in pull request #6917: URL: https://github.com/apache/incubator-tvm/pull/6917#discussion_r529437902 ## File path: include/tvm/runtime/crt/graph_runtime.h ## @@ -61,14 +61,20 @@ typedef struct TVMGraphRuntime TVMGraphRuntime; * \brief Allocate a new GraphRuntime with vmalloc and initialize it. * * \param sym_json JSON-encoded graph. - * \param m TVM Module that exposes the functions to call. + * \param module_handle TVM Module that exposes the functions to call. * \param ctxs runtime execution context. */ -TVMGraphRuntime* TVMGraphRuntime_Create(const char* sym_json, const struct TVMModule* m, +TVMGraphRuntime* TVMGraphRuntime_Create(const char* sym_json, TVMModuleHandle module_handle, const TVMContext* ctxs); int TVMGraphRuntime_GetInputIndex(TVMGraphRuntime* runtime, const char* name); +/*! + * \brief get number of input tensors allocated. + * \return integer number of tensors available to use. + */ +int TVMGraphRuntime_GetNumInputs(); Review comment: fine by me, then. 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: us...@infra.apache.org
[GitHub] [incubator-tvm] manupa-arm commented on a change in pull request #6950: [uTVM] Initial BYOC support with c-source module
manupa-arm commented on a change in pull request #6950: URL: https://github.com/apache/incubator-tvm/pull/6950#discussion_r529412248 ## File path: src/relay/backend/contrib/codegen_c/codegen.cc ## @@ -215,28 +214,37 @@ class CodegenC : public MemoizedExprTranslator>, public Code class CSourceCodegen : public CSourceModuleCodegenBase { public: - std::pair> GenCFunc(const Function& func) { + std::tuple, String> GenCFunc(const Function& func) { ICHECK(func.defined()) << "Input error: expect a Relay function."; // Record the external symbol for runtime lookup. auto sid = GetExtSymbol(func); CodegenC builder(sid); auto out = builder.VisitExpr(func->body); -code_stream_ << builder.JIT(out); - -return {sid, builder.const_vars_}; +return std::make_tuple(sid, builder.const_vars_, builder.JIT(out)); } runtime::Module CreateCSourceModule(const ObjectRef& ref) override { +ICHECK(ref->IsInstance()); +auto res = GenCFunc(Downcast(ref)); +String sym = std::get<0>(res); +Array variables = std::get<1>(res); + // Create headers -code_stream_ << "#include \n"; -code_stream_ << "#include \n"; -code_stream_ << "#include \n"; -code_stream_ << "#include \n"; -code_stream_ << "#include \n"; -code_stream_ << "#include \n"; -code_stream_ << "using namespace tvm::runtime;\n"; +code_stream_ << "#include \"tvm/runtime/c_runtime_api.h\"\n"; Review comment: Done 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: us...@infra.apache.org
[GitHub] [incubator-tvm] manupa-arm commented on a change in pull request #6950: [uTVM] Initial BYOC support with c-source module
manupa-arm commented on a change in pull request #6950: URL: https://github.com/apache/incubator-tvm/pull/6950#discussion_r529411942 ## File path: include/tvm/ir/module.h ## @@ -56,11 +56,14 @@ class IRModuleNode : public Object { Map type_definitions; /*! \brief The source map for the module. */ parser::SourceMap source_map; + /*! \brief The names of ext. functions for func registry */ Review comment: Done 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: us...@infra.apache.org
[GitHub] [incubator-tvm] manupa-arm edited a comment on pull request #6950: [uTVM] Initial BYOC support with c-source module
manupa-arm edited a comment on pull request #6950: URL: https://github.com/apache/incubator-tvm/pull/6950#issuecomment-732372088 @comaniac , Likewise this is also for demonstration purpose but in the uTVM context. i.e., if we can annotate and offload a set of operations and produce a c-source that can do the required computations and return the DLTensors, this is to show it works in the uTVM context. Thus, we do not intend to use "ccompiler" as the solution rather to show a external codegen that could create c-source the place of the "ccompiler", the changes done here should enable the compilation of a such a source. Moreover, we do not prefer the metadata packing of Imports (using PackImports* methods) as they will re-create the artifacts in the volatile memory. However, having a c-source gives much better control as to where the artifacts should be placed through a standard linker script. 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: us...@infra.apache.org
[GitHub] [incubator-tvm] manupa-arm commented on a change in pull request #6950: [uTVM] Initial BYOC support with c-source module
manupa-arm commented on a change in pull request #6950: URL: https://github.com/apache/incubator-tvm/pull/6950#discussion_r529399938 ## File path: src/relay/backend/contrib/codegen_c/codegen_c.h ## @@ -235,14 +289,14 @@ class CodegenCBase { continue; } this->PrintIndents(); - code_stream_ << "std::memcpy(out" << i << ", " << outs[i].name << ", 4 * " << outs[i].size + code_stream_ << "memcpy(out" << i << ", " << outs[i].name << ", 4 * " << outs[i].size Review comment: I dont think we need the namespace. Do we ? 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: us...@infra.apache.org
[GitHub] [incubator-tvm] manupa-arm commented on a change in pull request #6950: [uTVM] Initial BYOC support with c-source module
manupa-arm commented on a change in pull request #6950: URL: https://github.com/apache/incubator-tvm/pull/6950#discussion_r529398954 ## File path: src/relay/backend/contrib/codegen_c/codegen.cc ## @@ -215,28 +214,37 @@ class CodegenC : public MemoizedExprTranslator>, public Code class CSourceCodegen : public CSourceModuleCodegenBase { public: - std::pair> GenCFunc(const Function& func) { + std::tuple, String> GenCFunc(const Function& func) { ICHECK(func.defined()) << "Input error: expect a Relay function."; // Record the external symbol for runtime lookup. auto sid = GetExtSymbol(func); CodegenC builder(sid); auto out = builder.VisitExpr(func->body); -code_stream_ << builder.JIT(out); - -return {sid, builder.const_vars_}; +return std::make_tuple(sid, builder.const_vars_, builder.JIT(out)); } runtime::Module CreateCSourceModule(const ObjectRef& ref) override { +ICHECK(ref->IsInstance()); +auto res = GenCFunc(Downcast(ref)); +String sym = std::get<0>(res); +Array variables = std::get<1>(res); + // Create headers -code_stream_ << "#include \n"; -code_stream_ << "#include \n"; -code_stream_ << "#include \n"; -code_stream_ << "#include \n"; -code_stream_ << "#include \n"; -code_stream_ << "#include \n"; -code_stream_ << "using namespace tvm::runtime;\n"; +code_stream_ << "#include \"tvm/runtime/c_runtime_api.h\"\n"; +code_stream_ << "#include \"tvm/runtime/c_backend_api.h\"\n"; +code_stream_ << "#include \n"; +code_stream_ << "#include \n"; +code_stream_ << "#include \n"; +code_stream_ << "#include \n"; +if (!variables.empty()) { + // These are only needed to handle metadata copying + code_stream_ << "#include \n"; Review comment: Yea, this part is not expected to run with uTVM as it involves copying Array of NDArrays which is something we dont want in the context of uTVM, hence the gating as this is a demo. 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: us...@infra.apache.org
[GitHub] [incubator-tvm] manupa-arm commented on a change in pull request #6950: [uTVM] Initial BYOC support with c-source module
manupa-arm commented on a change in pull request #6950: URL: https://github.com/apache/incubator-tvm/pull/6950#discussion_r529395842 ## File path: python/tvm/micro/build.py ## @@ -162,7 +158,12 @@ def build_static_runtime( libs.append(compiler.library(lib_build_dir, lib_srcs, lib_opts)) -libs.append(compiler.library(mod_build_dir, [mod_src_path], generated_lib_opts)) +libs.append( Review comment: No, the export_library will create a temporary directory to save source files and it will not live beyond the scope of the function. So it did not occur to me saving the sources is a feature (I thought it was a side-effect of this flow). Thus, I ll just say what I generally do: use pdb and do get_source to see the c-source created. Anyhow, do we think this would be a user-facing feature ? if so we can do two things : A1 : Traverse module hierarchy and dump the sources here independently of export library, here. A2 : More generally we can introduce an attr to target_kind "c" in the lines of something like "-dbgdir=" and make the export_library to use that directory the dump the intermediary sources. I think A2 would be more generic, but would be beyond the scope of this PR. Thus if people agree, I could just do A1 here for now with a TODO for A2 at some point. What do you think ? 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: us...@infra.apache.org
[GitHub] [incubator-tvm] merrymercy commented on pull request #6939: Lazy import XGBoost
merrymercy commented on pull request #6939: URL: https://github.com/apache/incubator-tvm/pull/6939#issuecomment-732788532 @comaniac Missing the package is a fatal error. We should raise an exception when we fail to import it instead of prinitng a message. 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: us...@infra.apache.org
[GitHub] [incubator-tvm] leonwanghui commented on issue #6817: [WASM] apps/wasm-standalone is broken
leonwanghui commented on issue #6817: URL: https://github.com/apache/incubator-tvm/issues/6817#issuecomment-732730996 @WenheLI Sorry for the late reply, this issue has been addressed by PR #6862, please download the latest version of code and try it again. 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: us...@infra.apache.org