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 d8f1ac4e87fb10ecbac260a37e01627a4a684cfe Merge: 959b7e5e09 2eca9f0270 Author: Junru Shao <[email protected]> AuthorDate: Tue Jul 18 14:57:34 2023 -0700 Merge remote-tracking branch 'apache-upstream/main' into unity CONTRIBUTORS.md | 1 + .../template_project/microtvm_api_server.py | 9 +- ci/jenkins/docker-images.ini | 2 +- .../install/ubuntu_install_tensorflow_aarch64.sh | 2 +- docs/arch/index.rst | 4 +- include/tvm/runtime/device_api.h | 3 +- include/tvm/runtime/profiling.h | 4 +- include/tvm/topi/nn/rms_norm.h | 96 +++++ jvm/native/osx-x86_64/pom.xml | 2 +- jvm/pom.xml | 2 +- python/setup.py | 8 + python/tvm/_ffi/runtime_ctypes.py | 18 + python/tvm/contrib/hexagon/transform.py | 105 ++++- python/tvm/exec/gpu_memory_bandwidth.py | 192 +++++++++ python/tvm/relay/backend/contrib/ethosu/codegen.py | 89 +++- python/tvm/relay/frontend/keras.py | 21 +- python/tvm/relay/frontend/tflite.py | 12 +- python/tvm/relay/op/contrib/ethosu.py | 4 +- python/tvm/runtime/module.py | 5 + python/tvm/script/parser/_core.py | 2 +- python/tvm/script/parser/core/entry.py | 35 +- python/tvm/script/parser/tir/__init__.py | 4 +- python/tvm/script/parser/tir/entry.py | 99 ++++- python/tvm/script/parser/tir/parser.py | 60 ++- python/tvm/target/target.py | 4 + python/tvm/testing/runner.py | 12 +- python/tvm/tir/op.py | 2 +- python/tvm/topi/nn/__init__.py | 1 + python/tvm/topi/nn/rms_norm.py | 46 +++ python/tvm/topi/testing/__init__.py | 1 + python/tvm/topi/testing/rms_norm_python.py | 51 +++ src/relay/backend/aot_executor_codegen.cc | 38 +- src/relay/transforms/merge_compiler_regions.cc | 36 +- src/runtime/crt/common/crt_runtime_api.c | 5 +- src/runtime/cuda/cuda_device_api.cc | 6 + .../graph_executor/debug/graph_executor_debug.cc | 2 +- src/runtime/graph_executor/graph_executor.cc | 25 +- src/runtime/graph_executor/graph_executor.h | 6 +- src/runtime/metal/metal_device_api.mm | 2 + src/runtime/opencl/opencl_device_api.cc | 7 + src/runtime/profiling.cc | 16 +- src/runtime/rocm/rocm_device_api.cc | 5 + src/runtime/rpc/rpc_module.cc | 28 +- src/runtime/vulkan/vulkan_device_api.cc | 3 + src/support/socket.h | 16 +- src/te/operation/cross_thread_reduction.cc | 13 +- src/tir/transforms/lower_device_kernel_launch.cc | 41 +- src/tir/transforms/lower_thread_allreduce.cc | 337 +++++++++------ src/tir/transforms/lower_tvm_builtin.cc | 54 ++- src/tir/transforms/split_host_device.cc | 33 +- src/topi/nn.cc | 6 + tests/python/contrib/test_ethosu/test_codegen.py | 63 +++ tests/python/contrib/test_ethosu/test_legalize.py | 132 +++++- .../test_hexagon/test_relay_simplify_qnn_concat.py | 101 +++++ tests/python/frontend/keras/test_forward.py | 7 + tests/python/frontend/tflite/test_forward.py | 18 + .../relay/test_pass_merge_compiler_regions.py | 62 +++ tests/python/topi/python/test_topi_rms_norm.py | 68 ++++ tests/python/unittest/test_set_input_zero_copy.py | 137 +++++++ .../test_tir_transform_lower_thread_all_reduce.py | 451 +++++++++++++++++++++ .../test_tir_transform_lower_tvm_builtin.py | 23 +- .../test_tir_transform_split_host_device.py | 38 ++ tests/python/unittest/test_tvmscript_parser_tir.py | 107 +++++ tests/scripts/release/README.md | 13 +- tests/scripts/release/make_notes.py | 33 +- web/emcc/tvmjs_support.cc | 2 +- 66 files changed, 2563 insertions(+), 267 deletions(-) diff --cc python/tvm/script/parser/core/entry.py index a4362b00ae,08a593d5d3..de1afb6245 --- a/python/tvm/script/parser/core/entry.py +++ b/python/tvm/script/parser/core/entry.py @@@ -25,6 -25,25 +25,26 @@@ from .error import ParserErro from .parser import Parser + def _default_globals() -> Dict[str, Any]: + import tvm # pylint: disable=import-outside-toplevel + from tvm.script.parser import ir # pylint: disable=import-outside-toplevel ++ from tvm.script.parser import relax # pylint: disable=import-outside-toplevel + from tvm.script.parser import tir # pylint: disable=import-outside-toplevel + - extra_vars = {"tvm": tvm, "I": ir, "ir": ir, "T": tir, "tir": tir} ++ extra_vars = {"tvm": tvm, "I": ir, "ir": ir, "T": tir, "tir": tir, "R": relax, "relax": relax} + return extra_vars + + + def parse_macro(program: Union[Any, str], extra_vars: Dict[str, Any] = None) -> Any: + """Generate the AST, and the source code for __repr__.""" + # The AST will be converted into TIR at the time of expansion. + source = Source(program) + source_txt = source.source + source_ast = source.as_ast() + closure_vars = extra_vars or _default_globals() + return source_ast, source_txt, closure_vars + + def parse(program: Union[doc.AST, Any, str], extra_vars: Dict[str, Any] = None) -> Any: """Register a method for a operand type, AST operator node and operand index. diff --cc python/tvm/script/parser/tir/__init__.py index e44b6b521b,9d3fc1ec98..fa0b7d8f55 --- a/python/tvm/script/parser/tir/__init__.py +++ b/python/tvm/script/parser/tir/__init__.py @@@ -30,6 -30,6 +30,6 @@@ if TYPE_CHECKING # so most tvmscript won't trigger pylint error here. prim_func = staticmethod else: - from .entry import prim_func - from .entry import prim_func, macro ++ from .entry import macro, prim_func - __all__ = _tir.__all__ + ["Buffer", "Ptr", "bool", "prim_func"] -__all__ = _tir.__all__ + ["Buffer", "Ptr", "prim_func", "macro"] ++__all__ = _tir.__all__ + ["Buffer", "Ptr", "bool", "prim_func", "macro"]
