This is an automated email from the ASF dual-hosted git repository. junrushao pushed a commit to branch unity-staging in repository https://gitbox.apache.org/repos/asf/tvm.git
commit 1b869650b0f94108b068d786acad270c33d9c0ee Merge: 5828f1e9ee a60cd0fecf Author: Junru Shao <[email protected]> AuthorDate: Sat Jul 8 22:29:11 2023 -0700 Merge remote-tracking branch 'apache-upstream/main' into apache-upstream-unity cmake/utils/FindVulkan.cmake | 57 ++-- docs/reference/api/links.rst | 1 + include/tvm/relay/qnn/attrs.h | 2 + include/tvm/tir/index_map.h | 12 +- include/tvm/topi/transform.h | 9 +- pyproject.toml | 1 - python/tvm/contrib/emcc.py | 1 + python/tvm/contrib/ndk.py | 55 ++++ .../tvm/relay/backend/contrib/ethosu/vela_api.py | 86 +++++- python/tvm/relay/expr_functor.py | 56 +++- python/tvm/relay/frontend/keras.py | 2 + python/tvm/relay/qnn/op/qnn.py | 21 +- python/tvm/te/schedule.py | 11 +- python/tvm/testing/__init__.py | 2 +- python/tvm/testing/{rpc_run.py => runner.py} | 85 +++++- python/tvm/tir/analysis/analysis.py | 8 +- python/tvm/tir/function.py | 20 +- python/tvm/tir/op.py | 9 +- python/tvm/tir/schedule/schedule.py | 40 ++- python/tvm/tir/schedule/testing.py | 6 +- src/arith/analyzer.cc | 32 +- src/arith/ir_mutator_with_analyzer.cc | 20 ++ src/arith/ir_mutator_with_analyzer.h | 6 + src/arith/iter_affine_map.cc | 6 + src/arith/product_normal_form.h | 18 ++ src/relay/backend/te_compiler_cache.cc | 4 +- src/relay/op/tensor/transform.cc | 4 +- src/relay/qnn/op/dequantize.cc | 28 +- src/relay/qnn/op/quantize.cc | 5 +- src/relay/qnn/utils.h | 3 +- src/runtime/logging.cc | 3 + src/script/ir_builder/ir/ir.cc | 4 +- src/target/source/codegen_cuda.cc | 3 +- src/te/schedule/message_passing.cc | 14 +- src/te/schedule/schedule_lang.cc | 6 +- src/tir/analysis/verify_well_formed.cc | 25 +- src/tir/ir/index_map.cc | 64 ++-- src/tir/ir/script/script_complete.cc | 20 +- src/tir/schedule/analysis.h | 10 + src/tir/schedule/analysis/analysis.cc | 14 + src/tir/schedule/primitive.h | 4 +- src/tir/schedule/primitive/cache_read_write.cc | 323 +++++++++++++++++---- src/tir/schedule/primitive/compute_at.cc | 14 - .../schedule/primitive/layout_transformation.cc | 81 +++--- src/tir/schedule/transform.cc | 22 +- src/tir/transforms/flatten_buffer.cc | 13 +- src/tir/transforms/inject_double_buffer.cc | 4 +- src/tir/transforms/ir_utils.cc | 3 +- src/tir/transforms/lower_custom_datatypes.cc | 2 +- src/tir/transforms/lower_thread_allreduce.cc | 2 +- src/tir/transforms/lower_tvm_builtin.cc | 2 + src/tir/transforms/lower_warp_memory.cc | 2 +- src/tir/transforms/make_unpacked_api.cc | 11 +- src/tir/transforms/storage_flatten.cc | 7 +- src/tir/transforms/transform_mma_buffer_layout.cc | 6 +- src/tir/transforms/update_pointer_storage_scope.cc | 9 +- tests/python/contrib/test_ethosu/test_networks.py | 4 +- .../contrib/test_ethosu/test_replace_conv2d.py | 14 +- tests/python/contrib/test_ethosu/test_vela_api.py | 50 ++++ tests/python/frontend/keras/test_forward.py | 2 + tests/python/relay/test_expr_functor.py | 2 +- tests/python/relay/test_op_qnn_dequantize.py | 35 ++- tests/python/relay/test_op_qnn_quantize.py | 23 ++ .../python/unittest/test_arith_iter_affine_map.py | 4 +- ...e_postproc_rewrite_parallel_vectorize_unroll.py | 2 - .../test_meta_schedule_relay_integration.py | 20 +- ...meta_schedule_schedule_cuda_layout_transform.py | 6 +- .../test_meta_schedule_schedule_rule_mlt_tc.py | 19 +- .../unittest/test_meta_schedule_trace_apply.py | 10 +- .../python/unittest/test_meta_schedule_tune_tir.py | 5 + ...sform_layout.py => test_te_transform_layout.py} | 0 .../test_tir_analysis_verify_well_formed.py | 1 + .../{test_index_map.py => test_tir_index_map.py} | 11 +- .../unittest/test_tir_schedule_cache_read_write.py | 156 ++++++++-- .../unittest/test_tir_schedule_transform_layout.py | 112 ++++++- .../test_tir_transform_inject_ptx_async_copy.py | 97 ++++--- .../test_tir_transform_lower_tvm_builtin.py | 6 +- ...test_tir_transform_memhammer_lower_auto_copy.py | 8 - .../python/unittest/test_tir_transform_simplify.py | 16 +- tests/python/unittest/test_tvmscript_complete.py | 4 + tests/python/unittest/test_tvmscript_roundtrip.py | 17 ++ tests/scripts/release/README.md | 2 + tests/scripts/release/gather_prs.py | 22 +- tests/scripts/release/make_notes.py | 12 +- tests/scripts/task_python_docs.sh | 4 +- 85 files changed, 1499 insertions(+), 443 deletions(-) diff --cc src/script/ir_builder/ir/ir.cc index 445ff8dacd,02fb899f0d..ea611f6963 --- a/src/script/ir_builder/ir/ir.cc +++ b/src/script/ir_builder/ir/ir.cc @@@ -17,9 -17,10 +17,11 @@@ * under the License. */ #include <tvm/ir/module.h> +#include <tvm/relax/analysis.h> #include <tvm/runtime/registry.h> #include <tvm/script/ir_builder/ir/ir.h> + #include <tvm/tir/function.h> + #include <tvm/tir/op.h> #include "./utils.h" @@@ -35,23 -36,21 +37,23 @@@ IRModuleFrame IRModule() return IRModuleFrame(n); } +inline relax::StructInfo GetGlobalVarStructInfo(const BaseFunc& func) { + if (func->struct_info_.defined()) { + return tvm::relax::GetStructInfo(func); + } else if (const auto* prim_func = func.as<tvm::tir::PrimFuncNode>()) { + return tvm::relax::FuncStructInfo::OpaqueFunc( + tvm::relax::StructInfoFromType(prim_func->ret_type)); + } else { + LOG(FATAL) << "Unsupported function type: " << func->GetTypeKey(); + } +} + GlobalVar DeclFunction(const String& func_name, const BaseFunc& func_signature) { - IRModuleFrame frame = FindModuleFrame("I.DeclFunction"); + IRModuleFrame frame = FindModuleFrame(); CHECK(!frame->global_var_map.count(func_name)) << "ValueError: function " << func_name << " already exists"; - GlobalVar gv = GlobalVar(func_name); - - auto gvar_type = [&]() -> Type { - if (auto prim_func = func_signature.as<tir::PrimFuncNode>()) { - Array<Type> arg_types = prim_func->params.Map([](const auto& var) { return GetType(var); }); - return FuncType(arg_types, prim_func->ret_type, {}, {}); - } - - return {}; - }(); - + GlobalVar gv = GlobalVar(func_name, gvar_type); + gv->struct_info_ = GetGlobalVarStructInfo(func_signature); CHECK(frame->functions.find(gv) == frame->functions.end()) << "ValueError: function " << func_name << " has already been defined."; frame->global_var_map.Set(func_name, gv);
