From 88ffeb64c2c12ca52b53a8f6eb1b28165fc8fb56 Mon Sep 17 00:00:00 2001 From: Junru Shao Date: Wed, 24 Dec 2025 19:47:27 -0800 Subject: [PATCH] [BREAKING CHANGE] Prefix all type keys and function names with "tvm." --- apps/cpp_rpc/rpc_server.cc | 2 +- apps/hexagon_launcher/launcher_core.cc | 7 +- apps/hexagon_launcher/launcher_hexagon.cc | 4 +- apps/ios_rpc/tests/ios_rpc_test.py | 2 +- apps/ios_rpc/tvmrpc/RPCServer.mm | 2 +- apps/ios_rpc/tvmrpc/TVMRuntime.mm | 4 +- include/tvm/arith/analyzer.h | 4 +- include/tvm/arith/int_set.h | 2 +- include/tvm/arith/int_solver.h | 8 +- include/tvm/arith/iter_affine_map.h | 10 +- include/tvm/ir/attrs.h | 6 +- include/tvm/ir/diagnostic.h | 6 +- include/tvm/ir/env_func.h | 2 +- include/tvm/ir/expr.h | 16 +- include/tvm/ir/function.h | 2 +- include/tvm/ir/global_info.h | 6 +- include/tvm/ir/global_var_supply.h | 2 +- include/tvm/ir/instrument.h | 2 +- include/tvm/ir/module.h | 6 +- include/tvm/ir/name_supply.h | 2 +- include/tvm/ir/op.h | 2 +- include/tvm/ir/source_map.h | 10 +- include/tvm/ir/transform.h | 8 +- include/tvm/ir/type.h | 12 +- include/tvm/meta_schedule/arg_info.h | 4 +- include/tvm/meta_schedule/builder.h | 8 +- include/tvm/meta_schedule/cost_model.h | 5 +- include/tvm/meta_schedule/database.h | 8 +- include/tvm/meta_schedule/extracted_task.h | 2 +- include/tvm/meta_schedule/feature_extractor.h | 4 +- include/tvm/meta_schedule/measure_callback.h | 4 +- include/tvm/meta_schedule/measure_candidate.h | 3 +- include/tvm/meta_schedule/mutator.h | 4 +- include/tvm/meta_schedule/postproc.h | 4 +- include/tvm/meta_schedule/profiler.h | 2 +- include/tvm/meta_schedule/runner.h | 11 +- include/tvm/meta_schedule/schedule_rule.h | 4 +- include/tvm/meta_schedule/search_strategy.h | 4 +- include/tvm/meta_schedule/space_generator.h | 4 +- include/tvm/meta_schedule/task_scheduler.h | 6 +- include/tvm/meta_schedule/tune_context.h | 2 +- include/tvm/node/script_printer.h | 2 +- include/tvm/relax/attrs/ccl.h | 10 +- include/tvm/relax/attrs/create.h | 4 +- include/tvm/relax/attrs/datatype.h | 5 +- include/tvm/relax/attrs/distributed.h | 2 +- include/tvm/relax/attrs/image.h | 5 +- include/tvm/relax/attrs/index.h | 4 +- include/tvm/relax/attrs/linear_algebra.h | 4 +- include/tvm/relax/attrs/manipulate.h | 38 +++-- include/tvm/relax/attrs/nn.h | 55 +++--- include/tvm/relax/attrs/op.h | 13 +- include/tvm/relax/attrs/qdq.h | 2 +- include/tvm/relax/attrs/sampling.h | 2 +- include/tvm/relax/attrs/search.h | 5 +- include/tvm/relax/attrs/sorting.h | 6 +- include/tvm/relax/attrs/statistical.h | 4 +- include/tvm/relax/attrs/vision.h | 2 +- include/tvm/relax/binding_rewrite.h | 3 +- include/tvm/relax/block_builder.h | 2 +- include/tvm/relax/dataflow_pattern.h | 53 +++--- include/tvm/relax/distributed/global_info.h | 3 +- include/tvm/relax/distributed/struct_info.h | 9 +- include/tvm/relax/exec_builder.h | 2 +- include/tvm/relax/expr.h | 52 +++--- include/tvm/relax/struct_info.h | 16 +- include/tvm/relax/tir_pattern.h | 2 +- include/tvm/relax/transform.h | 6 +- include/tvm/relax/type.h | 8 +- include/tvm/runtime/disco/session.h | 4 +- include/tvm/runtime/memory/memory_manager.h | 2 +- include/tvm/runtime/profiling.h | 20 +-- include/tvm/runtime/vm/vm.h | 4 +- include/tvm/script/ir_builder/base.h | 5 +- include/tvm/script/ir_builder/ir/frame.h | 2 +- include/tvm/script/ir_builder/relax/frame.h | 15 +- include/tvm/script/ir_builder/tir/frame.h | 42 +++-- include/tvm/script/printer/doc.h | 57 ++++--- include/tvm/script/printer/ir_docsifier.h | 4 +- include/tvm/target/tag.h | 2 +- include/tvm/target/target.h | 2 +- include/tvm/target/target_info.h | 2 +- include/tvm/target/target_kind.h | 2 +- include/tvm/target/virtual_device.h | 2 +- include/tvm/te/operation.h | 12 +- include/tvm/te/tensor.h | 2 +- include/tvm/tir/block_dependence_info.h | 2 +- include/tvm/tir/block_scope.h | 6 +- include/tvm/tir/buffer.h | 4 +- include/tvm/tir/data_layout.h | 4 +- include/tvm/tir/expr.h | 60 +++---- include/tvm/tir/function.h | 4 +- include/tvm/tir/index_map.h | 2 +- include/tvm/tir/schedule/instruction.h | 5 +- include/tvm/tir/schedule/schedule.h | 6 +- include/tvm/tir/schedule/state.h | 2 +- include/tvm/tir/schedule/trace.h | 2 +- include/tvm/tir/stmt.h | 37 +++-- include/tvm/tir/var.h | 6 +- python/tvm/arith/_ffi_api.py | 2 +- python/tvm/arith/analyzer.py | 4 +- python/tvm/arith/int_set.py | 6 +- python/tvm/arith/int_solver.py | 6 +- python/tvm/arith/iter_affine_map.py | 10 +- python/tvm/contrib/cutlass/_ffi_api.py | 2 +- python/tvm/contrib/cutlass/build.py | 8 +- python/tvm/contrib/cutlass/gen_tensor_op.py | 2 +- python/tvm/contrib/hexagon/session.py | 4 +- python/tvm/contrib/hexagon/tools.py | 4 +- python/tvm/contrib/msc/core/_ffi_api.py | 2 +- .../tvm/contrib/msc/core/codegen/codegen.py | 2 +- python/tvm/contrib/msc/core/ir/graph.py | 16 +- python/tvm/contrib/msc/core/tools/execute.py | 6 +- python/tvm/contrib/msc/core/utils/info.py | 2 +- .../msc/framework/tensorflow/_ffi_api.py | 2 +- .../msc/framework/tensorrt/_ffi_api.py | 2 +- .../contrib/msc/framework/torch/_ffi_api.py | 2 +- .../tvm/contrib/msc/framework/tvm/_ffi_api.py | 2 +- python/tvm/contrib/msc/plugin/_ffi_api.py | 2 +- python/tvm/contrib/msc/plugin/op/_ffi_api.py | 2 +- python/tvm/contrib/ndk.py | 2 +- python/tvm/contrib/nvcc.py | 8 +- python/tvm/contrib/rocm.py | 6 +- python/tvm/dlight/analysis/common_analysis.py | 2 +- python/tvm/dlight/benchmark/bench.py | 2 +- python/tvm/driver/_ffi_api.py | 2 +- .../tvm/exec/disco_remote_socket_session.py | 2 +- python/tvm/exec/disco_worker.py | 16 +- python/tvm/ir/_ffi_analysis_api.py | 2 +- python/tvm/ir/_ffi_api.py | 2 +- python/tvm/ir/_ffi_instrument_api.py | 2 +- python/tvm/ir/_ffi_transform_api.py | 2 +- python/tvm/ir/attrs.py | 6 +- python/tvm/ir/base.py | 12 +- python/tvm/ir/diagnostics/__init__.py | 10 +- python/tvm/ir/diagnostics/_ffi_api.py | 2 +- python/tvm/ir/expr.py | 10 +- python/tvm/ir/function.py | 2 +- python/tvm/ir/global_info.py | 6 +- python/tvm/ir/instrument.py | 4 +- python/tvm/ir/module.py | 4 +- python/tvm/ir/op.py | 2 +- python/tvm/ir/supply.py | 4 +- python/tvm/ir/transform.py | 10 +- python/tvm/ir/type.py | 12 +- python/tvm/ir/type_relation.py | 4 +- python/tvm/meta_schedule/_ffi_api.py | 2 +- python/tvm/meta_schedule/arg_info.py | 4 +- python/tvm/meta_schedule/builder/builder.py | 8 +- .../meta_schedule/builder/local_builder.py | 6 +- .../meta_schedule/cost_model/cost_model.py | 4 +- python/tvm/meta_schedule/database/database.py | 8 +- .../meta_schedule/database/json_database.py | 2 +- .../meta_schedule/database/memory_database.py | 2 +- .../database/ordered_union_database.py | 2 +- .../database/schedule_fn_database.py | 2 +- .../meta_schedule/database/union_database.py | 2 +- python/tvm/meta_schedule/extracted_task.py | 2 +- .../feature_extractor/feature_extractor.py | 4 +- .../feature_extractor/per_store_feature.py | 2 +- .../measure_callback/add_to_database.py | 2 +- .../measure_callback/measure_callback.py | 4 +- .../measure_callback/remove_build_artifact.py | 2 +- .../measure_callback/update_cost_model.py | 2 +- .../mutator/mutate_compute_location.py | 2 +- .../meta_schedule/mutator/mutate_parallel.py | 2 +- .../mutator/mutate_thread_binding.py | 2 +- .../meta_schedule/mutator/mutate_tile_size.py | 2 +- .../meta_schedule/mutator/mutate_unroll.py | 2 +- python/tvm/meta_schedule/mutator/mutator.py | 2 +- .../disallow_async_strided_mem_copy.py | 2 +- .../postproc/disallow_dynamic_loop.py | 2 +- python/tvm/meta_schedule/postproc/postproc.py | 4 +- .../postproc/rewrite_cooperative_fetch.py | 2 +- .../meta_schedule/postproc/rewrite_layout.py | 2 +- .../rewrite_parallel_vectorize_unroll.py | 2 +- .../postproc/rewrite_reduction_block.py | 2 +- .../postproc/rewrite_tensorize.py | 2 +- .../postproc/rewrite_unbound_block.py | 2 +- .../meta_schedule/postproc/verify_gpu_code.py | 2 +- .../postproc/verify_vtcm_limit.py | 2 +- python/tvm/meta_schedule/profiler.py | 2 +- python/tvm/meta_schedule/relax_integration.py | 8 +- .../tvm/meta_schedule/runner/local_runner.py | 2 +- python/tvm/meta_schedule/runner/runner.py | 10 +- python/tvm/meta_schedule/runner/utils.py | 2 +- .../schedule/cuda/layout_transform.py | 2 +- .../schedule_rule/add_rfactor.py | 2 +- .../schedule_rule/apply_custom_rule.py | 2 +- .../meta_schedule/schedule_rule/auto_bind.py | 2 +- .../schedule_rule/auto_inline.py | 4 +- .../schedule_rule/cross_thread_reduction.py | 2 +- .../schedule_rule/multi_level_tiling.py | 8 +- .../parallel_vectorize_unroll.py | 2 +- .../schedule_rule/random_compute_location.py | 2 +- .../schedule_rule/schedule_rule.py | 4 +- .../search_strategy/evolutionary_search.py | 2 +- .../search_strategy/replay_func.py | 2 +- .../search_strategy/replay_trace.py | 2 +- .../search_strategy/search_strategy.py | 6 +- .../space_generator/post_order_apply.py | 2 +- .../space_generator/schedule_fn.py | 2 +- .../space_generator/space_generator.py | 4 +- .../space_generator/space_generator_union.py | 2 +- .../task_scheduler/gradient_based.py | 2 +- .../task_scheduler/round_robin.py | 2 +- .../task_scheduler/task_scheduler.py | 6 +- .../testing/validate_database.py | 4 +- python/tvm/meta_schedule/tune_context.py | 2 +- python/tvm/meta_schedule/utils.py | 12 +- python/tvm/relax/_ffi_api.py | 2 +- python/tvm/relax/analysis/_ffi_api.py | 2 +- python/tvm/relax/backend/_ffi_api.py | 2 +- python/tvm/relax/backend/adreno/clml.py | 2 +- .../backend/adreno/transform/_ffi_api.py | 2 +- python/tvm/relax/backend/cuda/cutlass.py | 2 +- .../tvm/relax/backend/dispatch_sort_scan.py | 4 +- python/tvm/relax/backend/metal/coreml.py | 4 +- python/tvm/relax/base_py_module.py | 4 +- python/tvm/relax/binding_rewrite.py | 2 +- python/tvm/relax/block_builder.py | 2 +- python/tvm/relax/distributed/_ffi_api.py | 2 +- python/tvm/relax/distributed/global_info.py | 2 +- python/tvm/relax/distributed/struct_info.py | 6 +- .../relax/distributed/transform/_ffi_api.py | 2 +- python/tvm/relax/dpl/_ffi.py | 2 +- python/tvm/relax/dpl/pattern.py | 6 +- python/tvm/relax/dpl/rewrite.py | 8 +- python/tvm/relax/exec_builder.py | 2 +- python/tvm/relax/expr.py | 44 ++--- python/tvm/relax/expr_functor.py | 4 +- python/tvm/relax/frontend/nn/llm/kv_cache.py | 16 +- python/tvm/relax/frontend/nn/modules.py | 6 +- python/tvm/relax/frontend/nn/op.py | 6 +- .../tvm/relax/frontend/onnx/onnx_frontend.py | 10 +- python/tvm/relax/op/_ffi_api.py | 2 +- python/tvm/relax/op/base.py | 6 +- python/tvm/relax/op/builtin/_ffi_api.py | 2 +- python/tvm/relax/op/ccl/_ffi_api.py | 2 +- python/tvm/relax/op/distributed/_ffi_api.py | 2 +- python/tvm/relax/op/grad/_ffi_api.py | 2 +- python/tvm/relax/op/image/_ffi_api.py | 2 +- python/tvm/relax/op/memory/_ffi_api.py | 2 +- python/tvm/relax/op/nn/_ffi_api.py | 2 +- python/tvm/relax/op/op_attrs.py | 138 +++++++-------- python/tvm/relax/op/sampling.py | 2 +- python/tvm/relax/op/set.py | 4 +- python/tvm/relax/op/vision/_ffi_api.py | 2 +- python/tvm/relax/op/vm/_ffi_api.py | 2 +- python/tvm/relax/struct_info.py | 12 +- python/tvm/relax/testing/nn.py | 4 +- python/tvm/relax/testing/transform.py | 14 +- python/tvm/relax/testing/vm.py | 20 +-- python/tvm/relax/training/_ffi_api.py | 2 +- python/tvm/relax/transform/_ffi_api.py | 2 +- .../relax/transform/ipc_allreduce_rewrite.py | 6 +- .../relax/transform/legalize_ops/binary.py | 52 +++--- .../tvm/relax/transform/legalize_ops/ccl.py | 8 +- .../transform/legalize_ops/distributed.py | 2 +- .../tvm/relax/transform/legalize_ops/grad.py | 2 +- .../tvm/relax/transform/legalize_ops/index.py | 2 +- python/tvm/relax/transform/legalize_ops/nn.py | 14 +- .../transform/legalize_ops/statistical.py | 2 +- .../transform/lower_gpu_ipc_alloc_storage.py | 4 +- python/tvm/relax/transform/transform.py | 10 +- python/tvm/relax/ty.py | 8 +- python/tvm/relax/vm_build.py | 4 +- python/tvm/rpc/_ffi_api.py | 2 +- python/tvm/rpc/client.py | 4 +- python/tvm/rpc/server.py | 2 +- python/tvm/rpc/testing.py | 14 +- python/tvm/runtime/_ffi_api.py | 2 +- python/tvm/runtime/_ffi_node_api.py | 2 +- python/tvm/runtime/disco/_ffi_api.py | 2 +- python/tvm/runtime/disco/process_pool.py | 2 +- python/tvm/runtime/disco/session.py | 40 ++--- python/tvm/runtime/profiling/__init__.py | 21 ++- python/tvm/runtime/profiling/_ffi_api.py | 2 +- python/tvm/runtime/script_printer.py | 4 +- python/tvm/runtime/support.py | 2 +- python/tvm/runtime/vm.py | 2 +- python/tvm/script/_ffi_api.py | 2 +- python/tvm/script/ir_builder/_ffi_api.py | 2 +- python/tvm/script/ir_builder/base.py | 4 +- python/tvm/script/ir_builder/ir/_ffi_api.py | 2 +- python/tvm/script/ir_builder/ir/frame.py | 2 +- .../tvm/script/ir_builder/relax/_ffi_api.py | 2 +- .../ir_builder/relax/distributed/_ffi_api.py | 2 +- python/tvm/script/ir_builder/relax/frame.py | 14 +- python/tvm/script/ir_builder/relax/ir.py | 2 +- python/tvm/script/ir_builder/tir/_ffi_api.py | 2 +- python/tvm/script/ir_builder/tir/frame.py | 34 ++-- python/tvm/script/printer/_ffi_api.py | 2 +- python/tvm/script/printer/doc.py | 54 +++--- python/tvm/support.py | 6 +- python/tvm/target/_ffi_api.py | 2 +- python/tvm/target/datatype.py | 6 +- python/tvm/target/detect_target.py | 2 +- python/tvm/target/target.py | 4 +- python/tvm/target/virtual_device.py | 2 +- python/tvm/te/_ffi_api.py | 2 +- python/tvm/te/tensor.py | 14 +- python/tvm/testing/_ffi_api.py | 2 +- python/tvm/testing/attrs.py | 2 +- python/tvm/testing/popen_pool.py | 6 +- python/tvm/testing/runner.py | 4 +- python/tvm/tir/_ffi_api.py | 2 +- python/tvm/tir/analysis/_ffi_api.py | 2 +- python/tvm/tir/analysis/analysis.py | 2 +- python/tvm/tir/block_dependence_info.py | 2 +- python/tvm/tir/block_scope.py | 6 +- python/tvm/tir/buffer.py | 4 +- python/tvm/tir/build.py | 4 +- python/tvm/tir/data_layout.py | 4 +- python/tvm/tir/expr.py | 70 ++++---- python/tvm/tir/function.py | 8 +- python/tvm/tir/functor.py | 4 +- python/tvm/tir/ir_builder.py | 2 +- python/tvm/tir/schedule/_ffi_api.py | 2 +- python/tvm/tir/schedule/analysis.py | 4 +- python/tvm/tir/schedule/instruction.py | 4 +- python/tvm/tir/schedule/schedule.py | 6 +- python/tvm/tir/schedule/state.py | 2 +- python/tvm/tir/schedule/trace.py | 2 +- python/tvm/tir/stmt.py | 34 ++-- python/tvm/tir/tensor_intrin/cuda.py | 4 +- python/tvm/tir/tensor_intrin/hexagon.py | 2 +- python/tvm/tir/tensor_intrin/riscv_cpu.py | 2 +- python/tvm/tir/tensor_intrin/rocm.py | 4 +- python/tvm/tir/transform/_ffi_api.py | 2 +- python/tvm/tir/transform/function_pass.py | 2 +- python/tvm/tir/transform/transform.py | 16 +- python/tvm/topi/cpp/cuda.py | 2 +- python/tvm/topi/cpp/generic.py | 2 +- python/tvm/topi/cpp/impl.py | 2 +- python/tvm/topi/cpp/nn.py | 2 +- python/tvm/topi/cpp/rocm.py | 2 +- python/tvm/topi/cpp/utils.py | 2 +- python/tvm/topi/cpp/vision/__init__.py | 2 +- python/tvm/topi/cpp/vision/yolo.py | 2 +- python/tvm/topi/cpp/x86.py | 2 +- python/tvm/topi/slice_scatter.py | 10 +- src/arith/analyzer.cc | 2 +- src/arith/bound_deducer.cc | 2 +- src/arith/canonical_simplify.cc | 6 +- src/arith/const_int_bound.cc | 4 +- src/arith/detect_common_subexpr.cc | 2 +- src/arith/detect_linear_equation.cc | 4 +- src/arith/domain_touched.cc | 4 +- src/arith/int_constraints.cc | 27 +-- src/arith/int_set.cc | 28 ++-- src/arith/interval_set.h | 2 +- src/arith/ir_mutator_with_analyzer.cc | 2 +- src/arith/iter_affine_map.cc | 20 +-- src/arith/modular_set.cc | 2 +- src/arith/narrow_predicate_expression.cc | 2 +- src/arith/presburger_set.cc | 2 +- src/arith/presburger_set.h | 4 +- src/arith/rewrite_simplify.cc | 2 +- src/arith/rewrite_simplify.h | 2 +- src/arith/scalable_expression.cc | 4 +- src/arith/solve_linear_equation.cc | 2 +- src/arith/solve_linear_inequality.cc | 31 ++-- src/contrib/msc/core/codegen/cpp_codegen.h | 4 +- src/contrib/msc/core/ir/graph.cc | 88 +++++----- src/contrib/msc/core/ir/graph.h | 16 +- src/contrib/msc/core/ir/graph_builder.cc | 4 +- src/contrib/msc/core/ir/plugin.cc | 9 +- src/contrib/msc/core/ir/plugin.h | 8 +- src/contrib/msc/core/printer/msc_doc.h | 16 +- .../msc/core/transform/bind_named_params.cc | 2 +- src/contrib/msc/core/transform/bind_shape.cc | 2 +- src/contrib/msc/core/transform/fuse_tuple.cc | 2 +- .../msc/core/transform/inline_params.cc | 2 +- .../msc/core/transform/set_byoc_attrs.cc | 2 +- .../msc/core/transform/set_expr_layout.cc | 2 +- .../msc/core/transform/set_expr_name.cc | 2 +- src/contrib/msc/core/utils.cc | 12 +- .../msc/framework/tensorflow/codegen.cc | 2 +- src/contrib/msc/framework/tensorrt/codegen.cc | 13 +- .../framework/tensorrt/transform_tensorrt.cc | 2 +- src/contrib/msc/framework/torch/codegen.cc | 2 +- src/contrib/msc/framework/tvm/codegen.cc | 16 +- src/contrib/msc/framework/tvm/relax_opcode.cc | 137 ++++++++------- src/contrib/msc/plugin/tensorrt_codegen.cc | 2 +- src/contrib/msc/plugin/torch_codegen.cc | 8 +- src/contrib/msc/plugin/tvm_codegen.cc | 4 +- src/ir/analysis.cc | 2 +- src/ir/apply_pass_to_function.cc | 2 +- src/ir/attrs.cc | 2 +- src/ir/diagnostic.cc | 27 +-- src/ir/env_func.cc | 10 +- src/ir/expr.cc | 12 +- src/ir/function.cc | 12 +- src/ir/global_info.cc | 4 +- src/ir/global_var_supply.cc | 13 +- src/ir/instrument.cc | 8 +- src/ir/module.cc | 39 ++--- src/ir/name_supply.cc | 8 +- src/ir/op.cc | 30 ++-- src/ir/replace_global_vars.cc | 4 +- src/ir/source_map.cc | 24 +-- src/ir/transform.cc | 26 +-- src/ir/type.cc | 15 +- src/meta_schedule/arg_info.cc | 15 +- src/meta_schedule/builder/builder.cc | 8 +- src/meta_schedule/cost_model/cost_model.cc | 10 +- src/meta_schedule/database/database.cc | 43 ++--- src/meta_schedule/database/json_database.cc | 5 +- src/meta_schedule/database/memory_database.cc | 4 +- .../database/ordered_union_database.cc | 6 +- .../database/schedule_fn_database.cc | 5 +- src/meta_schedule/database/union_database.cc | 5 +- src/meta_schedule/extracted_task.cc | 2 +- .../feature_extractor/feature_extractor.cc | 5 +- .../feature_extractor/per_store_feature.cc | 4 +- .../measure_callback/add_to_database.cc | 4 +- .../measure_callback/measure_callback.cc | 6 +- .../measure_callback/remove_build_artifact.cc | 8 +- .../measure_callback/update_cost_model.cc | 4 +- .../mutator/mutate_compute_location.cc | 4 +- src/meta_schedule/mutator/mutate_parallel.cc | 4 +- .../mutator/mutate_thread_binding.cc | 6 +- src/meta_schedule/mutator/mutate_tile_size.cc | 4 +- src/meta_schedule/mutator/mutate_unroll.cc | 5 +- src/meta_schedule/mutator/mutator.cc | 16 +- .../disallow_async_strided_mem_copy.cc | 4 +- .../postproc/disallow_dynamic_loop.cc | 7 +- src/meta_schedule/postproc/postproc.cc | 16 +- .../postproc/rewrite_cooperative_fetch.cc | 4 +- src/meta_schedule/postproc/rewrite_layout.cc | 5 +- .../rewrite_parallel_vectorize_unroll.cc | 4 +- .../postproc/rewrite_reduction_block.cc | 4 +- .../postproc/rewrite_tensorize.cc | 4 +- .../postproc/rewrite_unbound_block.cc | 7 +- src/meta_schedule/postproc/verify_gpu_code.cc | 5 +- .../postproc/verify_vtcm_limit.cc | 4 +- src/meta_schedule/profiler.cc | 14 +- src/meta_schedule/runner/runner.cc | 14 +- src/meta_schedule/schedule/cpu/winograd.cc | 8 +- src/meta_schedule/schedule/cuda/winograd.cc | 8 +- .../schedule_rule/add_rfactor.cc | 5 +- .../schedule_rule/apply_custom_rule.cc | 5 +- src/meta_schedule/schedule_rule/auto_bind.cc | 4 +- .../schedule_rule/auto_inline.cc | 9 +- .../schedule_rule/cross_thread_reduction.cc | 6 +- .../schedule_rule/multi_level_tiling.cc | 2 +- .../schedule_rule/multi_level_tiling.h | 4 +- .../multi_level_tiling_tensor_core.cc | 6 +- .../multi_level_tiling_wide_vector.cc | 4 +- .../multi_level_tiling_with_intrin.cc | 4 +- .../parallel_vectorize_unroll.cc | 4 +- .../schedule_rule/random_compute_location.cc | 4 +- .../schedule_rule/schedule_rule.cc | 21 +-- .../search_strategy/evolutionary_search.cc | 8 +- .../search_strategy/replay_func.cc | 5 +- .../search_strategy/replay_trace.cc | 4 +- .../search_strategy/search_strategy.cc | 16 +- .../space_generator/post_order_apply.cc | 4 +- .../space_generator/schedule_fn.cc | 5 +- .../space_generator/space_generator.cc | 12 +- .../space_generator/space_generator_union.cc | 6 +- .../task_scheduler/gradient_based.cc | 5 +- .../task_scheduler/round_robin.cc | 5 +- .../task_scheduler/task_scheduler.cc | 15 +- src/meta_schedule/trace_apply.cc | 2 +- src/meta_schedule/tune_context.cc | 8 +- src/meta_schedule/utils.h | 8 +- src/node/reflection.cc | 2 +- src/node/repr_printer.cc | 2 +- src/node/script_printer.cc | 4 +- src/node/serialization.cc | 2 +- src/node/structural_equal.cc | 4 +- src/node/structural_hash.cc | 10 +- src/relax/analysis/analysis.cc | 10 +- .../analysis/computable_at_compile_time.cc | 2 +- src/relax/analysis/detect_recursion.cc | 2 +- src/relax/analysis/layout_transformation.cc | 2 +- src/relax/analysis/struct_info_analysis.cc | 22 +-- src/relax/analysis/tir_op_pattern_kind.cc | 2 +- src/relax/analysis/udchain.cc | 2 +- src/relax/analysis/var2value.cc | 4 +- src/relax/analysis/well_formed.cc | 2 +- .../backend/adreno/annotate_custom_storage.cc | 2 +- .../adreno/fold_vdevice_scope_change.cc | 2 +- src/relax/backend/contrib/clml/codegen.cc | 10 +- src/relax/backend/contrib/cublas/codegen.cc | 4 +- src/relax/backend/contrib/cudnn/codegen.cc | 4 +- src/relax/backend/contrib/cutlass/codegen.cc | 14 +- src/relax/backend/contrib/dnnl/codegen.cc | 4 +- src/relax/backend/contrib/hipblas/codegen.cc | 4 +- src/relax/backend/contrib/nnapi/codegen.cc | 4 +- src/relax/backend/contrib/tensorrt/codegen.cc | 10 +- src/relax/backend/contrib/utils.cc | 2 +- src/relax/backend/pattern_registry.cc | 8 +- src/relax/backend/task_extraction.cc | 4 +- src/relax/backend/vm/codegen_vm.cc | 26 +-- src/relax/backend/vm/codegen_vm_tir.cc | 24 +-- src/relax/backend/vm/exec_builder.cc | 28 ++-- src/relax/backend/vm/lower_runtime_builtin.cc | 18 +- src/relax/backend/vm/vm_shape_lower.cc | 24 +-- src/relax/distributed/global_info.cc | 2 +- src/relax/distributed/struct_info.cc | 10 +- .../transform/legalize_redistribute.cc | 3 +- .../distributed/transform/lower_distir.cc | 6 +- .../lower_global_view_to_local_view.cc | 2 +- .../transform/propagate_sharding.cc | 6 +- src/relax/ir/binding_rewrite.cc | 16 +- src/relax/ir/block_builder.cc | 36 ++-- src/relax/ir/dataflow_block_rewriter.cc | 8 +- src/relax/ir/dataflow_expr_rewriter.cc | 18 +- src/relax/ir/dataflow_pattern.cc | 64 +++---- src/relax/ir/dataflow_rewriter.h | 9 +- src/relax/ir/emit_te.cc | 2 +- src/relax/ir/emit_te.h | 2 +- src/relax/ir/expr.cc | 101 +++++------ src/relax/ir/expr_functor.cc | 2 +- src/relax/ir/py_expr_functor.cc | 54 +++--- src/relax/ir/struct_info.cc | 39 ++--- src/relax/ir/transform.cc | 8 +- src/relax/ir/type.cc | 8 +- src/relax/op/ccl/ccl.cc | 8 +- src/relax/op/distributed/distributed.cc | 8 +- src/relax/op/image/resize.cc | 4 +- src/relax/op/memory/view.cc | 8 +- src/relax/op/nn/attention.cc | 4 +- src/relax/op/nn/convolution.cc | 10 +- src/relax/op/nn/nn.cc | 30 ++-- src/relax/op/nn/pooling.cc | 18 +- src/relax/op/op.cc | 79 ++++----- src/relax/op/op_common.h | 16 +- src/relax/op/tensor/binary.h | 5 +- src/relax/op/tensor/create.cc | 18 +- src/relax/op/tensor/datatype.cc | 4 +- src/relax/op/tensor/grad.cc | 14 +- src/relax/op/tensor/index.cc | 6 +- src/relax/op/tensor/linear_algebra.cc | 6 +- src/relax/op/tensor/manipulate.cc | 48 +++--- src/relax/op/tensor/qdq.cc | 4 +- src/relax/op/tensor/sampling.cc | 2 +- src/relax/op/tensor/search.cc | 6 +- src/relax/op/tensor/set.cc | 8 +- src/relax/op/tensor/sorting.cc | 6 +- src/relax/op/tensor/statistical.cc | 4 +- src/relax/op/tensor/statistical.h | 5 +- src/relax/op/tensor/ternary.cc | 2 +- src/relax/op/tensor/unary.cc | 2 +- src/relax/op/vision/nms.cc | 2 +- src/relax/testing/transform.cc | 2 +- src/relax/training/utils.cc | 2 +- src/relax/transform/adjust_matmul_order.cc | 2 +- src/relax/transform/allocate_workspace.cc | 2 +- src/relax/transform/alter_op_impl.cc | 2 +- .../transform/annotate_tir_op_pattern.cc | 2 +- .../attach_attr_layout_free_buffers.cc | 3 +- src/relax/transform/attach_global_symbol.cc | 2 +- src/relax/transform/bind_params.cc | 4 +- src/relax/transform/bind_symbolic_vars.cc | 4 +- src/relax/transform/bundle_model_params.cc | 2 +- src/relax/transform/call_tir_rewrite.cc | 2 +- src/relax/transform/canonicalize_bindings.cc | 2 +- .../transform/combine_parallel_matmul.cc | 2 +- src/relax/transform/compute_prim_value.cc | 2 +- src/relax/transform/convert_dataflow.cc | 2 +- src/relax/transform/convert_layout.cc | 2 +- src/relax/transform/dataflow_inplace.cc | 13 +- src/relax/transform/dead_code_elimination.cc | 2 +- src/relax/transform/decompose_ops.cc | 10 +- .../transform/eliminate_common_subexpr.cc | 2 +- src/relax/transform/expand_matmul_of_sum.cc | 2 +- src/relax/transform/expand_tuple_arguments.cc | 2 +- src/relax/transform/few_shot_tuning.cc | 9 +- src/relax/transform/fold_constant.cc | 6 +- src/relax/transform/fuse_ops.cc | 6 +- src/relax/transform/fuse_tir.cc | 2 +- src/relax/transform/gradient.cc | 2 +- src/relax/transform/infer_layout_utils.h | 5 +- src/relax/transform/inline_functions.cc | 4 +- src/relax/transform/kill_after_last_use.cc | 2 +- src/relax/transform/lambda_lift.cc | 2 +- src/relax/transform/lazy_transform_params.cc | 4 +- src/relax/transform/legalize_ops.cc | 2 +- src/relax/transform/lift_transform_params.cc | 4 +- src/relax/transform/lower_alloc_tensor.cc | 2 +- .../transform/merge_composite_functions.cc | 2 +- src/relax/transform/meta_schedule.cc | 6 +- src/relax/transform/normalize.cc | 4 +- src/relax/transform/realize_vdevice.cc | 2 +- src/relax/transform/remove_purity_checking.cc | 2 +- src/relax/transform/remove_unused_outputs.cc | 2 +- .../transform/remove_unused_parameters.cc | 2 +- .../reorder_permute_dims_after_concat.cc | 2 +- .../transform/reorder_take_after_matmul.cc | 2 +- src/relax/transform/rewrite_cuda_graph.cc | 7 +- .../transform/rewrite_dataflow_reshape.cc | 2 +- src/relax/transform/run_codegen.cc | 5 +- .../specialize_primfunc_based_on_callsite.cc | 2 +- .../transform/split_call_tir_by_pattern.cc | 2 +- .../transform/split_layout_rewrite_preproc.cc | 2 +- .../transform/static_plan_block_memory.cc | 4 +- src/relax/transform/to_mixed_precision.cc | 2 +- src/relax/transform/to_non_dataflow.cc | 2 +- src/relax/transform/topological_sort.cc | 2 +- .../transform/update_param_struct_info.cc | 2 +- src/relax/transform/update_vdevice.cc | 2 +- src/relax/utils.cc | 2 +- src/runtime/contrib/amx/amx_config.cc | 25 +-- .../contrib/arm_compute_lib/acl_runtime.cc | 2 +- src/runtime/contrib/bnns/bnns_json_runtime.cc | 2 +- src/runtime/contrib/clml/clml_runtime.cc | 8 +- .../contrib/cublas/cublas_json_runtime.cc | 2 +- .../contrib/cudnn/cudnn_frontend/attention.h | 2 +- .../contrib/cudnn/cudnn_json_runtime.cc | 2 +- src/runtime/contrib/cudnn/cudnn_utils.cc | 2 +- src/runtime/contrib/curand/curand.cc | 4 +- .../contrib/cutlass/fp16_group_gemm_sm100.cu | 2 +- .../contrib/cutlass/fp16_group_gemm_sm90.cu | 2 +- src/runtime/contrib/cutlass/fp8_gemm.cu | 6 +- .../contrib/cutlass/fp8_group_gemm_sm90.cu | 6 +- .../fp8_groupwise_scaled_gemm_sm100.cu | 4 +- .../cutlass/fp8_groupwise_scaled_gemm_sm90.cu | 5 +- .../fp8_groupwise_scaled_group_gemm_sm100.cu | 2 +- .../contrib/cutlass/weight_preprocess.cc | 4 +- src/runtime/contrib/dnnl/dnnl_json_runtime.cc | 2 +- .../contrib/hipblas/hipblas_json_runtime.cc | 2 +- src/runtime/contrib/miopen/miopen_utils.cc | 2 +- src/runtime/contrib/mps/mps_utils.mm | 2 +- src/runtime/contrib/mrvl/mrvl_hw_runtime.cc | 2 +- src/runtime/contrib/mrvl/mrvl_runtime.cc | 2 +- src/runtime/contrib/msc/tensorrt_runtime.cc | 6 +- src/runtime/contrib/nnapi/nnapi_runtime.cc | 2 +- src/runtime/contrib/nvshmem/init.cc | 8 +- src/runtime/contrib/nvshmem/kv_transfer.cu | 4 +- .../contrib/nvshmem/memory_allocator.cc | 4 +- src/runtime/contrib/papi/papi.cc | 6 +- src/runtime/contrib/random/random.cc | 2 +- .../contrib/tensorrt/tensorrt_runtime.cc | 2 +- src/runtime/contrib/tflite/tflite_runtime.cc | 2 +- src/runtime/cpu_device_api.cc | 2 +- src/runtime/cuda/cuda_device_api.cc | 18 +- src/runtime/cuda/cuda_module.cc | 4 +- src/runtime/cuda/l2_cache_flush.cc | 2 +- src/runtime/device_api.cc | 16 +- src/runtime/disco/bcast_session.cc | 2 +- src/runtime/disco/builtin.cc | 34 ++-- src/runtime/disco/cuda_ipc/cuda_ipc_memory.cc | 4 +- .../disco/cuda_ipc/custom_allreduce.cc | 2 +- .../disco/distributed/socket_session.cc | 16 +- src/runtime/disco/loader.cc | 14 +- src/runtime/disco/nccl/nccl.cc | 53 +++--- src/runtime/disco/process_session.cc | 7 +- src/runtime/disco/protocol.h | 7 +- src/runtime/disco/session.cc | 22 +-- src/runtime/disco/threaded_session.cc | 2 +- src/runtime/file_utils.cc | 9 +- src/runtime/hexagon/hexagon_common.cc | 4 +- src/runtime/hexagon/hexagon_device_api.cc | 22 +-- src/runtime/hexagon/rpc/hexagon/rpc_server.cc | 4 +- .../hexagon/rpc/simulator/rpc_server.cc | 4 +- src/runtime/memory/memory_manager.cc | 2 +- src/runtime/metal/metal_device_api.mm | 8 +- src/runtime/metal/metal_module.mm | 2 +- src/runtime/minrpc/minrpc_server.h | 2 +- src/runtime/module.cc | 22 +-- src/runtime/opencl/opencl_common.h | 3 +- src/runtime/opencl/opencl_device_api.cc | 17 +- src/runtime/profiling.cc | 28 ++-- src/runtime/rocm/rocm_device_api.cc | 10 +- src/runtime/rpc/rpc_device_api.cc | 2 +- src/runtime/rpc/rpc_endpoint.cc | 2 +- src/runtime/rpc/rpc_event_impl.cc | 2 +- src/runtime/rpc/rpc_local_session.cc | 2 +- src/runtime/rpc/rpc_module.cc | 12 +- src/runtime/rpc/rpc_pipe_impl.cc | 2 +- src/runtime/rpc/rpc_session.h | 2 +- src/runtime/rpc/rpc_socket_impl.cc | 6 +- src/runtime/static_library.cc | 2 +- src/runtime/tensor.cc | 10 +- src/runtime/thread_pool.cc | 4 +- src/runtime/vm/builtin.cc | 62 +++---- src/runtime/vm/cuda/cuda_graph_builtin.cc | 19 ++- src/runtime/vm/executable.cc | 2 +- src/runtime/vm/hexagon/builtin.cc | 6 +- src/runtime/vm/kv_state.cc | 51 +++--- src/runtime/vm/kv_state.h | 6 +- src/runtime/vm/lm_support.cc | 30 ++-- src/runtime/vm/paged_kv_cache.cc | 12 +- src/runtime/vm/rnn_state.cc | 14 +- src/runtime/vm/tensor_cache_support.cc | 20 +-- src/runtime/vulkan/vulkan_device_api.cc | 13 +- src/script/ir_builder/base.cc | 21 +-- src/script/ir_builder/ir/ir.cc | 16 +- src/script/ir_builder/relax/distributed.cc | 2 +- src/script/ir_builder/relax/ir.cc | 32 ++-- src/script/ir_builder/tir/ir.cc | 157 +++++++++--------- src/script/printer/doc.cc | 79 ++++----- .../printer/doc_printer/python_doc_printer.cc | 2 +- src/script/printer/ir/ir.cc | 6 +- src/script/printer/ir/utils.h | 2 +- src/script/printer/relax/function.cc | 2 +- src/script/printer/relax/type.cc | 2 +- src/script/printer/relax/utils.h | 2 +- src/script/printer/tir/expr.cc | 2 +- src/script/printer/tir/utils.h | 2 +- src/support/ffi_testing.cc | 53 +++--- src/support/libinfo.cc | 2 +- src/target/codegen.cc | 20 +-- src/target/datatype/registry.cc | 13 +- src/target/intrin_rule.cc | 14 +- src/target/llvm/codegen_amdgpu.cc | 6 +- src/target/llvm/codegen_hexagon.cc | 2 +- src/target/llvm/codegen_nvptx.cc | 4 +- src/target/llvm/intrin_rule_hexagon.cc | 14 +- src/target/llvm/intrin_rule_llvm.cc | 10 +- src/target/llvm/intrin_rule_nvptx.cc | 10 +- src/target/llvm/intrin_rule_rocm.cc | 10 +- src/target/llvm/llvm_module.cc | 32 ++-- src/target/opt/build_cuda_on.cc | 8 +- src/target/parsers/cpu.cc | 2 +- src/target/source/codegen_c_host.cc | 2 +- src/target/source/codegen_cuda.cc | 2 +- src/target/source/codegen_metal.cc | 4 +- src/target/source/codegen_opencl.cc | 4 +- src/target/source/codegen_webgpu.cc | 2 +- src/target/source/intrin_rule_cuda.cc | 10 +- src/target/source/intrin_rule_metal.cc | 10 +- src/target/source/intrin_rule_opencl.cc | 10 +- src/target/source/intrin_rule_webgpu.cc | 8 +- src/target/source/source_module.cc | 13 +- src/target/spirv/build_vulkan.cc | 2 +- src/target/spirv/intrin_rule_spirv.cc | 10 +- src/target/tag.cc | 4 +- src/target/target.cc | 16 +- src/target/target_kind.cc | 15 +- src/target/virtual_device.cc | 2 +- src/te/operation/compute_op.cc | 11 +- src/te/operation/create_primfunc.cc | 8 +- src/te/operation/extern_op.cc | 2 +- src/te/operation/graph.cc | 4 +- src/te/operation/placeholder_op.cc | 27 +-- src/te/operation/scan_op.cc | 2 +- src/te/tensor.cc | 17 +- .../analysis/block_access_region_detector.cc | 4 +- .../analysis/buffer_access_lca_detector.cc | 2 +- .../analysis/calculate_allocated_memory.cc | 6 +- src/tir/analysis/deep_equal.cc | 2 +- src/tir/analysis/estimate_flops.cc | 2 +- src/tir/analysis/identify_memcpy.cc | 2 +- src/tir/analysis/is_pure_function.cc | 2 +- src/tir/analysis/oob_checker.cc | 4 +- src/tir/analysis/stmt_finding.cc | 2 +- src/tir/analysis/var_use_def_analysis.cc | 2 +- src/tir/analysis/verify_gpu_code.cc | 4 +- src/tir/analysis/verify_memory.cc | 4 +- src/tir/analysis/verify_ssa.cc | 4 +- src/tir/analysis/verify_well_formed.cc | 4 +- src/tir/ir/block_dependence_info.cc | 4 +- src/tir/ir/block_scope.cc | 8 +- src/tir/ir/buffer.cc | 2 +- src/tir/ir/data_layout.cc | 12 +- src/tir/ir/expr.cc | 91 +++++----- src/tir/ir/function.cc | 8 +- src/tir/ir/index_map.cc | 12 +- src/tir/ir/py_functor.cc | 24 +-- src/tir/ir/script/script_complete.cc | 2 +- src/tir/ir/specialize.cc | 2 +- src/tir/ir/stmt.cc | 47 +++--- src/tir/ir/stmt_functor.cc | 8 +- src/tir/ir/transform.cc | 4 +- src/tir/op/op.cc | 60 +++---- src/tir/schedule/analysis.h | 4 +- src/tir/schedule/analysis/analysis.cc | 34 ++-- src/tir/schedule/analysis/layout.cc | 2 +- src/tir/schedule/instruction.cc | 4 +- .../schedule/primitive/decompose_padding.cc | 2 +- src/tir/schedule/primitive/reduction.cc | 2 +- src/tir/schedule/schedule.cc | 142 ++++++++-------- src/tir/schedule/state.cc | 10 +- src/tir/schedule/trace.cc | 20 +-- src/tir/schedule/transform.cc | 4 +- src/tir/transforms/annotate_device_regions.cc | 2 +- src/tir/transforms/annotate_irregular_loop.cc | 2 +- src/tir/transforms/bind_target.cc | 2 +- src/tir/transforms/bound_checker.cc | 2 +- src/tir/transforms/canonicalize_loop.cc | 2 +- src/tir/transforms/combine_context_call.cc | 2 +- src/tir/transforms/common_subexpr_elim.cc | 2 +- src/tir/transforms/compact_buffer_region.cc | 2 +- .../transforms/convert_blocks_to_opaque.cc | 2 +- .../transforms/convert_for_loops_serial.cc | 2 +- src/tir/transforms/decorate_device_scope.cc | 2 +- src/tir/transforms/default_gpu_schedule.cc | 2 +- src/tir/transforms/extract_constants.cc | 2 +- src/tir/transforms/flatten_buffer.cc | 2 +- .../transforms/force_narrow_index_to_i32.cc | 2 +- src/tir/transforms/hoist_expression.cc | 10 +- src/tir/transforms/inject_double_buffer.cc | 4 +- src/tir/transforms/inject_permuted_layout.cc | 2 +- src/tir/transforms/inject_ptx_async_copy.cc | 2 +- src/tir/transforms/inject_ptx_ldg32.cc | 2 +- src/tir/transforms/inject_rolling_buffer.cc | 2 +- .../transforms/inject_software_pipeline.cc | 2 +- src/tir/transforms/inject_virtual_thread.cc | 2 +- .../transforms/inline_private_functions.cc | 2 +- src/tir/transforms/ir_utils.cc | 2 +- src/tir/transforms/lift_thread_binding.cc | 2 +- src/tir/transforms/loop_partition.cc | 6 +- src/tir/transforms/lower_async_dma.cc | 2 +- .../lower_cross_thread_reduction.cc | 2 +- src/tir/transforms/lower_custom_datatypes.cc | 2 +- .../transforms/lower_device_kernel_launch.cc | 2 +- .../lower_device_storage_access_info.cc | 3 +- src/tir/transforms/lower_init_block.cc | 2 +- src/tir/transforms/lower_intrin.cc | 2 +- src/tir/transforms/lower_match_buffer.cc | 2 +- src/tir/transforms/lower_opaque_block.cc | 2 +- src/tir/transforms/lower_thread_allreduce.cc | 2 +- src/tir/transforms/lower_tvm_builtin.cc | 2 +- src/tir/transforms/lower_vtcm_alloc.cc | 2 +- src/tir/transforms/lower_warp_memory.cc | 2 +- src/tir/transforms/make_packed_api.cc | 2 +- src/tir/transforms/make_unpacked_api.cc | 2 +- .../manifest_shared_memory_local_stage.cc | 2 +- .../transforms/memhammer_lower_auto_copy.cc | 2 +- .../merge_shared_memory_allocations.cc | 3 +- src/tir/transforms/narrow_datatype.cc | 2 +- .../plan_update_buffer_allocation_location.cc | 2 +- src/tir/transforms/primfunc_utils.cc | 4 +- src/tir/transforms/profile_instrumentation.cc | 3 +- .../reduce_branching_through_overcompute.cc | 4 +- src/tir/transforms/remap_thread_axis.cc | 2 +- src/tir/transforms/remove_assume.cc | 2 +- src/tir/transforms/remove_no_op.cc | 4 +- src/tir/transforms/remove_store_undef.cc | 2 +- .../remove_weight_layout_rewrite_block.cc | 2 +- src/tir/transforms/renew_defs.cc | 2 +- .../transforms/renormalize_split_pattern.cc | 2 +- src/tir/transforms/rewrite_unsafe_select.cc | 2 +- src/tir/transforms/simplify.cc | 4 +- src/tir/transforms/skip_assert.cc | 2 +- src/tir/transforms/split_host_device.cc | 2 +- src/tir/transforms/storage_rewrite.cc | 4 +- .../transforms/tensorcore_infer_fragment.cc | 2 +- src/tir/transforms/thread_storage_sync.cc | 2 +- .../transforms/transform_mma_buffer_layout.cc | 8 +- src/tir/transforms/unify_thread_binding.cc | 2 +- src/tir/transforms/unroll_loop.cc | 4 +- .../transforms/unsupported_dtype_legalize.cc | 8 +- .../using_assume_to_reduce_branches.cc | 2 +- src/tir/transforms/vectorize_loop.cc | 2 +- src/topi/broadcast.cc | 52 +++--- src/topi/einsum.cc | 2 +- src/topi/elemwise.cc | 111 +++++++------ src/topi/nn.cc | 60 +++---- src/topi/reduction.cc | 18 +- src/topi/transform.cc | 64 +++---- src/topi/utils.cc | 6 +- src/topi/vision.cc | 2 +- web/apps/node/example.js | 2 +- web/emcc/tvmjs_support.cc | 4 +- web/emcc/wasm_runtime.cc | 18 +- web/emcc/webgpu_runtime.cc | 4 +- web/src/rpc_server.ts | 4 +- web/src/runtime.ts | 42 ++--- web/src/support.ts | 4 +- web/tests/node/test_packed_func.js | 26 +-- 866 files changed, 3698 insertions(+), 3546 deletions(-) diff --git a/apps/cpp_rpc/rpc_server.cc b/apps/cpp_rpc/rpc_server.cc index fd8fc476bbec..3d4607567482 100644 --- a/apps/cpp_rpc/rpc_server.cc +++ b/apps/cpp_rpc/rpc_server.cc @@ -401,7 +401,7 @@ void RPCServerCreate(std::string host, int port, int port_end, std::string track TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("rpc.ServerCreate", RPCServerCreate); + refl::GlobalDef().def("tvm.rpc.ServerCreate", RPCServerCreate); } } // namespace runtime } // namespace tvm diff --git a/apps/hexagon_launcher/launcher_core.cc b/apps/hexagon_launcher/launcher_core.cc index 3bf6ce23cf8d..d5d1362bb506 100644 --- a/apps/hexagon_launcher/launcher_core.cc +++ b/apps/hexagon_launcher/launcher_core.cc @@ -148,12 +148,13 @@ const tvm::ffi::Function get_module_func(tvm::runtime::Module module, const std: } void reset_device_api() { - const tvm::ffi::Function api = get_runtime_func("device_api.hexagon"); - tvm::ffi::Function::SetGlobal("device_api.cpu", api, true); + const tvm::ffi::Function api = get_runtime_func("tvm.device_api.hexagon"); + tvm::ffi::Function::SetGlobal("tvm.device_api.cpu", api, true); } tvm::runtime::Module load_module(const std::string& file_name) { - static const tvm::ffi::Function loader = get_runtime_func("ffi.Module.load_from_file.hexagon"); + static const tvm::ffi::Function loader = + get_runtime_func("tvm.ffi.Module.load_from_file.hexagon"); tvm::ffi::Any rv = loader(file_name); if (rv.type_code() == kTVMModuleHandle) { ICHECK_EQ(rv.type_code(), kTVMModuleHandle) diff --git a/apps/hexagon_launcher/launcher_hexagon.cc b/apps/hexagon_launcher/launcher_hexagon.cc index 64b795d8f45c..98c000b73abe 100644 --- a/apps/hexagon_launcher/launcher_hexagon.cc +++ b/apps/hexagon_launcher/launcher_hexagon.cc @@ -48,7 +48,7 @@ int __QAIC_HEADER(launcher_rpc_open)(const char* uri, remote_handle64* handle) { *handle = 0; // Just use any value. reset_device_api(); static const tvm::ffi::Function acq_res = - get_runtime_func("device_api.hexagon.acquire_resources"); + get_runtime_func("tvm.device_api.hexagon.acquire_resources"); acq_res(); return AEE_SUCCESS; } @@ -56,7 +56,7 @@ int __QAIC_HEADER(launcher_rpc_open)(const char* uri, remote_handle64* handle) { int __QAIC_HEADER(launcher_rpc_close)(remote_handle64 handle) { // Comment to stop clang-format from single-lining this function. static const tvm::ffi::Function rel_res = - get_runtime_func("device_api.hexagon.release_resources"); + get_runtime_func("tvm.device_api.hexagon.release_resources"); rel_res(); return AEE_SUCCESS; } diff --git a/apps/ios_rpc/tests/ios_rpc_test.py b/apps/ios_rpc/tests/ios_rpc_test.py index df850812e527..1f88f6f9fc37 100644 --- a/apps/ios_rpc/tests/ios_rpc_test.py +++ b/apps/ios_rpc/tests/ios_rpc_test.py @@ -39,7 +39,7 @@ # override metal compiler to compile to iphone -@tvm.register_global_func("tvm_callback_metal_compile") +@tvm.register_global_func("tvm.tvm_callback_metal_compile") def compile_metal(src, target): return xcode.compile_metal(src, sdk=sdk) diff --git a/apps/ios_rpc/tvmrpc/RPCServer.mm b/apps/ios_rpc/tvmrpc/RPCServer.mm index da689d4c7064..41ed95426a10 100644 --- a/apps/ios_rpc/tvmrpc/RPCServer.mm +++ b/apps/ios_rpc/tvmrpc/RPCServer.mm @@ -62,7 +62,7 @@ */ FEventHandler CreateServerEventHandler(NSOutputStream* outputStream, std::string name, std::string remote_key) { - auto event_handler_factory = tvm::ffi::Function::GetGlobal("rpc.CreateEventDrivenServer"); + auto event_handler_factory = tvm::ffi::Function::GetGlobal("tvm.rpc.CreateEventDrivenServer"); ICHECK(event_handler_factory.has_value()) << "You are using tvm_runtime module built without RPC support. " << "Please rebuild it with USE_RPC flag."; diff --git a/apps/ios_rpc/tvmrpc/TVMRuntime.mm b/apps/ios_rpc/tvmrpc/TVMRuntime.mm index 5dfff0cd86b4..9b47aa4ca6b1 100644 --- a/apps/ios_rpc/tvmrpc/TVMRuntime.mm +++ b/apps/ios_rpc/tvmrpc/TVMRuntime.mm @@ -70,7 +70,7 @@ void LogMessageImpl(const std::string& file, int lineno, int level, const std::s NSBundle* bundle = [NSBundle mainBundle]; base = [[bundle privateFrameworksPath] stringByAppendingPathComponent:@"tvm"]; - if (tvm::ffi::Function::GetGlobal("ffi.Module.load_from_file.dylib_custom")) { + if (tvm::ffi::Function::GetGlobal("tvm.ffi.Module.load_from_file.dylib_custom")) { // Custom dso loader is present. Will use it. base = NSTemporaryDirectory(); fmt = "dylib_custom"; @@ -114,7 +114,7 @@ void Init(const std::string& name) { // Add UnsignedDSOLoader plugin in global registry TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def_packed("ffi.Module.load_from_file.dylib_custom", + refl::GlobalDef().def_packed("tvm.ffi.Module.load_from_file.dylib_custom", [](ffi::PackedArgs args, ffi::Any* rv) { auto n = ffi::make_object(); n->Init(args[0]); diff --git a/include/tvm/arith/analyzer.h b/include/tvm/arith/analyzer.h index 099643d0a0bb..7821193c70a0 100644 --- a/include/tvm/arith/analyzer.h +++ b/include/tvm/arith/analyzer.h @@ -103,7 +103,7 @@ class ConstIntBoundNode : public Object { static const constexpr int64_t kNegInf = -kPosInf; static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind = kTVMFFISEqHashKindTreeNode; - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("arith.ConstIntBound", ConstIntBoundNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.arith.ConstIntBound", ConstIntBoundNode, Object); }; /*! @@ -215,7 +215,7 @@ class ModularSetNode : public Object { } static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind = kTVMFFISEqHashKindTreeNode; - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("arith.ModularSet", ModularSetNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.arith.ModularSet", ModularSetNode, Object); }; /*! diff --git a/include/tvm/arith/int_set.h b/include/tvm/arith/int_set.h index d1e8f9475750..1c0ce4959b03 100644 --- a/include/tvm/arith/int_set.h +++ b/include/tvm/arith/int_set.h @@ -56,7 +56,7 @@ enum SignType { kPositive, kNegative, kZero, kUnknown }; */ class IntSetNode : public Object { public: - TVM_FFI_DECLARE_OBJECT_INFO("ir.IntSet", IntSetNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO("tvm.ir.IntSet", IntSetNode, Object); }; /*! diff --git a/include/tvm/arith/int_solver.h b/include/tvm/arith/int_solver.h index b8f0ac6d4327..4a82815e6ae0 100644 --- a/include/tvm/arith/int_solver.h +++ b/include/tvm/arith/int_solver.h @@ -72,7 +72,7 @@ class IntGroupBoundsNode : public Object { } static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind = kTVMFFISEqHashKindTreeNode; - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("arith.IntGroupBounds", IntGroupBoundsNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.arith.IntGroupBounds", IntGroupBoundsNode, Object); }; /*! @@ -150,7 +150,7 @@ class IntConstraintsNode : public Object { } static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind = kTVMFFISEqHashKindTreeNode; - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("arith.IntConstraints", IntConstraintsNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.arith.IntConstraints", IntConstraintsNode, Object); }; /*! @@ -203,8 +203,8 @@ class IntConstraintsTransformNode : public Object { } static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind = kTVMFFISEqHashKindTreeNode; - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("arith.IntConstraintsTransform", IntConstraintsTransformNode, - Object); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.arith.IntConstraintsTransform", + IntConstraintsTransformNode, Object); }; /*! diff --git a/include/tvm/arith/iter_affine_map.h b/include/tvm/arith/iter_affine_map.h index 223fb3509571..89c484a77cdd 100644 --- a/include/tvm/arith/iter_affine_map.h +++ b/include/tvm/arith/iter_affine_map.h @@ -67,7 +67,7 @@ namespace arith { class IterMapExprNode : public PrimExprNode { public: static constexpr const uint32_t _type_child_slots = 2; - TVM_FFI_DECLARE_OBJECT_INFO("arith.IterMapExpr", IterMapExprNode, PrimExprNode); + TVM_FFI_DECLARE_OBJECT_INFO("tvm.arith.IterMapExpr", IterMapExprNode, PrimExprNode); }; /*! @@ -105,7 +105,7 @@ class IterMarkNode : public Object { } static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind = kTVMFFISEqHashKindDAGNode; - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("arith.IterMark", IterMarkNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.arith.IterMark", IterMarkNode, Object); }; /*! @@ -151,7 +151,7 @@ class IterSplitExprNode : public IterMapExprNode { } static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind = kTVMFFISEqHashKindTreeNode; - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("arith.IterSplitExpr", IterSplitExprNode, IterMapExprNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.arith.IterSplitExpr", IterSplitExprNode, IterMapExprNode); }; /*! @@ -205,7 +205,7 @@ class IterSumExprNode : public IterMapExprNode { } static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind = kTVMFFISEqHashKindTreeNode; - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("arith.IterSumExpr", IterSumExprNode, IterMapExprNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.arith.IterSumExpr", IterSumExprNode, IterMapExprNode); }; /*! @@ -264,7 +264,7 @@ class IterMapResultNode : public Object { .def_ro("errors", &IterMapResultNode::errors) .def_ro("padding_predicate", &IterMapResultNode::padding_predicate); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("arith.IterMapResult", IterMapResultNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.arith.IterMapResult", IterMapResultNode, Object); }; /*! diff --git a/include/tvm/ir/attrs.h b/include/tvm/ir/attrs.h index e68261602a47..cd5866cb7b0c 100644 --- a/include/tvm/ir/attrs.h +++ b/include/tvm/ir/attrs.h @@ -84,7 +84,7 @@ class AttrFieldInfoNode : public Object { static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind = kTVMFFISEqHashKindTreeNode; - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("ir.AttrFieldInfo", AttrFieldInfoNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.ir.AttrFieldInfo", AttrFieldInfoNode, Object); }; /*! \brief AttrFieldInfo */ @@ -121,7 +121,7 @@ class BaseAttrsNode : public Object { bool allow_unknown = false) = 0; static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind = kTVMFFISEqHashKindTreeNode; - TVM_FFI_DECLARE_OBJECT_INFO("ir.Attrs", BaseAttrsNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO("tvm.ir.Attrs", BaseAttrsNode, Object); }; /*! @@ -152,7 +152,7 @@ class DictAttrsNode : public BaseAttrsNode { void InitByPackedArgs(const ffi::PackedArgs& args, bool allow_unknown) final; // type info - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("ir.DictAttrs", DictAttrsNode, BaseAttrsNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.ir.DictAttrs", DictAttrsNode, BaseAttrsNode); }; /*! diff --git a/include/tvm/ir/diagnostic.h b/include/tvm/ir/diagnostic.h index 24553de6c408..aad9b87bd6e9 100644 --- a/include/tvm/ir/diagnostic.h +++ b/include/tvm/ir/diagnostic.h @@ -75,7 +75,7 @@ class DiagnosticNode : public Object { } static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind = kTVMFFISEqHashKindTreeNode; - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("Diagnostic", DiagnosticNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.Diagnostic", DiagnosticNode, Object); }; class Diagnostic : public ObjectRef { @@ -166,7 +166,7 @@ class DiagnosticRendererNode : public Object { namespace refl = tvm::ffi::reflection; refl::ObjectDef().def_ro("renderer", &DiagnosticRendererNode::renderer); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("DiagnosticRenderer", DiagnosticRendererNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.DiagnosticRenderer", DiagnosticRendererNode, Object); }; class DiagnosticRenderer : public ObjectRef { @@ -205,7 +205,7 @@ class DiagnosticContextNode : public Object { } static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind = kTVMFFISEqHashKindTreeNode; - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("DiagnosticContext", DiagnosticContextNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.DiagnosticContext", DiagnosticContextNode, Object); }; class DiagnosticContext : public ObjectRef { diff --git a/include/tvm/ir/env_func.h b/include/tvm/ir/env_func.h index c0735b7cd69f..c46cd8b3f1ae 100644 --- a/include/tvm/ir/env_func.h +++ b/include/tvm/ir/env_func.h @@ -58,7 +58,7 @@ class EnvFuncNode : public Object { } static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind = kTVMFFISEqHashKindTreeNode; - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("ir.EnvFunc", EnvFuncNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.ir.EnvFunc", EnvFuncNode, Object); }; /*! diff --git a/include/tvm/ir/expr.h b/include/tvm/ir/expr.h index 09c0363986cf..b9487cea39e7 100644 --- a/include/tvm/ir/expr.h +++ b/include/tvm/ir/expr.h @@ -64,7 +64,7 @@ class BaseExprNode : public Object { static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind = kTVMFFISEqHashKindTreeNode; static constexpr const uint32_t _type_child_slots = 64; - TVM_FFI_DECLARE_OBJECT_INFO("ir.BaseExpr", BaseExprNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO("tvm.ir.BaseExpr", BaseExprNode, Object); }; /*! @@ -114,7 +114,7 @@ class PrimExprNode : public BaseExprNode { TVM_OBJECT_ENABLE_SCRIPT_PRINTER(); static constexpr const uint32_t _type_child_slots = 40; - TVM_FFI_DECLARE_OBJECT_INFO("ir.PrimExpr", PrimExprNode, BaseExprNode); + TVM_FFI_DECLARE_OBJECT_INFO("tvm.ir.PrimExpr", PrimExprNode, BaseExprNode); }; /*! @@ -155,7 +155,7 @@ class PrimExprConvertibleNode : public Object { public: virtual ~PrimExprConvertibleNode() {} virtual PrimExpr ToPrimExpr() const = 0; - TVM_FFI_DECLARE_OBJECT_INFO("ir.PrimExprConvertible", PrimExprConvertibleNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO("tvm.ir.PrimExprConvertible", PrimExprConvertibleNode, Object); }; /*! @@ -429,7 +429,7 @@ class RelaxExprNode : public BaseExprNode { } static constexpr const uint32_t _type_child_slots = 22; - TVM_FFI_DECLARE_OBJECT_INFO("ir.RelaxExpr", RelaxExprNode, BaseExprNode); + TVM_FFI_DECLARE_OBJECT_INFO("tvm.ir.RelaxExpr", RelaxExprNode, BaseExprNode); }; /*! @@ -471,7 +471,7 @@ class GlobalVarNode : public RelaxExprNode { } static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind = kTVMFFISEqHashKindFreeVar; - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("ir.GlobalVar", GlobalVarNode, RelaxExprNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.ir.GlobalVar", GlobalVarNode, RelaxExprNode); }; /*! @@ -499,7 +499,7 @@ class IntImmNode : public PrimExprNode { namespace refl = tvm::ffi::reflection; refl::ObjectDef().def_ro("value", &IntImmNode::value); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("ir.IntImm", IntImmNode, PrimExprNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.ir.IntImm", IntImmNode, PrimExprNode); }; /*! @@ -534,7 +534,7 @@ class FloatImmNode : public PrimExprNode { namespace refl = tvm::ffi::reflection; refl::ObjectDef().def_ro("value", &FloatImmNode::value); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("ir.FloatImm", FloatImmNode, PrimExprNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.ir.FloatImm", FloatImmNode, PrimExprNode); }; /*! @@ -682,7 +682,7 @@ class RangeNode : public Object { static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind = kTVMFFISEqHashKindTreeNode; - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("ir.Range", RangeNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.ir.Range", RangeNode, Object); }; /*! \brief Range container */ diff --git a/include/tvm/ir/function.h b/include/tvm/ir/function.h index c440e6fc9e17..308f29c7ee92 100644 --- a/include/tvm/ir/function.h +++ b/include/tvm/ir/function.h @@ -223,7 +223,7 @@ class BaseFuncNode : public RelaxExprNode { } static constexpr const uint32_t _type_child_slots = 2; - TVM_FFI_DECLARE_OBJECT_INFO("ir.BaseFunc", BaseFuncNode, RelaxExprNode); + TVM_FFI_DECLARE_OBJECT_INFO("tvm.ir.BaseFunc", BaseFuncNode, RelaxExprNode); }; /*! diff --git a/include/tvm/ir/global_info.h b/include/tvm/ir/global_info.h index 892bba4da694..ab6c8abdacbf 100644 --- a/include/tvm/ir/global_info.h +++ b/include/tvm/ir/global_info.h @@ -44,7 +44,7 @@ class GlobalInfoNode : public Object { public: static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind = kTVMFFISEqHashKindTreeNode; - TVM_FFI_DECLARE_OBJECT_INFO("ir.GlobalInfo", GlobalInfoNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO("tvm.ir.GlobalInfo", GlobalInfoNode, Object); }; /*! @@ -77,7 +77,7 @@ class VDeviceNode : public GlobalInfoNode { .def_ro("memory_scope", &VDeviceNode::memory_scope); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("ir.VDevice", VDeviceNode, GlobalInfoNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.ir.VDevice", VDeviceNode, GlobalInfoNode); }; /*! @@ -100,7 +100,7 @@ class DummyGlobalInfoNode : public GlobalInfoNode { refl::ObjectDef(); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("ir.DummyGlobalInfo", DummyGlobalInfoNode, GlobalInfoNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.ir.DummyGlobalInfo", DummyGlobalInfoNode, GlobalInfoNode); }; /*! diff --git a/include/tvm/ir/global_var_supply.h b/include/tvm/ir/global_var_supply.h index 076b8d927ece..e84bf01f12c2 100644 --- a/include/tvm/ir/global_var_supply.h +++ b/include/tvm/ir/global_var_supply.h @@ -85,7 +85,7 @@ class GlobalVarSupplyNode : public Object { NameSupply name_supply_; static constexpr const bool _type_mutable = true; - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("ir.GlobalVarSupply", GlobalVarSupplyNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.ir.GlobalVarSupply", GlobalVarSupplyNode, Object); private: std::unordered_map name_to_var_map_; diff --git a/include/tvm/ir/instrument.h b/include/tvm/ir/instrument.h index c14549f41283..cd0e7bab78b4 100644 --- a/include/tvm/ir/instrument.h +++ b/include/tvm/ir/instrument.h @@ -141,7 +141,7 @@ class PassInstrumentNode : public Object { namespace refl = tvm::ffi::reflection; refl::ObjectDef().def_ro("name", &PassInstrumentNode::name); } - TVM_FFI_DECLARE_OBJECT_INFO("instrument.PassInstrument", PassInstrumentNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO("tvm.instrument.PassInstrument", PassInstrumentNode, Object); }; /*! diff --git a/include/tvm/ir/module.h b/include/tvm/ir/module.h index 3f70b2e25540..d66831893641 100644 --- a/include/tvm/ir/module.h +++ b/include/tvm/ir/module.h @@ -140,8 +140,8 @@ class IRModuleNode : public Object { .def_ro("global_infos", &IRModuleNode::global_infos); // register custom structural equal and hash. refl::TypeAttrDef() - .def("__s_equal__", &IRModuleNode::SEqual) - .def("__s_hash__", &IRModuleNode::SHash); + .def("tvm.__s_equal__", &IRModuleNode::SEqual) + .def("tvm.__s_hash__", &IRModuleNode::SHash); } TVM_DLL bool SEqual(const IRModuleNode* other, @@ -243,7 +243,7 @@ class IRModuleNode : public Object { static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind = kTVMFFISEqHashKindTreeNode; - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("ir.IRModule", IRModuleNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.ir.IRModule", IRModuleNode, Object); private: friend class IRModule; diff --git a/include/tvm/ir/name_supply.h b/include/tvm/ir/name_supply.h index d3139ea2c821..0304356b1bff 100644 --- a/include/tvm/ir/name_supply.h +++ b/include/tvm/ir/name_supply.h @@ -92,7 +92,7 @@ class NameSupplyNode : public Object { refl::ObjectDef(); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("ir.NameSupply", NameSupplyNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.ir.NameSupply", NameSupplyNode, Object); private: /*! \brief Helper function to add the NameSupply prefix to the name. */ diff --git a/include/tvm/ir/op.h b/include/tvm/ir/op.h index 211fc3eecc1f..4c422a157772 100644 --- a/include/tvm/ir/op.h +++ b/include/tvm/ir/op.h @@ -104,7 +104,7 @@ class OpNode : public RelaxExprNode { } static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind = kTVMFFISEqHashKindUniqueInstance; - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("ir.Op", OpNode, RelaxExprNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.ir.Op", OpNode, RelaxExprNode); private: /*! \return the internal attr registry index. */ diff --git a/include/tvm/ir/source_map.h b/include/tvm/ir/source_map.h index c94fb6b0a120..5594eb3d69b2 100644 --- a/include/tvm/ir/source_map.h +++ b/include/tvm/ir/source_map.h @@ -54,7 +54,7 @@ class SourceNameNode : public Object { } static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind = kTVMFFISEqHashKindTreeNode; - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("ir.SourceName", SourceNameNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.ir.SourceName", SourceNameNode, Object); }; /*! @@ -105,7 +105,7 @@ class SpanNode : public Object { } static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind = kTVMFFISEqHashKindTreeNode; - TVM_FFI_DECLARE_OBJECT_INFO("ir.Span", SpanNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO("tvm.ir.Span", SpanNode, Object); }; class Span : public ObjectRef { @@ -130,7 +130,7 @@ class SequentialSpanNode : public SpanNode { namespace refl = tvm::ffi::reflection; refl::ObjectDef().def_ro("spans", &SequentialSpanNode::spans); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("ir.SequentialSpan", SequentialSpanNode, SpanNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.ir.SequentialSpan", SequentialSpanNode, SpanNode); }; /*! @@ -170,7 +170,7 @@ class SourceNode : public Object { .def_ro("source_name", &SourceNode::source_name) .def_ro("source", &SourceNode::source); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("ir.Source", SourceNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.ir.Source", SourceNode, Object); }; class Source : public ObjectRef { @@ -199,7 +199,7 @@ class SourceMapObj : public Object { } static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind = kTVMFFISEqHashKindTreeNode; - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("ir.SourceMap", SourceMapObj, Object); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.ir.SourceMap", SourceMapObj, Object); }; class SourceMap : public ObjectRef { diff --git a/include/tvm/ir/transform.h b/include/tvm/ir/transform.h index 77d90a0e9558..efe6a1be1510 100644 --- a/include/tvm/ir/transform.h +++ b/include/tvm/ir/transform.h @@ -134,7 +134,7 @@ class PassContextNode : public Object { .def_ro("config", &PassContextNode::config) .def_ro("diag_ctx", &PassContextNode::diag_ctx); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("transform.PassContext", PassContextNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.transform.PassContext", PassContextNode, Object); }; /*! @@ -340,7 +340,7 @@ class PassInfoNode : public Object { .def_ro("required", &PassInfoNode::required) .def_ro("traceable", &PassInfoNode::traceable); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("transform.PassInfo", PassInfoNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.transform.PassInfo", PassInfoNode, Object); }; /*! @@ -394,7 +394,7 @@ class PassNode : public Object { * \return The transformed module. */ virtual IRModule operator()(IRModule mod, const PassContext& pass_ctx) const = 0; - TVM_FFI_DECLARE_OBJECT_INFO("transform.Pass", PassNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO("tvm.transform.Pass", PassNode, Object); }; class Pass : public ObjectRef { @@ -485,7 +485,7 @@ class SequentialNode : public PassNode { * \return Return the updated module. */ IRModule operator()(IRModule mod, const PassContext& pass_ctx) const final; - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("transform.Sequential", SequentialNode, PassNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.transform.Sequential", SequentialNode, PassNode); }; class Sequential : public Pass { diff --git a/include/tvm/ir/type.h b/include/tvm/ir/type.h index 5e38f3876937..0238e2adb064 100644 --- a/include/tvm/ir/type.h +++ b/include/tvm/ir/type.h @@ -90,7 +90,7 @@ class TypeNode : public Object { static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind = kTVMFFISEqHashKindTreeNode; static constexpr const uint32_t _type_child_slots = 14; - TVM_FFI_DECLARE_OBJECT_INFO("ir.Type", TypeNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO("tvm.ir.Type", TypeNode, Object); }; /*! @@ -121,7 +121,7 @@ class PrimTypeNode : public TypeNode { namespace refl = tvm::ffi::reflection; refl::ObjectDef().def_ro("dtype", &PrimTypeNode::dtype); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("ir.PrimType", PrimTypeNode, TypeNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.ir.PrimType", PrimTypeNode, TypeNode); }; /* @@ -167,7 +167,7 @@ class PointerTypeNode : public TypeNode { .def_ro("element_type", &PointerTypeNode::element_type) .def_ro("storage_scope", &PointerTypeNode::storage_scope); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("ir.PointerType", PointerTypeNode, TypeNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.ir.PointerType", PointerTypeNode, TypeNode); }; /* @@ -203,7 +203,7 @@ class TupleTypeNode : public TypeNode { .def_ro("fields", &TupleTypeNode::fields) .def_ro("span", &TupleTypeNode::span); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("ir.TupleType", TupleTypeNode, TypeNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.ir.TupleType", TupleTypeNode, TypeNode); }; /*! @@ -264,7 +264,7 @@ class FuncTypeNode : public TypeNode { .def_ro("ret_type", &FuncTypeNode::ret_type) .def_ro("span", &FuncTypeNode::span); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("ir.FuncType", FuncTypeNode, TypeNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.ir.FuncType", FuncTypeNode, TypeNode); }; /*! @@ -295,7 +295,7 @@ class TensorMapTypeNode : public TypeNode { namespace refl = tvm::ffi::reflection; refl::ObjectDef().def_ro("span", &TensorMapTypeNode::span); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("ir.TensorMapType", TensorMapTypeNode, TypeNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.ir.TensorMapType", TensorMapTypeNode, TypeNode); }; /*! diff --git a/include/tvm/meta_schedule/arg_info.h b/include/tvm/meta_schedule/arg_info.h index 6c664b636925..4f93d170f780 100644 --- a/include/tvm/meta_schedule/arg_info.h +++ b/include/tvm/meta_schedule/arg_info.h @@ -33,7 +33,7 @@ namespace meta_schedule { /*! \brief The argument information. */ class ArgInfoNode : public runtime::Object { public: - TVM_FFI_DECLARE_OBJECT_INFO("meta_schedule.ArgInfo", ArgInfoNode, runtime::Object); + TVM_FFI_DECLARE_OBJECT_INFO("tvm.meta_schedule.ArgInfo", ArgInfoNode, runtime::Object); public: /*! \brief Default destructor. */ @@ -88,7 +88,7 @@ class TensorInfoNode : public ArgInfoNode { .def_ro("dtype", &TensorInfoNode::dtype) .def_ro("shape", &TensorInfoNode::shape); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("meta_schedule.TensorInfo", TensorInfoNode, ArgInfoNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.meta_schedule.TensorInfo", TensorInfoNode, ArgInfoNode); public: ObjectRef AsJSON() const; diff --git a/include/tvm/meta_schedule/builder.h b/include/tvm/meta_schedule/builder.h index e4b5f011eb46..29f6a7c422ce 100644 --- a/include/tvm/meta_schedule/builder.h +++ b/include/tvm/meta_schedule/builder.h @@ -50,7 +50,7 @@ class BuilderInputNode : public runtime::Object { .def_ro("target", &BuilderInputNode::target) .def_ro("params", &BuilderInputNode::params); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("meta_schedule.BuilderInput", BuilderInputNode, + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.meta_schedule.BuilderInput", BuilderInputNode, runtime::Object); }; @@ -86,7 +86,7 @@ class BuilderResultNode : public runtime::Object { .def_ro("artifact_path", &BuilderResultNode::artifact_path) .def_ro("error_msg", &BuilderResultNode::error_msg); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("meta_schedule.BuilderResult", BuilderResultNode, + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.meta_schedule.BuilderResult", BuilderResultNode, runtime::Object); }; @@ -126,7 +126,7 @@ class BuilderNode : public runtime::Object { using FBuild = ffi::TypedFunction(const ffi::Array&)>; static constexpr const bool _type_mutable = true; - TVM_FFI_DECLARE_OBJECT_INFO("meta_schedule.Builder", BuilderNode, runtime::Object); + TVM_FFI_DECLARE_OBJECT_INFO("tvm.meta_schedule.Builder", BuilderNode, runtime::Object); }; /*! @@ -166,7 +166,7 @@ class PyBuilderNode : public BuilderNode { ICHECK(f_build != nullptr) << "PyBuilder's Build method not implemented!"; return f_build(build_inputs); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("meta_schedule.PyBuilder", PyBuilderNode, BuilderNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.meta_schedule.PyBuilder", PyBuilderNode, BuilderNode); }; } // namespace meta_schedule diff --git a/include/tvm/meta_schedule/cost_model.h b/include/tvm/meta_schedule/cost_model.h index aaf4665c2729..f52450e8680d 100644 --- a/include/tvm/meta_schedule/cost_model.h +++ b/include/tvm/meta_schedule/cost_model.h @@ -74,7 +74,7 @@ class CostModelNode : public runtime::Object { const ffi::Array& candidates) = 0; static constexpr const bool _type_mutable = true; - TVM_FFI_DECLARE_OBJECT_INFO("meta_schedule.CostModel", CostModelNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO("tvm.meta_schedule.CostModel", CostModelNode, Object); }; /*! \brief The cost model with customized methods on the python-side. */ @@ -130,7 +130,8 @@ class PyCostModelNode : public CostModelNode { const ffi::Array& results); std::vector Predict(const TuneContext& context, const ffi::Array& candidates); - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("meta_schedule.PyCostModel", PyCostModelNode, CostModelNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.meta_schedule.PyCostModel", PyCostModelNode, + CostModelNode); }; /*! diff --git a/include/tvm/meta_schedule/database.h b/include/tvm/meta_schedule/database.h index 6f6b8bfca8d6..7104967db724 100644 --- a/include/tvm/meta_schedule/database.h +++ b/include/tvm/meta_schedule/database.h @@ -53,7 +53,7 @@ class WorkloadNode : public runtime::Object { namespace refl = tvm::ffi::reflection; refl::ObjectDef().def_ro("mod", &WorkloadNode::mod); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("meta_schedule.Workload", WorkloadNode, runtime::Object); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.meta_schedule.Workload", WorkloadNode, runtime::Object); /*! * \brief Export the workload to a JSON string. @@ -133,7 +133,7 @@ class TuningRecordNode : public runtime::Object { .def_ro("target", &TuningRecordNode::target) .def_ro("args_info", &TuningRecordNode::args_info); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("meta_schedule.TuningRecord", TuningRecordNode, + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.meta_schedule.TuningRecord", TuningRecordNode, runtime::Object); /*! \brief Construct the measure candidate given the initial IR module and trace @@ -274,7 +274,7 @@ class DatabaseNode : public runtime::Object { } static constexpr const bool _type_mutable = true; - TVM_FFI_DECLARE_OBJECT_INFO("meta_schedule.Database", DatabaseNode, runtime::Object); + TVM_FFI_DECLARE_OBJECT_INFO("tvm.meta_schedule.Database", DatabaseNode, runtime::Object); private: /*! \brief The module equality testing and hashing method */ @@ -456,7 +456,7 @@ class PyDatabaseNode : public DatabaseNode { } static constexpr const bool _type_mutable = true; - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("meta_schedule.PyDatabase", PyDatabaseNode, DatabaseNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.meta_schedule.PyDatabase", PyDatabaseNode, DatabaseNode); }; /*! diff --git a/include/tvm/meta_schedule/extracted_task.h b/include/tvm/meta_schedule/extracted_task.h index 646ec3c00cf0..a7d23d899255 100644 --- a/include/tvm/meta_schedule/extracted_task.h +++ b/include/tvm/meta_schedule/extracted_task.h @@ -63,7 +63,7 @@ class ExtractedTaskNode : public runtime::Object { } static constexpr const bool _type_mutable = true; - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("meta_schedule.ExtractedTask", ExtractedTaskNode, + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.meta_schedule.ExtractedTask", ExtractedTaskNode, runtime::Object); }; diff --git a/include/tvm/meta_schedule/feature_extractor.h b/include/tvm/meta_schedule/feature_extractor.h index 9a339d39e7ba..bad72c088aa1 100644 --- a/include/tvm/meta_schedule/feature_extractor.h +++ b/include/tvm/meta_schedule/feature_extractor.h @@ -52,7 +52,7 @@ class FeatureExtractorNode : public runtime::Object { */ virtual ffi::Array ExtractFrom( const TuneContext& context, const ffi::Array& candidates) = 0; - TVM_FFI_DECLARE_OBJECT_INFO("meta_schedule.FeatureExtractor", FeatureExtractorNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO("tvm.meta_schedule.FeatureExtractor", FeatureExtractorNode, Object); }; /*! \brief The feature extractor with customized methods on the python-side. */ @@ -86,7 +86,7 @@ class PyFeatureExtractorNode : public FeatureExtractorNode { ffi::Array ExtractFrom( const TuneContext& context, const ffi::Array& candidates) final; - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("meta_schedule.PyFeatureExtractor", PyFeatureExtractorNode, + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.meta_schedule.PyFeatureExtractor", PyFeatureExtractorNode, FeatureExtractorNode); }; diff --git a/include/tvm/meta_schedule/measure_callback.h b/include/tvm/meta_schedule/measure_callback.h index 9e7d49a0c9d4..db1865cf44a4 100644 --- a/include/tvm/meta_schedule/measure_callback.h +++ b/include/tvm/meta_schedule/measure_callback.h @@ -62,7 +62,7 @@ class MeasureCallbackNode : public runtime::Object { const ffi::Array& runner_results) = 0; static constexpr const bool _type_mutable = true; - TVM_FFI_DECLARE_OBJECT_INFO("meta_schedule.MeasureCallback", MeasureCallbackNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO("tvm.meta_schedule.MeasureCallback", MeasureCallbackNode, Object); }; /*! \brief The measure callback with customized methods on the python-side. */ @@ -105,7 +105,7 @@ class PyMeasureCallbackNode : public MeasureCallbackNode { const ffi::Array& measure_candidates, // const ffi::Array& builds, // const ffi::Array& results); - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("meta_schedule.PyMeasureCallback", PyMeasureCallbackNode, + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.meta_schedule.PyMeasureCallback", PyMeasureCallbackNode, MeasureCallbackNode); }; diff --git a/include/tvm/meta_schedule/measure_candidate.h b/include/tvm/meta_schedule/measure_candidate.h index 557e9a3139d2..bee2bea1657f 100644 --- a/include/tvm/meta_schedule/measure_candidate.h +++ b/include/tvm/meta_schedule/measure_candidate.h @@ -43,7 +43,8 @@ class MeasureCandidateNode : public runtime::Object { .def_ro("sch", &MeasureCandidateNode::sch) .def_ro("args_info", &MeasureCandidateNode::args_info); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("meta_schedule.MeasureCandidate", MeasureCandidateNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.meta_schedule.MeasureCandidate", MeasureCandidateNode, + Object); }; /*! diff --git a/include/tvm/meta_schedule/mutator.h b/include/tvm/meta_schedule/mutator.h index 05489c755217..74dd25c1cbe8 100644 --- a/include/tvm/meta_schedule/mutator.h +++ b/include/tvm/meta_schedule/mutator.h @@ -68,7 +68,7 @@ class MutatorNode : public runtime::Object { virtual Mutator Clone() const = 0; static constexpr const bool _type_mutable = true; - TVM_FFI_DECLARE_OBJECT_INFO("meta_schedule.Mutator", MutatorNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO("tvm.meta_schedule.Mutator", MutatorNode, Object); }; /*! @@ -171,7 +171,7 @@ class PyMutatorNode : public MutatorNode { ffi::Optional Apply(const tir::Trace& trace, support::LinearCongruentialEngine::TRandState* rand_state) final; Mutator Clone() const final; - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("meta_schedule.PyMutator", PyMutatorNode, MutatorNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.meta_schedule.PyMutator", PyMutatorNode, MutatorNode); }; } // namespace meta_schedule diff --git a/include/tvm/meta_schedule/postproc.h b/include/tvm/meta_schedule/postproc.h index 948f75210701..fe25cbfb0a4f 100644 --- a/include/tvm/meta_schedule/postproc.h +++ b/include/tvm/meta_schedule/postproc.h @@ -65,7 +65,7 @@ class PostprocNode : public runtime::Object { virtual Postproc Clone() const = 0; static constexpr const bool _type_mutable = true; - TVM_FFI_DECLARE_OBJECT_INFO("meta_schedule.Postproc", PostprocNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO("tvm.meta_schedule.Postproc", PostprocNode, Object); }; /*! @@ -207,7 +207,7 @@ class PyPostprocNode : public PostprocNode { void InitializeWithTuneContext(const TuneContext& context) final; bool Apply(const tir::Schedule& sch) final; Postproc Clone() const final; - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("meta_schedule.PyPostproc", PyPostprocNode, PostprocNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.meta_schedule.PyPostproc", PyPostprocNode, PostprocNode); }; } // namespace meta_schedule diff --git a/include/tvm/meta_schedule/profiler.h b/include/tvm/meta_schedule/profiler.h index 5b82e6606b98..33b1a43c43e4 100644 --- a/include/tvm/meta_schedule/profiler.h +++ b/include/tvm/meta_schedule/profiler.h @@ -65,7 +65,7 @@ class ProfilerNode : public runtime::Object { } static constexpr const bool _type_mutable = true; - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("meta_schedule.Profiler", ProfilerNode, runtime::Object); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.meta_schedule.Profiler", ProfilerNode, runtime::Object); public: /*! \brief Get the internal stats of the running time */ diff --git a/include/tvm/meta_schedule/runner.h b/include/tvm/meta_schedule/runner.h index a88ae5feac1c..ddb99fe01bd2 100644 --- a/include/tvm/meta_schedule/runner.h +++ b/include/tvm/meta_schedule/runner.h @@ -48,7 +48,8 @@ class RunnerInputNode : public runtime::Object { .def_ro("device_type", &RunnerInputNode::device_type) .def_ro("args_info", &RunnerInputNode::args_info); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("meta_schedule.RunnerInput", RunnerInputNode, runtime::Object); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.meta_schedule.RunnerInput", RunnerInputNode, + runtime::Object); }; /*! @@ -82,7 +83,7 @@ class RunnerResultNode : public runtime::Object { .def_ro("run_secs", &RunnerResultNode::run_secs) .def_ro("error_msg", &RunnerResultNode::error_msg); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("meta_schedule.RunnerResult", RunnerResultNode, + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.meta_schedule.RunnerResult", RunnerResultNode, runtime::Object); }; @@ -148,7 +149,7 @@ class RunnerFutureNode : public runtime::Object { ICHECK(f_result != nullptr) << "PyRunnerFuture's Result method not implemented!"; return f_result(); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("meta_schedule.RunnerFuture", RunnerFutureNode, + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.meta_schedule.RunnerFuture", RunnerFutureNode, runtime::Object); }; @@ -197,7 +198,7 @@ class RunnerNode : public runtime::Object { } static constexpr const bool _type_mutable = true; - TVM_FFI_DECLARE_OBJECT_INFO("meta_schedule.Runner", RunnerNode, runtime::Object); + TVM_FFI_DECLARE_OBJECT_INFO("tvm.meta_schedule.Runner", RunnerNode, runtime::Object); }; /*! @@ -237,7 +238,7 @@ class PyRunnerNode : public RunnerNode { ICHECK(f_run != nullptr) << "PyRunner's Run method not implemented!"; return f_run(runner_inputs); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("meta_schedule.PyRunner", PyRunnerNode, RunnerNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.meta_schedule.PyRunner", PyRunnerNode, RunnerNode); }; } // namespace meta_schedule diff --git a/include/tvm/meta_schedule/schedule_rule.h b/include/tvm/meta_schedule/schedule_rule.h index be9074acbde7..a0a9f41550bb 100644 --- a/include/tvm/meta_schedule/schedule_rule.h +++ b/include/tvm/meta_schedule/schedule_rule.h @@ -69,7 +69,7 @@ class ScheduleRuleNode : public runtime::Object { virtual ScheduleRule Clone() const = 0; static constexpr const bool _type_mutable = true; - TVM_FFI_DECLARE_OBJECT_INFO("meta_schedule.ScheduleRule", ScheduleRuleNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO("tvm.meta_schedule.ScheduleRule", ScheduleRuleNode, Object); }; /*! @@ -345,7 +345,7 @@ class PyScheduleRuleNode : public ScheduleRuleNode { void InitializeWithTuneContext(const TuneContext& context) final; ffi::Array Apply(const tir::Schedule& sch, const tir::BlockRV& block) final; ScheduleRule Clone() const final; - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("meta_schedule.PyScheduleRule", PyScheduleRuleNode, + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.meta_schedule.PyScheduleRule", PyScheduleRuleNode, ScheduleRuleNode); }; diff --git a/include/tvm/meta_schedule/search_strategy.h b/include/tvm/meta_schedule/search_strategy.h index 714c43470f05..fb7afb830a16 100644 --- a/include/tvm/meta_schedule/search_strategy.h +++ b/include/tvm/meta_schedule/search_strategy.h @@ -130,7 +130,7 @@ class SearchStrategyNode : public runtime::Object { virtual SearchStrategy Clone() const = 0; static constexpr const bool _type_mutable = true; - TVM_FFI_DECLARE_OBJECT_INFO("meta_schedule.SearchStrategy", SearchStrategyNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO("tvm.meta_schedule.SearchStrategy", SearchStrategyNode, Object); }; /*! @@ -263,7 +263,7 @@ class PySearchStrategyNode : public SearchStrategyNode { void NotifyRunnerResults(const ffi::Array& measure_candidates, const ffi::Array& results); SearchStrategy Clone() const final; - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("meta_schedule.PySearchStrategy", PySearchStrategyNode, + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.meta_schedule.PySearchStrategy", PySearchStrategyNode, SearchStrategyNode); }; diff --git a/include/tvm/meta_schedule/space_generator.h b/include/tvm/meta_schedule/space_generator.h index 460a41e44a20..bc688286a04f 100644 --- a/include/tvm/meta_schedule/space_generator.h +++ b/include/tvm/meta_schedule/space_generator.h @@ -114,7 +114,7 @@ class SpaceGeneratorNode : public runtime::Object { virtual SpaceGenerator Clone() const = 0; static constexpr const bool _type_mutable = true; - TVM_FFI_DECLARE_OBJECT_INFO("meta_schedule.SpaceGenerator", SpaceGeneratorNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO("tvm.meta_schedule.SpaceGenerator", SpaceGeneratorNode, Object); }; /*! @@ -234,7 +234,7 @@ class PySpaceGeneratorNode : public SpaceGeneratorNode { void InitializeWithTuneContext(const TuneContext& context) final; ffi::Array GenerateDesignSpace(const IRModule& mod) final; SpaceGenerator Clone() const final; - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("meta_schedule.PySpaceGenerator", PySpaceGeneratorNode, + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.meta_schedule.PySpaceGenerator", PySpaceGeneratorNode, SpaceGeneratorNode); }; diff --git a/include/tvm/meta_schedule/task_scheduler.h b/include/tvm/meta_schedule/task_scheduler.h index 1cc56f251f10..6bdd638f3131 100644 --- a/include/tvm/meta_schedule/task_scheduler.h +++ b/include/tvm/meta_schedule/task_scheduler.h @@ -75,7 +75,7 @@ class TaskRecordNode : public runtime::Object { } static constexpr const bool _type_mutable = true; - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("meta_schedule.TaskRecord", TaskRecordNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.meta_schedule.TaskRecord", TaskRecordNode, Object); }; /*! @@ -202,7 +202,7 @@ class TaskSchedulerNode : public runtime::Object { void PrintTuningStatistics(); static constexpr const bool _type_mutable = true; - TVM_FFI_DECLARE_OBJECT_INFO("meta_schedule.TaskScheduler", TaskSchedulerNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO("tvm.meta_schedule.TaskScheduler", TaskSchedulerNode, Object); }; class TaskScheduler; @@ -250,7 +250,7 @@ class PyTaskSchedulerNode : public TaskSchedulerNode { int max_trials_per_task, int num_trials_per_iter, Builder builder, Runner runner, ffi::Array measure_callbacks, ffi::Optional database, ffi::Optional cost_model) final; - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("meta_schedule.PyTaskScheduler", PyTaskSchedulerNode, + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.meta_schedule.PyTaskScheduler", PyTaskSchedulerNode, TaskSchedulerNode); }; diff --git a/include/tvm/meta_schedule/tune_context.h b/include/tvm/meta_schedule/tune_context.h index a36a946d0ae5..c4deecc3b1e7 100644 --- a/include/tvm/meta_schedule/tune_context.h +++ b/include/tvm/meta_schedule/tune_context.h @@ -88,7 +88,7 @@ class TuneContextNode : public runtime::Object { TuneContext Clone() const; static constexpr const bool _type_mutable = true; - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("meta_schedule.TuneContext", TuneContextNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.meta_schedule.TuneContext", TuneContextNode, Object); }; /*! diff --git a/include/tvm/node/script_printer.h b/include/tvm/node/script_printer.h index ac293c88e884..214c119c3b54 100644 --- a/include/tvm/node/script_printer.h +++ b/include/tvm/node/script_printer.h @@ -149,7 +149,7 @@ class PrinterConfigNode : public ffi::Object { ffi::Array GetBuiltinKeywords(); static constexpr const bool _type_mutable = true; - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.PrinterConfig", PrinterConfigNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.script.PrinterConfig", PrinterConfigNode, Object); }; class PrinterConfig : public ObjectRef { diff --git a/include/tvm/relax/attrs/ccl.h b/include/tvm/relax/attrs/ccl.h index 09d40b4ed98e..153b85dcdef5 100644 --- a/include/tvm/relax/attrs/ccl.h +++ b/include/tvm/relax/attrs/ccl.h @@ -45,7 +45,8 @@ struct AllReduceAttrs : public tvm::AttrsNodeReflAdapter { "Whether the reduction operation performs in group or globally or in group as " "default."); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.AllReduceAttrs", AllReduceAttrs, BaseAttrsNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.attrs.AllReduceAttrs", AllReduceAttrs, + BaseAttrsNode); }; // struct AllReduceAttrs /*! \brief Attributes used in allgather operators */ @@ -63,7 +64,8 @@ struct AllGatherAttrs : public tvm::AttrsNodeReflAdapter { "Whether the allgather operation performs in group or globally or in group as " "default."); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.AllGatherAttrs", AllGatherAttrs, BaseAttrsNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.attrs.AllGatherAttrs", AllGatherAttrs, + BaseAttrsNode); }; // struct AllGatherAttrs /*! \brief Attributes used in scatter operators */ @@ -81,8 +83,8 @@ struct ScatterCollectiveAttrs : public tvm::AttrsNodeReflAdapter { refl::ObjectDef().def_ro("dtype", &InitAttrs::dtype, "The data type of the created tensor."); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.InitAttrs", InitAttrs, BaseAttrsNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.attrs.InitAttrs", InitAttrs, BaseAttrsNode); }; // struct InitAttrs /*! \brief Attributes used in tril and triu operator */ @@ -51,7 +51,7 @@ struct TriluAttrs : public AttrsNodeReflAdapter { "k", &TriluAttrs::k, "The number of diagonals above or below the main diagonal to exclude or include."); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.TriluAttrs", TriluAttrs, BaseAttrsNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.attrs.TriluAttrs", TriluAttrs, BaseAttrsNode); }; // struct TriluAttrs } // namespace relax diff --git a/include/tvm/relax/attrs/datatype.h b/include/tvm/relax/attrs/datatype.h index dd07e3b54851..f5e9629c4c6e 100644 --- a/include/tvm/relax/attrs/datatype.h +++ b/include/tvm/relax/attrs/datatype.h @@ -37,7 +37,7 @@ struct AstypeAttrs : public AttrsNodeReflAdapter { namespace refl = tvm::ffi::reflection; refl::ObjectDef().def_ro("dtype", &AstypeAttrs::dtype, "Target data type"); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.AstypeAttrs", AstypeAttrs, BaseAttrsNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.attrs.AstypeAttrs", AstypeAttrs, BaseAttrsNode); }; // struct AstypeAttrs. /*! \brief Attributes used in wrap_param operator */ @@ -48,7 +48,8 @@ struct WrapParamAttrs : public AttrsNodeReflAdapter { namespace refl = tvm::ffi::reflection; refl::ObjectDef().def_ro("dtype", &WrapParamAttrs::dtype, "Target data type"); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.WrapParamAttrs", WrapParamAttrs, BaseAttrsNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.attrs.WrapParamAttrs", WrapParamAttrs, + BaseAttrsNode); }; // struct WrapParamAttrs. } // namespace relax diff --git a/include/tvm/relax/attrs/distributed.h b/include/tvm/relax/attrs/distributed.h index 356a248ba220..68a97a7c6164 100644 --- a/include/tvm/relax/attrs/distributed.h +++ b/include/tvm/relax/attrs/distributed.h @@ -44,7 +44,7 @@ struct DistributionAttrs : public AttrsNodeReflAdapter { .def_ro("placement", &DistributionAttrs::placement, "The placement of a tensor's distribution plan"); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.DistributionAttrs", DistributionAttrs, + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.attrs.DistributionAttrs", DistributionAttrs, BaseAttrsNode); }; // struct DistributionAttrs diff --git a/include/tvm/relax/attrs/image.h b/include/tvm/relax/attrs/image.h index b367ce58433d..f718a08fa77b 100644 --- a/include/tvm/relax/attrs/image.h +++ b/include/tvm/relax/attrs/image.h @@ -75,7 +75,7 @@ struct Resize2DAttrs : public AttrsNodeReflAdapter { "The dtype of the output tensor. It it is not specified, the output will have the same " "dtype as input if not specified."); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.Resize2DAttrs", Resize2DAttrs, BaseAttrsNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.attrs.Resize2DAttrs", Resize2DAttrs, BaseAttrsNode); }; // struct Resize2dAttrs /*! \brief Attributes used in image grid_sample operator */ @@ -97,7 +97,8 @@ struct GridSampleAttrs : public AttrsNodeReflAdapter { .def_ro("align_corners", &GridSampleAttrs::align_corners, "If True, the corner pixels of the input and output tensors are aligned."); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.GridSampleAttrs", GridSampleAttrs, BaseAttrsNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.attrs.GridSampleAttrs", GridSampleAttrs, + BaseAttrsNode); }; // struct GridSampleAttrs } // namespace relax diff --git a/include/tvm/relax/attrs/index.h b/include/tvm/relax/attrs/index.h index 0ea7c06bacc0..19bfbe3ed40c 100644 --- a/include/tvm/relax/attrs/index.h +++ b/include/tvm/relax/attrs/index.h @@ -41,7 +41,7 @@ struct TakeAttrs : public AttrsNodeReflAdapter { .def_ro("mode", &TakeAttrs::mode, "The mode for handling out-of-bounds indices.", refl::DefaultValue("fast")); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.TakeAttrs", TakeAttrs, BaseAttrsNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.attrs.TakeAttrs", TakeAttrs, BaseAttrsNode); }; // struct TakeAttrs /*! \brief Attributes used in strided_slice operator */ @@ -56,7 +56,7 @@ struct StridedSliceAttrs : public AttrsNodeReflAdapter { "out of bound indices will be clipped to the bound.", refl::DefaultValue(true)); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.StridedSliceAttrs", StridedSliceAttrs, + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.attrs.StridedSliceAttrs", StridedSliceAttrs, BaseAttrsNode); }; // struct StridedSliceAttrs diff --git a/include/tvm/relax/attrs/linear_algebra.h b/include/tvm/relax/attrs/linear_algebra.h index f95d817f1e4d..adefbcc31251 100644 --- a/include/tvm/relax/attrs/linear_algebra.h +++ b/include/tvm/relax/attrs/linear_algebra.h @@ -38,7 +38,7 @@ struct MatmulAttrs : public AttrsNodeReflAdapter { refl::ObjectDef().def_ro("out_dtype", &MatmulAttrs::out_dtype, "The data type of the output tensor"); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.MatmulAttrs", MatmulAttrs, BaseAttrsNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.attrs.MatmulAttrs", MatmulAttrs, BaseAttrsNode); }; // struct MatmulAttrs /*! \brief Attributes used in einsum operator */ @@ -50,7 +50,7 @@ struct EinsumAttrs : public AttrsNodeReflAdapter { refl::ObjectDef().def_ro("subscripts", &EinsumAttrs::subscripts, "The einsum expression string"); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.EinsumAttrs", EinsumAttrs, BaseAttrsNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.attrs.EinsumAttrs", EinsumAttrs, BaseAttrsNode); }; // struct EinsumAttrs } // namespace relax diff --git a/include/tvm/relax/attrs/manipulate.h b/include/tvm/relax/attrs/manipulate.h index 21184848e3c7..34addccb0e17 100644 --- a/include/tvm/relax/attrs/manipulate.h +++ b/include/tvm/relax/attrs/manipulate.h @@ -40,7 +40,7 @@ struct ConcatAttrs : public AttrsNodeReflAdapter { "The axis at which the input arrays are concatenated." "Should lie in range `[-ndim, ndim)`."); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.ConcatAttrs", ConcatAttrs, BaseAttrsNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.attrs.ConcatAttrs", ConcatAttrs, BaseAttrsNode); }; // struct ConcatAttrs /*! \brief Attributes used in expand_dims operators */ @@ -55,7 +55,8 @@ struct ExpandDimsAttrs : public AttrsNodeReflAdapter { "All values are required to lie in range `[-data.ndim - 1, data.ndim]`, " "with the convention of negative indexing."); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.ExpandDimsAttrs", ExpandDimsAttrs, BaseAttrsNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.attrs.ExpandDimsAttrs", ExpandDimsAttrs, + BaseAttrsNode); }; // struct ExpandDimsAttrs /*! \brief Attributes used in layout_transform operator */ @@ -92,7 +93,7 @@ struct LayoutTransformAttrs : public AttrsNodeReflAdapter .def_ro("input_axis_separators", &LayoutTransformAttrs::input_axis_separators, "The separators between axes to regenerate output"); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.LayoutTransformAttrs", LayoutTransformAttrs, + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.attrs.LayoutTransformAttrs", LayoutTransformAttrs, BaseAttrsNode); }; // struct LayoutTransformAttrs @@ -105,7 +106,7 @@ struct PermuteDimsAttrs : public AttrsNodeReflAdapter { refl::ObjectDef().def_ro( "axes", &PermuteDimsAttrs::axes, "The target axes order, reverse order if not specified."); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.PermuteDimsAttrs", PermuteDimsAttrs, + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.attrs.PermuteDimsAttrs", PermuteDimsAttrs, BaseAttrsNode); }; // struct PermuteDimsAttrs @@ -121,7 +122,7 @@ struct SplitAttrs : public AttrsNodeReflAdapter { "The input array of indices or the number of split sections.") .def_ro("axis", &SplitAttrs::axis, "The axis to be splitted"); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.SplitAttrs", SplitAttrs, BaseAttrsNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.attrs.SplitAttrs", SplitAttrs, BaseAttrsNode); }; // struct SplitAttrs /*! \brief Attributes used in squeeze operators */ @@ -136,7 +137,7 @@ struct SqueezeAttrs : public AttrsNodeReflAdapter { "Else, the dimension in axes get squeezed." "It is an error if an axis does not has dimension 1."); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.SqueezeAttrs", SqueezeAttrs, BaseAttrsNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.attrs.SqueezeAttrs", SqueezeAttrs, BaseAttrsNode); }; // struct SqueezeAttrs /*! \brief Attributes used in stack operators */ @@ -152,7 +153,7 @@ struct StackAttrs : public AttrsNodeReflAdapter { "so it must be in range [-ndim-1, ndim] where ndim is the " "number of dimensions of the input tensors."); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.StackAttrs", StackAttrs, BaseAttrsNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.attrs.StackAttrs", StackAttrs, BaseAttrsNode); }; // struct StackAttrs /*! \brief Attributes used in repeat operators */ @@ -169,7 +170,7 @@ struct RepeatAttrs : public AttrsNodeReflAdapter { "counting from the backward. By default, use the flattened input array, and " "return a flat output array."); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.RepeatAttrs", RepeatAttrs, BaseAttrsNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.attrs.RepeatAttrs", RepeatAttrs, BaseAttrsNode); }; // struct RepeatAttrs /*! \brief Attributes used in tile operators */ @@ -181,7 +182,7 @@ struct TileAttrs : public AttrsNodeReflAdapter { refl::ObjectDef().def_ro("repeats", &TileAttrs::repeats, "The number of repetitions of data along each axis."); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.TileAttrs", TileAttrs, BaseAttrsNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.attrs.TileAttrs", TileAttrs, BaseAttrsNode); }; // struct TileAttrs /*! \brief Attributes used in flip operators */ @@ -194,7 +195,7 @@ struct FlipAttrs : public AttrsNodeReflAdapter { "The axis along which to flip over.", refl::DefaultValue(NullValue())); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.FlipAttrs", FlipAttrs, BaseAttrsNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.attrs.FlipAttrs", FlipAttrs, BaseAttrsNode); }; // struct FlipAttrs /*! \brief Attributes used in gather_elements operators */ @@ -207,7 +208,7 @@ struct GatherElementsAttrs : public AttrsNodeReflAdapter { "The axis along which to index.", refl::DefaultValue(0)); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.GatherElementsAttrs", GatherElementsAttrs, + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.attrs.GatherElementsAttrs", GatherElementsAttrs, BaseAttrsNode); }; // struct GatherElementsAttrs @@ -220,7 +221,7 @@ struct GatherNDAttrs : public AttrsNodeReflAdapter { refl::ObjectDef().def_ro("batch_dims", &GatherNDAttrs::batch_dims, "The number of batch dims.", refl::DefaultValue(0)); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.GatherNDAttrs", GatherNDAttrs, BaseAttrsNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.attrs.GatherNDAttrs", GatherNDAttrs, BaseAttrsNode); }; // struct GatherNDAttrs /*! \brief Attributes used in index_put operator */ @@ -236,7 +237,7 @@ struct IndexPutAttrs : public AttrsNodeReflAdapter { "otherwise performs tensor[indices] = values.", refl::DefaultValue(false)); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.IndexPutAttrs", IndexPutAttrs, BaseAttrsNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.attrs.IndexPutAttrs", IndexPutAttrs, BaseAttrsNode); }; // struct IndexPutAttrs /*! \brief Attribute used in meshgrid operator */ @@ -248,7 +249,7 @@ struct MeshgridAttrs : public AttrsNodeReflAdapter { refl::ObjectDef().def_ro("indexing", &MeshgridAttrs::indexing, "Specifies how the grid dimensions are ordered."); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.MeshgridAttrs", MeshgridAttrs, BaseAttrsNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.attrs.MeshgridAttrs", MeshgridAttrs, BaseAttrsNode); }; /*! \brief Attributes used in scatter_elements operators */ @@ -266,7 +267,7 @@ struct ScatterElementsAttrs : public AttrsNodeReflAdapter "either \"update\", \"add\", \"mul\", \"mean\", \"min\" or \"max\".", refl::DefaultValue("update")); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.ScatterElementsAttrs", ScatterElementsAttrs, + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.attrs.ScatterElementsAttrs", ScatterElementsAttrs, BaseAttrsNode); }; // struct ScatterElementsAttrs @@ -282,7 +283,8 @@ struct ScatterNDAttrs : public AttrsNodeReflAdapter { "either \"update\", \"add\", \"mul\", \"min\" or \"max\".", refl::DefaultValue("update")); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.ScatterNDAttrs", ScatterNDAttrs, BaseAttrsNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.attrs.ScatterNDAttrs", ScatterNDAttrs, + BaseAttrsNode); }; // struct ScatterNDAttrs /*! \brief Attributes used in slice_scatter operator */ @@ -295,7 +297,7 @@ struct SliceScatterAttrs : public AttrsNodeReflAdapter { "the dimension to insert the slice into ", refl::DefaultValue(0)); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.SliceScatterAttrs", SliceScatterAttrs, + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.attrs.SliceScatterAttrs", SliceScatterAttrs, BaseAttrsNode); }; // struct SliceScatterAttrs @@ -310,7 +312,7 @@ struct OneHotAttrs : public AttrsNodeReflAdapter { .def_ro("depth", &OneHotAttrs::depth, "Depth of the one hot dimension.") .def_ro("axis", &OneHotAttrs::axis, "Axis to fill.", refl::DefaultValue(-1)); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.OneHotAttrs", OneHotAttrs, BaseAttrsNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.attrs.OneHotAttrs", OneHotAttrs, BaseAttrsNode); }; // struct OneHotAttrs } // namespace relax diff --git a/include/tvm/relax/attrs/nn.h b/include/tvm/relax/attrs/nn.h index 13a54a16b378..4135da2459c0 100644 --- a/include/tvm/relax/attrs/nn.h +++ b/include/tvm/relax/attrs/nn.h @@ -70,7 +70,7 @@ struct Conv1DAttrs : public AttrsNodeReflAdapter { .def_ro("out_dtype", &Conv1DAttrs::out_dtype, "Output data type, set to explicit type under mixed precision setting"); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.Conv1DAttrs", Conv1DAttrs, BaseAttrsNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.attrs.Conv1DAttrs", Conv1DAttrs, BaseAttrsNode); }; // struct Conv1dAttrs /*! \brief Attributes used in Conv2d operator */ @@ -116,7 +116,7 @@ struct Conv2DAttrs : public AttrsNodeReflAdapter { .def_ro("out_dtype", &Conv2DAttrs::out_dtype, "Output data type, set to explicit type under mixed precision setting"); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.Conv2DAttrs", Conv2DAttrs, BaseAttrsNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.attrs.Conv2DAttrs", Conv2DAttrs, BaseAttrsNode); }; // struct Conv2dAttrs /*! \brief Attributes used in Conv3d operator */ @@ -164,7 +164,7 @@ struct Conv3DAttrs : public AttrsNodeReflAdapter { .def_ro("out_dtype", &Conv3DAttrs::out_dtype, "Output data type, set to explicit type under mixed precision setting"); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.Conv3DAttrs", Conv3DAttrs, BaseAttrsNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.attrs.Conv3DAttrs", Conv3DAttrs, BaseAttrsNode); }; // struct Conv3dAttrs /*! \brief Attributes used in Conv1DTranspose operator */ @@ -212,7 +212,7 @@ struct Conv1DTransposeAttrs : public AttrsNodeReflAdapter .def_ro("out_dtype", &Conv1DTransposeAttrs::out_dtype, "Output data type, set to explicit type under mixed precision setting"); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.Conv1DTransposeAttrs", Conv1DTransposeAttrs, + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.attrs.Conv1DTransposeAttrs", Conv1DTransposeAttrs, BaseAttrsNode); }; // struct Conv1DTransposeAttrs @@ -263,7 +263,7 @@ struct Conv2DTransposeAttrs : public AttrsNodeReflAdapter .def_ro("out_dtype", &Conv2DTransposeAttrs::out_dtype, "Output data type, set to explicit type under mixed precision setting"); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.Conv2DTransposeAttrs", Conv2DTransposeAttrs, + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.attrs.Conv2DTransposeAttrs", Conv2DTransposeAttrs, BaseAttrsNode); }; // struct Conv2DTransposeAttrs @@ -305,7 +305,7 @@ struct Pool1DAttrs : public AttrsNodeReflAdapter { "'N', 'C', 'W' stands for batch, channel, and width" "dimensions respectively. Pooling is applied on the 'W' dimensions."); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.Pool1DAttrs", Pool1DAttrs, BaseAttrsNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.attrs.Pool1DAttrs", Pool1DAttrs, BaseAttrsNode); }; // struct Pool1dAttrs /*! \brief Attributes used in max_pool2d and avg_pool2d operator */ @@ -348,7 +348,7 @@ struct Pool2DAttrs : public AttrsNodeReflAdapter { "dimensions respectively. Pooling is applied on the 'H' and" "'W' dimensions."); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.Pool2DAttrs", Pool2DAttrs, BaseAttrsNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.attrs.Pool2DAttrs", Pool2DAttrs, BaseAttrsNode); }; // struct Pool2dAttrs /*! \brief Attributes used in max_pool3d and avg_pool3d operator */ @@ -391,7 +391,7 @@ struct Pool3DAttrs : public AttrsNodeReflAdapter { "dimensions respectively. Pooling is applied on the 'D', 'H' and" "'W' dimensions."); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.Pool3DAttrs", Pool3DAttrs, BaseAttrsNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.attrs.Pool3DAttrs", Pool3DAttrs, BaseAttrsNode); }; // struct Pool3dAttrs /*! \brief Attributes for 1d adaptive pool operator */ @@ -415,7 +415,7 @@ struct AdaptivePool1DAttrs : public AttrsNodeReflAdapter { "dimensions respectively. Pooling is applied on the" "'W' dimensions."); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.AdaptivePool1DAttrs", AdaptivePool1DAttrs, + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.attrs.AdaptivePool1DAttrs", AdaptivePool1DAttrs, BaseAttrsNode); }; // struct AdaptivePool1DAttrs @@ -440,7 +440,7 @@ struct AdaptivePool2DAttrs : public AttrsNodeReflAdapter { "dimensions respectively. Pooling is applied on the 'H' and" "'W' dimensions."); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.AdaptivePool2DAttrs", AdaptivePool2DAttrs, + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.attrs.AdaptivePool2DAttrs", AdaptivePool2DAttrs, BaseAttrsNode); }; // struct AdaptivePool2DAttrs @@ -465,7 +465,7 @@ struct AdaptivePool3DAttrs : public AttrsNodeReflAdapter { "dimensions respectively. Pooling is applied on 'D', 'H' and" "'W' dimensions."); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.AdaptivePool3DAttrs", AdaptivePool3DAttrs, + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.attrs.AdaptivePool3DAttrs", AdaptivePool3DAttrs, BaseAttrsNode); }; // struct AdaptivePool3DAttrs @@ -478,7 +478,7 @@ struct SoftmaxAttrs : public AttrsNodeReflAdapter { refl::ObjectDef().def_ro("axis", &SoftmaxAttrs::axis, "The axis to sum over when computing softmax."); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.SoftmaxAttrs", SoftmaxAttrs, BaseAttrsNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.attrs.SoftmaxAttrs", SoftmaxAttrs, BaseAttrsNode); }; /*! \brief Attributes used in softmax operators */ @@ -490,7 +490,8 @@ struct LeakyReluAttrs : public AttrsNodeReflAdapter { refl::ObjectDef().def_ro("alpha", &LeakyReluAttrs::alpha, "The slope of the negative part."); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.LeakyReluAttrs", LeakyReluAttrs, BaseAttrsNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.attrs.LeakyReluAttrs", LeakyReluAttrs, + BaseAttrsNode); }; /*! \brief Attributes used in softplus operators */ @@ -506,7 +507,7 @@ struct SoftplusAttrs : public AttrsNodeReflAdapter { .def_ro("threshold", &SoftplusAttrs::threshold, "Value determining when to use linear approximation for numerical stability."); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.SoftplusAttrs", SoftplusAttrs, BaseAttrsNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.attrs.SoftplusAttrs", SoftplusAttrs, BaseAttrsNode); }; /*! \brief Attributes used in PReLU operator */ @@ -518,7 +519,7 @@ struct PReluAttrs : public AttrsNodeReflAdapter { refl::ObjectDef().def_ro("axis", &PReluAttrs::axis, "The axis along which the alpha values are applied."); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.PReluAttrs", PReluAttrs, BaseAttrsNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.attrs.PReluAttrs", PReluAttrs, BaseAttrsNode); }; /*! \brief Attributes used in batch_norm operator */ @@ -545,7 +546,8 @@ struct BatchNormAttrs : public AttrsNodeReflAdapter { .def_ro("training", &BatchNormAttrs::training, "Whether we are training (i.e., not in eval mode)."); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.BatchNormAttrs", BatchNormAttrs, BaseAttrsNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.attrs.BatchNormAttrs", BatchNormAttrs, + BaseAttrsNode); }; // struct BatchNormAttrs /*! \brief Attributes used in layer_norm operator */ @@ -567,7 +569,8 @@ struct LayerNormAttrs : public AttrsNodeReflAdapter { .def_ro("scale", &LayerNormAttrs::scale, "Indicating if the gamma scale will be multiplied."); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.LayerNormAttrs", LayerNormAttrs, BaseAttrsNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.attrs.LayerNormAttrs", LayerNormAttrs, + BaseAttrsNode); }; // struct LayerNormAttrs /*! \brief Attributes used in group_norm operator */ @@ -596,7 +599,8 @@ struct GroupNormAttrs : public AttrsNodeReflAdapter { .def_ro("scale", &GroupNormAttrs::scale, "Indicating if the gamma scale will be multiplied."); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.GroupNormAttrs", GroupNormAttrs, BaseAttrsNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.attrs.GroupNormAttrs", GroupNormAttrs, + BaseAttrsNode); }; // struct GroupNormAttrs /*! \brief Attributes used in instance_norm operator */ @@ -621,7 +625,7 @@ struct InstanceNormAttrs : public AttrsNodeReflAdapter { .def_ro("scale", &InstanceNormAttrs::scale, "Indicating if the gamma scale will be multiplied."); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.InstanceNormAttrs", InstanceNormAttrs, + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.attrs.InstanceNormAttrs", InstanceNormAttrs, BaseAttrsNode); }; // struct InstanceNormAttrs @@ -638,7 +642,7 @@ struct RMSNormAttrs : public AttrsNodeReflAdapter { .def_ro("epsilon", &RMSNormAttrs::epsilon, "Small float added to variance to avoid dividing by zero"); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.RMSNormAttrs", RMSNormAttrs, BaseAttrsNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.attrs.RMSNormAttrs", RMSNormAttrs, BaseAttrsNode); }; // struct RMSNormAttrs /*! \brief Attributes used in nll_loss operator */ @@ -655,7 +659,7 @@ struct NLLLossAttrs : public AttrsNodeReflAdapter { refl::DefaultValue("mean")) .def_ro("ignore_index", &NLLLossAttrs::ignore_index, "The target value to ignore."); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.NLLLossAttrs", NLLLossAttrs, BaseAttrsNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.attrs.NLLLossAttrs", NLLLossAttrs, BaseAttrsNode); }; // struct NLLLossAttrs /*! \brief Attributes used in dropout operator */ @@ -668,7 +672,7 @@ struct DropoutAttrs : public AttrsNodeReflAdapter { "rate", &DropoutAttrs::rate, "Fraction of the input that gets dropped out during training time"); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.DropoutAttrs", DropoutAttrs, BaseAttrsNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.attrs.DropoutAttrs", DropoutAttrs, BaseAttrsNode); }; // struct DropoutAttrs /*! \brief Attributes used in Attention operator */ @@ -688,7 +692,8 @@ struct AttentionAttrs : public AttrsNodeReflAdapter { .def_ro("window_size", &AttentionAttrs::window_size, "The size of the window for sliding-window attention."); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.AttentionAttrs", AttentionAttrs, BaseAttrsNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.attrs.AttentionAttrs", AttentionAttrs, + BaseAttrsNode); }; // struct AttentionAttrs /*! \brief Attributes used for the padding operator */ @@ -711,7 +716,7 @@ struct PadAttrs : public AttrsNodeReflAdapter { "\"reflect\" pads by reflecting values with respect to the edges.", refl::DefaultValue("constant")); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.PadAttrs", PadAttrs, BaseAttrsNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.attrs.PadAttrs", PadAttrs, BaseAttrsNode); }; /*! \brief Attributes used for the pixel shuffle operator */ @@ -724,7 +729,7 @@ struct PixelShuffleAttrs : public AttrsNodeReflAdapter { &PixelShuffleAttrs::upscale_factor, "Scale factor for spatial upsampling."); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.PixelShuffleAttrs", PixelShuffleAttrs, + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.attrs.PixelShuffleAttrs", PixelShuffleAttrs, BaseAttrsNode); }; diff --git a/include/tvm/relax/attrs/op.h b/include/tvm/relax/attrs/op.h index 54640901ff53..9e59a428966c 100644 --- a/include/tvm/relax/attrs/op.h +++ b/include/tvm/relax/attrs/op.h @@ -44,7 +44,7 @@ struct CallTIRWithGradAttrs : public AttrsNodeReflAdapter .def_ro("te_grad_kwargs", &CallTIRWithGradAttrs::te_grad_kwargs, "The keyword arguments passed to the te gradient function."); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.CallTIRWithGradAttrs", CallTIRWithGradAttrs, + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.attrs.CallTIRWithGradAttrs", CallTIRWithGradAttrs, BaseAttrsNode); }; // struct CallTIRAttrs @@ -64,7 +64,7 @@ struct CallTIRInplaceAttrs : public AttrsNodeReflAdapter { refl::ObjectDef().def_ro("inplace_indices", &CallTIRInplaceAttrs::inplace_indices); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.CallTIRInplaceAttrs", CallTIRInplaceAttrs, + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.attrs.CallTIRInplaceAttrs", CallTIRInplaceAttrs, BaseAttrsNode); }; // struct CallTIRInplaceAttrs @@ -84,8 +84,8 @@ struct CallInplacePackedAttrs : public AttrsNodeReflAdapter().def_ro("inplace_indices", &CallInplacePackedAttrs::inplace_indices); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.CallInplacePackedAttrs", CallInplacePackedAttrs, - BaseAttrsNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.attrs.CallInplacePackedAttrs", + CallInplacePackedAttrs, BaseAttrsNode); }; // struct CallInplacePackedAttrs /*! \brief Attributes used in to_vdevice */ @@ -97,7 +97,8 @@ struct ToVDeviceAttrs : public AttrsNodeReflAdapter { refl::ObjectDef().def_ro("dst_vdevice", &ToVDeviceAttrs::dst_vdevice, "The destination device where the data is copied to."); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.ToVDeviceAttrs", ToVDeviceAttrs, BaseAttrsNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.attrs.ToVDeviceAttrs", ToVDeviceAttrs, + BaseAttrsNode); }; // struct ToVDeviceAttrs /*! \brief Attributes used in hint_on_device */ @@ -114,7 +115,7 @@ struct HintOnDeviceAttrs : public AttrsNodeReflAdapter { .def_ro("index", &HintOnDeviceAttrs::index, "The device id.") .def_ro("memory_scope", &HintOnDeviceAttrs::memory_scope, "The device memory scope."); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.HintOnDeviceAttrs", HintOnDeviceAttrs, + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.attrs.HintOnDeviceAttrs", HintOnDeviceAttrs, BaseAttrsNode); }; // struct HintOnDeviceAttrs diff --git a/include/tvm/relax/attrs/qdq.h b/include/tvm/relax/attrs/qdq.h index ffb554994f98..ab4caa997700 100644 --- a/include/tvm/relax/attrs/qdq.h +++ b/include/tvm/relax/attrs/qdq.h @@ -43,7 +43,7 @@ struct QuantizeAttrs : public AttrsNodeReflAdapter { "Default value is -1, which corresponds to the last axis.", refl::DefaultValue(-1)); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.QuantizeAttrs", QuantizeAttrs, BaseAttrsNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.attrs.QuantizeAttrs", QuantizeAttrs, BaseAttrsNode); }; // QuantizeAttrs } // namespace relax diff --git a/include/tvm/relax/attrs/sampling.h b/include/tvm/relax/attrs/sampling.h index 53fd3a140497..da14fd70820d 100644 --- a/include/tvm/relax/attrs/sampling.h +++ b/include/tvm/relax/attrs/sampling.h @@ -39,7 +39,7 @@ struct MultinomialFromUniformAttrs : public AttrsNodeReflAdapter { "with size " "one."); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.ArgmaxArgminAttrs", ArgmaxArgminAttrs, + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.attrs.ArgmaxArgminAttrs", ArgmaxArgminAttrs, BaseAttrsNode); }; // struct ArgmaxArgminAttrs @@ -61,7 +61,8 @@ struct BucketizeAttrs : public tvm::AttrsNodeReflAdapter { .def_ro("right", &BucketizeAttrs::right, "Determines the behavior for values in boundaries"); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.BucketizeAttrs", BucketizeAttrs, BaseAttrsNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.attrs.BucketizeAttrs", BucketizeAttrs, + BaseAttrsNode); }; // struct BucketizeAttrs } // namespace relax diff --git a/include/tvm/relax/attrs/sorting.h b/include/tvm/relax/attrs/sorting.h index 0731c6cf4f6d..fdd40d943c80 100644 --- a/include/tvm/relax/attrs/sorting.h +++ b/include/tvm/relax/attrs/sorting.h @@ -47,7 +47,7 @@ struct SortAttrs : public AttrsNodeReflAdapter { "If it is not specified, it defaults to the ascending order.", refl::DefaultValue(false)); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.SortAttrs", SortAttrs, BaseAttrsNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.attrs.SortAttrs", SortAttrs, BaseAttrsNode); }; // struct SortAttrs /*! \brief Attributes used in argsort operator */ @@ -70,7 +70,7 @@ struct ArgsortAttrs : public AttrsNodeReflAdapter { .def_ro("dtype", &ArgsortAttrs::dtype, "DType of the output indices.", refl::DefaultValue(NullValue())); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.ArgsortAttrs", ArgsortAttrs, BaseAttrsNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.attrs.ArgsortAttrs", ArgsortAttrs, BaseAttrsNode); }; // struct ArgsortAttrs /*! \brief Attributes used in topk operator */ @@ -100,7 +100,7 @@ struct TopKAttrs : public AttrsNodeReflAdapter { .def_ro("dtype", &TopKAttrs::dtype, "Data type of the output indices.", refl::DefaultValue(NullValue())); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.TopKAttrs", TopKAttrs, BaseAttrsNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.attrs.TopKAttrs", TopKAttrs, BaseAttrsNode); }; // struct TopKAttrs } // namespace relax diff --git a/include/tvm/relax/attrs/statistical.h b/include/tvm/relax/attrs/statistical.h index 433524116d3c..1aaaec29ef94 100644 --- a/include/tvm/relax/attrs/statistical.h +++ b/include/tvm/relax/attrs/statistical.h @@ -44,7 +44,7 @@ struct StatisticalAttrs : public AttrsNodeReflAdapter { "with size " "one."); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.StatisticalAttrs", StatisticalAttrs, + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.attrs.StatisticalAttrs", StatisticalAttrs, BaseAttrsNode); }; // struct StatisticalAttrs @@ -66,7 +66,7 @@ struct ScanopAttrs : public AttrsNodeReflAdapter { .def_ro("exclusive", &ScanopAttrs::exclusive, "The first element is not included", refl::DefaultValue(Bool(false))); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.ScanopAttrs", ScanopAttrs, BaseAttrsNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.attrs.ScanopAttrs", ScanopAttrs, BaseAttrsNode); }; // struct ScanopAttrs } // namespace relax diff --git a/include/tvm/relax/attrs/vision.h b/include/tvm/relax/attrs/vision.h index 2fd98533b589..37c47f3d6588 100644 --- a/include/tvm/relax/attrs/vision.h +++ b/include/tvm/relax/attrs/vision.h @@ -44,7 +44,7 @@ struct AllClassNonMaximumSuppressionAttrs "Output format, onnx or tensorflow. Returns outputs in a way that can be easily " "consumed by each frontend."); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.AllClassNonMaximumSuppressionAttrs", + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.attrs.AllClassNonMaximumSuppressionAttrs", AllClassNonMaximumSuppressionAttrs, BaseAttrsNode); }; // struct AllClassNonMaximumSuppressionAttrs diff --git a/include/tvm/relax/binding_rewrite.h b/include/tvm/relax/binding_rewrite.h index 90d5b1540ee0..c4c739a36da9 100644 --- a/include/tvm/relax/binding_rewrite.h +++ b/include/tvm/relax/binding_rewrite.h @@ -74,7 +74,8 @@ class DataflowBlockRewriteNode : public Object { .def_ro("dfb", &DataflowBlockRewriteNode::dfb_) .def_ro("root_fn", &DataflowBlockRewriteNode::root_fn_); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.DataflowBlockRewrite", DataflowBlockRewriteNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.DataflowBlockRewrite", DataflowBlockRewriteNode, + Object); protected: friend class DataflowBlockRewrite; diff --git a/include/tvm/relax/block_builder.h b/include/tvm/relax/block_builder.h index 2ab6b52f4a91..46374a335310 100644 --- a/include/tvm/relax/block_builder.h +++ b/include/tvm/relax/block_builder.h @@ -258,7 +258,7 @@ class BlockBuilderNode : public Object { virtual arith::Analyzer* GetAnalyzer() = 0; static constexpr const bool _type_mutable = true; - TVM_FFI_DECLARE_OBJECT_INFO("relax.BlockBuilder", BlockBuilderNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO("tvm.relax.BlockBuilder", BlockBuilderNode, Object); }; class BlockBuilder : public ObjectRef { diff --git a/include/tvm/relax/dataflow_pattern.h b/include/tvm/relax/dataflow_pattern.h index 1925d5ae148d..15079038eeb0 100644 --- a/include/tvm/relax/dataflow_pattern.h +++ b/include/tvm/relax/dataflow_pattern.h @@ -91,7 +91,7 @@ TVM_DLL PatternSeq operator>>(const PatternSeq& lhs, const PatternSeq& rhs); class DFPatternNode : public Object { public: static constexpr const uint32_t _type_child_slots = 21; - TVM_FFI_DECLARE_OBJECT_INFO("relax.dpl.DFPattern", DFPatternNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO("tvm.relax.dpl.DFPattern", DFPatternNode, Object); }; /*! @@ -197,7 +197,7 @@ class DFConstraintNode : public Object { std::function(const DFPatternNode*)> match_state) const = 0; static constexpr const uint32_t _type_child_slots = 1; - TVM_FFI_DECLARE_OBJECT_INFO("relax.dpl.DFConstraint", DFConstraintNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO("tvm.relax.dpl.DFConstraint", DFConstraintNode, Object); }; class DFConstraint : public ObjectRef { @@ -218,7 +218,7 @@ class PatternSeqNode final : public Object { namespace refl = tvm::ffi::reflection; refl::ObjectDef().def_ro("patterns", &PatternSeqNode::patterns); } - TVM_FFI_DECLARE_OBJECT_INFO("relax.dpl.PatternSeq", PatternSeqNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO("tvm.relax.dpl.PatternSeq", PatternSeqNode, Object); }; /*! @@ -265,7 +265,7 @@ class PatternContextNode : public Object { // Non-edge constraints std::vector validation_constraints; - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.dpl.PatternContext", PatternContextNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.dpl.PatternContext", PatternContextNode, Object); }; /*! @@ -347,7 +347,7 @@ class ExprPatternNode : public DFPatternNode { namespace refl = tvm::ffi::reflection; refl::ObjectDef().def_ro("expr", &ExprPatternNode::expr); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.dpl.ExprPattern", ExprPatternNode, DFPatternNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.dpl.ExprPattern", ExprPatternNode, DFPatternNode); }; /*! @@ -376,7 +376,7 @@ class VarPatternNode : public DFPatternNode { } static constexpr const uint32_t _type_child_slots = 1; - TVM_FFI_DECLARE_OBJECT_INFO("relax.dpl.VarPattern", VarPatternNode, DFPatternNode); + TVM_FFI_DECLARE_OBJECT_INFO("tvm.relax.dpl.VarPattern", VarPatternNode, DFPatternNode); }; /*! @@ -404,7 +404,7 @@ class DataflowVarPatternNode : public VarPatternNode { namespace refl = tvm::ffi::reflection; refl::ObjectDef(); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.dpl.DataflowVarPattern", DataflowVarPatternNode, + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.dpl.DataflowVarPattern", DataflowVarPatternNode, VarPatternNode); }; @@ -425,7 +425,7 @@ class DataflowVarPattern : public DFPattern { */ class GlobalVarPatternNode : public VarPatternNode { public: - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.dpl.GlobalVarPattern", GlobalVarPatternNode, + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.dpl.GlobalVarPattern", GlobalVarPatternNode, DFPatternNode); }; @@ -449,7 +449,7 @@ class ConstantPatternNode : public DFPatternNode { namespace refl = tvm::ffi::reflection; refl::ObjectDef(); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.dpl.ConstantPattern", ConstantPatternNode, + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.dpl.ConstantPattern", ConstantPatternNode, DFPatternNode); }; @@ -491,7 +491,7 @@ class CallPatternNode : public DFPatternNode { .def_ro("op", &CallPatternNode::op) .def_ro("args", &CallPatternNode::args); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.dpl.CallPattern", CallPatternNode, DFPatternNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.dpl.CallPattern", CallPatternNode, DFPatternNode); }; class CallPattern : public DFPattern { @@ -513,7 +513,8 @@ class PrimArrPatternNode : public DFPatternNode { namespace refl = tvm::ffi::reflection; refl::ObjectDef().def_ro("fields", &PrimArrPatternNode::fields); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.dpl.PrimArrPattern", PrimArrPatternNode, DFPatternNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.dpl.PrimArrPattern", PrimArrPatternNode, + DFPatternNode); }; /*! @@ -548,7 +549,7 @@ class FunctionPatternNode : public DFPatternNode { .def_ro("params", &FunctionPatternNode::params) .def_ro("body", &FunctionPatternNode::body); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.dpl.FunctionPattern", FunctionPatternNode, + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.dpl.FunctionPattern", FunctionPatternNode, DFPatternNode); }; @@ -580,7 +581,7 @@ class TuplePatternNode : public DFPatternNode { namespace refl = tvm::ffi::reflection; refl::ObjectDef().def_ro("fields", &TuplePatternNode::fields); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.dpl.TuplePattern", TuplePatternNode, DFPatternNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.dpl.TuplePattern", TuplePatternNode, DFPatternNode); }; /*! @@ -606,8 +607,8 @@ class UnorderedTuplePatternNode : public DFPatternNode { refl::ObjectDef().def_ro("fields", &UnorderedTuplePatternNode::fields); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.dpl.UnorderedTuplePattern", UnorderedTuplePatternNode, - DFPatternNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.dpl.UnorderedTuplePattern", + UnorderedTuplePatternNode, DFPatternNode); }; /*! @@ -637,7 +638,7 @@ class TupleGetItemPatternNode : public DFPatternNode { .def_ro("tuple", &TupleGetItemPatternNode::tuple) .def_ro("index", &TupleGetItemPatternNode::index); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.dpl.TupleGetItemPattern", TupleGetItemPatternNode, + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.dpl.TupleGetItemPattern", TupleGetItemPatternNode, DFPatternNode); }; @@ -667,7 +668,7 @@ class AndPatternNode : public DFPatternNode { .def_ro("left", &AndPatternNode::left) .def_ro("right", &AndPatternNode::right); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.dpl.AndPattern", AndPatternNode, DFPatternNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.dpl.AndPattern", AndPatternNode, DFPatternNode); }; /*! @@ -695,7 +696,7 @@ class OrPatternNode : public DFPatternNode { .def_ro("left", &OrPatternNode::left) .def_ro("right", &OrPatternNode::right); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.dpl.OrPattern", OrPatternNode, DFPatternNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.dpl.OrPattern", OrPatternNode, DFPatternNode); }; /*! @@ -720,7 +721,7 @@ class NotPatternNode : public DFPatternNode { namespace refl = tvm::ffi::reflection; refl::ObjectDef().def_ro("reject", &NotPatternNode::reject); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.dpl.NotPattern", NotPatternNode, DFPatternNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.dpl.NotPattern", NotPatternNode, DFPatternNode); }; /*! @@ -743,7 +744,7 @@ class WildcardPatternNode : public DFPatternNode { namespace refl = tvm::ffi::reflection; refl::ObjectDef(); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.dpl.WildcardPattern", WildcardPatternNode, + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.dpl.WildcardPattern", WildcardPatternNode, DFPatternNode); }; @@ -782,7 +783,7 @@ class StructInfoPatternNode : public DFPatternNode { .def_ro("pattern", &StructInfoPatternNode::pattern) .def_ro("struct_info", &StructInfoPatternNode::struct_info); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.dpl.StructInfoPattern", StructInfoPatternNode, + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.dpl.StructInfoPattern", StructInfoPatternNode, DFPatternNode); }; @@ -807,7 +808,7 @@ class ShapePatternNode : public DFPatternNode { .def_ro("pattern", &ShapePatternNode::pattern) .def_ro("shape", &ShapePatternNode::shape); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.dpl.ShapePattern", ShapePatternNode, DFPatternNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.dpl.ShapePattern", ShapePatternNode, DFPatternNode); }; /*! @@ -837,7 +838,7 @@ class SameShapeConstraintNode : public DFConstraintNode { namespace refl = tvm::ffi::reflection; refl::ObjectDef().def_ro("args", &SameShapeConstraintNode::args); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.dpl.SameShapeConstraint", SameShapeConstraintNode, + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.dpl.SameShapeConstraint", SameShapeConstraintNode, DFConstraintNode); }; @@ -867,7 +868,7 @@ class DataTypePatternNode : public DFPatternNode { .def_ro("pattern", &DataTypePatternNode::pattern) .def_ro("dtype", &DataTypePatternNode::dtype); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.dpl.DataTypePattern", DataTypePatternNode, + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.dpl.DataTypePattern", DataTypePatternNode, DFPatternNode); }; @@ -896,7 +897,7 @@ class AttrPatternNode : public DFPatternNode { .def_ro("pattern", &AttrPatternNode::pattern) .def_ro("attrs", &AttrPatternNode::attrs); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.dpl.AttrPattern", AttrPatternNode, DFPatternNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.dpl.AttrPattern", AttrPatternNode, DFPatternNode); }; /*! @@ -926,7 +927,7 @@ class ExternFuncPatternNode : public DFPatternNode { refl::ObjectDef().def_ro("global_symbol", &ExternFuncPatternNode::global_symbol_); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.dpl.ExternFuncPattern", ExternFuncPatternNode, + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.dpl.ExternFuncPattern", ExternFuncPatternNode, DFPatternNode); }; diff --git a/include/tvm/relax/distributed/global_info.h b/include/tvm/relax/distributed/global_info.h index 2bb8d8772b06..17047698f6b4 100644 --- a/include/tvm/relax/distributed/global_info.h +++ b/include/tvm/relax/distributed/global_info.h @@ -52,7 +52,8 @@ class DeviceMeshNode : public GlobalInfoNode { .def_ro("device_ids", &DeviceMeshNode::device_ids) .def_ro("device_range", &DeviceMeshNode::device_range); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.distributed.DeviceMesh", DeviceMeshNode, GlobalInfoNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.distributed.DeviceMesh", DeviceMeshNode, + GlobalInfoNode); }; /*! diff --git a/include/tvm/relax/distributed/struct_info.h b/include/tvm/relax/distributed/struct_info.h index 9ca3b1513828..abc6ed88a539 100644 --- a/include/tvm/relax/distributed/struct_info.h +++ b/include/tvm/relax/distributed/struct_info.h @@ -52,7 +52,7 @@ class PlacementSpecNode : public Object { } static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind = kTVMFFISEqHashKindConstTreeNode; - TVM_FFI_DECLARE_OBJECT_INFO("relax.distributed.PlacementSpec", PlacementSpecNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO("tvm.relax.distributed.PlacementSpec", PlacementSpecNode, Object); }; /*! @@ -78,7 +78,8 @@ class ShardingNode : public PlacementSpecNode { refl::ObjectDef().def_ro("sharding_dim", &ShardingNode::sharding_dim); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.distributed.Sharding", ShardingNode, PlacementSpecNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.distributed.Sharding", ShardingNode, + PlacementSpecNode); }; /*! \brief Describes how data is distributed in each dimension of the device mesh*/ @@ -95,7 +96,7 @@ class PlacementNode : public Object { } static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind = kTVMFFISEqHashKindConstTreeNode; - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.distributed.Placement", PlacementNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.distributed.Placement", PlacementNode, Object); }; /*! @@ -135,7 +136,7 @@ class DTensorStructInfoNode : public StructInfoNode { .def_ro("placement", &DTensorStructInfoNode::placement) .def_ro("tensor_sinfo", &DTensorStructInfoNode::tensor_sinfo); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.DTensorStructInfo", DTensorStructInfoNode, + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.DTensorStructInfo", DTensorStructInfoNode, StructInfoNode); }; diff --git a/include/tvm/relax/exec_builder.h b/include/tvm/relax/exec_builder.h index 4fd0fd66bb90..d2e237a5194a 100644 --- a/include/tvm/relax/exec_builder.h +++ b/include/tvm/relax/exec_builder.h @@ -143,7 +143,7 @@ class ExecBuilderNode : public Object { } static constexpr const bool _type_mutable = true; - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.ExecBuilder", ExecBuilderNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.ExecBuilder", ExecBuilderNode, Object); private: /*! diff --git a/include/tvm/relax/expr.h b/include/tvm/relax/expr.h index 9b5a3176f413..0fb74107a270 100644 --- a/include/tvm/relax/expr.h +++ b/include/tvm/relax/expr.h @@ -62,7 +62,7 @@ class IdNode : public Object { } static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind = kTVMFFISEqHashKindFreeVar; - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.Id", IdNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.Id", IdNode, Object); }; class Id : public ObjectRef { @@ -122,7 +122,7 @@ class StructInfoNode : public Object { static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind = kTVMFFISEqHashKindTreeNode; static constexpr const uint32_t _type_child_slots = 7; - TVM_FFI_DECLARE_OBJECT_INFO("ir.StructInfo", StructInfoNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO("tvm.ir.StructInfo", StructInfoNode, Object); }; /*! @@ -174,7 +174,7 @@ class CallNode : public ExprNode { .def_ro("attrs", &CallNode::attrs) .def_ro("sinfo_args", &CallNode::sinfo_args); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.expr.Call", CallNode, ExprNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.expr.Call", CallNode, ExprNode); }; class Call : public Expr { @@ -216,7 +216,7 @@ class TupleNode : public ExprNode { namespace refl = tvm::ffi::reflection; refl::ObjectDef().def_ro("fields", &TupleNode::fields); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.expr.Tuple", TupleNode, ExprNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.expr.Tuple", TupleNode, ExprNode); }; class Tuple : public Expr { @@ -273,7 +273,7 @@ class TupleGetItemNode : public ExprNode { .def_ro("tuple_value", &TupleGetItemNode::tuple) .def_ro("index", &TupleGetItemNode::index); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.expr.TupleGetItem", TupleGetItemNode, ExprNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.expr.TupleGetItem", TupleGetItemNode, ExprNode); }; class TupleGetItem : public Expr { @@ -307,7 +307,7 @@ TupleGetItem WithFields(TupleGetItem tuple_get_item, class LeafExprNode : public ExprNode { public: static constexpr const uint32_t _type_child_slots = 7; - TVM_FFI_DECLARE_OBJECT_INFO("relax.expr.LeafExpr", LeafExprNode, ExprNode); + TVM_FFI_DECLARE_OBJECT_INFO("tvm.relax.expr.LeafExpr", LeafExprNode, ExprNode); }; /*! @@ -330,7 +330,7 @@ class ShapeExprNode : public LeafExprNode { namespace refl = tvm::ffi::reflection; refl::ObjectDef().def_ro("values", &ShapeExprNode::values); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.expr.ShapeExpr", ShapeExprNode, LeafExprNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.expr.ShapeExpr", ShapeExprNode, LeafExprNode); }; class ShapeExpr : public LeafExpr { @@ -355,8 +355,8 @@ class VarNode : public LeafExprNode { refl::ObjectDef().def_ro("vid", &VarNode::vid); // customize structural equal and hash to include struct_info_ refl::TypeAttrDef() - .def("__s_equal__", &VarNode::SEqual) - .def("__s_hash__", &VarNode::SHash); + .def("tvm.__s_equal__", &VarNode::SEqual) + .def("tvm.__s_hash__", &VarNode::SHash); } bool SEqual(const VarNode* other, @@ -375,7 +375,7 @@ class VarNode : public LeafExprNode { static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind = kTVMFFISEqHashKindDAGNode; static constexpr const uint32_t _type_child_slots = 1; - TVM_FFI_DECLARE_OBJECT_INFO("relax.expr.Var", VarNode, LeafExprNode); + TVM_FFI_DECLARE_OBJECT_INFO("tvm.relax.expr.Var", VarNode, LeafExprNode); }; class Var : public LeafExpr { @@ -402,7 +402,7 @@ class DataflowVarNode : public VarNode { } static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind = kTVMFFISEqHashKindDAGNode; - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.expr.DataflowVar", DataflowVarNode, VarNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.expr.DataflowVar", DataflowVarNode, VarNode); }; class DataflowVar : public Var { @@ -438,7 +438,7 @@ class ConstantNode : public LeafExprNode { namespace refl = tvm::ffi::reflection; refl::ObjectDef().def_ro("data", &ConstantNode::data); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.expr.Constant", ConstantNode, LeafExprNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.expr.Constant", ConstantNode, LeafExprNode); }; class Constant : public LeafExpr { @@ -472,7 +472,7 @@ class PrimValueNode : public LeafExprNode { namespace refl = tvm::ffi::reflection; refl::ObjectDef().def_ro("value", &PrimValueNode::value); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.expr.PrimValue", PrimValueNode, LeafExprNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.expr.PrimValue", PrimValueNode, LeafExprNode); }; /*! @@ -512,7 +512,7 @@ class StringImmNode : public LeafExprNode { namespace refl = tvm::ffi::reflection; refl::ObjectDef().def_ro("value", &StringImmNode::value); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.expr.StringImm", StringImmNode, LeafExprNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.expr.StringImm", StringImmNode, LeafExprNode); }; /*! @@ -544,7 +544,7 @@ class DataTypeImmNode : public LeafExprNode { namespace refl = tvm::ffi::reflection; refl::ObjectDef().def_ro("value", &DataTypeImmNode::value); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.expr.DataTypeImm", DataTypeImmNode, LeafExprNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.expr.DataTypeImm", DataTypeImmNode, LeafExprNode); }; /*! @@ -580,7 +580,7 @@ class BindingNode : public Object { static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind = kTVMFFISEqHashKindTreeNode; - TVM_FFI_DECLARE_OBJECT_INFO("relax.expr.Binding", BindingNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO("tvm.relax.expr.Binding", BindingNode, Object); }; class Binding : public ObjectRef { @@ -616,7 +616,7 @@ class MatchCastNode : public BindingNode { .def_ro("value", &MatchCastNode::value) .def_ro("struct_info", &MatchCastNode::struct_info, refl::AttachFieldFlag::SEqHashDef()); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.expr.MatchCast", MatchCastNode, BindingNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.expr.MatchCast", MatchCastNode, BindingNode); }; /*! @@ -641,15 +641,15 @@ class VarBindingNode : public BindingNode { refl::ObjectDef().def_ro("value", &VarBindingNode::value); // customize the SEqual and SHash methods for better error messages refl::TypeAttrDef() - .def("__s_equal__", &VarBindingNode::SEqual) - .def("__s_hash__", &VarBindingNode::SHash); + .def("tvm.__s_equal__", &VarBindingNode::SEqual) + .def("tvm.__s_hash__", &VarBindingNode::SHash); } bool SEqual(const VarBindingNode* other, ffi::TypedFunction equal) const; uint64_t SHash(uint64_t init_hash, ffi::TypedFunction hash) const; - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.expr.VarBinding", VarBindingNode, BindingNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.expr.VarBinding", VarBindingNode, BindingNode); }; class VarBinding : public Binding { @@ -673,7 +673,7 @@ class BindingBlockNode : public Object { } static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind = kTVMFFISEqHashKindTreeNode; - TVM_FFI_DECLARE_OBJECT_INFO("relax.expr.BindingBlock", BindingBlockNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO("tvm.relax.expr.BindingBlock", BindingBlockNode, Object); }; class BindingBlock : public ObjectRef { @@ -690,7 +690,7 @@ class DataflowBlockNode : public BindingBlockNode { namespace refl = tvm::ffi::reflection; refl::ObjectDef(); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.expr.DataflowBlock", DataflowBlockNode, + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.expr.DataflowBlock", DataflowBlockNode, BindingBlockNode); }; @@ -716,7 +716,7 @@ class SeqExprNode : public ExprNode { .def_ro("blocks", &SeqExprNode::blocks) .def_ro("body", &SeqExprNode::body); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.expr.SeqExpr", SeqExprNode, ExprNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.expr.SeqExpr", SeqExprNode, ExprNode); }; class SeqExpr : public Expr { @@ -768,7 +768,7 @@ class IfNode : public ExprNode { } static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind = kTVMFFISEqHashKindDAGNode; - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.expr.If", IfNode, ExprNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.expr.If", IfNode, ExprNode); }; class If : public Expr { @@ -828,7 +828,7 @@ class FunctionNode : public BaseFuncNode { } static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind = kTVMFFISEqHashKindDAGNode; - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.expr.Function", FunctionNode, BaseFuncNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.expr.Function", FunctionNode, BaseFuncNode); }; class Function : public BaseFunc { @@ -911,7 +911,7 @@ class ExternFuncNode : public BaseFuncNode { namespace refl = tvm::ffi::reflection; refl::ObjectDef().def_ro("global_symbol", &ExternFuncNode::global_symbol); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.expr.ExternFunc", ExternFuncNode, BaseFuncNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.expr.ExternFunc", ExternFuncNode, BaseFuncNode); }; class ExternFunc : public BaseFunc { diff --git a/include/tvm/relax/struct_info.h b/include/tvm/relax/struct_info.h index f08d737fdca5..4baf04c3fce8 100644 --- a/include/tvm/relax/struct_info.h +++ b/include/tvm/relax/struct_info.h @@ -41,7 +41,8 @@ class ObjectStructInfoNode : public StructInfoNode { namespace refl = tvm::ffi::reflection; refl::ObjectDef(); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.ObjectStructInfo", ObjectStructInfoNode, StructInfoNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.ObjectStructInfo", ObjectStructInfoNode, + StructInfoNode); }; /*! @@ -72,7 +73,7 @@ class PrimStructInfoNode : public StructInfoNode { .def_ro("value", &PrimStructInfoNode::value) .def_ro("dtype", &PrimStructInfoNode::dtype); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.PrimStructInfo", PrimStructInfoNode, StructInfoNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.PrimStructInfo", PrimStructInfoNode, StructInfoNode); }; /*! @@ -112,7 +113,8 @@ class ShapeStructInfoNode : public StructInfoNode { .def_ro("values", &ShapeStructInfoNode::values) .def_ro("ndim", &ShapeStructInfoNode::ndim); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.ShapeStructInfo", ShapeStructInfoNode, StructInfoNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.ShapeStructInfo", ShapeStructInfoNode, + StructInfoNode); }; /*! @@ -180,7 +182,8 @@ class TensorStructInfoNode : public StructInfoNode { .def_ro("vdevice", &TensorStructInfoNode::vdevice) .def_ro("ndim", &TensorStructInfoNode::ndim); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.TensorStructInfo", TensorStructInfoNode, StructInfoNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.TensorStructInfo", TensorStructInfoNode, + StructInfoNode); }; /*! @@ -226,7 +229,8 @@ class TupleStructInfoNode : public StructInfoNode { namespace refl = tvm::ffi::reflection; refl::ObjectDef().def_ro("fields", &TupleStructInfoNode::fields); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.TupleStructInfo", TupleStructInfoNode, StructInfoNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.TupleStructInfo", TupleStructInfoNode, + StructInfoNode); }; /*! @@ -298,7 +302,7 @@ class FuncStructInfoNode : public StructInfoNode { .def_ro("derive_func", &FuncStructInfoNode::derive_func) .def_ro("purity", &FuncStructInfoNode::purity); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.FuncStructInfo", FuncStructInfoNode, StructInfoNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.FuncStructInfo", FuncStructInfoNode, StructInfoNode); }; /*! diff --git a/include/tvm/relax/tir_pattern.h b/include/tvm/relax/tir_pattern.h index 6bd36560a6ac..d7d4af4002c5 100644 --- a/include/tvm/relax/tir_pattern.h +++ b/include/tvm/relax/tir_pattern.h @@ -52,7 +52,7 @@ class MatchResultNode : public Object { .def_ro("symbol_values", &MatchResultNode::symbol_values) .def_ro("matched_buffers", &MatchResultNode::matched_buffers); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.MatchResult", MatchResultNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.MatchResult", MatchResultNode, Object); }; /*! diff --git a/include/tvm/relax/transform.h b/include/tvm/relax/transform.h index 786dfdcdf98c..16bb564f4318 100644 --- a/include/tvm/relax/transform.h +++ b/include/tvm/relax/transform.h @@ -409,7 +409,7 @@ class FusionPatternNode : public Object { .def_ro("check", &FusionPatternNode::check) .def_ro("attrs_getter", &FusionPatternNode::attrs_getter); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.transform.FusionPattern", FusionPatternNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.transform.FusionPattern", FusionPatternNode, Object); }; class FusionPattern : public ObjectRef { @@ -467,8 +467,8 @@ class PatternCheckContextNode : public Object { .def_ro("var_usages", &PatternCheckContextNode::var_usages) .def_ro("value_to_bound_var", &PatternCheckContextNode::value_to_bound_var); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.transform.PatternCheckContext", PatternCheckContextNode, - Object); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.transform.PatternCheckContext", + PatternCheckContextNode, Object); }; class PatternCheckContext : public ObjectRef { diff --git a/include/tvm/relax/type.h b/include/tvm/relax/type.h index 8eaaf7bddc48..d0883c46b641 100644 --- a/include/tvm/relax/type.h +++ b/include/tvm/relax/type.h @@ -48,7 +48,7 @@ class ShapeTypeNode : public TypeNode { namespace refl = tvm::ffi::reflection; refl::ObjectDef().def_ro("ndim", &ShapeTypeNode::ndim); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.ShapeType", ShapeTypeNode, TypeNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.ShapeType", ShapeTypeNode, TypeNode); }; class ShapeType : public Type { @@ -84,7 +84,7 @@ class TensorTypeNode : public TypeNode { inline bool IsUnknownNdim() const { return ndim == kUnknownNDim; } inline bool IsUnknownDtype() const { return dtype.is_void(); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.DynTensorType", TensorTypeNode, TypeNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.DynTensorType", TensorTypeNode, TypeNode); }; /*! @@ -118,7 +118,7 @@ class ObjectTypeNode : public TypeNode { namespace refl = tvm::ffi::reflection; refl::ObjectDef(); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.ObjectType", ObjectTypeNode, TypeNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.ObjectType", ObjectTypeNode, TypeNode); }; class ObjectType : public Type { @@ -134,7 +134,7 @@ class PackedFuncTypeNode : public TypeNode { namespace refl = tvm::ffi::reflection; refl::ObjectDef(); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.PackedFuncType", PackedFuncTypeNode, TypeNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.PackedFuncType", PackedFuncTypeNode, TypeNode); }; class PackedFuncType : public Type { diff --git a/include/tvm/runtime/disco/session.h b/include/tvm/runtime/disco/session.h index 283d75740c4f..48d93df1e11e 100644 --- a/include/tvm/runtime/disco/session.h +++ b/include/tvm/runtime/disco/session.h @@ -152,7 +152,7 @@ class DRefObj : public Object { static constexpr const uint32_t _type_index = TypeIndex::kRuntimeDiscoDRef; static const constexpr bool _type_final = true; static constexpr const bool _type_mutable = true; - TVM_FFI_DECLARE_OBJECT_INFO_STATIC("runtime.disco.DRef", DRefObj, Object); + TVM_FFI_DECLARE_OBJECT_INFO_STATIC("tvm.runtime.disco.DRef", DRefObj, Object); /*! \brief The id of the register */ int64_t reg_id; @@ -257,7 +257,7 @@ class SessionObj : public Object { friend class DRefObj; static constexpr const bool _type_mutable = true; - TVM_FFI_DECLARE_OBJECT_INFO("runtime.disco.Session", SessionObj, Object); + TVM_FFI_DECLARE_OBJECT_INFO("tvm.runtime.disco.Session", SessionObj, Object); protected: /*! \brief Deallocate a register id, kill it on all workers, and append it to `free_regs_`. */ diff --git a/include/tvm/runtime/memory/memory_manager.h b/include/tvm/runtime/memory/memory_manager.h index 8d2de7791af0..cac9a38a6538 100644 --- a/include/tvm/runtime/memory/memory_manager.h +++ b/include/tvm/runtime/memory/memory_manager.h @@ -177,7 +177,7 @@ class StorageObj : public Object { } static constexpr const bool _type_mutable = true; - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("vm.Storage", StorageObj, Object); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.vm.Storage", StorageObj, Object); }; /*! \brief reference to storage. */ diff --git a/include/tvm/runtime/profiling.h b/include/tvm/runtime/profiling.h index c04310d9db20..b1626a485521 100644 --- a/include/tvm/runtime/profiling.h +++ b/include/tvm/runtime/profiling.h @@ -76,7 +76,7 @@ class TimerNode : public Object { virtual ~TimerNode() {} static constexpr const bool _type_mutable = true; - TVM_FFI_DECLARE_OBJECT_INFO("runtime.TimerNode", TimerNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO("tvm.runtime.TimerNode", TimerNode, Object); }; /*! \brief Timer for a specific device. @@ -125,7 +125,7 @@ class Timer : public ObjectRef { * virtual int64_t SyncAndGetElapsedNanos() { return duration_.count(); } * virtual ~CPUTimerNode() {} * - * static constexpr const char* _type_key = "runtime.CPUTimerNode"; + * static constexpr const char* _type_key = "tvm.runtime.CPUTimerNode"; * TVM_FFI_DECLARE_OBJECT_INFO_FINAL(CPUTimerNode, TimerNode); * * private: @@ -136,7 +136,7 @@ class Timer : public ObjectRef { * * TVM_FFI_STATIC_INIT_BLOCK() { * namespace refl = tvm::ffi::reflection; - * refl::GlobalDef().def("profiling.timer.cpu", [](Device dev) { + * refl::GlobalDef().def("tvm.profiling.timer.cpu", [](Device dev) { * return Timer(ffi::make_object()); * }); * } @@ -166,7 +166,7 @@ struct DeviceWrapperNode : public Object { /*! Constructor */ explicit DeviceWrapperNode(Device device) : device(device) {} - TVM_FFI_DECLARE_OBJECT_INFO("runtime.profiling.DeviceWrapper", DeviceWrapperNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO("tvm.runtime.profiling.DeviceWrapper", DeviceWrapperNode, Object); }; /*! \brief Wrapper for `Device`. */ @@ -254,7 +254,7 @@ class ReportNode : public Object { * \endcode */ ffi::String AsJSON() const; - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("runtime.profiling.Report", ReportNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.runtime.profiling.Report", ReportNode, Object); }; class Report : public ObjectRef { @@ -318,7 +318,7 @@ class MetricCollectorNode : public Object { virtual ~MetricCollectorNode() {} static constexpr const bool _type_mutable = true; - TVM_FFI_DECLARE_OBJECT_INFO("runtime.profiling.MetricCollector", MetricCollectorNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO("tvm.runtime.profiling.MetricCollector", MetricCollectorNode, Object); }; /*! \brief Wrapper for `MetricCollectorNode`. */ @@ -436,7 +436,7 @@ class DurationNode : public Object { * \param a The duration in microseconds. */ explicit DurationNode(double a) : microseconds(a) {} - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("runtime.profiling.Duration", DurationNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.runtime.profiling.Duration", DurationNode, Object); }; /* A percentage of something */ @@ -449,7 +449,7 @@ class PercentNode : public Object { * \param a The percentage out of 100. */ explicit PercentNode(double a) : percent(a) {} - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("runtime.profiling.Percent", PercentNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.runtime.profiling.Percent", PercentNode, Object); }; /* A count of something */ @@ -462,7 +462,7 @@ class CountNode : public Object { * \param a The count. */ explicit CountNode(int64_t a) : value(a) {} - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("runtime.profiling.Count", CountNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.runtime.profiling.Count", CountNode, Object); }; /* \brief A ratio of two things. */ @@ -475,7 +475,7 @@ class RatioNode : public Object { * \param a The ratio. */ explicit RatioNode(double a) : ratio(a) {} - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("runtime.profiling.Ratio", RatioNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.runtime.profiling.Ratio", RatioNode, Object); }; /*! \brief ffi::String representation of an array of Tensor shapes diff --git a/include/tvm/runtime/vm/vm.h b/include/tvm/runtime/vm/vm.h index 335d77f1966d..4a352199acf8 100644 --- a/include/tvm/runtime/vm/vm.h +++ b/include/tvm/runtime/vm/vm.h @@ -77,7 +77,7 @@ class VMClosureObj : public Object { * the same arguments as the normal function call. */ ffi::Function impl; - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.vm.Closure", VMClosureObj, Object); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.vm.Closure", VMClosureObj, Object); }; /*! \brief reference to closure. */ @@ -107,7 +107,7 @@ class VMClosure : public ObjectRef { */ class VMExtensionNode : public Object { protected: - TVM_FFI_DECLARE_OBJECT_INFO("runtime.VMExtension", VMExtensionNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO("tvm.runtime.VMExtension", VMExtensionNode, Object); }; /*! \brief Managed reference to VM extension. */ diff --git a/include/tvm/script/ir_builder/base.h b/include/tvm/script/ir_builder/base.h index 8c5209982b10..9fd0a80bdc11 100644 --- a/include/tvm/script/ir_builder/base.h +++ b/include/tvm/script/ir_builder/base.h @@ -74,7 +74,7 @@ class IRBuilderFrameNode : public runtime::Object { } static constexpr const bool _type_mutable = true; - TVM_FFI_DECLARE_OBJECT_INFO("script.ir_builder.IRBuilderFrame", IRBuilderFrameNode, + TVM_FFI_DECLARE_OBJECT_INFO("tvm.script.ir_builder.IRBuilderFrame", IRBuilderFrameNode, runtime::Object); public: @@ -171,7 +171,8 @@ class IRBuilderNode : public runtime::Object { } static constexpr const bool _type_mutable = true; - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.ir_builder.IRBuilder", IRBuilderNode, runtime::Object); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.script.ir_builder.IRBuilder", IRBuilderNode, + runtime::Object); public: /*! diff --git a/include/tvm/script/ir_builder/ir/frame.h b/include/tvm/script/ir_builder/ir/frame.h index 53efc9df7f2b..b9905d7389f1 100644 --- a/include/tvm/script/ir_builder/ir/frame.h +++ b/include/tvm/script/ir_builder/ir/frame.h @@ -60,7 +60,7 @@ class IRModuleFrameNode : public IRBuilderFrameNode { .def_ro("attrs", &IRModuleFrameNode::attrs) .def_ro("global_infos", &IRModuleFrameNode::global_infos); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.ir_builder.IRModuleFrame", IRModuleFrameNode, + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.script.ir_builder.IRModuleFrame", IRModuleFrameNode, IRBuilderFrameNode); public: diff --git a/include/tvm/script/ir_builder/relax/frame.h b/include/tvm/script/ir_builder/relax/frame.h index 5d6bcc8a2c2f..60d57497b6d2 100644 --- a/include/tvm/script/ir_builder/relax/frame.h +++ b/include/tvm/script/ir_builder/relax/frame.h @@ -40,7 +40,7 @@ class RelaxFrameNode : public IRBuilderFrameNode { namespace refl = tvm::ffi::reflection; refl::ObjectDef(); } - TVM_FFI_DECLARE_OBJECT_INFO("script.ir_builder.relax.RelaxFrame", RelaxFrameNode, + TVM_FFI_DECLARE_OBJECT_INFO("tvm.script.ir_builder.relax.RelaxFrame", RelaxFrameNode, IRBuilderFrameNode); }; @@ -72,7 +72,7 @@ class SeqExprFrameNode : public RelaxFrameNode { .def_ro("binding_blocks", &SeqExprFrameNode::binding_blocks) .def_ro("output", &SeqExprFrameNode::output); } - TVM_FFI_DECLARE_OBJECT_INFO("script.ir_builder.relax.SeqExprFrame", SeqExprFrameNode, + TVM_FFI_DECLARE_OBJECT_INFO("tvm.script.ir_builder.relax.SeqExprFrame", SeqExprFrameNode, RelaxFrameNode); public: @@ -130,7 +130,7 @@ class FunctionFrameNode : public SeqExprFrameNode { .def_ro("output", &FunctionFrameNode::output); // `block_builder` is not registered as it's not visited. } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.ir_builder.relax.FunctionFrame", FunctionFrameNode, + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.script.ir_builder.relax.FunctionFrame", FunctionFrameNode, SeqExprFrameNode); public: @@ -173,7 +173,7 @@ class BlockFrameNode : public RelaxFrameNode { .def_ro("output_vars", &BlockFrameNode::output_vars); // `block_ended` is not registered as it's not visited. } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.ir_builder.relax.BlockFrame", BlockFrameNode, + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.script.ir_builder.relax.BlockFrame", BlockFrameNode, RelaxFrameNode); public: @@ -216,7 +216,8 @@ class IfFrameNode : public RelaxFrameNode { .def_ro("var", &IfFrameNode::var) .def_ro("var_name", &IfFrameNode::var_name); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.ir_builder.relax.IfFrame", IfFrameNode, RelaxFrameNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.script.ir_builder.relax.IfFrame", IfFrameNode, + RelaxFrameNode); public: /*! @@ -255,7 +256,7 @@ class ThenFrameNode : public SeqExprFrameNode { namespace refl = tvm::ffi::reflection; refl::ObjectDef(); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.ir_builder.relax.ThenFrame", ThenFrameNode, + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.script.ir_builder.relax.ThenFrame", ThenFrameNode, SeqExprFrameNode); public: @@ -295,7 +296,7 @@ class ElseFrameNode : public SeqExprFrameNode { namespace refl = tvm::ffi::reflection; refl::ObjectDef(); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.ir_builder.relax.ElseFrame", ElseFrameNode, + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.script.ir_builder.relax.ElseFrame", ElseFrameNode, SeqExprFrameNode); public: diff --git a/include/tvm/script/ir_builder/tir/frame.h b/include/tvm/script/ir_builder/tir/frame.h index db5776890ab9..ac5cd5fab302 100644 --- a/include/tvm/script/ir_builder/tir/frame.h +++ b/include/tvm/script/ir_builder/tir/frame.h @@ -44,7 +44,8 @@ class TIRFrameNode : public IRBuilderFrameNode { namespace refl = tvm::ffi::reflection; refl::ObjectDef().def_ro("stmts", &TIRFrameNode::stmts); } - TVM_FFI_DECLARE_OBJECT_INFO("script.ir_builder.tir.TIRFrame", TIRFrameNode, IRBuilderFrameNode); + TVM_FFI_DECLARE_OBJECT_INFO("tvm.script.ir_builder.tir.TIRFrame", TIRFrameNode, + IRBuilderFrameNode); }; /*! @@ -97,7 +98,7 @@ class PrimFuncFrameNode : public TIRFrameNode { .def_ro("env_threads", &PrimFuncFrameNode::env_threads) .def_ro("root_alloc_buffers", &PrimFuncFrameNode::root_alloc_buffers); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.ir_builder.tir.PrimFuncFrame", PrimFuncFrameNode, + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.script.ir_builder.tir.PrimFuncFrame", PrimFuncFrameNode, TIRFrameNode); public: @@ -170,7 +171,7 @@ class BlockFrameNode : public TIRFrameNode { .def_ro("predicate", &BlockFrameNode::predicate) .def_ro("no_realize", &BlockFrameNode::no_realize); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.ir_builder.tir.BlockFrame", BlockFrameNode, + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.script.ir_builder.tir.BlockFrame", BlockFrameNode, TIRFrameNode); public: @@ -207,7 +208,7 @@ class BlockInitFrameNode : public TIRFrameNode { namespace refl = tvm::ffi::reflection; refl::ObjectDef(); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.ir_builder.tir.BlockInitFrame", BlockInitFrameNode, + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.script.ir_builder.tir.BlockInitFrame", BlockInitFrameNode, TIRFrameNode); public: @@ -270,7 +271,8 @@ class ForFrameNode : public TIRFrameNode { .def_ro("doms", &ForFrameNode::doms); // `f_make_for_loop` is not registered as it's not visited. } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.ir_builder.tir.ForFrame", ForFrameNode, TIRFrameNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.script.ir_builder.tir.ForFrame", ForFrameNode, + TIRFrameNode); public: /*! @@ -313,7 +315,7 @@ class AssertFrameNode : public TIRFrameNode { .def_ro("condition", &AssertFrameNode::condition) .def_ro("message", &AssertFrameNode::message); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.ir_builder.tir.AssertFrame", AssertFrameNode, + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.script.ir_builder.tir.AssertFrame", AssertFrameNode, TIRFrameNode); public: @@ -356,7 +358,8 @@ class LetFrameNode : public TIRFrameNode { .def_ro("var", &LetFrameNode::var) .def_ro("value", &LetFrameNode::value); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.ir_builder.tir.LetFrame", LetFrameNode, TIRFrameNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.script.ir_builder.tir.LetFrame", LetFrameNode, + TIRFrameNode); public: /*! @@ -400,7 +403,7 @@ class LaunchThreadFrameNode : public TIRFrameNode { .def_ro("attr_key", &LaunchThreadFrameNode::attr_key) .def_ro("iter_var", &LaunchThreadFrameNode::iter_var); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.ir_builder.tir.LaunchThreadFrame", + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.script.ir_builder.tir.LaunchThreadFrame", LaunchThreadFrameNode, TIRFrameNode); public: @@ -446,7 +449,7 @@ class RealizeFrameNode : public TIRFrameNode { .def_ro("storage_scope", &RealizeFrameNode::storage_scope) .def_ro("condition", &RealizeFrameNode::condition); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.ir_builder.tir.RealizeFrame", RealizeFrameNode, + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.script.ir_builder.tir.RealizeFrame", RealizeFrameNode, TIRFrameNode); public: @@ -501,7 +504,7 @@ class AllocateFrameNode : public TIRFrameNode { .def_ro("annotations", &AllocateFrameNode::annotations) .def_ro("buffer_var", &AllocateFrameNode::buffer_var); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.ir_builder.tir.AllocateFrame", AllocateFrameNode, + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.script.ir_builder.tir.AllocateFrame", AllocateFrameNode, TIRFrameNode); public: @@ -553,7 +556,7 @@ class AllocateConstFrameNode : public TIRFrameNode { .def_ro("buffer_var", &AllocateConstFrameNode::buffer_var) .def_ro("annotations", &AllocateConstFrameNode::annotations); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.ir_builder.tir.AllocateConstFrame", + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.script.ir_builder.tir.AllocateConstFrame", AllocateConstFrameNode, TIRFrameNode); public: @@ -600,7 +603,8 @@ class AttrFrameNode : public TIRFrameNode { .def_ro("attr_key", &AttrFrameNode::attr_key) .def_ro("value", &AttrFrameNode::value); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.ir_builder.tir.AttrFrame", AttrFrameNode, TIRFrameNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.script.ir_builder.tir.AttrFrame", AttrFrameNode, + TIRFrameNode); public: /*! @@ -638,7 +642,7 @@ class WhileFrameNode : public TIRFrameNode { namespace refl = tvm::ffi::reflection; refl::ObjectDef().def_ro("condition", &WhileFrameNode::condition); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.ir_builder.tir.WhileFrame", WhileFrameNode, + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.script.ir_builder.tir.WhileFrame", WhileFrameNode, TIRFrameNode); public: @@ -684,7 +688,7 @@ class IfFrameNode : public TIRFrameNode { .def_ro("then_stmts", &IfFrameNode::then_stmts) .def_ro("else_stmts", &IfFrameNode::else_stmts); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.ir_builder.tir.IfFrame", IfFrameNode, TIRFrameNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.script.ir_builder.tir.IfFrame", IfFrameNode, TIRFrameNode); public: /*! @@ -718,7 +722,8 @@ class ThenFrameNode : public TIRFrameNode { namespace refl = tvm::ffi::reflection; refl::ObjectDef(); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.ir_builder.tir.ThenFrame", ThenFrameNode, TIRFrameNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.script.ir_builder.tir.ThenFrame", ThenFrameNode, + TIRFrameNode); public: /*! @@ -757,7 +762,8 @@ class ElseFrameNode : public TIRFrameNode { namespace refl = tvm::ffi::reflection; refl::ObjectDef(); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.ir_builder.tir.ElseFrame", ElseFrameNode, TIRFrameNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.script.ir_builder.tir.ElseFrame", ElseFrameNode, + TIRFrameNode); public: /*! @@ -799,8 +805,8 @@ class DeclBufferFrameNode : public TIRFrameNode { .def_ro("buffer", &DeclBufferFrameNode::buffer) .def_ro("allocated", &DeclBufferFrameNode::allocated); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.ir_builder.tir.DeclBufferFrame", DeclBufferFrameNode, - TIRFrameNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.script.ir_builder.tir.DeclBufferFrame", + DeclBufferFrameNode, TIRFrameNode); public: void ExitWithScope() final; diff --git a/include/tvm/script/printer/doc.h b/include/tvm/script/printer/doc.h index 9ce980d268df..54eb87e67271 100644 --- a/include/tvm/script/printer/doc.h +++ b/include/tvm/script/printer/doc.h @@ -73,7 +73,7 @@ class DocNode : public Object { static constexpr bool _type_mutable = true; - TVM_FFI_DECLARE_OBJECT_INFO("script.printer.Doc", DocNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO("tvm.script.printer.Doc", DocNode, Object); public: virtual ~DocNode() = default; @@ -134,7 +134,7 @@ class ExprDocNode : public DocNode { namespace refl = tvm::ffi::reflection; refl::ObjectDef(); } - TVM_FFI_DECLARE_OBJECT_INFO("script.printer.ExprDoc", ExprDocNode, DocNode); + TVM_FFI_DECLARE_OBJECT_INFO("tvm.script.printer.ExprDoc", ExprDocNode, DocNode); }; /*! @@ -179,7 +179,7 @@ class StmtDocNode : public DocNode { namespace refl = tvm::ffi::reflection; refl::ObjectDef().def_rw("comment", &StmtDocNode::comment); } - TVM_FFI_DECLARE_OBJECT_INFO("script.printer.StmtDoc", StmtDocNode, DocNode); + TVM_FFI_DECLARE_OBJECT_INFO("tvm.script.printer.StmtDoc", StmtDocNode, DocNode); }; /*! @@ -210,7 +210,7 @@ class StmtBlockDocNode : public DocNode { namespace refl = tvm::ffi::reflection; refl::ObjectDef().def_ro("stmts", &StmtBlockDocNode::stmts); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.StmtBlockDoc", StmtBlockDocNode, DocNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.script.printer.StmtBlockDoc", StmtBlockDocNode, DocNode); }; /*! @@ -249,7 +249,7 @@ class LiteralDocNode : public ExprDocNode { namespace refl = tvm::ffi::reflection; refl::ObjectDef().def_ro("value", &LiteralDocNode::value); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.LiteralDoc", LiteralDocNode, ExprDocNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.script.printer.LiteralDoc", LiteralDocNode, ExprDocNode); }; /*! @@ -338,7 +338,7 @@ class IdDocNode : public ExprDocNode { namespace refl = tvm::ffi::reflection; refl::ObjectDef().def_ro("name", &IdDocNode::name); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.IdDoc", IdDocNode, ExprDocNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.script.printer.IdDoc", IdDocNode, ExprDocNode); }; /*! @@ -375,7 +375,8 @@ class AttrAccessDocNode : public ExprDocNode { .def_ro("value", &AttrAccessDocNode::value) .def_ro("name", &AttrAccessDocNode::name); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.AttrAccessDoc", AttrAccessDocNode, ExprDocNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.script.printer.AttrAccessDoc", AttrAccessDocNode, + ExprDocNode); }; /*! @@ -418,7 +419,7 @@ class IndexDocNode : public ExprDocNode { .def_ro("value", &IndexDocNode::value) .def_ro("indices", &IndexDocNode::indices); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.IndexDoc", IndexDocNode, ExprDocNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.script.printer.IndexDoc", IndexDocNode, ExprDocNode); }; /*! @@ -466,7 +467,7 @@ class CallDocNode : public ExprDocNode { .def_ro("kwargs_keys", &CallDocNode::kwargs_keys) .def_ro("kwargs_values", &CallDocNode::kwargs_values); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.CallDoc", CallDocNode, ExprDocNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.script.printer.CallDoc", CallDocNode, ExprDocNode); }; /*! @@ -547,7 +548,8 @@ class OperationDocNode : public ExprDocNode { .def_ro("kind", &OperationDocNode::kind) .def_ro("operands", &OperationDocNode::operands); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.OperationDoc", OperationDocNode, ExprDocNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.script.printer.OperationDoc", OperationDocNode, + ExprDocNode); }; /*! @@ -587,7 +589,7 @@ class LambdaDocNode : public ExprDocNode { .def_ro("args", &LambdaDocNode::args) .def_ro("body", &LambdaDocNode::body); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.LambdaDoc", LambdaDocNode, ExprDocNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.script.printer.LambdaDoc", LambdaDocNode, ExprDocNode); }; /*! @@ -620,7 +622,7 @@ class TupleDocNode : public ExprDocNode { namespace refl = tvm::ffi::reflection; refl::ObjectDef().def_ro("elements", &TupleDocNode::elements); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.TupleDoc", TupleDocNode, ExprDocNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.script.printer.TupleDoc", TupleDocNode, ExprDocNode); }; /*! @@ -656,7 +658,7 @@ class ListDocNode : public ExprDocNode { namespace refl = tvm::ffi::reflection; refl::ObjectDef().def_ro("elements", &ListDocNode::elements); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.ListDoc", ListDocNode, ExprDocNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.script.printer.ListDoc", ListDocNode, ExprDocNode); }; /*! @@ -701,7 +703,7 @@ class DictDocNode : public ExprDocNode { .def_ro("keys", &DictDocNode::keys) .def_ro("values", &DictDocNode::values); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.DictDoc", DictDocNode, ExprDocNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.script.printer.DictDoc", DictDocNode, ExprDocNode); }; /*! @@ -747,7 +749,7 @@ class SliceDocNode : public DocNode { .def_ro("stop", &SliceDocNode::stop) .def_ro("step", &SliceDocNode::step); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.SliceDoc", SliceDocNode, DocNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.script.printer.SliceDoc", SliceDocNode, DocNode); }; /*! @@ -793,7 +795,7 @@ class AssignDocNode : public StmtDocNode { .def_ro("rhs", &AssignDocNode::rhs) .def_ro("annotation", &AssignDocNode::annotation); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.AssignDoc", AssignDocNode, StmtDocNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.script.printer.AssignDoc", AssignDocNode, StmtDocNode); }; /*! @@ -834,7 +836,7 @@ class IfDocNode : public StmtDocNode { .def_ro("then_branch", &IfDocNode::then_branch) .def_ro("else_branch", &IfDocNode::else_branch); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.IfDoc", IfDocNode, StmtDocNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.script.printer.IfDoc", IfDocNode, StmtDocNode); }; /*! @@ -873,7 +875,7 @@ class WhileDocNode : public StmtDocNode { .def_ro("predicate", &WhileDocNode::predicate) .def_ro("body", &WhileDocNode::body); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.WhileDoc", WhileDocNode, StmtDocNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.script.printer.WhileDoc", WhileDocNode, StmtDocNode); }; /*! @@ -917,7 +919,7 @@ class ForDocNode : public StmtDocNode { .def_ro("rhs", &ForDocNode::rhs) .def_ro("body", &ForDocNode::body); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.ForDoc", ForDocNode, StmtDocNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.script.printer.ForDoc", ForDocNode, StmtDocNode); }; /*! @@ -963,7 +965,7 @@ class ScopeDocNode : public StmtDocNode { .def_ro("rhs", &ScopeDocNode::rhs) .def_ro("body", &ScopeDocNode::body); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.ScopeDoc", ScopeDocNode, StmtDocNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.script.printer.ScopeDoc", ScopeDocNode, StmtDocNode); }; /*! @@ -1005,7 +1007,7 @@ class ExprStmtDocNode : public StmtDocNode { namespace refl = tvm::ffi::reflection; refl::ObjectDef().def_ro("expr", &ExprStmtDocNode::expr); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.ExprStmtDoc", ExprStmtDocNode, StmtDocNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.script.printer.ExprStmtDoc", ExprStmtDocNode, StmtDocNode); }; /*! @@ -1041,7 +1043,7 @@ class AssertDocNode : public StmtDocNode { .def_ro("test", &AssertDocNode::test) .def_ro("msg", &AssertDocNode::msg); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.AssertDoc", AssertDocNode, StmtDocNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.script.printer.AssertDoc", AssertDocNode, StmtDocNode); }; /*! @@ -1074,7 +1076,7 @@ class ReturnDocNode : public StmtDocNode { namespace refl = tvm::ffi::reflection; refl::ObjectDef().def_ro("value", &ReturnDocNode::value); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.ReturnDoc", ReturnDocNode, StmtDocNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.script.printer.ReturnDoc", ReturnDocNode, StmtDocNode); }; /*! @@ -1125,7 +1127,7 @@ class FunctionDocNode : public StmtDocNode { .def_ro("return_type", &FunctionDocNode::return_type) .def_ro("body", &FunctionDocNode::body); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.FunctionDoc", FunctionDocNode, StmtDocNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.script.printer.FunctionDoc", FunctionDocNode, StmtDocNode); }; /*! @@ -1169,7 +1171,7 @@ class ClassDocNode : public StmtDocNode { .def_ro("decorators", &ClassDocNode::decorators) .def_ro("body", &ClassDocNode::body); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.ClassDoc", ClassDocNode, StmtDocNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.script.printer.ClassDoc", ClassDocNode, StmtDocNode); }; /*! @@ -1200,7 +1202,7 @@ class CommentDocNode : public StmtDocNode { namespace refl = tvm::ffi::reflection; refl::ObjectDef(); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.CommentDoc", CommentDocNode, StmtDocNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.script.printer.CommentDoc", CommentDocNode, StmtDocNode); }; /*! @@ -1225,7 +1227,8 @@ class DocStringDocNode : public StmtDocNode { namespace refl = tvm::ffi::reflection; refl::ObjectDef(); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.DocStringDoc", DocStringDocNode, StmtDocNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.script.printer.DocStringDoc", DocStringDocNode, + StmtDocNode); }; /*! diff --git a/include/tvm/script/printer/ir_docsifier.h b/include/tvm/script/printer/ir_docsifier.h index b5d50d89019b..bc74bfccce37 100644 --- a/include/tvm/script/printer/ir_docsifier.h +++ b/include/tvm/script/printer/ir_docsifier.h @@ -62,7 +62,7 @@ class FrameNode : public Object { } static constexpr const bool _type_mutable = true; - TVM_FFI_DECLARE_OBJECT_INFO("script.printer.Frame", FrameNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO("tvm.script.printer.Frame", FrameNode, Object); public: virtual ~FrameNode() = default; @@ -165,7 +165,7 @@ class IRDocsifierNode : public Object { } static constexpr const bool _type_mutable = true; - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.IRDocsifier", IRDocsifierNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.script.printer.IRDocsifier", IRDocsifierNode, Object); public: /*! diff --git a/include/tvm/target/tag.h b/include/tvm/target/tag.h index 59a13ae572ab..e78eedf545f3 100644 --- a/include/tvm/target/tag.h +++ b/include/tvm/target/tag.h @@ -47,7 +47,7 @@ class TargetTagNode : public Object { .def_ro("name", &TargetTagNode::name) .def_ro("config", &TargetTagNode::config); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("target.TargetTag", TargetTagNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.target.TargetTag", TargetTagNode, Object); private: /*! \brief Return the index stored in attr registry */ diff --git a/include/tvm/target/target.h b/include/tvm/target/target.h index 78d4d102f431..7449900becc6 100644 --- a/include/tvm/target/target.h +++ b/include/tvm/target/target.h @@ -176,7 +176,7 @@ class TargetNode : public Object { TVM_DLL std::unordered_set GetLibs() const; static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind = kTVMFFISEqHashKindTreeNode; - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("target.Target", TargetNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.target.Target", TargetNode, Object); private: /*! \brief Internal string repr. */ diff --git a/include/tvm/target/target_info.h b/include/tvm/target/target_info.h index c4e12ac532f8..39de385e756c 100644 --- a/include/tvm/target/target_info.h +++ b/include/tvm/target/target_info.h @@ -57,7 +57,7 @@ class MemoryInfoNode : public Object { .def_ro("max_simd_bits", &MemoryInfoNode::max_simd_bits) .def_ro("head_address", &MemoryInfoNode::head_address); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("target.MemoryInfo", MemoryInfoNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.target.MemoryInfo", MemoryInfoNode, Object); }; /*! \brief Defines memory info */ diff --git a/include/tvm/target/target_kind.h b/include/tvm/target/target_kind.h index 7722211b3e61..e437ccf33b52 100644 --- a/include/tvm/target/target_kind.h +++ b/include/tvm/target/target_kind.h @@ -88,7 +88,7 @@ class TargetKindNode : public Object { } static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind = kTVMFFISEqHashKindUniqueInstance; - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("target.TargetKind", TargetKindNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.target.TargetKind", TargetKindNode, Object); private: /*! \brief Return the index stored in attr registry */ diff --git a/include/tvm/target/virtual_device.h b/include/tvm/target/virtual_device.h index ebe5eb39f580..17b00cf0fff3 100644 --- a/include/tvm/target/virtual_device.h +++ b/include/tvm/target/virtual_device.h @@ -257,7 +257,7 @@ class VirtualDeviceNode : public AttrsNodeReflAdapter { "The area of memory w.r.t. the virtual device where data is stored.", refl::DefaultValue("")); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("target.VirtualDevice", VirtualDeviceNode, BaseAttrsNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.target.VirtualDevice", VirtualDeviceNode, BaseAttrsNode); friend class VirtualDevice; }; diff --git a/include/tvm/te/operation.h b/include/tvm/te/operation.h index 17de92c8be36..538d6914b337 100644 --- a/include/tvm/te/operation.h +++ b/include/tvm/te/operation.h @@ -90,7 +90,7 @@ class TVM_DLL OperationNode : public Object { .def_ro("tag", &OperationNode::tag) .def_ro("attrs", &OperationNode::attrs); } - TVM_FFI_DECLARE_OBJECT_INFO("te.Operation", OperationNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO("tvm.te.Operation", OperationNode, Object); }; /*! @@ -114,7 +114,7 @@ class PlaceholderOpNode : public OperationNode { .def_ro("shape", &PlaceholderOpNode::shape) .def_ro("dtype", &PlaceholderOpNode::dtype); } - TVM_FFI_DECLARE_OBJECT_INFO("te.PlaceholderOp", PlaceholderOpNode, OperationNode); + TVM_FFI_DECLARE_OBJECT_INFO("tvm.te.PlaceholderOp", PlaceholderOpNode, OperationNode); }; /*! @@ -147,7 +147,7 @@ class TVM_DLL BaseComputeOpNode : public OperationNode { .def_ro("axis", &BaseComputeOpNode::axis) .def_ro("reduce_axis", &BaseComputeOpNode::reduce_axis); } - TVM_FFI_DECLARE_OBJECT_INFO("te.BaseComputeOp", BaseComputeOpNode, OperationNode); + TVM_FFI_DECLARE_OBJECT_INFO("tvm.te.BaseComputeOp", BaseComputeOpNode, OperationNode); }; /*! @@ -168,7 +168,7 @@ class TVM_DLL ComputeOpNode : public BaseComputeOpNode { namespace refl = tvm::ffi::reflection; refl::ObjectDef().def_ro("body", &ComputeOpNode::body); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("te.ComputeOp", ComputeOpNode, BaseComputeOpNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.te.ComputeOp", ComputeOpNode, BaseComputeOpNode); }; /*! @@ -230,7 +230,7 @@ class ScanOpNode : public OperationNode { .def_ro("inputs", &ScanOpNode::inputs) .def_ro("spatial_axis_", &ScanOpNode::spatial_axis_); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("te.ScanOp", ScanOpNode, OperationNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.te.ScanOp", ScanOpNode, OperationNode); }; /*! @@ -277,7 +277,7 @@ class ExternOpNode : public OperationNode { .def_ro("output_placeholders", &ExternOpNode::output_placeholders) .def_ro("body", &ExternOpNode::body); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("te.ExternOp", ExternOpNode, OperationNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.te.ExternOp", ExternOpNode, OperationNode); }; /*! diff --git a/include/tvm/te/tensor.h b/include/tvm/te/tensor.h index 501b5b062b52..9d73ec91f570 100644 --- a/include/tvm/te/tensor.h +++ b/include/tvm/te/tensor.h @@ -90,7 +90,7 @@ class TensorNode : public DataProducerNode { static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind = kTVMFFISEqHashKindConstTreeNode; - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("te.Tensor", TensorNode, DataProducerNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.te.Tensor", TensorNode, DataProducerNode); }; /*! diff --git a/include/tvm/tir/block_dependence_info.h b/include/tvm/tir/block_dependence_info.h index b1fd8998645a..68eb203499d7 100644 --- a/include/tvm/tir/block_dependence_info.h +++ b/include/tvm/tir/block_dependence_info.h @@ -65,7 +65,7 @@ class BlockDependenceInfoNode : public Object { namespace refl = tvm::ffi::reflection; refl::ObjectDef(); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tir.BlockDependenceInfo", BlockDependenceInfoNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.tir.BlockDependenceInfo", BlockDependenceInfoNode, Object); /*! * \brief Get the BlockScope corresponding to the sref of scope root block diff --git a/include/tvm/tir/block_scope.h b/include/tvm/tir/block_scope.h index f1120c7837ff..8b0e352b035a 100644 --- a/include/tvm/tir/block_scope.h +++ b/include/tvm/tir/block_scope.h @@ -73,7 +73,7 @@ class StmtSRefNode : public Object { } static constexpr const bool _type_mutable = true; - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tir.StmtSRef", StmtSRefNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.tir.StmtSRef", StmtSRefNode, Object); /*! \brief Reset the object inplace to the invalid state */ void Reset() { @@ -223,7 +223,7 @@ class DependencyNode : public Object { .def_ro("dst", &DependencyNode::dst) .def_ro("kind", &DependencyNode::kind); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tir.Dependency", DependencyNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.tir.Dependency", DependencyNode, Object); }; /*! @@ -267,7 +267,7 @@ class BlockScopeNode : public Object { namespace refl = tvm::ffi::reflection; refl::ObjectDef(); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tir.BlockScope", BlockScopeNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.tir.BlockScope", BlockScopeNode, Object); public: /******** Dependency ********/ diff --git a/include/tvm/tir/buffer.h b/include/tvm/tir/buffer.h index 1075693bb541..aa5712e76f7b 100644 --- a/include/tvm/tir/buffer.h +++ b/include/tvm/tir/buffer.h @@ -144,7 +144,7 @@ class BufferNode : public Object { static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind = kTVMFFISEqHashKindTreeNode; - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tir.Buffer", BufferNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.tir.Buffer", BufferNode, Object); TVM_OBJECT_ENABLE_SCRIPT_PRINTER(); }; @@ -276,7 +276,7 @@ class DataProducerNode : public PrimExprConvertibleNode { * \return The data type. */ virtual ffi::String GetNameHint() const = 0; - TVM_FFI_DECLARE_OBJECT_INFO("tir.DataProducer", DataProducerNode, PrimExprConvertibleNode); + TVM_FFI_DECLARE_OBJECT_INFO("tvm.tir.DataProducer", DataProducerNode, PrimExprConvertibleNode); }; /*! diff --git a/include/tvm/tir/data_layout.h b/include/tvm/tir/data_layout.h index 4f2a4452b89f..ee4b693e755d 100644 --- a/include/tvm/tir/data_layout.h +++ b/include/tvm/tir/data_layout.h @@ -114,7 +114,7 @@ class LayoutNode : public Object { .def_ro("name", &LayoutNode::name) .def_ro("axes", &LayoutNode::axes); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tir.Layout", LayoutNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.tir.Layout", LayoutNode, Object); }; /*! @@ -321,7 +321,7 @@ class BijectiveLayoutNode : public Object { .def_ro("shape_forward_rule", &BijectiveLayoutNode::shape_forward_rule) .def_ro("shape_backward_rule", &BijectiveLayoutNode::shape_backward_rule); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tir.BijectiveLayout", BijectiveLayoutNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.tir.BijectiveLayout", BijectiveLayoutNode, Object); }; /*! diff --git a/include/tvm/tir/expr.h b/include/tvm/tir/expr.h index 529765469165..b196ddcb0b67 100644 --- a/include/tvm/tir/expr.h +++ b/include/tvm/tir/expr.h @@ -59,7 +59,7 @@ class StringImmNode : public PrimExprNode { namespace refl = tvm::ffi::reflection; refl::ObjectDef().def_ro("value", &StringImmNode::value); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tir.StringImm", StringImmNode, PrimExprNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.tir.StringImm", StringImmNode, PrimExprNode); }; /*! @@ -86,7 +86,7 @@ class CastNode : public PrimExprNode { namespace refl = tvm::ffi::reflection; refl::ObjectDef().def_ro("value", &CastNode::value); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tir.Cast", CastNode, PrimExprNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.tir.Cast", CastNode, PrimExprNode); }; /*! @@ -125,7 +125,7 @@ class BinaryOpNode : public PrimExprNode { /*! \brief a + b */ class AddNode : public BinaryOpNode { public: - static constexpr const char* _type_key = "tir.Add"; + static constexpr const char* _type_key = "tvm.tir.Add"; }; /*! @@ -142,7 +142,7 @@ class Add : public PrimExpr { /*! \brief a - b */ class SubNode : public BinaryOpNode { public: - static constexpr const char* _type_key = "tir.Sub"; + static constexpr const char* _type_key = "tvm.tir.Sub"; }; /*! @@ -160,7 +160,7 @@ class Sub : public PrimExpr { /*! \brief a * b */ class MulNode : public BinaryOpNode { public: - static constexpr const char* _type_key = "tir.Mul"; + static constexpr const char* _type_key = "tvm.tir.Mul"; }; /*! @@ -180,7 +180,7 @@ class Mul : public PrimExpr { */ class DivNode : public BinaryOpNode { public: - static constexpr const char* _type_key = "tir.Div"; + static constexpr const char* _type_key = "tvm.tir.Div"; }; /*! @@ -200,7 +200,7 @@ class Div : public PrimExpr { */ class ModNode : public BinaryOpNode { public: - static constexpr const char* _type_key = "tir.Mod"; + static constexpr const char* _type_key = "tvm.tir.Mod"; }; /*! @@ -217,7 +217,7 @@ class Mod : public PrimExpr { /*! \brief Floor division, floor(a/b) */ class FloorDivNode : public BinaryOpNode { public: - static constexpr const char* _type_key = "tir.FloorDiv"; + static constexpr const char* _type_key = "tvm.tir.FloorDiv"; }; /*! @@ -234,7 +234,7 @@ class FloorDiv : public PrimExpr { /*! \brief The remainder of the floordiv */ class FloorModNode : public BinaryOpNode { public: - static constexpr const char* _type_key = "tir.FloorMod"; + static constexpr const char* _type_key = "tvm.tir.FloorMod"; }; /*! @@ -251,7 +251,7 @@ class FloorMod : public PrimExpr { /*! \brief min(a, b) */ class MinNode : public BinaryOpNode { public: - static constexpr const char* _type_key = "tir.Min"; + static constexpr const char* _type_key = "tvm.tir.Min"; }; /*! @@ -268,7 +268,7 @@ class Min : public PrimExpr { /*! \brief max(a, b) */ class MaxNode : public BinaryOpNode { public: - static constexpr const char* _type_key = "tir.Max"; + static constexpr const char* _type_key = "tvm.tir.Max"; }; /*! @@ -307,7 +307,7 @@ class CmpOpNode : public PrimExprNode { /*! \brief a == b */ class EQNode : public CmpOpNode { public: - static constexpr const char* _type_key = "tir.EQ"; + static constexpr const char* _type_key = "tvm.tir.EQ"; }; /*! @@ -324,7 +324,7 @@ class EQ : public PrimExpr { /*! \brief a != b */ class NENode : public CmpOpNode { public: - static constexpr const char* _type_key = "tir.NE"; + static constexpr const char* _type_key = "tvm.tir.NE"; }; /*! @@ -341,7 +341,7 @@ class NE : public PrimExpr { /*! \brief a < b */ class LTNode : public CmpOpNode { public: - static constexpr const char* _type_key = "tir.LT"; + static constexpr const char* _type_key = "tvm.tir.LT"; }; /*! @@ -358,7 +358,7 @@ class LT : public PrimExpr { /*! \brief a <= b */ struct LENode : public CmpOpNode { public: - static constexpr const char* _type_key = "tir.LE"; + static constexpr const char* _type_key = "tvm.tir.LE"; }; /*! @@ -375,7 +375,7 @@ class LE : public PrimExpr { /*! \brief a > b */ class GTNode : public CmpOpNode { public: - static constexpr const char* _type_key = "tir.GT"; + static constexpr const char* _type_key = "tvm.tir.GT"; }; /*! @@ -392,7 +392,7 @@ class GT : public PrimExpr { /*! \brief a >= b */ class GENode : public CmpOpNode { public: - static constexpr const char* _type_key = "tir.GE"; + static constexpr const char* _type_key = "tvm.tir.GE"; }; /*! @@ -418,7 +418,7 @@ class AndNode : public PrimExprNode { namespace refl = tvm::ffi::reflection; refl::ObjectDef().def_ro("a", &AndNode::a).def_ro("b", &AndNode::b); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tir.And", AndNode, PrimExprNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.tir.And", AndNode, PrimExprNode); }; /*! @@ -444,7 +444,7 @@ class OrNode : public PrimExprNode { namespace refl = tvm::ffi::reflection; refl::ObjectDef().def_ro("a", &OrNode::a).def_ro("b", &OrNode::b); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tir.Or", OrNode, PrimExprNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.tir.Or", OrNode, PrimExprNode); }; /*! @@ -468,7 +468,7 @@ class NotNode : public PrimExprNode { namespace refl = tvm::ffi::reflection; refl::ObjectDef().def_ro("a", &NotNode::a); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tir.Not", NotNode, PrimExprNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.tir.Not", NotNode, PrimExprNode); }; /*! @@ -505,7 +505,7 @@ class SelectNode : public PrimExprNode { .def_ro("true_value", &SelectNode::true_value) .def_ro("false_value", &SelectNode::false_value); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tir.Select", SelectNode, PrimExprNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.tir.Select", SelectNode, PrimExprNode); }; /*! @@ -546,7 +546,7 @@ class BufferLoadNode : public PrimExprNode { .def_ro("indices", &BufferLoadNode::indices) .def_ro("predicate", &BufferLoadNode::predicate); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tir.BufferLoad", BufferLoadNode, PrimExprNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.tir.BufferLoad", BufferLoadNode, PrimExprNode); private: /*! \brief Set the dtype based on the buffer/indices @@ -599,7 +599,7 @@ class ProducerLoadNode : public PrimExprNode { .def_ro("producer", &ProducerLoadNode::producer) .def_ro("indices", &ProducerLoadNode::indices); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tir.ProducerLoad", ProducerLoadNode, PrimExprNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.tir.ProducerLoad", ProducerLoadNode, PrimExprNode); }; /*! @@ -640,7 +640,7 @@ class RampNode : public PrimExprNode { .def_ro("stride", &RampNode::stride) .def_ro("lanes", &RampNode::lanes); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tir.Ramp", RampNode, PrimExprNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.tir.Ramp", RampNode, PrimExprNode); }; /*! @@ -668,7 +668,7 @@ class BroadcastNode : public PrimExprNode { .def_ro("value", &BroadcastNode::value) .def_ro("lanes", &BroadcastNode::lanes); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tir.Broadcast", BroadcastNode, PrimExprNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.tir.Broadcast", BroadcastNode, PrimExprNode); }; /*! @@ -701,7 +701,7 @@ class LetNode : public PrimExprNode { .def_ro("value", &LetNode::value) .def_ro("body", &LetNode::body); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tir.Let", LetNode, PrimExprNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.tir.Let", LetNode, PrimExprNode); }; /*! @@ -735,7 +735,7 @@ class CallNode : public PrimExprNode { namespace refl = tvm::ffi::reflection; refl::ObjectDef().def_ro("op", &CallNode::op).def_ro("args", &CallNode::args); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tir.Call", CallNode, PrimExprNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.tir.Call", CallNode, PrimExprNode); }; /*! @@ -767,7 +767,7 @@ class ShuffleNode : public PrimExprNode { .def_ro("vectors", &ShuffleNode::vectors) .def_ro("indices", &ShuffleNode::indices); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tir.Shuffle", ShuffleNode, PrimExprNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.tir.Shuffle", ShuffleNode, PrimExprNode); }; /*! @@ -822,7 +822,7 @@ class CommReducerNode : public Object { } static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind = kTVMFFISEqHashKindTreeNode; - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tir.CommReducer", CommReducerNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.tir.CommReducer", CommReducerNode, Object); }; /*! @@ -866,7 +866,7 @@ class ReduceNode : public PrimExprNode { .def_ro("condition", &ReduceNode::condition) .def_ro("value_index", &ReduceNode::value_index); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tir.Reduce", ReduceNode, PrimExprNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.tir.Reduce", ReduceNode, PrimExprNode); }; /*! diff --git a/include/tvm/tir/function.h b/include/tvm/tir/function.h index 97701d16b097..7918d8d255e1 100644 --- a/include/tvm/tir/function.h +++ b/include/tvm/tir/function.h @@ -119,7 +119,7 @@ class PrimFuncNode : public BaseFuncNode { TVM_DLL FuncType func_type_annotation() const; TVM_OBJECT_ENABLE_SCRIPT_PRINTER(); - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tir.PrimFunc", PrimFuncNode, BaseFuncNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.tir.PrimFunc", PrimFuncNode, BaseFuncNode); }; /*! @@ -170,7 +170,7 @@ class TensorIntrinNode : public Object { .def_ro("desc", &TensorIntrinNode::desc) .def_ro("impl", &TensorIntrinNode::impl); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tir.TensorIntrin", TensorIntrinNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.tir.TensorIntrin", TensorIntrinNode, Object); }; /*! diff --git a/include/tvm/tir/index_map.h b/include/tvm/tir/index_map.h index 6866431ee487..b893688f959b 100644 --- a/include/tvm/tir/index_map.h +++ b/include/tvm/tir/index_map.h @@ -163,7 +163,7 @@ class IndexMapNode : public Object { } static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind = kTVMFFISEqHashKindTreeNode; - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tir.IndexMap", IndexMapNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.tir.IndexMap", IndexMapNode, Object); }; class IndexMap : public ObjectRef { diff --git a/include/tvm/tir/schedule/instruction.h b/include/tvm/tir/schedule/instruction.h index b6e283f400fb..61790905e985 100644 --- a/include/tvm/tir/schedule/instruction.h +++ b/include/tvm/tir/schedule/instruction.h @@ -121,7 +121,8 @@ class InstructionKindNode : public runtime::Object { /*! \brief Checks if the instruction kind is EnterPostproc */ bool IsPostproc() const; - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tir.InstructionKind", InstructionKindNode, runtime::Object); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.tir.InstructionKind", InstructionKindNode, + runtime::Object); }; /*! @@ -179,7 +180,7 @@ class InstructionNode : public runtime::Object { .def_ro("attrs", &InstructionNode::attrs) .def_ro("outputs", &InstructionNode::outputs); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tir.Instruction", InstructionNode, runtime::Object); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.tir.Instruction", InstructionNode, runtime::Object); }; /*! diff --git a/include/tvm/tir/schedule/schedule.h b/include/tvm/tir/schedule/schedule.h index a768a7dd4f31..b0cd6b02d03c 100644 --- a/include/tvm/tir/schedule/schedule.h +++ b/include/tvm/tir/schedule/schedule.h @@ -54,7 +54,7 @@ class BlockRVNode : public runtime::Object { namespace refl = tvm::ffi::reflection; refl::ObjectDef(); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tir.BlockRV", BlockRVNode, runtime::Object); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.tir.BlockRV", BlockRVNode, runtime::Object); }; /*! @@ -77,7 +77,7 @@ class LoopRVNode : public runtime::Object { namespace refl = tvm::ffi::reflection; refl::ObjectDef(); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tir.LoopRV", LoopRVNode, runtime::Object); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.tir.LoopRV", LoopRVNode, runtime::Object); }; /*! @@ -110,7 +110,7 @@ class ScheduleNode : public runtime::Object { virtual ~ScheduleNode() = default; static constexpr const bool _type_mutable = true; - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tir.Schedule", ScheduleNode, runtime::Object); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.tir.Schedule", ScheduleNode, runtime::Object); public: /*! \brief Get the IRModule associated with this schedule. */ diff --git a/include/tvm/tir/schedule/state.h b/include/tvm/tir/schedule/state.h index 4467463912e8..426f57f44d1a 100644 --- a/include/tvm/tir/schedule/state.h +++ b/include/tvm/tir/schedule/state.h @@ -157,7 +157,7 @@ class ScheduleStateNode : public Object { TVM_DLL void DebugVerify() const; static constexpr const bool _type_mutable = true; - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tir.ScheduleState", ScheduleStateNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.tir.ScheduleState", ScheduleStateNode, Object); /******** Property of blocks ********/ /*! \brief Returns the BlockInfo correpsonding to the block sref */ diff --git a/include/tvm/tir/schedule/trace.h b/include/tvm/tir/schedule/trace.h index f5aa7cb5ffd6..a8676c5fc7ac 100644 --- a/include/tvm/tir/schedule/trace.h +++ b/include/tvm/tir/schedule/trace.h @@ -70,7 +70,7 @@ class TraceNode : public runtime::Object { } static constexpr const bool _type_mutable = true; - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tir.Trace", TraceNode, runtime::Object); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.tir.Trace", TraceNode, runtime::Object); public: /*! diff --git a/include/tvm/tir/stmt.h b/include/tvm/tir/stmt.h index 0831b84cf6fe..fdda23780c6f 100644 --- a/include/tvm/tir/stmt.h +++ b/include/tvm/tir/stmt.h @@ -56,7 +56,7 @@ class StmtNode : public Object { static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind = kTVMFFISEqHashKindTreeNode; static constexpr const uint32_t _type_child_slots = 15; - TVM_FFI_DECLARE_OBJECT_INFO("tir.Stmt", StmtNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO("tvm.tir.Stmt", StmtNode, Object); }; /*! \brief Container of all statements */ @@ -84,7 +84,7 @@ class LetStmtNode : public StmtNode { .def_ro("value", &LetStmtNode::value) .def_ro("body", &LetStmtNode::body); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tir.LetStmt", LetStmtNode, StmtNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.tir.LetStmt", LetStmtNode, StmtNode); }; /*! @@ -128,7 +128,7 @@ class AttrStmtNode : public StmtNode { .def_ro("value", &AttrStmtNode::value) .def_ro("body", &AttrStmtNode::body); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tir.AttrStmt", AttrStmtNode, StmtNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.tir.AttrStmt", AttrStmtNode, StmtNode); }; /*! @@ -166,7 +166,7 @@ class AssertStmtNode : public StmtNode { .def_ro("message", &AssertStmtNode::message) .def_ro("body", &AssertStmtNode::body); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tir.AssertStmt", AssertStmtNode, StmtNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.tir.AssertStmt", AssertStmtNode, StmtNode); }; /*! @@ -210,7 +210,7 @@ class BufferStoreNode : public StmtNode { .def_ro("indices", &BufferStoreNode::indices) .def_ro("predicate", &BufferStoreNode::predicate); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tir.BufferStore", BufferStoreNode, StmtNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.tir.BufferStore", BufferStoreNode, StmtNode); }; /*! @@ -262,7 +262,7 @@ class BufferRealizeNode : public StmtNode { BufferRealizeNode(Buffer buffer, ffi::Array bounds, PrimExpr condition, Stmt body, Span span = Span()) : StmtNode(span), buffer(buffer), bounds(bounds), condition(condition), body(body) {} - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tir.BufferRealize", BufferRealizeNode, StmtNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.tir.BufferRealize", BufferRealizeNode, StmtNode); }; /*! @@ -325,7 +325,7 @@ class AllocateNode : public StmtNode { * \return The result. */ TVM_DLL static int64_t ConstantAllocationSize(const ffi::Array& extents); - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tir.Allocate", AllocateNode, StmtNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.tir.Allocate", AllocateNode, StmtNode); }; /*! @@ -397,7 +397,7 @@ class AllocateConstNode : public StmtNode { * \return The result. */ TVM_DLL static int64_t ConstantAllocationSize(const ffi::Array& extents); - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tir.AllocateConst", AllocateConstNode, StmtNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.tir.AllocateConst", AllocateConstNode, StmtNode); }; /*! @@ -432,7 +432,7 @@ class DeclBufferNode : public StmtNode { .def_ro("buffer", &DeclBufferNode::buffer) .def_ro("body", &DeclBufferNode::body); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tir.DeclBuffer", DeclBufferNode, StmtNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.tir.DeclBuffer", DeclBufferNode, StmtNode); }; /*! \brief Managed reference to DeclBufferNode */ @@ -463,7 +463,7 @@ class SeqStmtNode : public StmtNode { namespace refl = tvm::ffi::reflection; refl::ObjectDef().def_ro("seq", &SeqStmtNode::seq); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tir.SeqStmt", SeqStmtNode, StmtNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.tir.SeqStmt", SeqStmtNode, StmtNode); }; /*! @@ -481,7 +481,7 @@ class EvaluateNode : public StmtNode { namespace refl = tvm::ffi::reflection; refl::ObjectDef().def_ro("value", &EvaluateNode::value); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tir.Evaluate", EvaluateNode, StmtNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.tir.Evaluate", EvaluateNode, StmtNode); }; /*! @@ -668,7 +668,7 @@ class IfThenElseNode : public StmtNode { .def_ro("then_case", &IfThenElseNode::then_case) .def_ro("else_case", &IfThenElseNode::else_case); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tir.IfThenElse", IfThenElseNode, StmtNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.tir.IfThenElse", IfThenElseNode, StmtNode); }; /*! @@ -769,7 +769,7 @@ class ForNode : public StmtNode { /*! \brief Check it is a loop without nontrivial loop step. */ bool HasTrivialStep() const; - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tir.For", ForNode, StmtNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.tir.For", ForNode, StmtNode); }; /*! @@ -810,7 +810,7 @@ class WhileNode : public StmtNode { .def_ro("condition", &WhileNode::condition) .def_ro("body", &WhileNode::body); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tir.While", WhileNode, StmtNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.tir.While", WhileNode, StmtNode); }; /*! @@ -845,7 +845,8 @@ class BufferRegionNode : public PrimExprConvertibleNode { TVM_DLL PrimExpr ToPrimExpr() const final; static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind = kTVMFFISEqHashKindTreeNode; - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tir.BufferRegion", BufferRegionNode, PrimExprConvertibleNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.tir.BufferRegion", BufferRegionNode, + PrimExprConvertibleNode); }; /*! @@ -899,7 +900,7 @@ class MatchBufferRegionNode : public Object { } static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind = kTVMFFISEqHashKindTreeNode; - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tir.MatchBufferRegion", MatchBufferRegionNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.tir.MatchBufferRegion", MatchBufferRegionNode, Object); }; /*! @@ -975,7 +976,7 @@ class BlockNode : public StmtNode { .def_ro("init", &BlockNode::init) .def_ro("body", &BlockNode::body); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tir.Block", BlockNode, StmtNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.tir.Block", BlockNode, StmtNode); }; /*! @@ -1019,7 +1020,7 @@ class BlockRealizeNode : public StmtNode { .def_ro("predicate", &BlockRealizeNode::predicate) .def_ro("block", &BlockRealizeNode::block); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tir.BlockRealize", BlockRealizeNode, StmtNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.tir.BlockRealize", BlockRealizeNode, StmtNode); }; /*! diff --git a/include/tvm/tir/var.h b/include/tvm/tir/var.h index 521b03a4728b..9e09a476ae22 100644 --- a/include/tvm/tir/var.h +++ b/include/tvm/tir/var.h @@ -70,7 +70,7 @@ class VarNode : public PrimExprNode { static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind = kTVMFFISEqHashKindFreeVar; static constexpr const uint32_t _type_child_slots = 1; - TVM_FFI_DECLARE_OBJECT_INFO("tir.Var", VarNode, PrimExprNode); + TVM_FFI_DECLARE_OBJECT_INFO("tvm.tir.Var", VarNode, PrimExprNode); }; /*! \brief a named variable in TIR */ @@ -136,7 +136,7 @@ class SizeVarNode : public VarNode { namespace refl = tvm::ffi::reflection; refl::ObjectDef(); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tir.SizeVar", SizeVarNode, VarNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.tir.SizeVar", SizeVarNode, VarNode); }; /*! \brief a named variable represents a tensor index size */ @@ -285,7 +285,7 @@ class IterVarNode : public PrimExprConvertibleNode { } static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind = kTVMFFISEqHashKindTreeNode; - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tir.IterVar", IterVarNode, PrimExprConvertibleNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.tir.IterVar", IterVarNode, PrimExprConvertibleNode); }; /*! diff --git a/python/tvm/arith/_ffi_api.py b/python/tvm/arith/_ffi_api.py index 519423aa4e1f..e2d1d37f0b60 100644 --- a/python/tvm/arith/_ffi_api.py +++ b/python/tvm/arith/_ffi_api.py @@ -18,4 +18,4 @@ import tvm_ffi -tvm_ffi.init_ffi_api("arith", __name__) +tvm_ffi.init_ffi_api("tvm.arith", __name__) diff --git a/python/tvm/arith/analyzer.py b/python/tvm/arith/analyzer.py index c5c8fc067cc8..75fca21d5305 100644 --- a/python/tvm/arith/analyzer.py +++ b/python/tvm/arith/analyzer.py @@ -47,7 +47,7 @@ class Extension(enum.Flag): ComparisonOfProductAndSum = 1 << 3 -@tvm_ffi.register_object("arith.ModularSet") +@tvm_ffi.register_object("tvm.arith.ModularSet") class ModularSet(Object): """Represent range of (coeff * x + base) for x in Z""" @@ -55,7 +55,7 @@ def __init__(self, coeff, base): self.__init_handle_by_constructor__(_ffi_api.ModularSet, coeff, base) -@tvm_ffi.register_object("arith.ConstIntBound") +@tvm_ffi.register_object("tvm.arith.ConstIntBound") class ConstIntBound(Object): """Represent constant integer bound diff --git a/python/tvm/arith/int_set.py b/python/tvm/arith/int_set.py index fc6c20dec1ce..d2f121b76087 100644 --- a/python/tvm/arith/int_set.py +++ b/python/tvm/arith/int_set.py @@ -20,7 +20,7 @@ from . import _ffi_api -@tvm_ffi.register_object("ir.IntSet") +@tvm_ffi.register_object("tvm.ir.IntSet") class IntSet(Object): """Represent a set of integer in one dimension.""" @@ -65,7 +65,7 @@ def single_point(point): return _ffi_api.intset_single_point(point) -@tvm_ffi.register_object("arith.IntervalSet") +@tvm_ffi.register_object("tvm.arith.IntervalSet") class IntervalSet(IntSet): """Represent set of continuous interval [min_value, max_value] @@ -82,7 +82,7 @@ def __init__(self, min_value, max_value): self.__init_handle_by_constructor__(_ffi_api.IntervalSet, min_value, max_value) -@tvm_ffi.register_object("arith.PresburgerSet") +@tvm_ffi.register_object("tvm.arith.PresburgerSet") class PresburgerSet(IntSet): """Represent of Presburger Set""" diff --git a/python/tvm/arith/int_solver.py b/python/tvm/arith/int_solver.py index 72e4c46896ff..dc7f52cc9979 100644 --- a/python/tvm/arith/int_solver.py +++ b/python/tvm/arith/int_solver.py @@ -20,7 +20,7 @@ from . import _ffi_api -@tvm_ffi.register_object("arith.IntGroupBounds") +@tvm_ffi.register_object("tvm.arith.IntGroupBounds") class IntGroupBounds(Object): """Represent integer grouped bounds which are classified into lower bounds (include), upper bounds (include) and equalities. @@ -66,7 +66,7 @@ def find_best_range(self): return _ffi_api.IntGroupBounds_FindBestRange(self) -@tvm_ffi.register_object("arith.IntConstraints") +@tvm_ffi.register_object("tvm.arith.IntConstraints") class IntConstraints(Object): """Represent a set of integer constraints including variables, their ranges and the relations between them (either equations or inequalities) @@ -85,7 +85,7 @@ def __init__(self, variables, ranges, relations): self.__init_handle_by_constructor__(_ffi_api.IntConstraints, variables, ranges, relations) -@tvm_ffi.register_object("arith.IntConstraintsTransform") +@tvm_ffi.register_object("tvm.arith.IntConstraintsTransform") class IntConstraintsTransform(Object): """We can have different set of variables to represent the same integer constraints. For example, the following two constrains are equivalent, diff --git a/python/tvm/arith/iter_affine_map.py b/python/tvm/arith/iter_affine_map.py index 69ad3022fb4a..e5042e1cb1ee 100644 --- a/python/tvm/arith/iter_affine_map.py +++ b/python/tvm/arith/iter_affine_map.py @@ -22,12 +22,12 @@ from . import _ffi_api -@tvm_ffi.register_object("arith.IterMapExpr") +@tvm_ffi.register_object("tvm.arith.IterMapExpr") class IterMapExpr(PrimExpr): """Base class of all IterMap expressions.""" -@tvm_ffi.register_object("arith.IterMark") +@tvm_ffi.register_object("tvm.arith.IterMark") class IterMark(Object): """Mark the source as an iterator in [0, extent). @@ -44,7 +44,7 @@ def __init__(self, source, extent): self.__init_handle_by_constructor__(_ffi_api.IterMark, source, extent) -@tvm_ffi.register_object("arith.IterSplitExpr") +@tvm_ffi.register_object("tvm.arith.IterSplitExpr") class IterSplitExpr(IterMapExpr): """Split of an iterator. @@ -71,7 +71,7 @@ def __init__(self, source, lower_factor, extent, scale): ) -@tvm_ffi.register_object("arith.IterSumExpr") +@tvm_ffi.register_object("tvm.arith.IterSumExpr") class IterSumExpr(IterMapExpr): """Fuse multiple iterators by summing them with scaling. @@ -90,7 +90,7 @@ def __init__(self, args, base): self.__init_handle_by_constructor__(_ffi_api.IterSumExpr, args, base) -@tvm_ffi.register_object("arith.IterMapResult") +@tvm_ffi.register_object("tvm.arith.IterMapResult") class IterMapResult(Object): """Result of iter map detection.""" diff --git a/python/tvm/contrib/cutlass/_ffi_api.py b/python/tvm/contrib/cutlass/_ffi_api.py index d57825835b6b..5e82e9066c65 100644 --- a/python/tvm/contrib/cutlass/_ffi_api.py +++ b/python/tvm/contrib/cutlass/_ffi_api.py @@ -17,4 +17,4 @@ """FFI API for CUTLASS BYOC.""" import tvm_ffi -tvm_ffi.init_ffi_api("contrib.cutlass", __name__) +tvm_ffi.init_ffi_api("tvm.contrib.cutlass", __name__) diff --git a/python/tvm/contrib/cutlass/build.py b/python/tvm/contrib/cutlass/build.py index 4b2a50a5f1d8..07a27a6c57cb 100644 --- a/python/tvm/contrib/cutlass/build.py +++ b/python/tvm/contrib/cutlass/build.py @@ -39,7 +39,7 @@ def has_cutlass(): """Returns true if the CUTLASS custom codegen is available""" - return tvm.get_global_func("relax.ext.cutlass", True) is not None + return tvm.get_global_func("tvm.relax.ext.cutlass", True) is not None def _get_cutlass_path(): @@ -396,7 +396,7 @@ def _extract_relax_function_signature(f): def _extract_arg_idx(pattern_name, f): - extract_func = tvm.get_global_func("relax.contrib.extract_arg_idx") + extract_func = tvm.get_global_func("tvm.relax.contrib.extract_arg_idx") arg_indices = extract_func(pattern_name, f) return {k: int(v) for k, v in arg_indices.items()} @@ -821,7 +821,7 @@ def visit_span(self, span): return span -@register_global_func("contrib.cutlass.tune_relax_function") +@register_global_func("tvm.contrib.cutlass.tune_relax_function") def profile_relax_function(functions, options): """Tune and annotate CUTLASS composite functions with shape, dtype and generated templates.""" tmp_dir = options.get("tmp_dir", "./tmp") @@ -840,7 +840,7 @@ def profile_relax_function(functions, options): return annotated_functions -@register_global_func("contrib.cutlass.compile") +@register_global_func("tvm.contrib.cutlass.compile") def compile_cutlass_module(c_source_module, options): """Compile all CUTLASS kernels in the given C-source module. diff --git a/python/tvm/contrib/cutlass/gen_tensor_op.py b/python/tvm/contrib/cutlass/gen_tensor_op.py index 3a875ce220d0..c4b612bf0c11 100644 --- a/python/tvm/contrib/cutlass/gen_tensor_op.py +++ b/python/tvm/contrib/cutlass/gen_tensor_op.py @@ -461,7 +461,7 @@ def _get_optional_int_annotation(annotations, key, default=None): return int(value) -@tvm_ffi.register_global_func("contrib.cutlass.instantiate_template") +@tvm_ffi.register_global_func("tvm.contrib.cutlass.instantiate_template") def instantiate_template(func_name, annotations, func_args): """Return CUTLASS host code based on a template and the provided annotations. diff --git a/python/tvm/contrib/hexagon/session.py b/python/tvm/contrib/hexagon/session.py index b92c78309482..a459248ca6bd 100644 --- a/python/tvm/contrib/hexagon/session.py +++ b/python/tvm/contrib/hexagon/session.py @@ -100,7 +100,7 @@ def __enter__(self): self._rpc_receive_buffer_size_bytes, ], ) - func = self._rpc.get_function("device_api.hexagon.acquire_resources") + func = self._rpc.get_function("tvm.device_api.hexagon.acquire_resources") func() return self @@ -109,7 +109,7 @@ def __enter__(self): def __exit__(self, exc_type, exc_value, exc_traceback): try: - func = self._rpc.get_function("device_api.hexagon.release_resources") + func = self._rpc.get_function("tvm.device_api.hexagon.release_resources") func() except RuntimeError as exception: print( diff --git a/python/tvm/contrib/hexagon/tools.py b/python/tvm/contrib/hexagon/tools.py index f010461df082..c1d08c6f6740 100644 --- a/python/tvm/contrib/hexagon/tools.py +++ b/python/tvm/contrib/hexagon/tools.py @@ -336,13 +336,13 @@ def pack_imports( """ path_bin = os.path.join(workspace_dir, "imports.bin") - pack_to_bin_f_name = "runtime.ModulePackImportsToTensor" + pack_to_bin_f_name = "tvm.runtime.ModulePackImportsToTensor" fpack_to_bin = tvm.get_global_func(pack_to_bin_f_name) assert fpack_to_bin, f"Expecting {pack_to_bin_f_name} in registry" fpack_to_bin(module).numpy().tofile(path_bin) - mblob_symbol = c_symbol_prefix + tvm.get_global_func("runtime.ModuleImportsBlobName")() + mblob_symbol = c_symbol_prefix + tvm.get_global_func("tvm.runtime.ModuleImportsBlobName")() binary_size = os.path.getsize(path_bin) hexagon_toolchain = os.environ.get("HEXAGON_TOOLCHAIN") diff --git a/python/tvm/contrib/msc/core/_ffi_api.py b/python/tvm/contrib/msc/core/_ffi_api.py index ff027a0dec8e..798fd90ec8db 100644 --- a/python/tvm/contrib/msc/core/_ffi_api.py +++ b/python/tvm/contrib/msc/core/_ffi_api.py @@ -18,4 +18,4 @@ import tvm_ffi -tvm_ffi.init_ffi_api("msc.core", __name__) +tvm_ffi.init_ffi_api("tvm.msc.core", __name__) diff --git a/python/tvm/contrib/msc/core/codegen/codegen.py b/python/tvm/contrib/msc/core/codegen/codegen.py index b2b97fc8b593..b634bb751409 100644 --- a/python/tvm/contrib/msc/core/codegen/codegen.py +++ b/python/tvm/contrib/msc/core/codegen/codegen.py @@ -209,7 +209,7 @@ def _post_proc(mod: tvm.IRModule, folder: msc_utils.MSCDirectory) -> tvm.IRModul passes, name="tvm.contrib.msc.core.codegen.to_relax_postproc" )(mod) - source_getter = tvm.get_global_func("msc.framework.tvm.GetRelaxSources") + source_getter = tvm.get_global_func("tvm.msc.framework.tvm.GetRelaxSources") codegen = CodeGen(graph, source_getter, codegen_config, print_config, build_folder) model_args = [_to_var(i) for i in graph.get_inputs()] if plugin: diff --git a/python/tvm/contrib/msc/core/ir/graph.py b/python/tvm/contrib/msc/core/ir/graph.py index 6b40be4bf9de..f3cd36b822dd 100644 --- a/python/tvm/contrib/msc/core/ir/graph.py +++ b/python/tvm/contrib/msc/core/ir/graph.py @@ -26,7 +26,7 @@ from tvm.contrib.msc.core import utils as msc_utils -@tvm_ffi.register_object("msc.core.MSCTensor") +@tvm_ffi.register_object("tvm.msc.core.MSCTensor") class MSCTensor(Object): """Tensor in MSCGraph @@ -195,12 +195,12 @@ def ndim(self) -> int: return len(self.shape) -@tvm_ffi.register_object("msc.core.BaseJoint") +@tvm_ffi.register_object("tvm.msc.core.BaseJoint") class BaseJoint(Object): """Base class of all MSC Nodes.""" -@tvm_ffi.register_object("msc.core.MSCJoint") +@tvm_ffi.register_object("tvm.msc.core.MSCJoint") class MSCJoint(BaseJoint): """Node in MSCGraph @@ -425,7 +425,7 @@ def equal(self, other: BaseJoint) -> bool: return msc_utils.dict_equal(self.get_attrs(), other.get_attrs()) -@tvm_ffi.register_object("msc.core.MSCPrim") +@tvm_ffi.register_object("tvm.msc.core.MSCPrim") class MSCPrim(BaseJoint): """Prim in MSCGraph @@ -449,7 +449,7 @@ def __init__( self.__init_handle_by_constructor__(_ffi_api.MSCPrim, index, name, optype, attrs, parents) -@tvm_ffi.register_object("msc.core.WeightJoint") +@tvm_ffi.register_object("tvm.msc.core.WeightJoint") class WeightJoint(BaseJoint): """Node in WeightGraph @@ -563,12 +563,12 @@ def has_attr(self, key: str) -> bool: return bool(_ffi_api.WeightJointHasAttr(self, key)) -@tvm_ffi.register_object("msc.core.BaseGraph") +@tvm_ffi.register_object("tvm.msc.core.BaseGraph") class BaseGraph(Object): """Base class of all MSC Graphs.""" -@tvm_ffi.register_object("msc.core.MSCGraph") +@tvm_ffi.register_object("tvm.msc.core.MSCGraph") class MSCGraph(BaseGraph): """The MSCGraph @@ -957,7 +957,7 @@ def visualize(self, path: Optional[str] = None) -> str: return graph_proto -@tvm_ffi.register_object("msc.core.WeightGraph") +@tvm_ffi.register_object("tvm.msc.core.WeightGraph") class WeightGraph(BaseGraph): """The WeightGraph diff --git a/python/tvm/contrib/msc/core/tools/execute.py b/python/tvm/contrib/msc/core/tools/execute.py index dce9b1f1316f..0a4128893f01 100644 --- a/python/tvm/contrib/msc/core/tools/execute.py +++ b/python/tvm/contrib/msc/core/tools/execute.py @@ -214,7 +214,7 @@ def process_tensor(tensor: Any, name: str, consumer: str, scope: str, tag: str = return tensor -@tvm.register_global_func("msc_tool.codegen_tensor") +@tvm.register_global_func("tvm.msc_tool.codegen_tensor") def codegen_tensor( tensor_ctx: Dict[str, str], name: str, consumer: str, scope: str, tag: str = "main" ) -> List[str]: @@ -356,7 +356,7 @@ def _execute_step_with_context( return step_ctx -@tvm.register_global_func("msc_tool.codegen_step") +@tvm.register_global_func("tvm.msc_tool.codegen_step") def codegen_step( step_ctx: Dict[str, str], step: str, graph_name: str, tag: str = "main" ) -> List[str]: @@ -384,7 +384,7 @@ def codegen_step( return step_ctx["processed"] -@tvm.register_global_func("msc_tool.callback_step") +@tvm.register_global_func("tvm.msc_tool.callback_step") def callback_step(step_ctx: Dict[str, Any], step: str, graph_name: str = "main", tag: str = "main"): """Execute tools for a step diff --git a/python/tvm/contrib/msc/core/utils/info.py b/python/tvm/contrib/msc/core/utils/info.py index 03eed9b7fdd0..06e141a368e5 100644 --- a/python/tvm/contrib/msc/core/utils/info.py +++ b/python/tvm/contrib/msc/core/utils/info.py @@ -404,7 +404,7 @@ def get_version(framework: str) -> List[int]: raw_version = tensorflow.__version__ if framework == MSCFramework.TENSORRT: raw_version = ".".join( - [str(v) for v in tvm.get_global_func("relax.get_tensorrt_version")()] + [str(v) for v in tvm.get_global_func("tvm.relax.get_tensorrt_version")()] ) else: raw_version = "1.0.0" diff --git a/python/tvm/contrib/msc/framework/tensorflow/_ffi_api.py b/python/tvm/contrib/msc/framework/tensorflow/_ffi_api.py index f7cd2ea43e3e..b089acfeb1f7 100644 --- a/python/tvm/contrib/msc/framework/tensorflow/_ffi_api.py +++ b/python/tvm/contrib/msc/framework/tensorflow/_ffi_api.py @@ -18,4 +18,4 @@ import tvm_ffi -tvm_ffi.init_ffi_api("msc.framework.tensorflow", __name__) +tvm_ffi.init_ffi_api("tvm.msc.framework.tensorflow", __name__) diff --git a/python/tvm/contrib/msc/framework/tensorrt/_ffi_api.py b/python/tvm/contrib/msc/framework/tensorrt/_ffi_api.py index a09ab875fbed..440696a40bd7 100644 --- a/python/tvm/contrib/msc/framework/tensorrt/_ffi_api.py +++ b/python/tvm/contrib/msc/framework/tensorrt/_ffi_api.py @@ -18,4 +18,4 @@ import tvm_ffi -tvm_ffi.init_ffi_api("msc.framework.tensorrt", __name__) +tvm_ffi.init_ffi_api("tvm.msc.framework.tensorrt", __name__) diff --git a/python/tvm/contrib/msc/framework/torch/_ffi_api.py b/python/tvm/contrib/msc/framework/torch/_ffi_api.py index d1f27a53bdcf..d695dfbfa52b 100644 --- a/python/tvm/contrib/msc/framework/torch/_ffi_api.py +++ b/python/tvm/contrib/msc/framework/torch/_ffi_api.py @@ -18,4 +18,4 @@ import tvm_ffi -tvm_ffi.init_ffi_api("msc.framework.torch", __name__) +tvm_ffi.init_ffi_api("tvm.msc.framework.torch", __name__) diff --git a/python/tvm/contrib/msc/framework/tvm/_ffi_api.py b/python/tvm/contrib/msc/framework/tvm/_ffi_api.py index c9f63e21eaef..24cb2c16e973 100644 --- a/python/tvm/contrib/msc/framework/tvm/_ffi_api.py +++ b/python/tvm/contrib/msc/framework/tvm/_ffi_api.py @@ -18,4 +18,4 @@ import tvm_ffi -tvm_ffi.init_ffi_api("msc.framework.tvm", __name__) +tvm_ffi.init_ffi_api("tvm.msc.framework.tvm", __name__) diff --git a/python/tvm/contrib/msc/plugin/_ffi_api.py b/python/tvm/contrib/msc/plugin/_ffi_api.py index 88f9204f3a02..a6c967977a4d 100644 --- a/python/tvm/contrib/msc/plugin/_ffi_api.py +++ b/python/tvm/contrib/msc/plugin/_ffi_api.py @@ -18,4 +18,4 @@ import tvm_ffi -tvm_ffi.init_ffi_api("msc.plugin", __name__) +tvm_ffi.init_ffi_api("tvm.msc.plugin", __name__) diff --git a/python/tvm/contrib/msc/plugin/op/_ffi_api.py b/python/tvm/contrib/msc/plugin/op/_ffi_api.py index 8ca5071cdaf6..e46035da7f54 100644 --- a/python/tvm/contrib/msc/plugin/op/_ffi_api.py +++ b/python/tvm/contrib/msc/plugin/op/_ffi_api.py @@ -18,4 +18,4 @@ import tvm_ffi -tvm_ffi.init_ffi_api("msc.plugin.op", __name__) +tvm_ffi.init_ffi_api("tvm.msc.plugin.op", __name__) diff --git a/python/tvm/contrib/ndk.py b/python/tvm/contrib/ndk.py index f3a23e55db0c..8e9695254280 100644 --- a/python/tvm/contrib/ndk.py +++ b/python/tvm/contrib/ndk.py @@ -157,7 +157,7 @@ def get_global_symbol_section_map(path, *, nm=None) -> Dict[str, str]: return _cc.get_global_symbol_section_map(path, nm=nm) -@register_global_func("meta_schedule.builder.export_ndk") +@register_global_func("tvm.meta_schedule.builder.export_ndk") def _ndk_export(mod): tmp_dir = tempfile.mkdtemp() binary_name = "tmp_binary.so" diff --git a/python/tvm/contrib/nvcc.py b/python/tvm/contrib/nvcc.py index d062714938d6..98a19ff36961 100644 --- a/python/tvm/contrib/nvcc.py +++ b/python/tvm/contrib/nvcc.py @@ -61,7 +61,7 @@ def compile_cuda(code, target_format=None, arch=None, options=None, path_target= use_nvshmem = "#include " in code or "#include " in code if use_nvshmem: # NOTE: we cannot check whether nvshmem is used based on whether - # the global function "runtime.nvshmem.cumodule_init" is defined. + # the global function "tvm.runtime.nvshmem.cumodule_init" is defined. # The reason is because that if the input code does not use any NVSHMEM functions # while the global function is defined, using cubin to compile the # code may cause a compilation error. @@ -89,7 +89,7 @@ def compile_cuda(code, target_format=None, arch=None, options=None, path_target= temp_code = temp.relpath(f"{file_name}.cu") temp_target = temp.relpath(f"{file_name}.{target_format}") - pass_context = tvm_ffi.get_global_func("transform.GetCurrentPassContext")() + pass_context = tvm_ffi.get_global_func("tvm.transform.GetCurrentPassContext")() kernels_output_dir = ( pass_context.config["cuda.kernels_output_dir"] if "cuda.kernels_output_dir" in pass_context.config @@ -313,14 +313,14 @@ def find_nvshmem_paths() -> Tuple[str, str]: raise RuntimeError("\n".join(error_message)) -@tvm_ffi.register_global_func +@tvm_ffi.register_global_func("tvm.tvm_callback_cuda_compile") def tvm_callback_cuda_compile(code, target): # pylint: disable=unused-argument """use nvcc to generate fatbin code for better optimization""" ptx = compile_cuda(code, target_format="fatbin") return ptx -@tvm_ffi.register_global_func("tvm_callback_libdevice_path") +@tvm_ffi.register_global_func("tvm.tvm_callback_libdevice_path") def find_libdevice_path(arch): """Utility function to find libdevice diff --git a/python/tvm/contrib/rocm.py b/python/tvm/contrib/rocm.py index 38e74b660c51..4fa4b283f05b 100644 --- a/python/tvm/contrib/rocm.py +++ b/python/tvm/contrib/rocm.py @@ -99,7 +99,7 @@ def rocm_link(in_file, out_file, lld=None): raise RuntimeError(msg) -@tvm_ffi.register_global_func("tvm_callback_rocm_link") +@tvm_ffi.register_global_func("tvm.tvm_callback_rocm_link") def callback_rocm_link(obj_bin): """Links object file generated from LLVM to HSA Code Object @@ -123,7 +123,7 @@ def callback_rocm_link(obj_bin): return cobj_bin -@tvm_ffi.register_global_func("tvm_callback_rocm_bitcode_path") +@tvm_ffi.register_global_func("tvm.tvm_callback_rocm_bitcode_path") def callback_rocm_bitcode_path(rocdl_dir=None): """Utility function to find ROCm device library bitcodes @@ -227,7 +227,7 @@ def have_matrixcore(compute_version=None): return False -@tvm_ffi.register_global_func("tvm_callback_rocm_get_arch") +@tvm_ffi.register_global_func("tvm.tvm_callback_rocm_get_arch") def get_rocm_arch(rocm_path=None): """Utility function to get the AMD GPU architecture diff --git a/python/tvm/dlight/analysis/common_analysis.py b/python/tvm/dlight/analysis/common_analysis.py index e3357c6e78db..0b13a7f4c126 100644 --- a/python/tvm/dlight/analysis/common_analysis.py +++ b/python/tvm/dlight/analysis/common_analysis.py @@ -132,7 +132,7 @@ def __repr__(self) -> str: return str(self) -_normalize_prim_func = get_global_func("tir.schedule.NormalizePrimFunc") +_normalize_prim_func = get_global_func("tvm.tir.schedule.NormalizePrimFunc") def normalize_prim_func(sch: tir.Schedule) -> Optional[List[BlockInfo]]: diff --git a/python/tvm/dlight/benchmark/bench.py b/python/tvm/dlight/benchmark/bench.py index b600e7efb783..049ee031a430 100644 --- a/python/tvm/dlight/benchmark/bench.py +++ b/python/tvm/dlight/benchmark/bench.py @@ -134,7 +134,7 @@ def benchmark( number=evaluator_config.number, repeat=evaluator_config.repeat, min_repeat_ms=evaluator_config.min_repeat_ms, - f_preproc="cache_flush_cpu_non_first_arg" + f_preproc="tvm.cache_flush_cpu_non_first_arg" if evaluator_config.enable_cpu_cache_flush else "", )(*input_tensors) diff --git a/python/tvm/driver/_ffi_api.py b/python/tvm/driver/_ffi_api.py index e56426fd5182..5ed751fb8258 100644 --- a/python/tvm/driver/_ffi_api.py +++ b/python/tvm/driver/_ffi_api.py @@ -17,4 +17,4 @@ """FFI APIs for tvm.driver""" import tvm_ffi -tvm_ffi.init_ffi_api("driver", __name__) +tvm_ffi.init_ffi_api("tvm.driver", __name__) diff --git a/python/tvm/exec/disco_remote_socket_session.py b/python/tvm/exec/disco_remote_socket_session.py index 3111ce30ac4b..6c6da652152c 100644 --- a/python/tvm/exec/disco_remote_socket_session.py +++ b/python/tvm/exec/disco_remote_socket_session.py @@ -29,5 +29,5 @@ server_host = sys.argv[1] server_port = int(sys.argv[2]) num_workers = int(sys.argv[3]) - func = tvm.get_global_func("runtime.disco.RemoteSocketSession") + func = tvm.get_global_func("tvm.runtime.disco.RemoteSocketSession") func(server_host, server_port, num_workers) diff --git a/python/tvm/exec/disco_worker.py b/python/tvm/exec/disco_worker.py index 7fe94c6cb0df..646ca6d88483 100644 --- a/python/tvm/exec/disco_worker.py +++ b/python/tvm/exec/disco_worker.py @@ -27,39 +27,39 @@ from tvm.runtime import tensor -@register_global_func("tests.disco.add_one", override=True) +@register_global_func("tvm.tests.disco.add_one", override=True) def _add_one(x: int) -> int: return x + 1 -@register_global_func("tests.disco.add_one_float", override=True) +@register_global_func("tvm.tests.disco.add_one_float", override=True) def _add_one_float(x: float): return x + 0.5 -@register_global_func("tests.disco.add_one_tensor", override=True) +@register_global_func("tvm.tests.disco.add_one_tensor", override=True) def _add_one_tensor(x: Tensor) -> Tensor: return tensor(x.numpy() + 1) -@register_global_func("tests.disco.str", override=True) +@register_global_func("tvm.tests.disco.str", override=True) def _str_func(x: str): return x + "_suffix" -@register_global_func("tests.disco.str_obj", override=True) +@register_global_func("tvm.tests.disco.str_obj", override=True) def _str_obj_func(x: str): assert isinstance(x, str) return String(x + "_suffix") -@register_global_func("tests.disco.shape_tuple", override=True) +@register_global_func("tvm.tests.disco.shape_tuple", override=True) def _shape_tuple_func(x: ShapeTuple): assert isinstance(x, ShapeTuple) return ShapeTuple(list(x) + [4, 5]) -@register_global_func("tests.disco.test_callback", override=True) +@register_global_func("tvm.tests.disco.test_callback", override=True) def _make_callback(device: tvm.runtime.Device) -> Callable[[str, int], Tensor]: """For use in tests/python/disco/test_callback.py @@ -114,7 +114,7 @@ def main(): reader = int(sys.argv[4]) writer = int(sys.argv[5]) - worker_func = get_global_func("runtime.disco.WorkerProcess") + worker_func = get_global_func("tvm.runtime.disco.WorkerProcess") worker_func(worker_id, num_workers, num_groups, reader, writer) diff --git a/python/tvm/ir/_ffi_analysis_api.py b/python/tvm/ir/_ffi_analysis_api.py index 9d7c12332c18..ad6e2b09fb4d 100644 --- a/python/tvm/ir/_ffi_analysis_api.py +++ b/python/tvm/ir/_ffi_analysis_api.py @@ -19,4 +19,4 @@ import tvm_ffi -tvm_ffi.init_ffi_api("ir.analysis", __name__) +tvm_ffi.init_ffi_api("tvm.ir.analysis", __name__) diff --git a/python/tvm/ir/_ffi_api.py b/python/tvm/ir/_ffi_api.py index 798e69fca507..9ee370d8b7a3 100644 --- a/python/tvm/ir/_ffi_api.py +++ b/python/tvm/ir/_ffi_api.py @@ -18,4 +18,4 @@ import tvm_ffi -tvm_ffi.init_ffi_api("ir", __name__) +tvm_ffi.init_ffi_api("tvm.ir", __name__) diff --git a/python/tvm/ir/_ffi_instrument_api.py b/python/tvm/ir/_ffi_instrument_api.py index 18aea5cf8a2f..506cdd1ac725 100644 --- a/python/tvm/ir/_ffi_instrument_api.py +++ b/python/tvm/ir/_ffi_instrument_api.py @@ -17,4 +17,4 @@ """FFI APIs for tvm.instrument""" import tvm_ffi -tvm_ffi.init_ffi_api("instrument", __name__) +tvm_ffi.init_ffi_api("tvm.instrument", __name__) diff --git a/python/tvm/ir/_ffi_transform_api.py b/python/tvm/ir/_ffi_transform_api.py index 8a2f517e2145..f1eca737b72c 100644 --- a/python/tvm/ir/_ffi_transform_api.py +++ b/python/tvm/ir/_ffi_transform_api.py @@ -18,4 +18,4 @@ import tvm_ffi -tvm_ffi.init_ffi_api("transform", __name__) +tvm_ffi.init_ffi_api("tvm.transform", __name__) diff --git a/python/tvm/ir/attrs.py b/python/tvm/ir/attrs.py index fb408cdb8c70..f69b4b7368fe 100644 --- a/python/tvm/ir/attrs.py +++ b/python/tvm/ir/attrs.py @@ -22,7 +22,7 @@ from . import _ffi_api -@tvm_ffi.register_object("ir.Attrs") +@tvm_ffi.register_object("tvm.ir.Attrs") class Attrs(Object): """Attribute node, which is mainly use for defining attributes of operators. @@ -73,7 +73,7 @@ def __getitem__(self, item): return getattr(self, item) -@tvm_ffi.register_object("ir.DictAttrs") +@tvm_ffi.register_object("tvm.ir.DictAttrs") class DictAttrs(Attrs): """Dictionary attributes.""" @@ -143,7 +143,7 @@ def make_node(type_key, **kwargs): .. code-block:: python - x = tvm.ir.make_node("ir.IntImm", dtype="int32", value=10, span=None) + x = tvm.ir.make_node("tvm.ir.IntImm", dtype="int32", value=10, span=None) assert isinstance(x, tvm.tir.IntImm) assert x.value == 10 """ diff --git a/python/tvm/ir/base.py b/python/tvm/ir/base.py index 651ab392039c..29c1ff2bdf81 100644 --- a/python/tvm/ir/base.py +++ b/python/tvm/ir/base.py @@ -26,13 +26,13 @@ class Node(Object): """Base class of all IR Nodes.""" -@register_object("ir.SourceMap") +@register_object("tvm.ir.SourceMap") class SourceMap(Object): def add(self, name, content): - return get_global_func("SourceMapAdd")(self, name, content) + return get_global_func("tvm.SourceMapAdd")(self, name, content) -@register_object("ir.SourceName") +@register_object("tvm.ir.SourceName") class SourceName(Object): """A identifier for a source location. @@ -46,7 +46,7 @@ def __init__(self, name): self.__init_handle_by_constructor__(_ffi_api.SourceName, name) # type: ignore # pylint: disable=no-member -@register_object("ir.Span") +@register_object("tvm.ir.Span") class Span(Object): """Specifies a location in a source program. @@ -68,7 +68,7 @@ def __init__(self, source_name, line, end_line, column, end_column): ) -@register_object("ir.SequentialSpan") +@register_object("tvm.ir.SequentialSpan") class SequentialSpan(Object): """A sequence of source spans @@ -85,7 +85,7 @@ def __init__(self, spans): self.__init_handle_by_constructor__(_ffi_api.SequentialSpan, spans) -@register_object("ir.EnvFunc") +@register_object("tvm.ir.EnvFunc") class EnvFunc(Object): """Environment function. diff --git a/python/tvm/ir/diagnostics/__init__.py b/python/tvm/ir/diagnostics/__init__.py index 4a521dfa587e..e6b77b6657d0 100644 --- a/python/tvm/ir/diagnostics/__init__.py +++ b/python/tvm/ir/diagnostics/__init__.py @@ -38,7 +38,7 @@ def get_renderer(): return _ffi_api.GetRenderer() -@tvm_ffi.register_global_func("diagnostics.override_renderer") +@tvm_ffi.register_global_func("tvm.diagnostics.override_renderer") def override_renderer(render_func): """ Sets a custom renderer for diagnostics. @@ -54,7 +54,7 @@ def override_renderer(render_func): def _render_factory(): return DiagnosticRenderer(render_func) - register_global_func("diagnostics.OverrideRenderer", _render_factory, override=True) + register_global_func("tvm.diagnostics.OverrideRenderer", _render_factory, override=True) else: _ffi_api.ClearRenderer() @@ -69,7 +69,7 @@ class DiagnosticLevel(enum.IntEnum): HELP = 50 -@tvm_ffi.register_object("Diagnostic") +@tvm_ffi.register_object("tvm.Diagnostic") class Diagnostic(Object): """A single diagnostic object from TVM.""" @@ -77,7 +77,7 @@ def __init__(self, level, span, message): self.__init_handle_by_constructor__(_ffi_api.Diagnostic, level, span, message) -@tvm_ffi.register_object("DiagnosticRenderer") +@tvm_ffi.register_object("tvm.DiagnosticRenderer") class DiagnosticRenderer(Object): """ A diagnostic renderer, which given a diagnostic context produces a "rendered" @@ -100,7 +100,7 @@ def render(self, ctx): # Register the diagnostic context. -@tvm_ffi.register_object("DiagnosticContext") +@tvm_ffi.register_object("tvm.DiagnosticContext") class DiagnosticContext(Object): """ A diagnostic context which records active errors diff --git a/python/tvm/ir/diagnostics/_ffi_api.py b/python/tvm/ir/diagnostics/_ffi_api.py index 65fb2cc896f3..3473ac69f2ed 100644 --- a/python/tvm/ir/diagnostics/_ffi_api.py +++ b/python/tvm/ir/diagnostics/_ffi_api.py @@ -18,4 +18,4 @@ import tvm_ffi -tvm_ffi.init_ffi_api("diagnostics", __name__) +tvm_ffi.init_ffi_api("tvm.diagnostics", __name__) diff --git a/python/tvm/ir/expr.py b/python/tvm/ir/expr.py index 19abb6bd1eae..048531773f1b 100644 --- a/python/tvm/ir/expr.py +++ b/python/tvm/ir/expr.py @@ -26,14 +26,14 @@ from .base import Node, Span -@tvm_ffi.register_object("ir.BaseExpr") +@tvm_ffi.register_object("tvm.ir.BaseExpr") class BaseExpr(Node): """Base class of all the expressions.""" span: Optional[Span] -@tvm_ffi.register_object("ir.PrimExpr") +@tvm_ffi.register_object("tvm.ir.PrimExpr") class PrimExpr(BaseExpr): """Base class of all primitive expressions. @@ -44,7 +44,7 @@ class PrimExpr(BaseExpr): dtype: str -@tvm_ffi.register_object("ir.RelaxExpr") +@tvm_ffi.register_object("tvm.ir.RelaxExpr") class RelaxExpr(BaseExpr): """Base class of all non-primitive expressions.""" @@ -60,7 +60,7 @@ def struct_info(self) -> Optional["tvm.relax.StructInfo"]: return _ffi_api.ExprStructInfo(self) -@tvm_ffi.register_object("ir.GlobalVar") +@tvm_ffi.register_object("tvm.ir.GlobalVar") class GlobalVar(RelaxExpr): """A global variable in the IR. @@ -106,7 +106,7 @@ def __call__(self, *args: RelaxExpr) -> BaseExpr: raise RuntimeError(f"Do not know how to handle GlobalVar.__call__ for types {arg_types}") -@tvm_ffi.register_object("ir.Range") +@tvm_ffi.register_object("tvm.ir.Range") class Range(Node, Scriptable): """Represent a range in TVM. diff --git a/python/tvm/ir/function.py b/python/tvm/ir/function.py index 75718503aae1..099d93961176 100644 --- a/python/tvm/ir/function.py +++ b/python/tvm/ir/function.py @@ -36,7 +36,7 @@ class CallingConv(IntEnum): DEVICE_KERNEL_LAUNCH = 2 -@tvm_ffi.register_object("ir.BaseFunc") +@tvm_ffi.register_object("tvm.ir.BaseFunc") class BaseFunc(RelaxExpr): """Base class of all functions.""" diff --git a/python/tvm/ir/global_info.py b/python/tvm/ir/global_info.py index 185e10b88cce..8fe5d7f0c2b0 100644 --- a/python/tvm/ir/global_info.py +++ b/python/tvm/ir/global_info.py @@ -21,7 +21,7 @@ from . import _ffi_api -@tvm_ffi.register_object("ir.GlobalInfo") +@tvm_ffi.register_object("tvm.ir.GlobalInfo") class GlobalInfo(Object): """Base node for all global info that can appear in the IR""" @@ -37,7 +37,7 @@ def same_as(self, other): return super().__eq__(other) -@tvm_ffi.register_object("ir.DummyGlobalInfo") +@tvm_ffi.register_object("tvm.ir.DummyGlobalInfo") class DummyGlobalInfo(GlobalInfo): def __init__(self) -> None: self.__init_handle_by_constructor__( @@ -45,7 +45,7 @@ def __init__(self) -> None: ) -@tvm_ffi.register_object("ir.VDevice") +@tvm_ffi.register_object("tvm.ir.VDevice") class VDevice(GlobalInfo): def __init__( self, diff --git a/python/tvm/ir/instrument.py b/python/tvm/ir/instrument.py index 0f1bcf3adfda..8431fb8db342 100644 --- a/python/tvm/ir/instrument.py +++ b/python/tvm/ir/instrument.py @@ -30,7 +30,7 @@ from . import _ffi_instrument_api -@tvm_ffi.register_object("instrument.PassInstrument") +@tvm_ffi.register_object("tvm.instrument.PassInstrument") class PassInstrument(tvm.runtime.Object): """A pass instrument implementation. @@ -230,7 +230,7 @@ def create_pass_instrument(pi_cls): return create_pass_instrument -@tvm_ffi.register_object("instrument.PassInstrument") +@tvm_ffi.register_object("tvm.instrument.PassInstrument") class PassTimingInstrument(tvm.runtime.Object): """A wrapper to create a passes time instrument that implemented in C++""" diff --git a/python/tvm/ir/module.py b/python/tvm/ir/module.py index 21c86c05ec4c..7550ba829bea 100644 --- a/python/tvm/ir/module.py +++ b/python/tvm/ir/module.py @@ -31,7 +31,7 @@ from .base import Node -@tvm_ffi.register_object("ir.IRModule") +@tvm_ffi.register_object("tvm.ir.IRModule") class IRModule(Node, Scriptable): """IRModule that holds functions and type definitions. @@ -58,7 +58,7 @@ def __init__(self, functions=None, attrs=None, global_infos=None): attrs = None if not attrs else attrs if attrs is not None: - attrs = tvm.ir.make_node("ir.DictAttrs", **attrs) + attrs = tvm.ir.make_node("tvm.ir.DictAttrs", **attrs) if global_infos is None: global_infos = {} self.__init_handle_by_constructor__( diff --git a/python/tvm/ir/op.py b/python/tvm/ir/op.py index 5b62d3fe8df7..571487d18668 100644 --- a/python/tvm/ir/op.py +++ b/python/tvm/ir/op.py @@ -22,7 +22,7 @@ from .expr import RelaxExpr -@tvm_ffi.register_object("ir.Op") +@tvm_ffi.register_object("tvm.ir.Op") class Op(RelaxExpr): """Primitive operator in the IR.""" diff --git a/python/tvm/ir/supply.py b/python/tvm/ir/supply.py index bc38089b2254..eda0aa732b9b 100644 --- a/python/tvm/ir/supply.py +++ b/python/tvm/ir/supply.py @@ -21,7 +21,7 @@ from . import _ffi_api -@tvm_ffi.register_object("ir.NameSupply") +@tvm_ffi.register_object("tvm.ir.NameSupply") class NameSupply(Object): """NameSupply that can be used to generate unique names. @@ -78,7 +78,7 @@ def contains_name(self, name, add_prefix=True): return _ffi_api.NameSupply_ContainsName(self, name, add_prefix) -@tvm_ffi.register_object("ir.GlobalVarSupply") +@tvm_ffi.register_object("tvm.ir.GlobalVarSupply") class GlobalVarSupply(Object): """GlobalVarSupply that holds a mapping between names and GlobalVars. diff --git a/python/tvm/ir/transform.py b/python/tvm/ir/transform.py index fd9a2ac3b212..ad65c988bf9a 100644 --- a/python/tvm/ir/transform.py +++ b/python/tvm/ir/transform.py @@ -25,7 +25,7 @@ from . import _ffi_transform_api -@tvm_ffi.register_object("transform.PassInfo") +@tvm_ffi.register_object("tvm.transform.PassInfo") class PassInfo(tvm.runtime.Object): """The class contains the meta data required by a pass. It is the container of information needed by running an optimization or analysis. @@ -50,7 +50,7 @@ def __init__(self, opt_level, name, required=None, traceable=False): ) -@tvm_ffi.register_object("transform.PassContext") +@tvm_ffi.register_object("tvm.transform.PassContext") class PassContext(tvm.runtime.Object): """The basis where a TVM optimization/analysis runs on. Each pass context contains a number of auxiliary information that is used @@ -138,7 +138,7 @@ def list_configs(): return _ffi_transform_api.ListConfigs() -@tvm_ffi.register_object("transform.Pass") +@tvm_ffi.register_object("tvm.transform.Pass") class Pass(tvm.runtime.Object): """The base class of all passes. All methods here are just simple wrappers that are implemented in the backend. They are defined for users to @@ -167,7 +167,7 @@ def __call__(self, mod): return _ffi_transform_api.RunPass(self, mod) -@tvm_ffi.register_object("transform.ModulePass") +@tvm_ffi.register_object("tvm.transform.ModulePass") class ModulePass(Pass): """A pass that works on tvm.IRModule. Users don't need to interact with this class directly. Instead, a module pass should be created through @@ -178,7 +178,7 @@ class ModulePass(Pass): """ -@tvm_ffi.register_object("transform.Sequential") +@tvm_ffi.register_object("tvm.transform.Sequential") class Sequential(Pass): """A pass that works on a sequence of pass objects. Multiple passes can be executed sequentially using this class. diff --git a/python/tvm/ir/type.py b/python/tvm/ir/type.py index 68bed8fb69f0..1f1da8dcbe7f 100644 --- a/python/tvm/ir/type.py +++ b/python/tvm/ir/type.py @@ -23,7 +23,7 @@ from .base import Node -@tvm_ffi.register_object("ir.Type") +@tvm_ffi.register_object("tvm.ir.Type") class Type(Node, Scriptable): """The base class of all types.""" @@ -39,7 +39,7 @@ def same_as(self, other): return super().__eq__(other) -@tvm_ffi.register_object("ir.PrimType") +@tvm_ffi.register_object("tvm.ir.PrimType") class PrimType(Type): """Primitive data type in the low level IR @@ -53,7 +53,7 @@ def __init__(self, dtype): self.__init_handle_by_constructor__(_ffi_api.PrimType, dtype) -@tvm_ffi.register_object("ir.PointerType") +@tvm_ffi.register_object("tvm.ir.PointerType") class PointerType(Type): """PointerType used in the low-level TIR. @@ -70,7 +70,7 @@ def __init__(self, element_type, storage_scope=""): self.__init_handle_by_constructor__(_ffi_api.PointerType, element_type, storage_scope) -@tvm_ffi.register_object("ir.TupleType") +@tvm_ffi.register_object("tvm.ir.TupleType") class TupleType(Type): """The type of tuple values. @@ -84,7 +84,7 @@ def __init__(self, fields): self.__init_handle_by_constructor__(_ffi_api.TupleType, fields) -@tvm_ffi.register_object("ir.FuncType") +@tvm_ffi.register_object("tvm.ir.FuncType") class FuncType(Type): """Function type. @@ -110,7 +110,7 @@ def __init__(self, arg_types, ret_type): ) -@tvm_ffi.register_object("ir.TensorMapType") +@tvm_ffi.register_object("tvm.ir.TensorMapType") class TensorMapType(Type): """TensorMapType used in the low-level TIR. diff --git a/python/tvm/ir/type_relation.py b/python/tvm/ir/type_relation.py index 70950958024d..5ec9336b2c2a 100644 --- a/python/tvm/ir/type_relation.py +++ b/python/tvm/ir/type_relation.py @@ -21,7 +21,7 @@ from . import _ffi_api -@tvm_ffi.register_object("TypeCall") +@tvm_ffi.register_object("tvm.TypeCall") class TypeCall(Type): """Type function application. @@ -43,7 +43,7 @@ def __init__(self, func, args): self.__init_handle_by_constructor__(_ffi_api.TypeCall, func, args) -@tvm_ffi.register_object("TypeRelation") +@tvm_ffi.register_object("tvm.TypeRelation") class TypeRelation(TypeConstraint): """User defined type relation, it is an input-output relation on types. diff --git a/python/tvm/meta_schedule/_ffi_api.py b/python/tvm/meta_schedule/_ffi_api.py index 1a06aef5a482..edebd19cdcff 100644 --- a/python/tvm/meta_schedule/_ffi_api.py +++ b/python/tvm/meta_schedule/_ffi_api.py @@ -17,4 +17,4 @@ """FFI APIs for tvm.meta_schedule""" import tvm_ffi -tvm_ffi.init_ffi_api("meta_schedule", __name__) # pylint: disable=protected-access +tvm_ffi.init_ffi_api("tvm.meta_schedule", __name__) # pylint: disable=protected-access diff --git a/python/tvm/meta_schedule/arg_info.py b/python/tvm/meta_schedule/arg_info.py index 3f8d721ed1f0..042fe14db20e 100644 --- a/python/tvm/meta_schedule/arg_info.py +++ b/python/tvm/meta_schedule/arg_info.py @@ -26,7 +26,7 @@ from .utils import _json_de_tvm -@register_object("meta_schedule.ArgInfo") +@register_object("tvm.meta_schedule.ArgInfo") class ArgInfo(Object): """Argument information""" @@ -85,7 +85,7 @@ def from_entry_func(mod: IRModule, remove_preproc: bool = True) -> List["ArgInfo return _ffi_api.ArgInfoFromEntryFunc(mod, remove_preproc) # type: ignore # pylint: disable=no-member -@register_object("meta_schedule.TensorInfo") +@register_object("tvm.meta_schedule.TensorInfo") class TensorInfo(ArgInfo): """Tensor argument information diff --git a/python/tvm/meta_schedule/builder/builder.py b/python/tvm/meta_schedule/builder/builder.py index 39493781404a..cf4e5243f0a8 100644 --- a/python/tvm/meta_schedule/builder/builder.py +++ b/python/tvm/meta_schedule/builder/builder.py @@ -29,7 +29,7 @@ from .. import _ffi_api -@register_object("meta_schedule.BuilderInput") +@register_object("tvm.meta_schedule.BuilderInput") class BuilderInput(Object): """The builder's input. @@ -72,7 +72,7 @@ def __init__( ) -@register_object("meta_schedule.BuilderResult") +@register_object("tvm.meta_schedule.BuilderResult") class BuilderResult(Object): """The builder's result. @@ -108,7 +108,7 @@ def __init__( ) -@register_object("meta_schedule.Builder") +@register_object("tvm.meta_schedule.Builder") class Builder(Object): """The abstract builder interface.""" @@ -156,7 +156,7 @@ def create( # pylint: disable=keyword-arg-before-vararg create = Builder.create # pylint: disable=invalid-name -@register_object("meta_schedule.PyBuilder") +@register_object("tvm.meta_schedule.PyBuilder") class _PyBuilder(Builder): """ A TVM object builder to support customization on the python side. diff --git a/python/tvm/meta_schedule/builder/local_builder.py b/python/tvm/meta_schedule/builder/local_builder.py index c5d8b21d89ba..dd58949af079 100644 --- a/python/tvm/meta_schedule/builder/local_builder.py +++ b/python/tvm/meta_schedule/builder/local_builder.py @@ -234,7 +234,7 @@ def _worker_func( return artifact_path -@register_global_func("meta_schedule.builder.default_build") +@register_global_func("tvm.meta_schedule.builder.default_build") def default_build(mod: IRModule, target: Target, _params: Optional[Dict[str, Tensor]]) -> Module: """Default build function. @@ -262,7 +262,7 @@ def default_build(mod: IRModule, target: Target, _params: Optional[Dict[str, Ten return tvm_build(mod, target=target) -@register_global_func("meta_schedule.builder.default_export") +@register_global_func("tvm.meta_schedule.builder.default_export") def default_export(mod: Module) -> str: """Default export function. @@ -283,7 +283,7 @@ def default_export(mod: Module) -> str: return artifact_path -@register_global_func("meta_schedule.builder.get_local_builder") +@register_global_func("tvm.meta_schedule.builder.get_local_builder") def get_local_builder() -> LocalBuilder: """Get the local builder. diff --git a/python/tvm/meta_schedule/cost_model/cost_model.py b/python/tvm/meta_schedule/cost_model/cost_model.py index f51d2f2ac89b..9e07542474d2 100644 --- a/python/tvm/meta_schedule/cost_model/cost_model.py +++ b/python/tvm/meta_schedule/cost_model/cost_model.py @@ -34,7 +34,7 @@ from ..utils import _get_default_str -@register_object("meta_schedule.CostModel") +@register_object("tvm.meta_schedule.CostModel") class CostModel(Object): """Cost model.""" @@ -150,7 +150,7 @@ def create( create = CostModel.create # pylint: disable=invalid-name -@register_object("meta_schedule.PyCostModel") +@register_object("tvm.meta_schedule.PyCostModel") class _PyCostModel(CostModel): """ A TVM object cost model to support customization on the python side. diff --git a/python/tvm/meta_schedule/database/database.py b/python/tvm/meta_schedule/database/database.py index 08bcbd33c7ad..a39617a5f81d 100644 --- a/python/tvm/meta_schedule/database/database.py +++ b/python/tvm/meta_schedule/database/database.py @@ -33,7 +33,7 @@ from ..utils import _json_de_tvm -@register_object("meta_schedule.Workload") +@register_object("tvm.meta_schedule.Workload") class Workload(Object): """A workload, i.e. an IRModule and its structural hash. @@ -79,7 +79,7 @@ def from_json(json_obj: Any) -> "Workload": return _ffi_api.WorkloadFromJSON(json_obj) # type: ignore # pylint: disable=no-member -@register_object("meta_schedule.TuningRecord") +@register_object("tvm.meta_schedule.TuningRecord") class TuningRecord(Object): """The class of tuning records. @@ -160,7 +160,7 @@ def from_json(json_obj: Any, workload: Workload) -> "TuningRecord": return _ffi_api.TuningRecordFromJSON(json_obj, workload) # type: ignore # pylint: disable=no-member -@register_object("meta_schedule.Database") +@register_object("tvm.meta_schedule.Database") class Database(Object): """The abstract database interface.""" @@ -427,7 +427,7 @@ def create( # pylint: disable=keyword-arg-before-vararg create = Database.create # pylint: disable=invalid-name -@register_object("meta_schedule.PyDatabase") +@register_object("tvm.meta_schedule.PyDatabase") class _PyDatabase(Database): """ A TVM object database to support customization on the python side. diff --git a/python/tvm/meta_schedule/database/json_database.py b/python/tvm/meta_schedule/database/json_database.py index 7c6f7459cacc..a97a8097ee94 100644 --- a/python/tvm/meta_schedule/database/json_database.py +++ b/python/tvm/meta_schedule/database/json_database.py @@ -24,7 +24,7 @@ from .database import Database -@register_object("meta_schedule.JSONDatabase") +@register_object("tvm.meta_schedule.JSONDatabase") class JSONDatabase(Database): """Database class backed by JSON. diff --git a/python/tvm/meta_schedule/database/memory_database.py b/python/tvm/meta_schedule/database/memory_database.py index 1d6d4121231c..6d4579ab1c53 100644 --- a/python/tvm/meta_schedule/database/memory_database.py +++ b/python/tvm/meta_schedule/database/memory_database.py @@ -21,7 +21,7 @@ from .database import Database -@register_object("meta_schedule.MemoryDatabase") +@register_object("tvm.meta_schedule.MemoryDatabase") class MemoryDatabase(Database): """An in-memory database diff --git a/python/tvm/meta_schedule/database/ordered_union_database.py b/python/tvm/meta_schedule/database/ordered_union_database.py index 717d2f3001c9..768b7f0b8023 100644 --- a/python/tvm/meta_schedule/database/ordered_union_database.py +++ b/python/tvm/meta_schedule/database/ordered_union_database.py @@ -21,7 +21,7 @@ from .database import Database -@register_object("meta_schedule.OrderedUnionDatabase") +@register_object("tvm.meta_schedule.OrderedUnionDatabase") class OrderedUnionDatabase(Database): """A database composed of multiple databases, allowing users to guide IR rewriting using combined knowledge of those databases. To each query, it returns the record from the first diff --git a/python/tvm/meta_schedule/database/schedule_fn_database.py b/python/tvm/meta_schedule/database/schedule_fn_database.py index 74b2a6eb60da..c8fef2412fac 100644 --- a/python/tvm/meta_schedule/database/schedule_fn_database.py +++ b/python/tvm/meta_schedule/database/schedule_fn_database.py @@ -24,7 +24,7 @@ from .database import Database -@register_object("meta_schedule.ScheduleFnDatabase") +@register_object("tvm.meta_schedule.ScheduleFnDatabase") class ScheduleFnDatabase(Database): """A database for injecting handcrafted schedule functions. diff --git a/python/tvm/meta_schedule/database/union_database.py b/python/tvm/meta_schedule/database/union_database.py index 3a1afbe32adf..734a01e66a05 100644 --- a/python/tvm/meta_schedule/database/union_database.py +++ b/python/tvm/meta_schedule/database/union_database.py @@ -21,7 +21,7 @@ from .database import Database -@register_object("meta_schedule.UnionDatabase") +@register_object("tvm.meta_schedule.UnionDatabase") class UnionDatabase(Database): """A database composed of multiple databases, allowing users to guide IR rewriting using combined knowledge of those databases. To each query, it returns the best record among all the diff --git a/python/tvm/meta_schedule/extracted_task.py b/python/tvm/meta_schedule/extracted_task.py index df66e774e595..15af2a85e5ec 100644 --- a/python/tvm/meta_schedule/extracted_task.py +++ b/python/tvm/meta_schedule/extracted_task.py @@ -25,7 +25,7 @@ from . import _ffi_api -@register_object("meta_schedule.ExtractedTask") +@register_object("tvm.meta_schedule.ExtractedTask") class ExtractedTask(Object): """A tuning task extracted from the high-level IR diff --git a/python/tvm/meta_schedule/feature_extractor/feature_extractor.py b/python/tvm/meta_schedule/feature_extractor/feature_extractor.py index b50a22142943..9ff5389119d1 100644 --- a/python/tvm/meta_schedule/feature_extractor/feature_extractor.py +++ b/python/tvm/meta_schedule/feature_extractor/feature_extractor.py @@ -32,7 +32,7 @@ from ..utils import _get_default_str -@register_object("meta_schedule.FeatureExtractor") +@register_object("tvm.meta_schedule.FeatureExtractor") class FeatureExtractor(Object): """Extractor for features from measure candidates for use in cost model.""" @@ -74,7 +74,7 @@ def create( raise ValueError(f"Unknown CostModel: {kind}") -@register_object("meta_schedule.PyFeatureExtractor") +@register_object("tvm.meta_schedule.PyFeatureExtractor") class _PyFeatureExtractor(FeatureExtractor): """ A TVM object feature extractor to support customization on the python side. diff --git a/python/tvm/meta_schedule/feature_extractor/per_store_feature.py b/python/tvm/meta_schedule/feature_extractor/per_store_feature.py index 673a722955d2..3e84d8af808f 100644 --- a/python/tvm/meta_schedule/feature_extractor/per_store_feature.py +++ b/python/tvm/meta_schedule/feature_extractor/per_store_feature.py @@ -24,7 +24,7 @@ from .feature_extractor import FeatureExtractor -@register_object("meta_schedule.PerStoreFeature") +@register_object("tvm.meta_schedule.PerStoreFeature") class PerStoreFeature(FeatureExtractor): """PerStoreFeature extracts one feature vector per BufferStoreNode diff --git a/python/tvm/meta_schedule/measure_callback/add_to_database.py b/python/tvm/meta_schedule/measure_callback/add_to_database.py index e0a6f5a273fc..cc81f07bbcce 100644 --- a/python/tvm/meta_schedule/measure_callback/add_to_database.py +++ b/python/tvm/meta_schedule/measure_callback/add_to_database.py @@ -21,7 +21,7 @@ from .measure_callback import MeasureCallback -@register_object("meta_schedule.AddToDatabase") +@register_object("tvm.meta_schedule.AddToDatabase") class AddToDatabase(MeasureCallback): def __init__(self) -> None: """A callback that adds the measurement results into the database""" diff --git a/python/tvm/meta_schedule/measure_callback/measure_callback.py b/python/tvm/meta_schedule/measure_callback/measure_callback.py index 885f70e88de8..e21fe77a17b3 100644 --- a/python/tvm/meta_schedule/measure_callback/measure_callback.py +++ b/python/tvm/meta_schedule/measure_callback/measure_callback.py @@ -36,7 +36,7 @@ from ..task_scheduler import TaskScheduler -@register_object("meta_schedule.MeasureCallback") +@register_object("tvm.meta_schedule.MeasureCallback") class MeasureCallback(Object): """Rules to apply after measure results is available.""" @@ -82,7 +82,7 @@ def create(kind: Literal["default"]) -> List["MeasureCallback"]: raise ValueError(f"Unknown kind of MeasureCallback list: {kind}") -@register_object("meta_schedule.PyMeasureCallback") +@register_object("tvm.meta_schedule.PyMeasureCallback") class _PyMeasureCallback(MeasureCallback): """ A TVM object measure callback to support customization on the python side. diff --git a/python/tvm/meta_schedule/measure_callback/remove_build_artifact.py b/python/tvm/meta_schedule/measure_callback/remove_build_artifact.py index 23808b7e99d7..7662bbafe377 100644 --- a/python/tvm/meta_schedule/measure_callback/remove_build_artifact.py +++ b/python/tvm/meta_schedule/measure_callback/remove_build_artifact.py @@ -21,7 +21,7 @@ from .measure_callback import MeasureCallback -@register_object("meta_schedule.RemoveBuildArtifact") +@register_object("tvm.meta_schedule.RemoveBuildArtifact") class RemoveBuildArtifact(MeasureCallback): def __init__(self) -> None: """A callback that removes the build artifacts from the disk""" diff --git a/python/tvm/meta_schedule/measure_callback/update_cost_model.py b/python/tvm/meta_schedule/measure_callback/update_cost_model.py index 7cf60c095b97..763bbd826ce3 100644 --- a/python/tvm/meta_schedule/measure_callback/update_cost_model.py +++ b/python/tvm/meta_schedule/measure_callback/update_cost_model.py @@ -21,7 +21,7 @@ from .measure_callback import MeasureCallback -@register_object("meta_schedule.UpdateCostModel") +@register_object("tvm.meta_schedule.UpdateCostModel") class UpdateCostModel(MeasureCallback): def __init__(self) -> None: """A measure callback that updates the cost model""" diff --git a/python/tvm/meta_schedule/mutator/mutate_compute_location.py b/python/tvm/meta_schedule/mutator/mutate_compute_location.py index 620e0062cbff..aa6c15c5138a 100644 --- a/python/tvm/meta_schedule/mutator/mutate_compute_location.py +++ b/python/tvm/meta_schedule/mutator/mutate_compute_location.py @@ -21,7 +21,7 @@ from .mutator import Mutator -@register_object("meta_schedule.MutateComputeLocation") +@register_object("tvm.meta_schedule.MutateComputeLocation") class MutateComputeLocation(Mutator): """A mutator that mutates the compute-at location decision of SampleComputeLocation""" diff --git a/python/tvm/meta_schedule/mutator/mutate_parallel.py b/python/tvm/meta_schedule/mutator/mutate_parallel.py index fc077cd0d4aa..0bca99361a89 100644 --- a/python/tvm/meta_schedule/mutator/mutate_parallel.py +++ b/python/tvm/meta_schedule/mutator/mutate_parallel.py @@ -21,7 +21,7 @@ from .mutator import Mutator -@register_object("meta_schedule.MutateParallel") +@register_object("tvm.meta_schedule.MutateParallel") class MutateParallel(Mutator): """Mutator that mutates the parallel extent""" diff --git a/python/tvm/meta_schedule/mutator/mutate_thread_binding.py b/python/tvm/meta_schedule/mutator/mutate_thread_binding.py index 4c9fa44c50a0..a14c027040ef 100644 --- a/python/tvm/meta_schedule/mutator/mutate_thread_binding.py +++ b/python/tvm/meta_schedule/mutator/mutate_thread_binding.py @@ -21,7 +21,7 @@ from .mutator import Mutator -@register_object("meta_schedule.MutateThreadBinding") +@register_object("tvm.meta_schedule.MutateThreadBinding") class MutateThreadBinding(Mutator): """Mutator that mutates the binding extent""" diff --git a/python/tvm/meta_schedule/mutator/mutate_tile_size.py b/python/tvm/meta_schedule/mutator/mutate_tile_size.py index f40894f5ba0f..ab5c15d2d136 100644 --- a/python/tvm/meta_schedule/mutator/mutate_tile_size.py +++ b/python/tvm/meta_schedule/mutator/mutate_tile_size.py @@ -21,7 +21,7 @@ from .mutator import Mutator -@register_object("meta_schedule.MutateTileSize") +@register_object("tvm.meta_schedule.MutateTileSize") class MutateTileSize(Mutator): """Mutator that mutates the decision of instruction Sample-Perfect-Tile""" diff --git a/python/tvm/meta_schedule/mutator/mutate_unroll.py b/python/tvm/meta_schedule/mutator/mutate_unroll.py index 97999c2888f8..4b8f81a924d9 100644 --- a/python/tvm/meta_schedule/mutator/mutate_unroll.py +++ b/python/tvm/meta_schedule/mutator/mutate_unroll.py @@ -21,7 +21,7 @@ from .mutator import Mutator -@register_object("meta_schedule.MutateUnroll") +@register_object("tvm.meta_schedule.MutateUnroll") class MutateUnroll(Mutator): """Mutator that mutates auto unroll step""" diff --git a/python/tvm/meta_schedule/mutator/mutator.py b/python/tvm/meta_schedule/mutator/mutator.py index 211e2c2b5015..3ebb9c4c3512 100644 --- a/python/tvm/meta_schedule/mutator/mutator.py +++ b/python/tvm/meta_schedule/mutator/mutator.py @@ -111,7 +111,7 @@ def create( create = Mutator.create # pylint: disable=invalid-name -@register_object("meta_schedule.PyMutator") +@register_object("tvm.meta_schedule.PyMutator") class _PyMutator(Mutator): """ A TVM object mutator to support customization on the python side. diff --git a/python/tvm/meta_schedule/postproc/disallow_async_strided_mem_copy.py b/python/tvm/meta_schedule/postproc/disallow_async_strided_mem_copy.py index 5c18475ea0ca..4b5f16b4ab48 100644 --- a/python/tvm/meta_schedule/postproc/disallow_async_strided_mem_copy.py +++ b/python/tvm/meta_schedule/postproc/disallow_async_strided_mem_copy.py @@ -21,7 +21,7 @@ from .postproc import Postproc -@register_object("meta_schedule.DisallowAsyncStridedMemCopy") +@register_object("tvm.meta_schedule.DisallowAsyncStridedMemCopy") class DisallowAsyncStridedMemCopy(Postproc): """A postprocessor that disallows schedules that use async strided mem copies.""" diff --git a/python/tvm/meta_schedule/postproc/disallow_dynamic_loop.py b/python/tvm/meta_schedule/postproc/disallow_dynamic_loop.py index da604e42cc81..32a4315c29df 100644 --- a/python/tvm/meta_schedule/postproc/disallow_dynamic_loop.py +++ b/python/tvm/meta_schedule/postproc/disallow_dynamic_loop.py @@ -21,7 +21,7 @@ from .postproc import Postproc -@register_object("meta_schedule.DisallowDynamicLoop") +@register_object("tvm.meta_schedule.DisallowDynamicLoop") class DisallowDynamicLoop(Postproc): """A postprocessor that checks if the IRModule has any loop with non-constant extent""" diff --git a/python/tvm/meta_schedule/postproc/postproc.py b/python/tvm/meta_schedule/postproc/postproc.py index 8e89ad2fe138..17cc55bc07da 100644 --- a/python/tvm/meta_schedule/postproc/postproc.py +++ b/python/tvm/meta_schedule/postproc/postproc.py @@ -33,7 +33,7 @@ from ..tune_context import TuneContext -@register_object("meta_schedule.Postproc") +@register_object("tvm.meta_schedule.Postproc") class Postproc(Object): """Rules to apply a postprocessor to a schedule.""" @@ -105,7 +105,7 @@ def create(kind: Literal["llvm", "cuda", "cuda-tensorcore", "hexagon"]) -> List[ create = Postproc.create # pylint: disable=invalid-name -@register_object("meta_schedule.PyPostproc") +@register_object("tvm.meta_schedule.PyPostproc") class _PyPostproc(Postproc): """ A TVM object post processor to support customization on the python side. diff --git a/python/tvm/meta_schedule/postproc/rewrite_cooperative_fetch.py b/python/tvm/meta_schedule/postproc/rewrite_cooperative_fetch.py index d20c22d0f6d8..9e82474f2ee5 100644 --- a/python/tvm/meta_schedule/postproc/rewrite_cooperative_fetch.py +++ b/python/tvm/meta_schedule/postproc/rewrite_cooperative_fetch.py @@ -22,7 +22,7 @@ from .postproc import Postproc -@register_object("meta_schedule.RewriteCooperativeFetch") +@register_object("tvm.meta_schedule.RewriteCooperativeFetch") class RewriteCooperativeFetch(Postproc): """A postprocessor that rewrites the cooperative fetch annotation to actual vectorized cooperative fetching in loop bindings. diff --git a/python/tvm/meta_schedule/postproc/rewrite_layout.py b/python/tvm/meta_schedule/postproc/rewrite_layout.py index 73b6dde9f76a..bb801f9ab78f 100644 --- a/python/tvm/meta_schedule/postproc/rewrite_layout.py +++ b/python/tvm/meta_schedule/postproc/rewrite_layout.py @@ -22,7 +22,7 @@ from .postproc import Postproc -@register_object("meta_schedule.RewriteLayout") +@register_object("tvm.meta_schedule.RewriteLayout") class RewriteLayout(Postproc): """A postprocessor that rewrites the layout of input tensor""" diff --git a/python/tvm/meta_schedule/postproc/rewrite_parallel_vectorize_unroll.py b/python/tvm/meta_schedule/postproc/rewrite_parallel_vectorize_unroll.py index 30235517f9c6..a1a1327edebf 100644 --- a/python/tvm/meta_schedule/postproc/rewrite_parallel_vectorize_unroll.py +++ b/python/tvm/meta_schedule/postproc/rewrite_parallel_vectorize_unroll.py @@ -22,7 +22,7 @@ from .postproc import Postproc -@register_object("meta_schedule.RewriteParallelVectorizeUnroll") +@register_object("tvm.meta_schedule.RewriteParallelVectorizeUnroll") class RewriteParallelVectorizeUnroll(Postproc): """A postprocessor that applies parallelization, vectorization and auto unrolling according to the annotation of each block""" diff --git a/python/tvm/meta_schedule/postproc/rewrite_reduction_block.py b/python/tvm/meta_schedule/postproc/rewrite_reduction_block.py index 5bbe2b88381e..9fa9ac0c73e5 100644 --- a/python/tvm/meta_schedule/postproc/rewrite_reduction_block.py +++ b/python/tvm/meta_schedule/postproc/rewrite_reduction_block.py @@ -21,7 +21,7 @@ from .postproc import Postproc -@register_object("meta_schedule.RewriteReductionBlock") +@register_object("tvm.meta_schedule.RewriteReductionBlock") class RewriteReductionBlock(Postproc): """A postprocessor that rewrites reduction block by moving the init block out.""" diff --git a/python/tvm/meta_schedule/postproc/rewrite_tensorize.py b/python/tvm/meta_schedule/postproc/rewrite_tensorize.py index 8f0edb869586..d030ba603410 100644 --- a/python/tvm/meta_schedule/postproc/rewrite_tensorize.py +++ b/python/tvm/meta_schedule/postproc/rewrite_tensorize.py @@ -21,7 +21,7 @@ from .postproc import Postproc -@register_object("meta_schedule.RewriteTensorize") +@register_object("tvm.meta_schedule.RewriteTensorize") class RewriteTensorize(Postproc): """A postprocessor that applies tensorization to annotated blocks. diff --git a/python/tvm/meta_schedule/postproc/rewrite_unbound_block.py b/python/tvm/meta_schedule/postproc/rewrite_unbound_block.py index b274c2f55c11..adb21fcd846f 100644 --- a/python/tvm/meta_schedule/postproc/rewrite_unbound_block.py +++ b/python/tvm/meta_schedule/postproc/rewrite_unbound_block.py @@ -22,7 +22,7 @@ from .postproc import Postproc -@register_object("meta_schedule.RewriteUnboundBlock") +@register_object("tvm.meta_schedule.RewriteUnboundBlock") class RewriteUnboundBlock(Postproc): """A postprocessor that adds thread binding to unbound blocks""" diff --git a/python/tvm/meta_schedule/postproc/verify_gpu_code.py b/python/tvm/meta_schedule/postproc/verify_gpu_code.py index 48fbe8f4b14c..3dd7e0c72503 100644 --- a/python/tvm/meta_schedule/postproc/verify_gpu_code.py +++ b/python/tvm/meta_schedule/postproc/verify_gpu_code.py @@ -21,7 +21,7 @@ from .postproc import Postproc -@register_object("meta_schedule.VerifyGPUCode") +@register_object("tvm.meta_schedule.VerifyGPUCode") class VerifyGPUCode(Postproc): """A postprocessor that verifies if the GPU code is correct""" diff --git a/python/tvm/meta_schedule/postproc/verify_vtcm_limit.py b/python/tvm/meta_schedule/postproc/verify_vtcm_limit.py index 96ece2270bbc..de48ad1f0db6 100644 --- a/python/tvm/meta_schedule/postproc/verify_vtcm_limit.py +++ b/python/tvm/meta_schedule/postproc/verify_vtcm_limit.py @@ -21,7 +21,7 @@ from .postproc import Postproc -@register_object("meta_schedule.VerifyVTCMLimit") +@register_object("tvm.meta_schedule.VerifyVTCMLimit") class VerifyVTCMLimit(Postproc): """Verifies that the VTCM usage of a given schedule is within the provided limit.""" diff --git a/python/tvm/meta_schedule/profiler.py b/python/tvm/meta_schedule/profiler.py index 1a41f589de4c..94a6ee9b43ad 100644 --- a/python/tvm/meta_schedule/profiler.py +++ b/python/tvm/meta_schedule/profiler.py @@ -25,7 +25,7 @@ from . import _ffi_api -@register_object("meta_schedule.Profiler") +@register_object("tvm.meta_schedule.Profiler") class Profiler(Object): """Tuning time profiler.""" diff --git a/python/tvm/meta_schedule/relax_integration.py b/python/tvm/meta_schedule/relax_integration.py index dc78d2400a74..fc6894613ba6 100644 --- a/python/tvm/meta_schedule/relax_integration.py +++ b/python/tvm/meta_schedule/relax_integration.py @@ -48,13 +48,13 @@ from tvm import relax _extract_task_func = get_global_func( # pylint: disable=invalid-name - "relax.backend.MetaScheduleExtractTask", + "tvm.relax.backend.MetaScheduleExtractTask", allow_missing=False, ) def extract_tasks( - mod: Union[IRModule, "relax.Function"], + mod: Union[IRModule, "tvm.relax.Function"], target: Target, params: Optional[Dict[str, Tensor]] = None, module_equality: str = "structural", @@ -158,7 +158,7 @@ def extracted_tasks_to_tune_contexts( def tune_relax( - mod: Union[IRModule, "relax.Function"], + mod: Union[IRModule, "tvm.relax.Function"], params: Dict[str, Tensor], target: Union[str, Target], work_dir: str, @@ -271,7 +271,7 @@ def tune_relax( @register_global_func("tvm.meta_schedule.tune_relax") def _tune_relax( - mod: Union[IRModule, "relax.Function"], + mod: Union[IRModule, "tvm.relax.Function"], params: Dict[str, Tensor], target: Union[str, Target], work_dir: str, diff --git a/python/tvm/meta_schedule/runner/local_runner.py b/python/tvm/meta_schedule/runner/local_runner.py index b35e47c94dda..9b039de1e547 100644 --- a/python/tvm/meta_schedule/runner/local_runner.py +++ b/python/tvm/meta_schedule/runner/local_runner.py @@ -392,7 +392,7 @@ def default_cleanup() -> None: pass # pylint: disable=unnecessary-pass -@tvm.register_global_func("meta_schedule.runner.get_local_runner") +@tvm.register_global_func("tvm.meta_schedule.runner.get_local_runner") def get_local_builder() -> LocalRunner: """Get the local Runner. diff --git a/python/tvm/meta_schedule/runner/runner.py b/python/tvm/meta_schedule/runner/runner.py index 0d7cd32bd7a5..cb6b65cd162a 100644 --- a/python/tvm/meta_schedule/runner/runner.py +++ b/python/tvm/meta_schedule/runner/runner.py @@ -29,7 +29,7 @@ from ..arg_info import ArgInfo -@register_object("meta_schedule.RunnerInput") +@register_object("tvm.meta_schedule.RunnerInput") class RunnerInput(Object): """The runner's input @@ -72,7 +72,7 @@ def __init__( ) -@register_object("meta_schedule.RunnerResult") +@register_object("tvm.meta_schedule.RunnerResult") class RunnerResult(Object): """The runner's result @@ -108,7 +108,7 @@ def __init__( ) -@register_object("meta_schedule.RunnerFuture") +@register_object("tvm.meta_schedule.RunnerFuture") class RunnerFuture(Object): """ A class to fetch asynchronous runner's output. @@ -163,7 +163,7 @@ def result(self) -> RunnerResult: raise NotImplementedError -@register_object("meta_schedule.Runner") +@register_object("tvm.meta_schedule.Runner") class Runner(Object): """The abstract runner interface""" @@ -205,7 +205,7 @@ def create( # pylint: disable=keyword-arg-before-vararg create = Runner.create # pylint: disable=invalid-name -@register_object("meta_schedule.PyRunner") +@register_object("tvm.meta_schedule.PyRunner") class _PyRunner(Runner): """ A TVM object runner to support customization on the python side. diff --git a/python/tvm/meta_schedule/runner/utils.py b/python/tvm/meta_schedule/runner/utils.py index d4af6726cee0..267c00613a4e 100644 --- a/python/tvm/meta_schedule/runner/utils.py +++ b/python/tvm/meta_schedule/runner/utils.py @@ -108,7 +108,7 @@ def run_evaluator_common( number=evaluator_config.number, repeat=evaluator_config.repeat, min_repeat_ms=evaluator_config.min_repeat_ms, - f_preproc="cache_flush_cpu_non_first_arg" + f_preproc="tvm.cache_flush_cpu_non_first_arg" if evaluator_config.enable_cpu_cache_flush else "", ) diff --git a/python/tvm/meta_schedule/schedule/cuda/layout_transform.py b/python/tvm/meta_schedule/schedule/cuda/layout_transform.py index 58540839397d..964fbcf1781d 100644 --- a/python/tvm/meta_schedule/schedule/cuda/layout_transform.py +++ b/python/tvm/meta_schedule/schedule/cuda/layout_transform.py @@ -501,7 +501,7 @@ def get_max_tile_size() -> int: return max_tile_size -@tvm.register_global_func("meta_schedule.cuda.layout_transform") +@tvm.register_global_func("tvm.meta_schedule.cuda.layout_transform") def cuda_layout_transform_schedule_rule( sch: tvm.tir.Schedule, block: BlockRV, testing_tile_sizes: Optional[List[int]] = None ) -> List[tvm.tir.Schedule]: diff --git a/python/tvm/meta_schedule/schedule_rule/add_rfactor.py b/python/tvm/meta_schedule/schedule_rule/add_rfactor.py index 2bef40fffe74..89813e31286e 100644 --- a/python/tvm/meta_schedule/schedule_rule/add_rfactor.py +++ b/python/tvm/meta_schedule/schedule_rule/add_rfactor.py @@ -23,7 +23,7 @@ from .schedule_rule import ScheduleRule -@register_object("meta_schedule.AddRFactor") +@register_object("tvm.meta_schedule.AddRFactor") class AddRFactor(ScheduleRule): """Rules for add-rfactor to some blocks if needed. diff --git a/python/tvm/meta_schedule/schedule_rule/apply_custom_rule.py b/python/tvm/meta_schedule/schedule_rule/apply_custom_rule.py index 2e383c75eb91..a1be7f52359b 100644 --- a/python/tvm/meta_schedule/schedule_rule/apply_custom_rule.py +++ b/python/tvm/meta_schedule/schedule_rule/apply_custom_rule.py @@ -22,7 +22,7 @@ from .schedule_rule import ScheduleRule -@register_object("meta_schedule.ApplyCustomRule") +@register_object("tvm.meta_schedule.ApplyCustomRule") class ApplyCustomRule(ScheduleRule): """A rule that applies customized rules registered using block attribute `schedule_rule`. The rule will be dispatched according to target keys.""" diff --git a/python/tvm/meta_schedule/schedule_rule/auto_bind.py b/python/tvm/meta_schedule/schedule_rule/auto_bind.py index 0704b03f740f..323a4ab70642 100644 --- a/python/tvm/meta_schedule/schedule_rule/auto_bind.py +++ b/python/tvm/meta_schedule/schedule_rule/auto_bind.py @@ -23,7 +23,7 @@ from .schedule_rule import ScheduleRule -@register_object("meta_schedule.AutoBind") +@register_object("tvm.meta_schedule.AutoBind") class AutoBind(ScheduleRule): """Auto bind loops around the block to BlockIdx and ThreadIdx diff --git a/python/tvm/meta_schedule/schedule_rule/auto_inline.py b/python/tvm/meta_schedule/schedule_rule/auto_inline.py index b789dd750707..69b70e217a58 100644 --- a/python/tvm/meta_schedule/schedule_rule/auto_inline.py +++ b/python/tvm/meta_schedule/schedule_rule/auto_inline.py @@ -23,7 +23,7 @@ from .schedule_rule import ScheduleRule -@register_object("meta_schedule.AutoInline") +@register_object("tvm.meta_schedule.AutoInline") class AutoInline(ScheduleRule): """Rule that inlines spatial blocks if it satisfies some conditions @@ -67,7 +67,7 @@ def __init__( ) -@register_object("meta_schedule.InlineConstantScalars") +@register_object("tvm.meta_schedule.InlineConstantScalars") class InlineConstantScalars(ScheduleRule): """Inline blocks that produce a constant scalar. diff --git a/python/tvm/meta_schedule/schedule_rule/cross_thread_reduction.py b/python/tvm/meta_schedule/schedule_rule/cross_thread_reduction.py index 0c79d4f08bac..6192bc98bd55 100644 --- a/python/tvm/meta_schedule/schedule_rule/cross_thread_reduction.py +++ b/python/tvm/meta_schedule/schedule_rule/cross_thread_reduction.py @@ -23,7 +23,7 @@ from .schedule_rule import ScheduleRule -@register_object("meta_schedule.CrossThreadReduction") +@register_object("tvm.meta_schedule.CrossThreadReduction") class CrossThreadReduction(ScheduleRule): """A schedule rule which applies cross-thread reduction to some reduction blocks correspondingly when needed diff --git a/python/tvm/meta_schedule/schedule_rule/multi_level_tiling.py b/python/tvm/meta_schedule/schedule_rule/multi_level_tiling.py index 41c97a7862b4..cfe6126da8da 100644 --- a/python/tvm/meta_schedule/schedule_rule/multi_level_tiling.py +++ b/python/tvm/meta_schedule/schedule_rule/multi_level_tiling.py @@ -40,7 +40,7 @@ def as_dict(self) -> Dict[str, Any]: } -@register_object("meta_schedule.MultiLevelTiling") +@register_object("tvm.meta_schedule.MultiLevelTiling") class MultiLevelTiling(ScheduleRule): """Multi-level tiling with reuse. @@ -92,7 +92,7 @@ def __init__( ) -@register_object("meta_schedule.MultiLevelTilingWithIntrin") +@register_object("tvm.meta_schedule.MultiLevelTilingWithIntrin") class MultiLevelTilingWithIntrin(ScheduleRule): """Extension of MultiLevelTiling for auto-tensorizing with a single intrinsic. @@ -141,7 +141,7 @@ def __init__( ) -@register_object("meta_schedule.MultiLevelTilingTensorCore") +@register_object("tvm.meta_schedule.MultiLevelTilingTensorCore") class MultiLevelTilingTensorCore(ScheduleRule): """Extension of MultiLevelTiling for auto-tensorizing with multiple groups of candidate tensor core intrinsics. @@ -197,7 +197,7 @@ def __init__( ) -@register_object("meta_schedule.MultiLevelTilingWideVector") +@register_object("tvm.meta_schedule.MultiLevelTilingWideVector") class MultiLevelTilingWideVector(ScheduleRule): """Extension of MultiLevelTiling for backends with wide vectors. The loop over the innermost spatial axis of the output buffer is always vectorized with the maximum vector length. diff --git a/python/tvm/meta_schedule/schedule_rule/parallel_vectorize_unroll.py b/python/tvm/meta_schedule/schedule_rule/parallel_vectorize_unroll.py index 259620b3f715..e5b5b940e293 100644 --- a/python/tvm/meta_schedule/schedule_rule/parallel_vectorize_unroll.py +++ b/python/tvm/meta_schedule/schedule_rule/parallel_vectorize_unroll.py @@ -24,7 +24,7 @@ from .schedule_rule import ScheduleRule -@register_object("meta_schedule.ParallelizeVectorizeUnroll") +@register_object("tvm.meta_schedule.ParallelizeVectorizeUnroll") class ParallelizeVectorizeUnroll(ScheduleRule): """Rule that mark parallelize, vectorize and unroll to the root block. The mark will be applied to each block in a follow-up post processor diff --git a/python/tvm/meta_schedule/schedule_rule/random_compute_location.py b/python/tvm/meta_schedule/schedule_rule/random_compute_location.py index 8f1c96f6eb0a..a5223b713ea6 100644 --- a/python/tvm/meta_schedule/schedule_rule/random_compute_location.py +++ b/python/tvm/meta_schedule/schedule_rule/random_compute_location.py @@ -21,7 +21,7 @@ from .schedule_rule import ScheduleRule -@register_object("meta_schedule.RandomComputeLocation") +@register_object("tvm.meta_schedule.RandomComputeLocation") class RandomComputeLocation(ScheduleRule): """A rule that randomly select a compute-at location for a free block""" diff --git a/python/tvm/meta_schedule/schedule_rule/schedule_rule.py b/python/tvm/meta_schedule/schedule_rule/schedule_rule.py index 98c81e5b8f30..0a9d687c77e4 100644 --- a/python/tvm/meta_schedule/schedule_rule/schedule_rule.py +++ b/python/tvm/meta_schedule/schedule_rule/schedule_rule.py @@ -36,7 +36,7 @@ from ..tune_context import TuneContext -@register_object("meta_schedule.ScheduleRule") +@register_object("tvm.meta_schedule.ScheduleRule") class ScheduleRule(Object): """Rules to modify a block in a schedule.""" @@ -112,7 +112,7 @@ def create(kind: Literal["llvm", "cuda", "cuda-tensorcore", "hexagon"]) -> List[ create = ScheduleRule.create # pylint: disable=invalid-name -@register_object("meta_schedule.PyScheduleRule") +@register_object("tvm.meta_schedule.PyScheduleRule") class _PyScheduleRule(ScheduleRule): """ A TVM object schedule rule to support customization on the python side. diff --git a/python/tvm/meta_schedule/search_strategy/evolutionary_search.py b/python/tvm/meta_schedule/search_strategy/evolutionary_search.py index 04f9310e6e0d..be5ee16efb90 100644 --- a/python/tvm/meta_schedule/search_strategy/evolutionary_search.py +++ b/python/tvm/meta_schedule/search_strategy/evolutionary_search.py @@ -21,7 +21,7 @@ from .search_strategy import SearchStrategy -@register_object("meta_schedule.EvolutionarySearch") +@register_object("tvm.meta_schedule.EvolutionarySearch") class EvolutionarySearch(SearchStrategy): """ Replay Trace Search Strategy is a search strategy that always replays the trace by removing its diff --git a/python/tvm/meta_schedule/search_strategy/replay_func.py b/python/tvm/meta_schedule/search_strategy/replay_func.py index 682c9638c513..b7fedcf0117d 100644 --- a/python/tvm/meta_schedule/search_strategy/replay_func.py +++ b/python/tvm/meta_schedule/search_strategy/replay_func.py @@ -21,7 +21,7 @@ from .search_strategy import SearchStrategy -@register_object("meta_schedule.ReplayFunc") +@register_object("tvm.meta_schedule.ReplayFunc") class ReplayFunc(SearchStrategy): """ Replay Func Search Strategy is a search strategy that generates measure candidates by diff --git a/python/tvm/meta_schedule/search_strategy/replay_trace.py b/python/tvm/meta_schedule/search_strategy/replay_trace.py index e04a440da68a..c26bb5fe3c86 100644 --- a/python/tvm/meta_schedule/search_strategy/replay_trace.py +++ b/python/tvm/meta_schedule/search_strategy/replay_trace.py @@ -21,7 +21,7 @@ from .search_strategy import SearchStrategy -@register_object("meta_schedule.ReplayTrace") +@register_object("tvm.meta_schedule.ReplayTrace") class ReplayTrace(SearchStrategy): """ Replay Trace Search Strategy is a search strategy that always replays the trace by removing its diff --git a/python/tvm/meta_schedule/search_strategy/search_strategy.py b/python/tvm/meta_schedule/search_strategy/search_strategy.py index cfb45dafdeb2..d51028289ddd 100644 --- a/python/tvm/meta_schedule/search_strategy/search_strategy.py +++ b/python/tvm/meta_schedule/search_strategy/search_strategy.py @@ -38,7 +38,7 @@ from ..tune_context import TuneContext -@register_object("meta_schedule.MeasureCandidate") +@register_object("tvm.meta_schedule.MeasureCandidate") class MeasureCandidate(Object): """Measure candidate class. @@ -74,7 +74,7 @@ def __init__( ) -@register_object("meta_schedule.SearchStrategy") +@register_object("tvm.meta_schedule.SearchStrategy") class SearchStrategy(Object): """Search strategy is the class that generates the measure candidates.""" @@ -219,7 +219,7 @@ def create( # pylint: disable=keyword-arg-before-vararg create = SearchStrategy.create # pylint: disable=invalid-name -@register_object("meta_schedule.PySearchStrategy") +@register_object("tvm.meta_schedule.PySearchStrategy") class _PySearchStrategy(SearchStrategy): """ A TVM object search strategy to support customization on the python side. diff --git a/python/tvm/meta_schedule/space_generator/post_order_apply.py b/python/tvm/meta_schedule/space_generator/post_order_apply.py index 45b81bdf3e59..9e7b2ea06122 100644 --- a/python/tvm/meta_schedule/space_generator/post_order_apply.py +++ b/python/tvm/meta_schedule/space_generator/post_order_apply.py @@ -27,7 +27,7 @@ ) -@register_object("meta_schedule.PostOrderApply") +@register_object("tvm.meta_schedule.PostOrderApply") class PostOrderApply(SpaceGenerator): """ PostOrderApply is the design space generator that generates design spaces by applying schedule diff --git a/python/tvm/meta_schedule/space_generator/schedule_fn.py b/python/tvm/meta_schedule/space_generator/schedule_fn.py index d01cd7fdcbd1..8fe4eef1e66b 100644 --- a/python/tvm/meta_schedule/space_generator/schedule_fn.py +++ b/python/tvm/meta_schedule/space_generator/schedule_fn.py @@ -27,7 +27,7 @@ ) -@register_object("meta_schedule.ScheduleFn") +@register_object("tvm.meta_schedule.ScheduleFn") class ScheduleFn(SpaceGenerator): """Create a design space generator with customized schedule function. The schedule function can have the following signatures: diff --git a/python/tvm/meta_schedule/space_generator/space_generator.py b/python/tvm/meta_schedule/space_generator/space_generator.py index 35f9e2236764..5b1feb1c3fa7 100644 --- a/python/tvm/meta_schedule/space_generator/space_generator.py +++ b/python/tvm/meta_schedule/space_generator/space_generator.py @@ -38,7 +38,7 @@ from ..tune_context import TuneContext -@register_object("meta_schedule.SpaceGenerator") +@register_object("tvm.meta_schedule.SpaceGenerator") class SpaceGenerator(Object): """The abstract design space generator interface.""" @@ -184,7 +184,7 @@ def _normalize_rules( return sch_rules, postprocs, mutator_probs # type: ignore -@register_object("meta_schedule.PySpaceGenerator") +@register_object("tvm.meta_schedule.PySpaceGenerator") class _PySpaceGenerator(SpaceGenerator): """ A TVM object space generator to support customization on the python side. diff --git a/python/tvm/meta_schedule/space_generator/space_generator_union.py b/python/tvm/meta_schedule/space_generator/space_generator_union.py index 0b8ceb453116..8c863e7fe453 100644 --- a/python/tvm/meta_schedule/space_generator/space_generator_union.py +++ b/python/tvm/meta_schedule/space_generator/space_generator_union.py @@ -29,7 +29,7 @@ ) -@register_object("meta_schedule.SpaceGeneratorUnion") +@register_object("tvm.meta_schedule.SpaceGeneratorUnion") class SpaceGeneratorUnion(SpaceGenerator): """Union of design space generators.""" diff --git a/python/tvm/meta_schedule/task_scheduler/gradient_based.py b/python/tvm/meta_schedule/task_scheduler/gradient_based.py index 18d7e2be614a..7373596dbaea 100644 --- a/python/tvm/meta_schedule/task_scheduler/gradient_based.py +++ b/python/tvm/meta_schedule/task_scheduler/gradient_based.py @@ -24,7 +24,7 @@ logger = get_logger(__name__) # pylint: disable=invalid-name -@register_object("meta_schedule.GradientBased") +@register_object("tvm.meta_schedule.GradientBased") class GradientBased(TaskScheduler): """Gradient Based Task Scheduler""" diff --git a/python/tvm/meta_schedule/task_scheduler/round_robin.py b/python/tvm/meta_schedule/task_scheduler/round_robin.py index 78504608f9ab..4d7ffe6df04d 100644 --- a/python/tvm/meta_schedule/task_scheduler/round_robin.py +++ b/python/tvm/meta_schedule/task_scheduler/round_robin.py @@ -24,7 +24,7 @@ logger = get_logger(__name__) # pylint: disable=invalid-name -@register_object("meta_schedule.RoundRobin") +@register_object("tvm.meta_schedule.RoundRobin") class RoundRobin(TaskScheduler): """Round Robin Task Scheduler""" diff --git a/python/tvm/meta_schedule/task_scheduler/task_scheduler.py b/python/tvm/meta_schedule/task_scheduler/task_scheduler.py index 4513f6081560..4aaef0b78fa5 100644 --- a/python/tvm/meta_schedule/task_scheduler/task_scheduler.py +++ b/python/tvm/meta_schedule/task_scheduler/task_scheduler.py @@ -38,7 +38,7 @@ logger = get_logger(__name__) # pylint: disable=invalid-name -@register_object("meta_schedule.TaskRecord") +@register_object("tvm.meta_schedule.TaskRecord") class TaskRecord(Object): """The running record of a task.""" @@ -53,7 +53,7 @@ class TaskRecord(Object): runner_results: List[RunnerResult] -@register_object("meta_schedule.TaskScheduler") +@register_object("tvm.meta_schedule.TaskScheduler") class TaskScheduler(Object): """The abstract task scheduler interface.""" @@ -189,7 +189,7 @@ def create( # pylint: disable=keyword-arg-before-vararg create = TaskScheduler.create # pylint: disable=invalid-name -@register_object("meta_schedule.PyTaskScheduler") +@register_object("tvm.meta_schedule.PyTaskScheduler") class _PyTaskScheduler(TaskScheduler): """ A TVM object task scheduler to support customization on the python side. diff --git a/python/tvm/meta_schedule/testing/validate_database.py b/python/tvm/meta_schedule/testing/validate_database.py index 8b5a87f61932..c6218d9347e0 100644 --- a/python/tvm/meta_schedule/testing/validate_database.py +++ b/python/tvm/meta_schedule/testing/validate_database.py @@ -475,7 +475,9 @@ def f_with_args_run_evaluator_common( repeat=evaluator_config.repeat, min_repeat_ms=evaluator_config.min_repeat_ms, f_preproc=( - "cache_flush_cpu_non_first_arg" if evaluator_config.enable_cpu_cache_flush else "" + "tvm.cache_flush_cpu_non_first_arg" + if evaluator_config.enable_cpu_cache_flush + else "" ), ) diff --git a/python/tvm/meta_schedule/tune_context.py b/python/tvm/meta_schedule/tune_context.py index 35a8d468a75c..3459dae9bf4c 100644 --- a/python/tvm/meta_schedule/tune_context.py +++ b/python/tvm/meta_schedule/tune_context.py @@ -58,7 +58,7 @@ def _normalize_mod(mod: Union[PrimFunc, IRModule]) -> IRModule: return mod -@register_object("meta_schedule.TuneContext") +@register_object("tvm.meta_schedule.TuneContext") class TuneContext(Object): """The tune context class is designed to contain all resources for a tuning task. diff --git a/python/tvm/meta_schedule/utils.py b/python/tvm/meta_schedule/utils.py index 385ddc30f9ab..be5a7a5a92ea 100644 --- a/python/tvm/meta_schedule/utils.py +++ b/python/tvm/meta_schedule/utils.py @@ -47,7 +47,7 @@ def derived_object(cls: type) -> type: ------- .. code-block:: python - @register_object("meta_schedule.PyRunner") + @register_object("tvm.meta_schedule.PyRunner") class _PyRunner(meta_schedule.Runner): def __init__(self, f_run: Callable = None): self.__init_handle_by_constructor__(_ffi_api.RunnerPyRunner, f_run) @@ -163,7 +163,7 @@ def __setattr__(self, name, value): return TVMDerivedObject -@register_global_func("meta_schedule.cpu_count") +@register_global_func("tvm.meta_schedule.cpu_count") def _cpu_count_impl(logical: bool = True) -> int: """Return the number of logical or physical CPUs in the system @@ -219,7 +219,7 @@ def cpu_count(logical: bool = True) -> int: return _cpu_count_impl(logical) -@register_global_func("meta_schedule.using_ipython") +@register_global_func("tvm.meta_schedule.using_ipython") def _using_ipython() -> bool: """Return whether the current process is running in an IPython shell. @@ -234,7 +234,7 @@ def _using_ipython() -> bool: return False -@register_global_func("meta_schedule.print_interactive_table") +@register_global_func("tvm.meta_schedule.print_interactive_table") def print_interactive_table(data: str) -> None: """Print the dataframe interactive table in notebook. @@ -327,7 +327,7 @@ def get_global_func_on_rpc_session( return result -@register_global_func("meta_schedule.remove_build_dir") +@register_global_func("tvm.meta_schedule.remove_build_dir") def remove_build_dir(artifact_path: str) -> None: """Clean up the build directory""" shutil.rmtree(os.path.dirname(artifact_path)) @@ -374,7 +374,7 @@ def shash2hex(mod: IRModule) -> str: result : str The structural hash of the module. """ - func = get_global_func("meta_schedule._SHash2Hex") + func = get_global_func("tvm.meta_schedule._SHash2Hex") return str(func(mod)) diff --git a/python/tvm/relax/_ffi_api.py b/python/tvm/relax/_ffi_api.py index c5e98a22eaaf..380e29cf6b1e 100644 --- a/python/tvm/relax/_ffi_api.py +++ b/python/tvm/relax/_ffi_api.py @@ -17,4 +17,4 @@ """FFI API for Relax.""" import tvm_ffi -tvm_ffi.init_ffi_api("relax", __name__) +tvm_ffi.init_ffi_api("tvm.relax", __name__) diff --git a/python/tvm/relax/analysis/_ffi_api.py b/python/tvm/relax/analysis/_ffi_api.py index 0a230fbd8bb6..50bf55e9c9f9 100644 --- a/python/tvm/relax/analysis/_ffi_api.py +++ b/python/tvm/relax/analysis/_ffi_api.py @@ -16,4 +16,4 @@ """FFI APIs""" import tvm_ffi -tvm_ffi.init_ffi_api("relax.analysis", __name__) +tvm_ffi.init_ffi_api("tvm.relax.analysis", __name__) diff --git a/python/tvm/relax/backend/_ffi_api.py b/python/tvm/relax/backend/_ffi_api.py index 97a999788b93..02bc820ca550 100644 --- a/python/tvm/relax/backend/_ffi_api.py +++ b/python/tvm/relax/backend/_ffi_api.py @@ -18,4 +18,4 @@ import tvm_ffi -tvm_ffi.init_ffi_api("relax.backend", __name__) +tvm_ffi.init_ffi_api("tvm.relax.backend", __name__) diff --git a/python/tvm/relax/backend/adreno/clml.py b/python/tvm/relax/backend/adreno/clml.py index 5b230c159970..08d2ec2ae354 100644 --- a/python/tvm/relax/backend/adreno/clml.py +++ b/python/tvm/relax/backend/adreno/clml.py @@ -95,7 +95,7 @@ def is_clml_runtime_enabled(): ret: bool True if present, False if not. """ - check_enabled = tvm.get_global_func("relax.op.is_openclml_runtime_enabled", True) + check_enabled = tvm.get_global_func("tvm.relax.op.is_openclml_runtime_enabled", True) if check_enabled: return check_enabled() return False diff --git a/python/tvm/relax/backend/adreno/transform/_ffi_api.py b/python/tvm/relax/backend/adreno/transform/_ffi_api.py index d665ba02a70e..8286c99fb96a 100644 --- a/python/tvm/relax/backend/adreno/transform/_ffi_api.py +++ b/python/tvm/relax/backend/adreno/transform/_ffi_api.py @@ -16,4 +16,4 @@ """FFI APIs for Adreno transform""" import tvm.ffi -tvm.ffi.init_ffi_api("relax.backend.adreno.transform", __name__) +tvm.ffi.init_ffi_api("tvm.relax.backend.adreno.transform", __name__) diff --git a/python/tvm/relax/backend/cuda/cutlass.py b/python/tvm/relax/backend/cuda/cutlass.py index 80979bbe7e25..91a8adf38656 100644 --- a/python/tvm/relax/backend/cuda/cutlass.py +++ b/python/tvm/relax/backend/cuda/cutlass.py @@ -243,7 +243,7 @@ def _check_decode_matmul(ctx): if ( isinstance(packed_weight, Call) and isinstance(packed_weight.args[0], ExternFunc) - and packed_weight.args[0].global_symbol != "cutlass.ft_preprocess_weight" + and packed_weight.args[0].global_symbol != "tvm.cutlass.ft_preprocess_weight" ): return False diff --git a/python/tvm/relax/backend/dispatch_sort_scan.py b/python/tvm/relax/backend/dispatch_sort_scan.py index 1dac0bf230f3..53676778962b 100644 --- a/python/tvm/relax/backend/dispatch_sort_scan.py +++ b/python/tvm/relax/backend/dispatch_sort_scan.py @@ -167,7 +167,7 @@ def visit_call_(self, call: relax.Call) -> relax.Expr: out_dtype = out_dtype or in_dtype cumsum_2d_shape = relax.ShapeExpr([dim, shape[-1]]) reshape = relax.call_pure_packed( - "vm.builtin.reshape", + "tvm.vm.builtin.reshape", call.args[0], cumsum_2d_shape, sinfo_args=relax.TensorStructInfo(cumsum_2d_shape, out_dtype), @@ -182,7 +182,7 @@ def visit_call_(self, call: relax.Call) -> relax.Expr: out_sinfo=relax.TensorStructInfo(cumsum_2d_shape, out_dtype), ) return relax.call_pure_packed( - "vm.builtin.reshape", + "tvm.vm.builtin.reshape", cumsum, shape, sinfo_args=call.struct_info, diff --git a/python/tvm/relax/backend/metal/coreml.py b/python/tvm/relax/backend/metal/coreml.py index dfc891dc1f31..e6eb431a6468 100644 --- a/python/tvm/relax/backend/metal/coreml.py +++ b/python/tvm/relax/backend/metal/coreml.py @@ -320,7 +320,7 @@ def __init__(self, model_name, function): self.model_inputs_ = [] self.buf_idx_ = 0 - getter = tvm.get_global_func("relax.analysis.get_var2val") + getter = tvm.get_global_func("tvm.relax.analysis.get_var2val") assert getter, "Cannot find `relax.analysis.get_var2val` function." self.var2val = getter(function) @@ -463,7 +463,7 @@ def compile(self, out_dir): compile_coreml(model, self.model_name, out_dir) -@tvm_ffi.register_global_func("relax.ext.coreml") +@tvm_ffi.register_global_func("tvm.relax.ext.coreml") def coreml_compiler(funcs, options, constant_names): """ Create a CoreML runtime from a Relax module. diff --git a/python/tvm/relax/base_py_module.py b/python/tvm/relax/base_py_module.py index 41ef44fb300b..9245218bceff 100644 --- a/python/tvm/relax/base_py_module.py +++ b/python/tvm/relax/base_py_module.py @@ -55,7 +55,7 @@ class BasePyModule: def __del__(self): """Clean up registered Python functions on module destruction.""" try: - clear_func = tvm.get_global_func("vm.builtin.clear_py_func_registry") + clear_func = tvm.get_global_func("tvm.vm.builtin.clear_py_func_registry") clear_func() except (ValueError, AttributeError): pass @@ -199,7 +199,7 @@ def _register_python_functions(self): return try: - register_py_func = tvm.get_global_func("vm.builtin.register_py_func") + register_py_func = tvm.get_global_func("tvm.vm.builtin.register_py_func") except ValueError: return diff --git a/python/tvm/relax/binding_rewrite.py b/python/tvm/relax/binding_rewrite.py index 077f8feebb90..5c0151e7fb28 100644 --- a/python/tvm/relax/binding_rewrite.py +++ b/python/tvm/relax/binding_rewrite.py @@ -26,7 +26,7 @@ from . import _ffi_api -@tvm_ffi.register_object("relax.DataflowBlockRewrite") +@tvm_ffi.register_object("tvm.relax.DataflowBlockRewrite") class DataflowBlockRewrite(Object): """ A binding/statement-level dataflow block rewriter. diff --git a/python/tvm/relax/block_builder.py b/python/tvm/relax/block_builder.py index 8c777eb53756..af2315eb1091 100644 --- a/python/tvm/relax/block_builder.py +++ b/python/tvm/relax/block_builder.py @@ -101,7 +101,7 @@ def __exit__(self, ptype, value, trace): self._bb.end_scope() -@tvm_ffi.register_object("relax.BlockBuilder") +@tvm_ffi.register_object("tvm.relax.BlockBuilder") class BlockBuilder(Object): """A builder to build Relax IR for testing and dev. diff --git a/python/tvm/relax/distributed/_ffi_api.py b/python/tvm/relax/distributed/_ffi_api.py index 71185a1276da..6208307b799c 100644 --- a/python/tvm/relax/distributed/_ffi_api.py +++ b/python/tvm/relax/distributed/_ffi_api.py @@ -17,4 +17,4 @@ """FFI APIs for tvm.relax.distributed""" import tvm_ffi -tvm_ffi.init_ffi_api("relax.distributed", __name__) +tvm_ffi.init_ffi_api("tvm.relax.distributed", __name__) diff --git a/python/tvm/relax/distributed/global_info.py b/python/tvm/relax/distributed/global_info.py index 34d3f2da4720..d096dfde824d 100644 --- a/python/tvm/relax/distributed/global_info.py +++ b/python/tvm/relax/distributed/global_info.py @@ -26,7 +26,7 @@ from . import _ffi_api as ffi -@tvm_ffi.register_object("relax.distributed.DeviceMesh") +@tvm_ffi.register_object("tvm.relax.distributed.DeviceMesh") class DeviceMesh(GlobalInfo): """Device mesh express a view of topology of devices, represented by an n-d matrix of device ids. diff --git a/python/tvm/relax/distributed/struct_info.py b/python/tvm/relax/distributed/struct_info.py index 554c83e47490..204935fd75bb 100644 --- a/python/tvm/relax/distributed/struct_info.py +++ b/python/tvm/relax/distributed/struct_info.py @@ -33,7 +33,7 @@ class PlacementSpecKind(enum.IntEnum): kReplica = 1 -@tvm_ffi.register_object("relax.distributed.PlacementSpec") +@tvm_ffi.register_object("tvm.relax.distributed.PlacementSpec") class PlacementSpec(Object): """Describes how data is distributed in one dimension of the device mesh @@ -80,7 +80,7 @@ def replica() -> "PlacementSpec": return _ffi_api.Replica() -@tvm_ffi.register_object("relax.distributed.Placement") +@tvm_ffi.register_object("tvm.relax.distributed.Placement") class Placement(Object): """Describes how data is distributed in each dimension of the device mesh @@ -110,7 +110,7 @@ def from_text(text: str) -> "Placement": return _ffi_api.PlacementFromText(text) -@tvm_ffi.register_object("relax.DTensorStructInfo") +@tvm_ffi.register_object("tvm.relax.DTensorStructInfo") class DTensorStructInfo(StructInfo): """StructInfo of a Distributed Tensor value. diff --git a/python/tvm/relax/distributed/transform/_ffi_api.py b/python/tvm/relax/distributed/transform/_ffi_api.py index 35808cc2bc93..c0fcc378d44c 100644 --- a/python/tvm/relax/distributed/transform/_ffi_api.py +++ b/python/tvm/relax/distributed/transform/_ffi_api.py @@ -16,4 +16,4 @@ """FFI APIs for tvm.relax.distributed.transform""" import tvm_ffi -tvm_ffi.init_ffi_api("relax.distributed.transform", __name__) +tvm_ffi.init_ffi_api("tvm.relax.distributed.transform", __name__) diff --git a/python/tvm/relax/dpl/_ffi.py b/python/tvm/relax/dpl/_ffi.py index b03e5800e8fc..2f0b5800b5c4 100644 --- a/python/tvm/relax/dpl/_ffi.py +++ b/python/tvm/relax/dpl/_ffi.py @@ -17,4 +17,4 @@ """DataFlow Pattern Language FFI bindings.""" import tvm_ffi -tvm_ffi.init_ffi_api("relax.dpl", __name__) +tvm_ffi.init_ffi_api("tvm.relax.dpl", __name__) diff --git a/python/tvm/relax/dpl/pattern.py b/python/tvm/relax/dpl/pattern.py index ef7516f31f46..ba636d8809a8 100644 --- a/python/tvm/relax/dpl/pattern.py +++ b/python/tvm/relax/dpl/pattern.py @@ -46,7 +46,9 @@ def register_df_node(type_key=None): The type key of the node """ if not isinstance(type_key, str): - return tvm_ffi.register_object("relax.dpl." + type_key.__name__)(type_key) + return tvm_ffi.register_object("tvm.relax.dpl." + type_key.__name__)(type_key) + if not type_key.startswith("tvm."): + type_key = "tvm." + type_key return tvm_ffi.register_object(type_key) @@ -120,7 +122,7 @@ def has_attr(self, attrs: Dict[str, Object]) -> "AttrPattern": result: AttrPattern The resulting AttrPattern """ - attrs = make_node("ir.DictAttrs", **attrs) + attrs = make_node("tvm.ir.DictAttrs", **attrs) return AttrPattern(self, attrs) def has_struct_info(self, struct_info: "StructInfo") -> "StructInfoPattern": diff --git a/python/tvm/relax/dpl/rewrite.py b/python/tvm/relax/dpl/rewrite.py index 6dd730e83147..9d4e1585e635 100644 --- a/python/tvm/relax/dpl/rewrite.py +++ b/python/tvm/relax/dpl/rewrite.py @@ -28,7 +28,7 @@ from . import _ffi as ffi -@register_object("relax.dpl.PatternMatchingRewriter") +@register_object("tvm.relax.dpl.PatternMatchingRewriter") class PatternMatchingRewriter(Object): """A pattern-matching rewriter for Relax""" @@ -171,7 +171,7 @@ def __or__(self, other: "PatternMatchingRewriter") -> "PatternMatchingRewriter": return OrRewriter(self, other) -@register_object("relax.dpl.ExprPatternRewriter") +@register_object("tvm.relax.dpl.ExprPatternRewriter") class ExprPatternRewriter(PatternMatchingRewriter): def __init__(self, pattern, func): self.__init_handle_by_constructor__( @@ -181,7 +181,7 @@ def __init__(self, pattern, func): ) # type: ignore -@register_object("relax.dpl.OrRewriter") +@register_object("tvm.relax.dpl.OrRewriter") class OrRewriter(PatternMatchingRewriter): def __init__(self, lhs, rhs): self.__init_handle_by_constructor__( @@ -191,7 +191,7 @@ def __init__(self, lhs, rhs): ) # type: ignore -@register_object("relax.dpl.TupleRewriter") +@register_object("tvm.relax.dpl.TupleRewriter") class TupleRewriter(PatternMatchingRewriter): def __init__(self, patterns, func): self.__init_handle_by_constructor__( diff --git a/python/tvm/relax/exec_builder.py b/python/tvm/relax/exec_builder.py index 50d6c0679eca..6251a19682a2 100644 --- a/python/tvm/relax/exec_builder.py +++ b/python/tvm/relax/exec_builder.py @@ -56,7 +56,7 @@ def __exit__(self, ptype, value, trace): self.exit_callback() -@tvm_ffi.register_object("relax.ExecBuilder") +@tvm_ffi.register_object("tvm.relax.ExecBuilder") class ExecBuilder(tvm_ffi.core.Object): """A builder to emit instructions and build executable for the virtual machine.""" diff --git a/python/tvm/relax/expr.py b/python/tvm/relax/expr.py index e9bc9a7a3e98..de3a1aa5c39d 100644 --- a/python/tvm/relax/expr.py +++ b/python/tvm/relax/expr.py @@ -42,7 +42,7 @@ GlobalVar = Union[tvm.ir.GlobalVar] -@tvm_ffi.register_object("relax.Id") +@tvm_ffi.register_object("tvm.relax.Id") class Id(Object): """Unique identifier(name) used in Var. Guaranteed to be stable across all passes. @@ -56,7 +56,7 @@ def __init__(self): # NOTE: place base struct info in expr to avoid cyclic dep # from expr to struct info. -@tvm_ffi.register_object("ir.StructInfo") +@tvm_ffi.register_object("tvm.ir.StructInfo") class StructInfo(Node, Scriptable): """The base class of all StructInfo. @@ -527,7 +527,7 @@ def __getitem__(self, axis: Union[int, PrimExpr, Expr]) -> Expr: return tvm.relax.Call(op, [self.tensor, axis]) -@tvm_ffi.register_object("relax.expr.Call") +@tvm_ffi.register_object("tvm.relax.expr.Call") class Call(ExprWithOp): """Function call node in Relax. @@ -576,7 +576,7 @@ def __init__( ) -@tvm_ffi.register_object("relax.expr.If") +@tvm_ffi.register_object("tvm.relax.expr.If") class If(ExprWithOp): """A conditional expression in Relax. @@ -608,7 +608,7 @@ def __init__( ) -@tvm_ffi.register_object("relax.expr.Tuple") +@tvm_ffi.register_object("tvm.relax.expr.Tuple") class Tuple(ExprWithOp): """Tuple expression that groups several fields together. @@ -643,7 +643,7 @@ def __len__(self) -> int: return len(self.fields) -@tvm_ffi.register_object("relax.expr.TupleGetItem") +@tvm_ffi.register_object("tvm.relax.expr.TupleGetItem") class TupleGetItem(ExprWithOp): """Get index-th item from a tuple. @@ -669,7 +669,7 @@ def __init__(self, tuple_value: Expr, index: int, span: Optional[Span] = None): ) -@tvm_ffi.register_object("relax.expr.ShapeExpr") +@tvm_ffi.register_object("tvm.relax.expr.ShapeExpr") class ShapeExpr(ExprWithOp): """A shape expression which allows users to construct a shape containing PrimExpr. @@ -707,7 +707,7 @@ def make_shape(shape: Union[List[Any], typing.Tuple[Any, ...]]) -> ShapeExpr: raise ValueError("Wrong type") -@tvm_ffi.register_object("relax.expr.Constant") +@tvm_ffi.register_object("tvm.relax.expr.Constant") class Constant(ExprWithOp): """Constant Tensor @@ -741,7 +741,7 @@ def __init__( ) -@tvm_ffi.register_object("relax.expr.Var") +@tvm_ffi.register_object("tvm.relax.expr.Var") class Var(ExprWithOp): """The variable class for all Relax bindings. @@ -788,7 +788,7 @@ def name_hint(self) -> str: return name -@tvm_ffi.register_object("relax.expr.DataflowVar") +@tvm_ffi.register_object("tvm.relax.expr.DataflowVar") class DataflowVar(Var): """A sub-type of the variable node used to mark dataflow variables from normal visible "function local" bindings. @@ -837,7 +837,7 @@ def __init__( ) -@tvm_ffi.register_object("relax.expr.PrimValue") +@tvm_ffi.register_object("tvm.relax.expr.PrimValue") class PrimValue(Expr, Scriptable): """The prim expr representing the value.""" @@ -849,7 +849,7 @@ def __init__(self, value: Union[PrimExpr, int], span: Optional[Span] = None) -> self.__init_handle_by_constructor__(_ffi_api.PrimValue, value, span) # type: ignore -@tvm_ffi.register_object("relax.expr.StringImm") +@tvm_ffi.register_object("tvm.relax.expr.StringImm") class StringImm(Expr, Scriptable): """Represent a string literal constant.""" @@ -860,7 +860,7 @@ def __init__(self, value: str, span: Optional[Span] = None) -> None: self.__init_handle_by_constructor__(_ffi_api.StringImm, value, span) # type: ignore -@tvm_ffi.register_object("relax.expr.DataTypeImm") +@tvm_ffi.register_object("tvm.relax.expr.DataTypeImm") class DataTypeImm(Expr, Scriptable): """Represent a data type constant.""" @@ -871,7 +871,7 @@ def __init__(self, value: Union[DataType, str], span: Optional[Span] = None) -> self.__init_handle_by_constructor__(_ffi_api.DataTypeImm, value, span) # type: ignore -@tvm_ffi.register_object("relax.expr.Binding") +@tvm_ffi.register_object("tvm.relax.expr.Binding") class Binding(Node, Scriptable): """The base class of a binding in Relax.""" @@ -879,7 +879,7 @@ class Binding(Node, Scriptable): span: Optional[Span] -@tvm_ffi.register_object("relax.expr.MatchCast") +@tvm_ffi.register_object("tvm.relax.expr.MatchCast") class MatchCast(Binding): """Runtime-match the value to the struct info. @@ -911,7 +911,7 @@ def __init__( ) -@tvm_ffi.register_object("relax.expr.VarBinding") +@tvm_ffi.register_object("tvm.relax.expr.VarBinding") class VarBinding(Binding): """Variable binding, bind he variable of the lhs with the rhs. @@ -933,7 +933,7 @@ def __init__(self, var: Var, value: Expr, span: Optional[Span] = None) -> None: self.__init_handle_by_constructor__(_ffi_api.VarBinding, var, value, span) # type: ignore -@tvm_ffi.register_object("relax.expr.BindingBlock") +@tvm_ffi.register_object("tvm.relax.expr.BindingBlock") class BindingBlock(Node, Scriptable): """base class of binding block, bindings inside can be impure (with side effect or control flow)""" @@ -945,7 +945,7 @@ def __init__(self, bindings: List[Binding], span: Optional[Span] = None) -> None self.__init_handle_by_constructor__(_ffi_api.BindingBlock, bindings, span) # type: ignore -@tvm_ffi.register_object("relax.expr.DataflowBlock") +@tvm_ffi.register_object("tvm.relax.expr.DataflowBlock") class DataflowBlock(BindingBlock): """dataflow block, bindings inside are pure (no side effect and no control flow)""" @@ -957,7 +957,7 @@ def __init__(self, bindings: List[Binding], span: Optional[Span] = None) -> None self.__init_handle_by_constructor__(_ffi_api.DataflowBlock, bindings, span) # type: ignore -@tvm_ffi.register_object("relax.expr.SeqExpr") +@tvm_ffi.register_object("tvm.relax.expr.SeqExpr") class SeqExpr(ExprWithOp): """A sequence of binding blocks followed by an expression.""" @@ -969,7 +969,7 @@ def __init__(self, blocks: List[BindingBlock], body: Expr, span: Optional[Span] self.__init_handle_by_constructor__(_ffi_api.SeqExpr, blocks, body, span) # type: ignore -@tvm_ffi.register_object("relax.expr.Function") +@tvm_ffi.register_object("tvm.relax.expr.Function") class Function(BaseFunc, Scriptable): """A Relax function.""" @@ -1108,7 +1108,7 @@ def inline_functions( return _ffi_api.FunctionInlineFunctions(self, function_map) # type: ignore -@tvm_ffi.register_object("relax.expr.ExternFunc") +@tvm_ffi.register_object("tvm.relax.expr.ExternFunc") class ExternFunc(BaseFunc, ExprWithOp): """extern function, which represents a PackedFunc.""" @@ -1179,7 +1179,7 @@ def const( return Constant(value) -@tvm_ffi.register_object("relax.TEPlaceholderOp") +@tvm_ffi.register_object("tvm.relax.TEPlaceholderOp") class TEPlaceholderOp(tvm.te.tensor.Operation): """The placeholder op that represents a relax expression.""" diff --git a/python/tvm/relax/expr_functor.py b/python/tvm/relax/expr_functor.py index e5e77251c66d..2f18c09baa62 100644 --- a/python/tvm/relax/expr_functor.py +++ b/python/tvm/relax/expr_functor.py @@ -261,7 +261,7 @@ def visit_var_def(self, var: Var): raise TypeError("Invalid type: {0}".format(type(var))) -@tvm_ffi.register_object("expr_functor.PyExprVisitor") +@tvm_ffi.register_object("tvm.expr_functor.PyExprVisitor") class _PyExprVisitor(tvm_ffi.core.Object): """ A TVM object to support customization of ExprVisitor on the python side. @@ -781,7 +781,7 @@ def visit_span(self, span: Span) -> None: return _ffi_api.ExprVisitorVisitSpan(self._outer(), span) # type: ignore -@tvm_ffi.register_object("expr_functor.PyExprMutator") +@tvm_ffi.register_object("tvm.expr_functor.PyExprMutator") class _PyExprMutator(Object): """ A TVM object to support customization of ExprMutator on the python side. diff --git a/python/tvm/relax/frontend/nn/llm/kv_cache.py b/python/tvm/relax/frontend/nn/llm/kv_cache.py index e94d5c42957b..bbc31a4ec24e 100644 --- a/python/tvm/relax/frontend/nn/llm/kv_cache.py +++ b/python/tvm/relax/frontend/nn/llm/kv_cache.py @@ -131,7 +131,7 @@ def attention_with_fused_qkv( return Tensor( _expr=rx.BlockBuilder.current().emit( rx.call_dps_packed( - "vm.builtin.attention_kv_cache_attention_with_fused_qkv", + "tvm.vm.builtin.attention_kv_cache_attention_with_fused_qkv", [ self._expr, rx.PrimValue(layer_id), # type: ignore[arg-type] @@ -161,7 +161,7 @@ def self_attention( # pylint: disable=too-many-locals bb = rx.BlockBuilder.current() attn_results = bb.emit( rx.call_dps_packed( - "vm.builtin.attention_kv_cache_self_attention", + "tvm.vm.builtin.attention_kv_cache_self_attention", [ self._expr, rx.PrimValue(layer_id), # type: ignore[arg-type] @@ -196,7 +196,7 @@ def cross_attention( bb = rx.BlockBuilder.current() attn_results = bb.emit( rx.call_dps_packed( - "vm.builtin.attention_kv_cache_cross_attention", + "tvm.vm.builtin.attention_kv_cache_cross_attention", [ self._expr, rx.PrimValue(layer_id), # type: ignore[arg-type] @@ -222,7 +222,7 @@ def append_mla_kv(self, layer_id: int, kv: Tensor) -> "PagedKVCache": kv = kv.reshape(b * s, d_qk) return PagedKVCache( _expr=rx.call_pure_packed( - "vm.builtin.attention_kv_cache_append_mla_kv", + "tvm.vm.builtin.attention_kv_cache_append_mla_kv", self._expr, rx.PrimValue(layer_id), # type: ignore[arg-type] kv._expr, @@ -250,7 +250,7 @@ def merge_attn_output_inplace( bb = rx.BlockBuilder.current() merge_results = bb.emit( rx.call_pure_packed( - "vm.builtin.attention_kv_cache_merge_attn_output_inplace", + "tvm.vm.builtin.attention_kv_cache_merge_attn_output_inplace", self._expr, o_self_attn._expr, lse_self_attn._expr, @@ -287,7 +287,7 @@ def get_query_positions(self, total_length: tir.PrimExpr) -> Tensor: return Tensor( _expr=rx.BlockBuilder.current().emit( rx.call_pure_packed( - "vm.builtin.attention_kv_cache_get_query_positions", + "tvm.vm.builtin.attention_kv_cache_get_query_positions", self._expr, sinfo_args=rx.TensorStructInfo((total_length,), "int32"), ) @@ -477,7 +477,7 @@ def __init__( # pylint: disable=too-many-locals ] super().__init__( _expr=rx.call_pure_packed( - "vm.builtin.paged_attention_kv_cache_create", + "tvm.vm.builtin.paged_attention_kv_cache_create", *args, sinfo_args=rx.ObjectStructInfo(), ), @@ -665,7 +665,7 @@ def __init__( # pylint: disable=too-many-locals super().__init__( _expr=rx.call_pure_packed( - "vm.builtin.paged_attention_kv_cache_create", + "tvm.vm.builtin.paged_attention_kv_cache_create", *args, sinfo_args=rx.ObjectStructInfo(), ), diff --git a/python/tvm/relax/frontend/nn/modules.py b/python/tvm/relax/frontend/nn/modules.py index 5ca5f72787b7..512c0375dae6 100644 --- a/python/tvm/relax/frontend/nn/modules.py +++ b/python/tvm/relax/frontend/nn/modules.py @@ -600,7 +600,7 @@ def emit_init(self, name_hint: str, bb: rx.BlockBuilder): # pylint: disable=arg return [ bb.emit( rx.op.call_pure_packed( - "vm.builtin.attention_kv_cache_create", + "tvm.vm.builtin.attention_kv_cache_create", rx.op.zeros(init_shape, self.dtype), init_shape, rx.PrimValue(0), @@ -673,7 +673,7 @@ def view(self, seq_len: tir.Var) -> Tensor: return Tensor( _expr=rx.BlockBuilder.current().emit( rx.op.call_pure_packed( - "vm.builtin.attention_kv_cache_view", + "tvm.vm.builtin.attention_kv_cache_view", self.cache, shape, sinfo_args=rx.TensorStructInfo(shape, self.dtype), @@ -697,7 +697,7 @@ def append(self, new_element: Tensor) -> None: ) self.cache = rx.BlockBuilder.current().emit( rx.op.call_inplace_packed( - "vm.builtin.attention_kv_cache_append", + "tvm.vm.builtin.attention_kv_cache_append", self.cache, new_element._expr, inplace_indices=[0], diff --git a/python/tvm/relax/frontend/nn/op.py b/python/tvm/relax/frontend/nn/op.py index 50d4772d8ca1..aa84398f2c37 100644 --- a/python/tvm/relax/frontend/nn/op.py +++ b/python/tvm/relax/frontend/nn/op.py @@ -2275,7 +2275,7 @@ def debug_func(lineno: str, arg_0, arg_1, ...) -> None: io.effect = BlockBuilder.current().emit( rx.call_pure_packed( - "vm.builtin.invoke_debug_func", + "tvm.vm.builtin.invoke_debug_func", io.effect, rx.StringImm(name), rx.StringImm(_line_info), @@ -2290,7 +2290,7 @@ def print_(tensor: Tensor): """Debug printing a Tensor during runtime.""" filename, line_number = inspect.getframeinfo(inspect.currentframe().f_back)[:2] line_info = f"{filename}:{line_number}" - debug_func("vm.builtin.debug_print", tensor, _line_info=line_info) + debug_func("tvm.vm.builtin.debug_print", tensor, _line_info=line_info) def less(a: Tensor, b: Tensor, name: str = "less") -> Tensor: @@ -2641,7 +2641,7 @@ def multinomial_from_uniform( Notes ----- - For better cpu performance, use 'vm.builtin.multinomial_from_uniform'. + For better cpu performance, use 'tvm.vm.builtin.multinomial_from_uniform'. For accurate results, ensure probabilities are between 0 and 1 and sum to 1. Parameters diff --git a/python/tvm/relax/frontend/onnx/onnx_frontend.py b/python/tvm/relax/frontend/onnx/onnx_frontend.py index 24a4014f840a..bea0dd6d968b 100644 --- a/python/tvm/relax/frontend/onnx/onnx_frontend.py +++ b/python/tvm/relax/frontend/onnx/onnx_frontend.py @@ -1011,17 +1011,17 @@ def _impl_v1(cls, bb, inputs, attr, params): min = float(attr.get("min", -_np.inf)) max = float(attr.get("max", _np.inf)) results = inputs[0] - results = bb.emit_te(topi.maximum, results, min) - results = bb.emit_te(topi.minimum, results, max) + results = bb.emit_te(tvm.topi.maximum, results, min) + results = bb.emit_te(tvm.topi.minimum, results, max) return results @classmethod def _impl_v13(cls, bb, inputs, attr, params): results = inputs[0] if inputs[1] is not None: - results = bb.emit_te(topi.maximum, results, inputs[1]) + results = bb.emit_te(tvm.topi.maximum, results, inputs[1]) if inputs[2] is not None: - results = bb.emit_te(topi.minimum, results, inputs[2]) + results = bb.emit_te(tvm.topi.minimum, results, inputs[2]) return results @@ -2032,7 +2032,7 @@ def _impl_v13(cls, bb, inputs, attr, params): shape_ndim = [dim.value for dim in shape.struct_info.shape.values][0] shape_dataflow_var = bb.emit( relax.Call( - relax.ExternFunc("vm.builtin.tensor_to_shape"), + relax.ExternFunc("tvm.vm.builtin.tensor_to_shape"), [shape], sinfo_args=[relax.ShapeStructInfo(ndim=shape_ndim)], ) diff --git a/python/tvm/relax/op/_ffi_api.py b/python/tvm/relax/op/_ffi_api.py index 867c43e4d85b..076916f41870 100644 --- a/python/tvm/relax/op/_ffi_api.py +++ b/python/tvm/relax/op/_ffi_api.py @@ -16,4 +16,4 @@ """FFI APIs for tvm.relax.op""" import tvm_ffi -tvm_ffi.init_ffi_api("relax.op", __name__) +tvm_ffi.init_ffi_api("tvm.relax.op", __name__) diff --git a/python/tvm/relax/op/base.py b/python/tvm/relax/op/base.py index ffa19fbaa060..c7e2fdfc16fe 100644 --- a/python/tvm/relax/op/base.py +++ b/python/tvm/relax/op/base.py @@ -458,7 +458,7 @@ def render_object(val: tvm.Object) -> str: return str(val) -@tvm.register_global_func("relax.run.shape_to_tensor") +@tvm.register_global_func("tvm.relax.run.shape_to_tensor") def relax_shape_to_tensor(shape_tuple: tvm.runtime.ShapeTuple) -> tvm.runtime.Tensor: """ Takes a ShapeTuple and convert it to Tensor. @@ -471,7 +471,7 @@ def relax_shape_to_tensor(shape_tuple: tvm.runtime.ShapeTuple) -> tvm.runtime.Te return tvm.runtime.tensor([int(v) for v in shape_tuple]) -@tvm.register_global_func("relax.run.print") +@tvm.register_global_func("tvm.relax.run.print") def relax_print(format_str: str, *format_args: tvm.Object) -> None: """ Takes a list of values to print, formats with the given format string. @@ -519,7 +519,7 @@ def print(*values: List[Expr], format: Union[str, Expr] = "") -> Expr: return _ffi_api.print(values, format) # type: ignore # pylint: disable=no-member -@tvm.register_global_func("relax.run.assert_op") +@tvm.register_global_func("tvm.relax.run.assert_op") def relax_assert_op(condition: tvm.Object, format_str: str, *format_args: tvm.Object) -> None: """ A variadic function. The first value serves as the assertion condition: diff --git a/python/tvm/relax/op/builtin/_ffi_api.py b/python/tvm/relax/op/builtin/_ffi_api.py index 0e5955f6e47d..85cd6251cc34 100644 --- a/python/tvm/relax/op/builtin/_ffi_api.py +++ b/python/tvm/relax/op/builtin/_ffi_api.py @@ -16,4 +16,4 @@ """FFI APIs for tvm.relax.op.builtin""" import tvm_ffi -tvm_ffi.init_ffi_api("relax.op.builtin", __name__) +tvm_ffi.init_ffi_api("tvm.relax.op.builtin", __name__) diff --git a/python/tvm/relax/op/ccl/_ffi_api.py b/python/tvm/relax/op/ccl/_ffi_api.py index f0796d3da318..e74fc75fff46 100644 --- a/python/tvm/relax/op/ccl/_ffi_api.py +++ b/python/tvm/relax/op/ccl/_ffi_api.py @@ -17,4 +17,4 @@ """Operators serving for Collective Communications Library (CCL) operators""" import tvm_ffi -tvm_ffi.init_ffi_api("relax.op.ccl", __name__) +tvm_ffi.init_ffi_api("tvm.relax.op.ccl", __name__) diff --git a/python/tvm/relax/op/distributed/_ffi_api.py b/python/tvm/relax/op/distributed/_ffi_api.py index fa1c163794b9..54783d3cee30 100644 --- a/python/tvm/relax/op/distributed/_ffi_api.py +++ b/python/tvm/relax/op/distributed/_ffi_api.py @@ -17,4 +17,4 @@ """FFI APIs for tvm.relax.op.distributed""" import tvm_ffi -tvm_ffi.init_ffi_api("relax.op.dist", __name__) +tvm_ffi.init_ffi_api("tvm.relax.op.dist", __name__) diff --git a/python/tvm/relax/op/grad/_ffi_api.py b/python/tvm/relax/op/grad/_ffi_api.py index 1a8ebb09aa8d..bbf533cf6719 100644 --- a/python/tvm/relax/op/grad/_ffi_api.py +++ b/python/tvm/relax/op/grad/_ffi_api.py @@ -17,4 +17,4 @@ """FFI APIs for tvm.relax.op.grad""" import tvm_ffi -tvm_ffi.init_ffi_api("relax.op.grad", __name__) +tvm_ffi.init_ffi_api("tvm.relax.op.grad", __name__) diff --git a/python/tvm/relax/op/image/_ffi_api.py b/python/tvm/relax/op/image/_ffi_api.py index 8147a155cb76..5c6a2571acff 100644 --- a/python/tvm/relax/op/image/_ffi_api.py +++ b/python/tvm/relax/op/image/_ffi_api.py @@ -17,4 +17,4 @@ """Constructor APIs""" import tvm_ffi -tvm_ffi.init_ffi_api("relax.op.image", __name__) +tvm_ffi.init_ffi_api("tvm.relax.op.image", __name__) diff --git a/python/tvm/relax/op/memory/_ffi_api.py b/python/tvm/relax/op/memory/_ffi_api.py index 05dbf534c7f5..1c61ce98a2dd 100644 --- a/python/tvm/relax/op/memory/_ffi_api.py +++ b/python/tvm/relax/op/memory/_ffi_api.py @@ -16,4 +16,4 @@ """FFI APIs for tvm.relax.op.memory""" import tvm_ffi -tvm_ffi.init_ffi_api("relax.op.memory", __name__) +tvm_ffi.init_ffi_api("tvm.relax.op.memory", __name__) diff --git a/python/tvm/relax/op/nn/_ffi_api.py b/python/tvm/relax/op/nn/_ffi_api.py index d58fa186fc7c..90cc709ce222 100644 --- a/python/tvm/relax/op/nn/_ffi_api.py +++ b/python/tvm/relax/op/nn/_ffi_api.py @@ -17,4 +17,4 @@ """Constructor APIs""" import tvm_ffi -tvm_ffi.init_ffi_api("relax.op.nn", __name__) +tvm_ffi.init_ffi_api("tvm.relax.op.nn", __name__) diff --git a/python/tvm/relax/op/op_attrs.py b/python/tvm/relax/op/op_attrs.py index 229a789a45ef..1019c92508ac 100644 --- a/python/tvm/relax/op/op_attrs.py +++ b/python/tvm/relax/op/op_attrs.py @@ -19,346 +19,346 @@ import tvm_ffi -@tvm_ffi.register_object("relax.attrs.CallTIRWithGradAttrs") +@tvm_ffi.register_object("tvm.relax.attrs.CallTIRWithGradAttrs") class CallTIRWithGradAttrs(Attrs): """Attributes used in call_tir_with_grad operator""" -@tvm_ffi.register_object("relax.attrs.InitAttrs") +@tvm_ffi.register_object("tvm.relax.attrs.InitAttrs") class InitAttrs(Attrs): """Attributes used in full/full_like, ones/ones_like, and zeros/zeros_like operator""" -@tvm_ffi.register_object("relax.attrs.TriluAttrs") +@tvm_ffi.register_object("tvm.relax.attrs.TriluAttrs") class TriluAttrs(Attrs): """Attributes used in tril and triu operator""" -@tvm_ffi.register_object("relax.attrs.AstypeAttrs") +@tvm_ffi.register_object("tvm.relax.attrs.AstypeAttrs") class AstypeAttrs(Attrs): """Attributes used in astype operator""" -@tvm_ffi.register_object("relax.attrs.TakeAttrs") +@tvm_ffi.register_object("tvm.relax.attrs.TakeAttrs") class TakeAttrs(Attrs): """Attributes used in take operator""" -@tvm_ffi.register_object("relax.attrs.StridedSliceAttrs") +@tvm_ffi.register_object("tvm.relax.attrs.StridedSliceAttrs") class StridedSliceAttrs(Attrs): """Attributes used in strided_slice operator""" -@tvm_ffi.register_object("relax.attrs.MatmulAttrs") +@tvm_ffi.register_object("tvm.relax.attrs.MatmulAttrs") class MatmulAttrs(Attrs): """Attributes for matmul operator""" -@tvm_ffi.register_object("relax.attrs.Conv2DAttrs") +@tvm_ffi.register_object("tvm.relax.attrs.Conv2DAttrs") class Conv2DAttrs(Attrs): """Attributes for nn.conv2d""" -@tvm_ffi.register_object("relax.attrs.Conv3DAttrs") +@tvm_ffi.register_object("tvm.relax.attrs.Conv3DAttrs") class Conv3DAttrs(Attrs): """Attributes for nn.conv3d""" -@tvm_ffi.register_object("relax.attrs.Conv2DTransposeAttrs") +@tvm_ffi.register_object("tvm.relax.attrs.Conv2DTransposeAttrs") class Conv2DTransposeAttrs(Attrs): """Attributes for nn.conv2d_transpose""" -@tvm_ffi.register_object("relax.attrs.Pool2DAttrs") +@tvm_ffi.register_object("tvm.relax.attrs.Pool2DAttrs") class Pool2DAttrs(Attrs): """Attributes for nn.max_pool2d""" -@tvm_ffi.register_object("relax.attrs.AdaptivePool2DAttrs") +@tvm_ffi.register_object("tvm.relax.attrs.AdaptivePool2DAttrs") class AdaptivePool2DAttrs(Attrs): """Attributes for 2d adaptive pool operator""" -@tvm_ffi.register_object("relax.attrs.SoftmaxAttrs") +@tvm_ffi.register_object("tvm.relax.attrs.SoftmaxAttrs") class SoftmaxAttrs(Attrs): """Attributes for nn.softmax""" -@tvm_ffi.register_object("relax.attrs.BatchNormAttrs") +@tvm_ffi.register_object("tvm.relax.attrs.BatchNormAttrs") class BatchNormAttrs(Attrs): """Attributes used in batch_norm operator""" -@tvm_ffi.register_object("relax.attrs.LayerNormAttrs") +@tvm_ffi.register_object("tvm.relax.attrs.LayerNormAttrs") class LayerNormAttrs(Attrs): """Attributes used in layer_norm operator""" -@tvm_ffi.register_object("relax.attrs.InstanceNormAttrs") +@tvm_ffi.register_object("tvm.relax.attrs.InstanceNormAttrs") class InstanceNormAttrs(Attrs): """Attributes used in instance_norm operator""" -@tvm_ffi.register_object("relax.attrs.DropoutAttrs") +@tvm_ffi.register_object("tvm.relax.attrs.DropoutAttrs") class DropoutAttrs(Attrs): """Attributes for dropout operator""" -@tvm_ffi.register_object("relax.attrs.StatisticalAttrs") +@tvm_ffi.register_object("tvm.relax.attrs.StatisticalAttrs") class StatisticalAttrs(Attrs): """Attributes used in statistical operator""" -@tvm_ffi.register_object("relax.attrs.ConcatAttrs") +@tvm_ffi.register_object("tvm.relax.attrs.ConcatAttrs") class ConcatAttrs(Attrs): """Attributes for concat operator""" -@tvm_ffi.register_object("relax.attrs.ExpandDimsAttrs") +@tvm_ffi.register_object("tvm.relax.attrs.ExpandDimsAttrs") class ExpandDimsAttrs(Attrs): """Attributes for expand_dims operator""" -@tvm_ffi.register_object("relax.attrs.PermuteDimsAttrs") +@tvm_ffi.register_object("tvm.relax.attrs.PermuteDimsAttrs") class PermuteDimsAttrs(Attrs): """Attributes for permute_dims operator""" -@tvm_ffi.register_object("relax.attrs.SortAttrs") +@tvm_ffi.register_object("tvm.relax.attrs.SortAttrs") class SortAttrs(Attrs): """Attributes for sort operator""" -@tvm_ffi.register_object("relax.attrs.ArgsortAttrs") +@tvm_ffi.register_object("tvm.relax.attrs.ArgsortAttrs") class ArgsortAttrs(Attrs): """Attributes for argsort operator""" -@tvm_ffi.register_object("relax.attrs.SplitAttrs") +@tvm_ffi.register_object("tvm.relax.attrs.SplitAttrs") class SplitAttrs(Attrs): """Attributes used in split operator""" -@tvm_ffi.register_object("relax.attrs.SqueezeAttrs") +@tvm_ffi.register_object("tvm.relax.attrs.SqueezeAttrs") class SqueezeAttrs(Attrs): """Attributes for squeeze operator""" -@tvm_ffi.register_object("relax.attrs.StackAttrs") +@tvm_ffi.register_object("tvm.relax.attrs.StackAttrs") class StackAttrs(Attrs): """Attributes for concat operator""" -@tvm_ffi.register_object("relax.attrs.IndexPutAttrs") +@tvm_ffi.register_object("tvm.relax.attrs.IndexPutAttrs") class IndexPutAttrs(Attrs): """Attributes for index_put operator""" -@tvm_ffi.register_object("relax.attrs.LayoutTransformAttrs") +@tvm_ffi.register_object("tvm.relax.attrs.LayoutTransformAttrs") class LayoutTransformAttrs(Attrs): """Attributes used in layout_transform operator""" -@tvm_ffi.register_object("relax.attrs.Resize2DAttrs") +@tvm_ffi.register_object("tvm.relax.attrs.Resize2DAttrs") class Resize2DAttrs(Attrs): """Attributes used in image resize2d operator""" -@tvm_ffi.register_object("relax.attrs.ArgmaxArgminAttrs") +@tvm_ffi.register_object("tvm.relax.attrs.ArgmaxArgminAttrs") class ArgmaxArgminAttrs(Attrs): """Attributes for argmax/argmin operator""" -@tvm_ffi.register_object("relax.attrs.RepeatAttrs") +@tvm_ffi.register_object("tvm.relax.attrs.RepeatAttrs") class RepeatAttrs(Attrs): """Attributes for repeat operator""" -@tvm_ffi.register_object("relax.attrs.TileAttrs") +@tvm_ffi.register_object("tvm.relax.attrs.TileAttrs") class TileAttrs(Attrs): """Attributes for tile operator""" -@tvm_ffi.register_object("relax.attrs.ScanopAttrs") +@tvm_ffi.register_object("tvm.relax.attrs.ScanopAttrs") class ScanopAttrs(Attrs): """Attributes for scan operators""" -@tvm_ffi.register_object("relax.attrs.TopKAttrs") +@tvm_ffi.register_object("tvm.relax.attrs.TopKAttrs") class TopKAttrs(Attrs): """Attributes for topk operators""" -@tvm_ffi.register_object("relax.attrs.EinsumAttrs") +@tvm_ffi.register_object("tvm.relax.attrs.EinsumAttrs") class EinsumAttrs(Attrs): """Attributes for einsum operator""" -@tvm_ffi.register_object("relax.attrs.FlipAttrs") +@tvm_ffi.register_object("tvm.relax.attrs.FlipAttrs") class FlipAttrs(Attrs): """Attributes for flip operator""" -@tvm_ffi.register_object("relax.attrs.PadAttrs") +@tvm_ffi.register_object("tvm.relax.attrs.PadAttrs") class PadAttrs(Attrs): """Attributes used in pad operator""" -@tvm_ffi.register_object("relax.attrs.MultinomialFromUniformAttrs") +@tvm_ffi.register_object("tvm.relax.attrs.MultinomialFromUniformAttrs") class MultinomialFromUniformAttrs(Attrs): """Attributes for multinomial_from_uniform operator""" -@tvm_ffi.register_object("relax.attrs.CallInplacePackedAttrs") +@tvm_ffi.register_object("tvm.relax.attrs.CallInplacePackedAttrs") class CallInplacePackedAttrs(Attrs): """Attributes used in call_inplace_packed operator""" -@tvm_ffi.register_object("relax.attrs.CallTIRInplaceAttrs") +@tvm_ffi.register_object("tvm.relax.attrs.CallTIRInplaceAttrs") class CallTIRInplaceAttrs(Attrs): """Attributes used in call_tir_inplace operator""" -@tvm_ffi.register_object("relax.attrs.ToVDeviceAttrs") +@tvm_ffi.register_object("tvm.relax.attrs.ToVDeviceAttrs") class ToVDeviceAttrs(Attrs): """Attributes used in to_vdevice operator""" -@tvm_ffi.register_object("relax.attrs.HintOnDeviceAttrs") +@tvm_ffi.register_object("tvm.relax.attrs.HintOnDeviceAttrs") class HintOnDeviceAttrs(Attrs): """Attributes used in hint_on_device operator""" -@tvm_ffi.register_object("relax.attrs.ScatterCollectiveAttrs") +@tvm_ffi.register_object("tvm.relax.attrs.ScatterCollectiveAttrs") class ScatterCollectiveAttrs(Attrs): """Attributes used in scatter collective operators""" -@tvm_ffi.register_object("relax.attrs.AttentionAttrs") +@tvm_ffi.register_object("tvm.relax.attrs.AttentionAttrs") class AttentionAttrs(Attrs): """Attributes used in attention operator""" -@tvm_ffi.register_object("relax.attrs.AllClassNonMaximumSuppressionAttrs") +@tvm_ffi.register_object("tvm.relax.attrs.AllClassNonMaximumSuppressionAttrs") class AllClassNonMaximumSuppressionAttrs(Attrs): """Attributes for vision.all_class_non_max_suppression""" -@tvm_ffi.register_object("relax.attrs.Conv1DAttrs") +@tvm_ffi.register_object("tvm.relax.attrs.Conv1DAttrs") class Conv1DAttrs(Attrs): """Attributes for nn.conv1d""" -@tvm_ffi.register_object("relax.attrs.Conv1DTransposeAttrs") +@tvm_ffi.register_object("tvm.relax.attrs.Conv1DTransposeAttrs") class Conv1DTransposeAttrs(Attrs): """Attributes for nn.conv1d_transpose""" -@tvm_ffi.register_object("relax.attrs.Pool1DAttrs") +@tvm_ffi.register_object("tvm.relax.attrs.Pool1DAttrs") class Pool1DAttrs(Attrs): """Attributes for nn.max_pool1d and nn.avg_pool1d""" -@tvm_ffi.register_object("relax.attrs.Pool3DAttrs") +@tvm_ffi.register_object("tvm.relax.attrs.Pool3DAttrs") class Pool3DAttrs(Attrs): """Attributes for nn.max_pool3d and nn.avg_pool3d""" -@tvm_ffi.register_object("relax.attrs.AdaptivePool1DAttrs") +@tvm_ffi.register_object("tvm.relax.attrs.AdaptivePool1DAttrs") class AdaptivePool1DAttrs(Attrs): """Attributes for 1d adaptive pool operator""" -@tvm_ffi.register_object("relax.attrs.AdaptivePool3DAttrs") +@tvm_ffi.register_object("tvm.relax.attrs.AdaptivePool3DAttrs") class AdaptivePool3DAttrs(Attrs): """Attributes for 3d adaptive pool operator""" -@tvm_ffi.register_object("relax.attrs.LeakyReluAttrs") +@tvm_ffi.register_object("tvm.relax.attrs.LeakyReluAttrs") class LeakyReluAttrs(Attrs): """Attributes used in leaky_relu operator""" -@tvm_ffi.register_object("relax.attrs.SoftplusAttrs") +@tvm_ffi.register_object("tvm.relax.attrs.SoftplusAttrs") class SoftplusAttrs(Attrs): """Attributes used in softplus operator""" -@tvm_ffi.register_object("relax.attrs.PReluAttrs") +@tvm_ffi.register_object("tvm.relax.attrs.PReluAttrs") class PReluAttrs(Attrs): """Attributes used in prelu operator""" -@tvm_ffi.register_object("relax.attrs.PixelShuffleAttrs") +@tvm_ffi.register_object("tvm.relax.attrs.PixelShuffleAttrs") class PixelShuffleAttrs(Attrs): """Attributes used in pixel_shuffle operator""" -@tvm_ffi.register_object("relax.attrs.GroupNormAttrs") +@tvm_ffi.register_object("tvm.relax.attrs.GroupNormAttrs") class GroupNormAttrs(Attrs): """Attributes used in group_norm operator""" -@tvm_ffi.register_object("relax.attrs.RMSNormAttrs") +@tvm_ffi.register_object("tvm.relax.attrs.RMSNormAttrs") class RMSNormAttrs(Attrs): """Attributes used in rms_norm operator""" -@tvm_ffi.register_object("relax.attrs.NLLLossAttrs") +@tvm_ffi.register_object("tvm.relax.attrs.NLLLossAttrs") class NLLLossAttrs(Attrs): """Attributes used in nll_loss operator""" -@tvm_ffi.register_object("relax.attrs.AllReduceAttrs") +@tvm_ffi.register_object("tvm.relax.attrs.AllReduceAttrs") class AllReduceAttrs(Attrs): """Attributes used in allreduce operator""" -@tvm_ffi.register_object("relax.attrs.AllGatherAttrs") +@tvm_ffi.register_object("tvm.relax.attrs.AllGatherAttrs") class AllGatherAttrs(Attrs): """Attributes used in allgather operator""" -@tvm_ffi.register_object("relax.attrs.WrapParamAttrs") +@tvm_ffi.register_object("tvm.relax.attrs.WrapParamAttrs") class WrapParamAttrs(Attrs): """Attributes used in wrap_param operator""" -@tvm_ffi.register_object("relax.attrs.QuantizeAttrs") +@tvm_ffi.register_object("tvm.relax.attrs.QuantizeAttrs") class QuantizeAttrs(Attrs): """Attributes used in quantize/dequantize operators""" -@tvm_ffi.register_object("relax.attrs.GatherElementsAttrs") +@tvm_ffi.register_object("tvm.relax.attrs.GatherElementsAttrs") class GatherElementsAttrs(Attrs): """Attributes for gather_elements operator""" -@tvm_ffi.register_object("relax.attrs.GatherNDAttrs") +@tvm_ffi.register_object("tvm.relax.attrs.GatherNDAttrs") class GatherNDAttrs(Attrs): """Attributes for gather_nd operator""" -@tvm_ffi.register_object("relax.attrs.MeshgridAttrs") +@tvm_ffi.register_object("tvm.relax.attrs.MeshgridAttrs") class MeshgridAttrs(Attrs): """Attributes for meshgrid operator""" -@tvm_ffi.register_object("relax.attrs.ScatterElementsAttrs") +@tvm_ffi.register_object("tvm.relax.attrs.ScatterElementsAttrs") class ScatterElementsAttrs(Attrs): """Attributes for scatter_elements operator""" -@tvm_ffi.register_object("relax.attrs.ScatterNDAttrs") +@tvm_ffi.register_object("tvm.relax.attrs.ScatterNDAttrs") class ScatterNDAttrs(Attrs): """Attributes for scatter_nd operator""" -@tvm_ffi.register_object("relax.attrs.SliceScatterAttrs") +@tvm_ffi.register_object("tvm.relax.attrs.SliceScatterAttrs") class SliceScatterAttrs(Attrs): """Attributes for slice_scatter operator""" -@tvm_ffi.register_object("relax.attrs.OneHotAttrs") +@tvm_ffi.register_object("tvm.relax.attrs.OneHotAttrs") class OneHotAttrs(Attrs): """Attributes for one_hot operator""" diff --git a/python/tvm/relax/op/sampling.py b/python/tvm/relax/op/sampling.py index bcd43a392247..1ac78621b503 100644 --- a/python/tvm/relax/op/sampling.py +++ b/python/tvm/relax/op/sampling.py @@ -33,7 +33,7 @@ def multinomial_from_uniform( Notes ----- - For better cpu performance, use 'vm.builtin.multinomial_from_uniform'. + For better cpu performance, use 'tvm.vm.builtin.multinomial_from_uniform'. For accurate results, ensure probabilities are between 0 and 1 and sum to 1. Parameters diff --git a/python/tvm/relax/op/set.py b/python/tvm/relax/op/set.py index 87fd067e5d1e..6b9ce128cabd 100644 --- a/python/tvm/relax/op/set.py +++ b/python/tvm/relax/op/set.py @@ -84,7 +84,7 @@ def unique( ) -@tvm.register_global_func("relax.run.unique") +@tvm.register_global_func("tvm.relax.run.unique") def numpy_unique( x: tvm.runtime.tensor, sorted: int, @@ -143,7 +143,7 @@ def nonzero(x: Expr) -> Expr: return _ffi_api.nonzero(x) # type: ignore -@tvm.register_global_func("relax.run.nonzero") +@tvm.register_global_func("tvm.relax.run.nonzero") def numpy_nonzero(x: tvm.runtime.tensor) -> tvm.runtime.tensor: np_result = np.atleast_1d(x.numpy()).nonzero() return tvm.runtime.tensor(np.stack(np_result, axis=0)) diff --git a/python/tvm/relax/op/vision/_ffi_api.py b/python/tvm/relax/op/vision/_ffi_api.py index 8af761dc5a00..30457fb1f468 100644 --- a/python/tvm/relax/op/vision/_ffi_api.py +++ b/python/tvm/relax/op/vision/_ffi_api.py @@ -17,4 +17,4 @@ """Constructor APIs""" import tvm_ffi -tvm_ffi.init_ffi_api("relax.op.vision", __name__) +tvm_ffi.init_ffi_api("tvm.relax.op.vision", __name__) diff --git a/python/tvm/relax/op/vm/_ffi_api.py b/python/tvm/relax/op/vm/_ffi_api.py index eed64e53f036..72966b6a85aa 100644 --- a/python/tvm/relax/op/vm/_ffi_api.py +++ b/python/tvm/relax/op/vm/_ffi_api.py @@ -16,4 +16,4 @@ """FFI APIs for tvm.relax.op.vm""" import tvm_ffi -tvm_ffi.init_ffi_api("relax.op.vm", __name__) +tvm_ffi.init_ffi_api("tvm.relax.op.vm", __name__) diff --git a/python/tvm/relax/struct_info.py b/python/tvm/relax/struct_info.py index e8f6c42435da..8fed615c5c92 100644 --- a/python/tvm/relax/struct_info.py +++ b/python/tvm/relax/struct_info.py @@ -29,7 +29,7 @@ from . import _ffi_api, ty, expr -@tvm_ffi.register_object("relax.ObjectStructInfo") +@tvm_ffi.register_object("tvm.relax.ObjectStructInfo") class ObjectStructInfo(StructInfo): """StructInfo of an Object.""" @@ -37,7 +37,7 @@ def __init__(self, span: Span = None) -> None: self.__init_handle_by_constructor__(_ffi_api.ObjectStructInfo, span) # type: ignore -@tvm_ffi.register_object("relax.PrimStructInfo") +@tvm_ffi.register_object("tvm.relax.PrimStructInfo") class PrimStructInfo(StructInfo): """StructInfo of a primitive POD value. @@ -107,7 +107,7 @@ def __init__( ) # type: ignore -@tvm_ffi.register_object("relax.ShapeStructInfo") +@tvm_ffi.register_object("tvm.relax.ShapeStructInfo") class ShapeStructInfo(StructInfo): """StructInfo of a shape value. @@ -136,7 +136,7 @@ def __init__( ) -@tvm_ffi.register_object("relax.TensorStructInfo") +@tvm_ffi.register_object("tvm.relax.TensorStructInfo") class TensorStructInfo(StructInfo): """StructInfo of a Tensor value. @@ -180,7 +180,7 @@ def __init__( ) -@tvm_ffi.register_object("relax.TupleStructInfo") +@tvm_ffi.register_object("tvm.relax.TupleStructInfo") class TupleStructInfo(StructInfo): """StructInfo of a Tuple value. @@ -197,7 +197,7 @@ def __init__(self, fields: List[StructInfo], span: Span = None) -> None: self.__init_handle_by_constructor__(_ffi_api.TupleStructInfo, fields, span) # type: ignore -@tvm_ffi.register_object("relax.FuncStructInfo") +@tvm_ffi.register_object("tvm.relax.FuncStructInfo") class FuncStructInfo(StructInfo): """StructInfo of a function value. diff --git a/python/tvm/relax/testing/nn.py b/python/tvm/relax/testing/nn.py index fb3564c6f1a1..0eb460a3cf34 100644 --- a/python/tvm/relax/testing/nn.py +++ b/python/tvm/relax/testing/nn.py @@ -245,7 +245,7 @@ def __init__(self, in_features, out_features, bias=True): def forward(self, input: relax.Expr) -> relax.Var: y = emit_te(topi.matmul, input, self.weight) if self.bias is not None: - y = emit_te(topi.add, y, self.bias) + y = emit_te(tvm.topi.add, y, self.bias) return y """ @@ -354,5 +354,5 @@ def __init__(self, in_features, out_features, bias=True): def forward(self, input: relax.Expr) -> relax.Var: y = emit_te(topi.matmul, input, self.weight) if self.bias is not None: - y = emit_te(topi.add, y, self.bias) + y = emit_te(tvm.topi.add, y, self.bias) return y diff --git a/python/tvm/relax/testing/transform.py b/python/tvm/relax/testing/transform.py index 617ba73f09f4..0f9494ba3266 100644 --- a/python/tvm/relax/testing/transform.py +++ b/python/tvm/relax/testing/transform.py @@ -29,7 +29,7 @@ def ApplyEmptyCppMutator() -> tvm.ir.transform.Pass: """Create empty cpp mutator""" - packed_func = tvm.get_global_func("relax.testing.transform.ApplyEmptyCppMutator") + packed_func = tvm.get_global_func("tvm.relax.testing.transform.ApplyEmptyCppMutator") return packed_func() @@ -40,7 +40,7 @@ def dataflow_liveness_analysis(block: DataflowBlock) -> Dict[Var, Tuple[int, int if "PYTEST_CURRENT_TEST" not in os.environ: logging.warning("The function dataflow_liveness_analysis is exposed for testing only.") - live_ranges = tvm.get_global_func("relax.testing.transform.DataflowLivenessAnalysis")( + live_ranges = tvm.get_global_func("tvm.relax.testing.transform.DataflowLivenessAnalysis")( block ) # type: ignore ret = {} @@ -58,7 +58,9 @@ def dataflow_alias_analysis( if "PYTEST_CURRENT_TEST" not in os.environ: logging.warning("The function dataflow_alias_analysis is exposed for testing only.") - alias_sets, tuple_map = tvm.get_global_func("relax.testing.transform.DataflowAliasAnalysis")( + alias_sets, tuple_map = tvm.get_global_func( + "tvm.relax.testing.transform.DataflowAliasAnalysis" + )( block, inputs, ) # type: ignore @@ -71,7 +73,7 @@ def dataflow_alias_analysis( return res_alias_sets, res_tuple_map # type: ignore -@tvm_ffi.register_object("relax.transform.InplaceOpportunity") +@tvm_ffi.register_object("tvm.relax.transform.InplaceOpportunity") class InplaceOpportunity(Object): """ Represents an opportunity to make a binding in-place. Exposed only for testing; @@ -98,7 +100,7 @@ def dataflow_inplace_analysis( """ if "PYTEST_CURRENT_TEST" not in os.environ: logging.warning("The function dataflow_inplace_analysis is exposed for testing only.") - index_lists = tvm.get_global_func("relax.testing.transform.DataflowInplaceAnalysis")( + index_lists = tvm.get_global_func("tvm.relax.testing.transform.DataflowInplaceAnalysis")( block, inputs, mod ) # type: ignore @@ -117,7 +119,7 @@ def dataflow_single_inplace_call( if "PYTEST_CURRENT_TEST" not in os.environ: logging.warning("The function dataflow_single_inplace_call is exposed for testing only.") - ret = tvm.get_global_func("relax.testing.transform.SingleInplaceCall")( + ret = tvm.get_global_func("tvm.relax.testing.transform.SingleInplaceCall")( mod, call, inplace_indices, diff --git a/python/tvm/relax/testing/vm.py b/python/tvm/relax/testing/vm.py index 5516bac17cf7..920f570f7eb0 100644 --- a/python/tvm/relax/testing/vm.py +++ b/python/tvm/relax/testing/vm.py @@ -24,51 +24,51 @@ from tvm.runtime.object import Object -@tvm.register_global_func("test.vm.move") +@tvm.register_global_func("tvm.test.vm.move") def move(src): return src -@tvm.register_global_func("test.vm.add") +@tvm.register_global_func("tvm.test.vm.add") def add(a, b): ret = a.numpy() + b.numpy() return tvm.runtime.tensor(ret) -@tvm.register_global_func("test.vm.mul") +@tvm.register_global_func("tvm.test.vm.mul") def mul(a, b): ret = a.numpy() * b.numpy() return tvm.runtime.tensor(ret) -@tvm.register_global_func("test.vm.equal_zero") +@tvm.register_global_func("tvm.test.vm.equal_zero") def equal_zero(a): ret = np.all((a.numpy() == 0)) return tvm.runtime.tensor(ret) -@tvm.register_global_func("test.vm.subtract_one") +@tvm.register_global_func("tvm.test.vm.subtract_one") def subtract_one(a): ret = np.subtract(a.numpy(), 1) return tvm.runtime.tensor(ret) -@tvm.register_global_func("test.vm.identity") +@tvm.register_global_func("tvm.test.vm.identity") def identity_packed(a, b): b[:] = tvm.runtime.tensor(a.numpy()) -@tvm.register_global_func("test.vm.tile") +@tvm.register_global_func("tvm.test.vm.tile") def tile_packed(a, b): b[:] = tvm.runtime.tensor(np.tile(a.numpy(), (1, 2))) -@tvm.register_global_func("test.vm.add_scalar") +@tvm.register_global_func("tvm.test.vm.add_scalar") def add_scalar(a, b): return a + b -@tvm.register_global_func("test.vm.get_device_id") +@tvm.register_global_func("tvm.test.vm.get_device_id") def get_device_id(device): return device.index @@ -85,6 +85,6 @@ def check_saved_func(vm: relax.VirtualMachine, func_name: str, *inputs: List[Any return res1 -@tvm.register_global_func("test.vm.check_if_defined") +@tvm.register_global_func("tvm.test.vm.check_if_defined") def check_if_defined(obj: tvm.Object) -> tvm.tir.IntImm: return tvm.runtime.convert(obj is not None) diff --git a/python/tvm/relax/training/_ffi_api.py b/python/tvm/relax/training/_ffi_api.py index 25f395830341..f112d2837067 100644 --- a/python/tvm/relax/training/_ffi_api.py +++ b/python/tvm/relax/training/_ffi_api.py @@ -17,4 +17,4 @@ """FFI APIs for tvm.relax.training""" import tvm_ffi -tvm_ffi.init_ffi_api("relax.training", __name__) +tvm_ffi.init_ffi_api("tvm.relax.training", __name__) diff --git a/python/tvm/relax/transform/_ffi_api.py b/python/tvm/relax/transform/_ffi_api.py index 25d6ecd75385..1f03fd203075 100644 --- a/python/tvm/relax/transform/_ffi_api.py +++ b/python/tvm/relax/transform/_ffi_api.py @@ -16,4 +16,4 @@ """FFI APIs for tvm.transform""" import tvm_ffi -tvm_ffi.init_ffi_api("relax.transform", __name__) +tvm_ffi.init_ffi_api("tvm.relax.transform", __name__) diff --git a/python/tvm/relax/transform/ipc_allreduce_rewrite.py b/python/tvm/relax/transform/ipc_allreduce_rewrite.py index de5c22863403..187724ae7fb9 100644 --- a/python/tvm/relax/transform/ipc_allreduce_rewrite.py +++ b/python/tvm/relax/transform/ipc_allreduce_rewrite.py @@ -45,7 +45,7 @@ def __init__(self, allreduce_strategy: int) -> None: def transform_module(self, mod: IRModule, _ctx: tvm.transform.PassContext) -> IRModule: """IRModule-level transformation""" fcustom_allreduce = tvm.get_global_func( - "runtime.disco.cuda_ipc.custom_allreduce", allow_missing=True + "tvm.runtime.disco.cuda_ipc.custom_allreduce", allow_missing=True ) if fcustom_allreduce is None: # Customized allreduce is not available. @@ -91,7 +91,7 @@ def visit_var_binding_(self, binding: relax.VarBinding): def visit_call_(self, call: relax.Call) -> None: # pylint: disable=arguments-renamed if ( not isinstance(call.op, relax.ExternFunc) - or call.op.global_symbol != "runtime.disco.allreduce" + or call.op.global_symbol != "tvm.runtime.disco.allreduce" or call.args[1].values[0] != 0 ): # Return if the call is not a summation all-reduce. @@ -115,7 +115,7 @@ def visit_call_(self, call: relax.Call) -> None: # pylint: disable=arguments-re ) self.binding_replacement_map[call] = relax.Call( - relax.ExternFunc("runtime.disco.cuda_ipc.custom_allreduce"), + relax.ExternFunc("tvm.runtime.disco.cuda_ipc.custom_allreduce"), # The "cuda_ipc.custom_allreduce" implementation does not # yet support num_groups>1, and therefore does not use the # `in_group` argument. diff --git a/python/tvm/relax/transform/legalize_ops/binary.py b/python/tvm/relax/transform/legalize_ops/binary.py index 1acbddb2190b..9623985d9ab7 100644 --- a/python/tvm/relax/transform/legalize_ops/binary.py +++ b/python/tvm/relax/transform/legalize_ops/binary.py @@ -16,7 +16,7 @@ # under the License. # pylint: disable=invalid-name """Default legalization function for binary operators.""" -from tvm import topi +import tvm.topi from ...block_builder import BlockBuilder from ...expr import Call, Expr from .common import TEFunc, LegalizeFunc, _try_convert_to_scalar_const, register_legalize @@ -41,33 +41,33 @@ def binary_call_te(bb: BlockBuilder, call: Call) -> Expr: return binary_call_te -register_legalize("relax.add", _binary(topi.add)) -register_legalize("relax.divide", _binary(topi.divide)) -register_legalize("relax.floor_divide", _binary(topi.floor_divide)) -register_legalize("relax.log_add_exp", _binary(topi.log_add_exp)) -register_legalize("relax.multiply", _binary(topi.multiply)) -register_legalize("relax.power", _binary(topi.power)) -register_legalize("relax.subtract", _binary(topi.subtract)) -register_legalize("relax.equal", _binary(topi.equal)) -register_legalize("relax.mod", _binary(topi.mod)) -register_legalize("relax.floor_mod", _binary(topi.floor_mod)) -register_legalize("relax.greater", _binary(topi.greater)) -register_legalize("relax.greater_equal", _binary(topi.greater_equal)) -register_legalize("relax.less", _binary(topi.less)) -register_legalize("relax.less_equal", _binary(topi.less_equal)) -register_legalize("relax.not_equal", _binary(topi.not_equal)) +register_legalize("relax.add", _binary(tvm.topi.add)) +register_legalize("relax.divide", _binary(tvm.topi.divide)) +register_legalize("relax.floor_divide", _binary(tvm.topi.floor_divide)) +register_legalize("relax.log_add_exp", _binary(tvm.topi.log_add_exp)) +register_legalize("relax.multiply", _binary(tvm.topi.multiply)) +register_legalize("relax.power", _binary(tvm.topi.power)) +register_legalize("relax.subtract", _binary(tvm.topi.subtract)) +register_legalize("relax.equal", _binary(tvm.topi.equal)) +register_legalize("relax.mod", _binary(tvm.topi.mod)) +register_legalize("relax.floor_mod", _binary(tvm.topi.floor_mod)) +register_legalize("relax.greater", _binary(tvm.topi.greater)) +register_legalize("relax.greater_equal", _binary(tvm.topi.greater_equal)) +register_legalize("relax.less", _binary(tvm.topi.less)) +register_legalize("relax.less_equal", _binary(tvm.topi.less_equal)) +register_legalize("relax.not_equal", _binary(tvm.topi.not_equal)) -register_legalize("relax.maximum", _binary(topi.maximum)) -register_legalize("relax.minimum", _binary(topi.minimum)) +register_legalize("relax.maximum", _binary(tvm.topi.maximum)) +register_legalize("relax.minimum", _binary(tvm.topi.minimum)) # bitwise -register_legalize("relax.bitwise_and", _binary(topi.bitwise_and)) -register_legalize("relax.bitwise_or", _binary(topi.bitwise_or)) -register_legalize("relax.bitwise_xor", _binary(topi.bitwise_xor)) -register_legalize("relax.left_shift", _binary(topi.left_shift)) -register_legalize("relax.right_shift", _binary(topi.right_shift)) +register_legalize("relax.bitwise_and", _binary(tvm.topi.bitwise_and)) +register_legalize("relax.bitwise_or", _binary(tvm.topi.bitwise_or)) +register_legalize("relax.bitwise_xor", _binary(tvm.topi.bitwise_xor)) +register_legalize("relax.left_shift", _binary(tvm.topi.left_shift)) +register_legalize("relax.right_shift", _binary(tvm.topi.right_shift)) # logical -register_legalize("relax.logical_and", _binary(topi.logical_and)) -register_legalize("relax.logical_or", _binary(topi.logical_or)) -register_legalize("relax.logical_xor", _binary(topi.logical_xor)) +register_legalize("relax.logical_and", _binary(tvm.topi.logical_and)) +register_legalize("relax.logical_or", _binary(tvm.topi.logical_or)) +register_legalize("relax.logical_xor", _binary(tvm.topi.logical_xor)) diff --git a/python/tvm/relax/transform/legalize_ops/ccl.py b/python/tvm/relax/transform/legalize_ops/ccl.py index 364dee750e8b..2a470bca5672 100644 --- a/python/tvm/relax/transform/legalize_ops/ccl.py +++ b/python/tvm/relax/transform/legalize_ops/ccl.py @@ -40,7 +40,7 @@ def _allreduce(_bb: BlockBuilder, call: Call) -> Expr: f"Supported operations are {op_type_map.keys()}." ) return call_dps_packed( - "runtime.disco.allreduce", + "tvm.runtime.disco.allreduce", [call.args[0], ShapeExpr([op_type_map[op_type_str]]), call.attrs.in_group], out_sinfo=call.args[0].struct_info, ) @@ -61,7 +61,7 @@ def _allgather(_bb: BlockBuilder, call: Call) -> Expr: else: output_shape.append(shape_value) return call_dps_packed( - "runtime.disco.allgather", + "tvm.runtime.disco.allgather", [call.args[0], call.attrs.in_group], out_sinfo=TensorStructInfo( shape=output_shape, @@ -74,7 +74,7 @@ def _allgather(_bb: BlockBuilder, call: Call) -> Expr: @register_legalize("relax.ccl.broadcast_from_worker0") def _broadcast_from_worker0(_bb: BlockBuilder, call: Call) -> Expr: return call_dps_packed( - "runtime.disco.broadcast_from_worker0", + "tvm.runtime.disco.broadcast_from_worker0", [call.args[0], False], out_sinfo=call.args[0].struct_info, ) @@ -115,7 +115,7 @@ def _scatter_from_worker0(_bb: BlockBuilder, call: Call) -> Expr: output_shape = transpose_var.struct_info.shape.struct_info.values output_shape = output_shape[1:] return call_dps_packed( - "runtime.disco.scatter_from_worker0", + "tvm.runtime.disco.scatter_from_worker0", [transpose_var, False], out_sinfo=TensorStructInfo( shape=output_shape, diff --git a/python/tvm/relax/transform/legalize_ops/distributed.py b/python/tvm/relax/transform/legalize_ops/distributed.py index 2ca283d1ec09..00ea4f965ab2 100644 --- a/python/tvm/relax/transform/legalize_ops/distributed.py +++ b/python/tvm/relax/transform/legalize_ops/distributed.py @@ -30,7 +30,7 @@ def _redistribute_replica_to_shard(_bb: BlockBuilder, call: Call) -> Expr: axis = call.attrs.axis worker_id_symbol = tir.Var("worker_id", "int64") worker_id_var = _bb.emit( - call_pure_packed("runtime.disco.worker_id", sinfo_args=[ShapeStructInfo(None)]) + call_pure_packed("tvm.runtime.disco.worker_id", sinfo_args=[ShapeStructInfo(None)]) ) _bb.match_cast(worker_id_var, ShapeStructInfo([worker_id_symbol])) diff --git a/python/tvm/relax/transform/legalize_ops/grad.py b/python/tvm/relax/transform/legalize_ops/grad.py index 4fde2a25c38a..8f4f126b3a35 100644 --- a/python/tvm/relax/transform/legalize_ops/grad.py +++ b/python/tvm/relax/transform/legalize_ops/grad.py @@ -62,7 +62,7 @@ def te_nll_loss_backward(output_grad, predictions, targets, weights, reduction, output_grad = topi.broadcast_to(output_grad, targets.shape) elif reduction == "mean": weight_sum = topi_sum_extend(all_weights) - output_grad = topi.divide(topi.broadcast_to(output_grad, targets.shape), weight_sum) + output_grad = tvm.topi.divide(topi.broadcast_to(output_grad, targets.shape), weight_sum) # handle no batch if predictions.ndim == 1: diff --git a/python/tvm/relax/transform/legalize_ops/index.py b/python/tvm/relax/transform/legalize_ops/index.py index d99c1f4db6ed..cec9a7d2de09 100644 --- a/python/tvm/relax/transform/legalize_ops/index.py +++ b/python/tvm/relax/transform/legalize_ops/index.py @@ -117,7 +117,7 @@ def get_length(begin, end, strides, length): # we need to apply DecomposeOpsForInference in that case # and it's unclear when in the build it should happen call_pure_packed( - "vm.builtin.tensor_to_shape", output_shape, sinfo_args=ShapeStructInfo(ndim=ndim) + "tvm.vm.builtin.tensor_to_shape", output_shape, sinfo_args=ShapeStructInfo(ndim=ndim) ) ) output_shape_vars = [tir.Var("s", "int64") for i in range(ndim)] diff --git a/python/tvm/relax/transform/legalize_ops/nn.py b/python/tvm/relax/transform/legalize_ops/nn.py index ed9802fc9e63..b29ecd817c55 100644 --- a/python/tvm/relax/transform/legalize_ops/nn.py +++ b/python/tvm/relax/transform/legalize_ops/nn.py @@ -538,8 +538,8 @@ def te_selu(x: te.Tensor): # Compute SELU # SELU(x) = scale∗(max(0,x)+min(0,α∗(exp(x)−1))) - positive_part = topi.maximum(x, tir.const(0, dtype)) - negative_part = topi.minimum( + positive_part = tvm.topi.maximum(x, tir.const(0, dtype)) + negative_part = tvm.topi.minimum( tir.const(0, dtype), alpha * (topi.exp(x) - tir.const(1, dtype)) ) return scale * (positive_part + negative_part) @@ -550,7 +550,7 @@ def te_selu(x: te.Tensor): @register_legalize("relax.nn.silu") def _nn_silu(bb: BlockBuilder, call: Call) -> Expr: def te_silu(x: te.Tensor): - return topi.multiply(x, topi.sigmoid(x)) + return tvm.topi.multiply(x, topi.sigmoid(x)) return bb.call_te(te_silu, call.args[0], primfunc_name_hint="silu") @@ -682,12 +682,12 @@ def _te_attention( v = topi.reshape(v, [batch_size * num_head, seq_len_kv, head_dim_v]) p = topi.nn.batch_matmul(q, k) if scale is not None: - p = topi.multiply(p, scale) + p = tvm.topi.multiply(p, scale) else: - p = topi.divide(p, tir.sqrt(tir.Cast(p.dtype, head_dim))) + p = tvm.topi.divide(p, tir.sqrt(tir.Cast(p.dtype, head_dim))) if bias is not None: p = topi.reshape(p, [batch_size, num_head, seq_len, seq_len_kv]) - p = topi.add(p, bias) + p = tvm.topi.add(p, bias) p = topi.reshape(p, [batch_size * num_head, seq_len, seq_len_kv]) if causal_mask is None: s = topi.nn.softmax(p) @@ -703,7 +703,7 @@ def _te_attention( topi.exp(p_masked - topi.max(p_masked, axis=-1, keepdims=True)), k=offset, upper=False ) p_masked_sum = topi.sum(p_masked_exp, axis=-1, keepdims=True) - s = topi.divide(p_masked_exp, p_masked_sum) + s = tvm.topi.divide(p_masked_exp, p_masked_sum) o = topi.nn.batch_matmul(s, v, transpose_b=False) o = topi.reshape(o, [batch_size, num_head, seq_len, head_dim_v]) return topi.transpose(o, [0, 2, 1, 3]) diff --git a/python/tvm/relax/transform/legalize_ops/statistical.py b/python/tvm/relax/transform/legalize_ops/statistical.py index bdb79126f012..af9108fa09d6 100644 --- a/python/tvm/relax/transform/legalize_ops/statistical.py +++ b/python/tvm/relax/transform/legalize_ops/statistical.py @@ -41,7 +41,7 @@ def _compute_shape_prod(x: te.Tensor, axis: List[tir.IntImm]) -> tir.PrimExpr: def _te_mean(x: te.Tensor, axis: List[tir.IntImm], keepdims: bool) -> te.Tensor: shape_prod = _compute_shape_prod(x, axis) res_sum = topi.sum(x, axis, keepdims) - return topi.divide(res_sum, shape_prod) + return tvm.topi.divide(res_sum, shape_prod) def _te_variance(x: te.Tensor, axis: List[tir.IntImm], keepdims: bool) -> te.Tensor: diff --git a/python/tvm/relax/transform/lower_gpu_ipc_alloc_storage.py b/python/tvm/relax/transform/lower_gpu_ipc_alloc_storage.py index 00081f92b197..ff4cdf65bd98 100644 --- a/python/tvm/relax/transform/lower_gpu_ipc_alloc_storage.py +++ b/python/tvm/relax/transform/lower_gpu_ipc_alloc_storage.py @@ -63,7 +63,7 @@ def rewrite_alloc_storage(self, call: relax.Call) -> relax.Call: shape = call.args[0] dtype = call.args[3] return relax.Call( - relax.ExternFunc("runtime.disco.cuda_ipc.alloc_storage"), + relax.ExternFunc("tvm.runtime.disco.cuda_ipc.alloc_storage"), args=[shape, dtype], sinfo_args=[call.struct_info], ) @@ -72,7 +72,7 @@ def rewrite_alloc_tensor(self, call: relax.Call) -> relax.Call: shape = call.args[0] dtype = call.args[1] ipc_alloc_storage = relax.Call( - relax.ExternFunc("runtime.disco.cuda_ipc.alloc_storage"), + relax.ExternFunc("tvm.runtime.disco.cuda_ipc.alloc_storage"), args=[shape, dtype], sinfo_args=[relax.ObjectStructInfo()], ) diff --git a/python/tvm/relax/transform/transform.py b/python/tvm/relax/transform/transform.py index 46efc17e3d4f..97a4e058c872 100644 --- a/python/tvm/relax/transform/transform.py +++ b/python/tvm/relax/transform/transform.py @@ -36,14 +36,14 @@ from ..expr import Var -@tvm_ffi.register_object("relax.FunctionPass") +@tvm_ffi.register_object("tvm.relax.FunctionPass") class FunctionPass(tvm.ir.transform.Pass): """A pass that works on each tvm.relax.Function in a module. A function pass class should be created through `function_pass`. """ -@tvm_ffi.register_object("relax.DataflowBlockPass") +@tvm_ffi.register_object("tvm.relax.DataflowBlockPass") class DataflowBlockPass(tvm.ir.transform.Pass): """A pass that works on each tvm.relax.DataflowBlock in a module.""" @@ -820,7 +820,7 @@ def FuseTIR() -> tvm.ir.transform.Pass: return _ffi_api.FuseTIR() # type: ignore -@tvm_ffi.register_object("relax.transform.PatternCheckContext") +@tvm_ffi.register_object("tvm.relax.transform.PatternCheckContext") class PatternCheckContext(Object): """ The input of check function `FusionPattern.check`. @@ -854,7 +854,7 @@ class PatternCheckContext(Object): value_to_bound_var: Mapping[Expr, Var] -@tvm_ffi.register_object("relax.transform.FusionPattern") +@tvm_ffi.register_object("tvm.relax.transform.FusionPattern") class FusionPattern(Object): """ The pattern used by `FuseOpsByPattern`. It's mainly DFPattern but with other @@ -1123,7 +1123,7 @@ def main( # Define the customized legalization function for "relax.add" def customize_legalize_add(bb: relax.BlockBuilder, call: relax.Call) -> relax.Expr: from tvm import topi - return bb.call_te(topi.add, call.args[1], call.args[0]) + return bb.call_te(tvm.topi.add, call.args[1], call.args[0]) # Apply the pass with the customized function to the module. mod = LegalizeOps({"relax.add": customize_legalize_add})(Module) diff --git a/python/tvm/relax/ty.py b/python/tvm/relax/ty.py index ebf757f38136..88f412f80a8c 100644 --- a/python/tvm/relax/ty.py +++ b/python/tvm/relax/ty.py @@ -22,7 +22,7 @@ from . import _ffi_api -@tvm_ffi.register_object("relax.ShapeType") +@tvm_ffi.register_object("tvm.relax.ShapeType") class ShapeType(Type): """The type of shape in Relax. @@ -37,7 +37,7 @@ def __init__(self, ndim: int = -1, span: Span = None) -> None: self.__init_handle_by_constructor__(_ffi_api.ShapeType, ndim, span) # type: ignore -@tvm_ffi.register_object("relax.ObjectType") +@tvm_ffi.register_object("tvm.relax.ObjectType") class ObjectType(Type): """A type that corresponds to tvm::runtime::Object, is base of all possible object values in TVM.""" @@ -46,7 +46,7 @@ def __init__(self, span: Span = None) -> None: self.__init_handle_by_constructor__(_ffi_api.ObjectType, span) # type: ignore -@tvm_ffi.register_object("relax.DynTensorType") +@tvm_ffi.register_object("tvm.relax.DynTensorType") class TensorType(Type): """A dynamic tensor type in Relax. @@ -65,7 +65,7 @@ def __init__(self, ndim=-1, dtype="float32", span: Span = None) -> None: self.__init_handle_by_constructor__(_ffi_api.TensorType, ndim, dtype, span) # type: ignore -@tvm_ffi.register_object("relax.PackedFuncType") +@tvm_ffi.register_object("tvm.relax.PackedFuncType") class PackedFuncType(Type): """The type of ExternFunc in Relax.""" diff --git a/python/tvm/relax/vm_build.py b/python/tvm/relax/vm_build.py index cf8cd863309a..8e56a6d06423 100644 --- a/python/tvm/relax/vm_build.py +++ b/python/tvm/relax/vm_build.py @@ -50,7 +50,7 @@ def as_python(self) -> str: def _vmcodegen( - builder: "relax.ExecBuilder", + builder: "tvm.relax.ExecBuilder", mod: tvm.IRModule, exec_mode: str = "bytecode", ) -> tvm.IRModule: @@ -104,7 +104,7 @@ def _is_device_module(mod: tvm.runtime.Module) -> bool: def _vmlink( - builder: "relax.ExecBuilder", + builder: "tvm.relax.ExecBuilder", target: Optional[Union[str, tvm.target.Target]], tir_mod: Optional[tvm.IRModule] = None, tir_pipeline: Optional[Union[str, tvm.transform.Pass]] = "default", diff --git a/python/tvm/rpc/_ffi_api.py b/python/tvm/rpc/_ffi_api.py index 80fd79e31348..73c6baec7615 100644 --- a/python/tvm/rpc/_ffi_api.py +++ b/python/tvm/rpc/_ffi_api.py @@ -18,4 +18,4 @@ import tvm_ffi -tvm_ffi.init_ffi_api("rpc", __name__) +tvm_ffi.init_ffi_api("tvm.rpc", __name__) diff --git a/python/tvm/rpc/client.py b/python/tvm/rpc/client.py index 73e9db3d5b60..6528d8aafaa3 100644 --- a/python/tvm/rpc/client.py +++ b/python/tvm/rpc/client.py @@ -264,7 +264,7 @@ def __init__(self): RPCSession.__init__(self, _ffi_api.LocalSession()) -@tvm_ffi.register_global_func("rpc.PopenSession") +@tvm_ffi.register_global_func("tvm.rpc.PopenSession") def _popen_session(binary): temp = utils.tempdir() @@ -535,7 +535,7 @@ def connect( client_via_proxy = rpc.connect( proxy_server_url, proxy_server_port, proxy_server_key, enable_logging session_constructor_args=[ - "rpc.Connect", internal_url, internal_port, internal_key, internal_logging]) + "tvm.rpc.Connect", internal_url, internal_port, internal_key, internal_logging]) """ try: diff --git a/python/tvm/rpc/server.py b/python/tvm/rpc/server.py index 3ed512e9dd04..26815ceab10e 100644 --- a/python/tvm/rpc/server.py +++ b/python/tvm/rpc/server.py @@ -488,7 +488,7 @@ def server_init_callback(): # must import mypackage here import mypackage - tvm.register_global_func("function", mypackage.func) + tvm.register_global_func("tvm.function", mypackage.func) server = rpc.Server(host, server_init_callback=server_init_callback) """ diff --git a/python/tvm/rpc/testing.py b/python/tvm/rpc/testing.py index e3f216563863..31e1c1a1cd1c 100644 --- a/python/tvm/rpc/testing.py +++ b/python/tvm/rpc/testing.py @@ -22,38 +22,38 @@ # RPC test functions to be registered for unit-tests purposes -@tvm.register_global_func("rpc.test.addone") +@tvm.register_global_func("tvm.rpc.test.addone") def _addone(x): return x + 1 -@tvm.register_global_func("rpc.test.strcat") +@tvm.register_global_func("tvm.rpc.test.strcat") def _strcat(name, x): return f"{name}:{x}" -@tvm.register_global_func("rpc.test.except") +@tvm.register_global_func("tvm.rpc.test.except") def _remotethrow(name): raise ValueError(f"{name}") -@tvm.register_global_func("rpc.test.runtime_str_concat") +@tvm.register_global_func("tvm.rpc.test.runtime_str_concat") def _strcat(x, y): return x + y -@tvm.register_global_func("rpc.test.remote_tensor_func") +@tvm.register_global_func("tvm.rpc.test.remote_tensor_func") def _remote_tensor_func(y): x = np.ones((3, 4)) np.testing.assert_equal(y.numpy(), x) -@tvm.register_global_func("rpc.test.add_to_lhs") +@tvm.register_global_func("tvm.rpc.test.add_to_lhs") def _add_to_lhs(x): return lambda y: x + y -@tvm.register_global_func("rpc.test.remote_return_nd") +@tvm.register_global_func("tvm.rpc.test.remote_return_nd") def _my_module(name): # Use closure to check the ref counter correctness nd = tvm.runtime.tensor(np.zeros(10).astype("float32")) diff --git a/python/tvm/runtime/_ffi_api.py b/python/tvm/runtime/_ffi_api.py index c713b379c384..94d6b3d451ee 100644 --- a/python/tvm/runtime/_ffi_api.py +++ b/python/tvm/runtime/_ffi_api.py @@ -18,4 +18,4 @@ import tvm_ffi # Exports functions registered in runtime namespace. -tvm_ffi.init_ffi_api("runtime", __name__) +tvm_ffi.init_ffi_api("tvm.runtime", __name__) diff --git a/python/tvm/runtime/_ffi_node_api.py b/python/tvm/runtime/_ffi_node_api.py index a4f74864aa2d..3942b51ff29e 100644 --- a/python/tvm/runtime/_ffi_node_api.py +++ b/python/tvm/runtime/_ffi_node_api.py @@ -37,4 +37,4 @@ def LoadJSON(json_str): # Exports functions registered in node namespace. -tvm_ffi.init_ffi_api("node", __name__) +tvm_ffi.init_ffi_api("tvm.node", __name__) diff --git a/python/tvm/runtime/disco/_ffi_api.py b/python/tvm/runtime/disco/_ffi_api.py index 2caeef293ea5..9553dd991d5c 100644 --- a/python/tvm/runtime/disco/_ffi_api.py +++ b/python/tvm/runtime/disco/_ffi_api.py @@ -17,4 +17,4 @@ """FFI APIs from C++""" import tvm_ffi -tvm_ffi.init_ffi_api("runtime.disco", __name__) +tvm_ffi.init_ffi_api("tvm.runtime.disco", __name__) diff --git a/python/tvm/runtime/disco/process_pool.py b/python/tvm/runtime/disco/process_pool.py index 975c26fb922f..7bc2ffea02a4 100644 --- a/python/tvm/runtime/disco/process_pool.py +++ b/python/tvm/runtime/disco/process_pool.py @@ -177,7 +177,7 @@ def _kill_child_processes(pid): pass -@register_global_func("runtime.disco.create_process_pool") +@register_global_func("tvm.runtime.disco.create_process_pool") def _create_process_pool(num_workers: int, num_groups: int, entrypoint: str): """Create a process pool where the workers' are [1, num_workers).""" pool = [DiscoPopenWorker(i, num_workers, num_groups, entrypoint) for i in range(1, num_workers)] diff --git a/python/tvm/runtime/disco/session.py b/python/tvm/runtime/disco/session.py index f2c2dfc791ab..b87a3ab79b5c 100644 --- a/python/tvm/runtime/disco/session.py +++ b/python/tvm/runtime/disco/session.py @@ -34,7 +34,7 @@ from . import _ffi_api, process_pool # pylint: disable=unused-import -@register_object("runtime.disco.DRef") +@register_object("tvm.runtime.disco.DRef") class DRef(Object): """An object that exists on all workers. The controller process assigns a unique "register id" to each object, and the worker process uses this id to refer to the object residing on itself. @@ -98,7 +98,7 @@ def __getitem__(self, name: str) -> DPackedFunc: return DPackedFunc(func(self, name, False), self.session) -@register_object("runtime.disco.Session") +@register_object("tvm.runtime.disco.Session") class Session(Object): """A Disco interactive session. It allows users to interact with the Disco command queue with various PackedFunc calling convention.""" @@ -150,7 +150,7 @@ def empty( The created Tensor. """ - func = self._get_cached_method("runtime.disco.empty") + func = self._get_cached_method("tvm.runtime.disco.empty") return func(ShapeTuple(shape), dtype, device, worker0_only, in_group) def shutdown(self): @@ -190,7 +190,9 @@ def import_python_module(self, module_name: str) -> None: `import` statement. """ if not hasattr(self, "_import_python_module"): - self._import_python_module = self.get_global_func("runtime.disco._import_python_module") + self._import_python_module = self.get_global_func( + "tvm.runtime.disco._import_python_module" + ) self._import_python_module(module_name) @@ -306,7 +308,7 @@ def load_vm_module( module : DModule The loaded VM module. """ - func = self._get_cached_method("runtime.disco.load_vm_module") + func = self._get_cached_method("tvm.runtime.disco.load_vm_module") return DModule(func(path, device), self) def init_ccl(self, ccl: str, *device_ids): @@ -382,7 +384,7 @@ def broadcast_from_worker0(self, src: DRef, dst: DRef, in_group: bool = True) -> in_group: bool Whether the broadcast operation performs globally or in group as default. """ - func = self._get_cached_method("runtime.disco.broadcast_from_worker0") + func = self._get_cached_method("tvm.runtime.disco.broadcast_from_worker0") func(src, in_group, dst) def scatter( @@ -448,7 +450,7 @@ def scatter_from_worker0(self, from_array: DRef, to_array: DRef, in_group: bool in_group: bool Whether the scatter operation performs globally or in group as default. """ - func = self._get_cached_method("runtime.disco.scatter_from_worker0") + func = self._get_cached_method("tvm.runtime.disco.scatter_from_worker0") func(from_array, in_group, to_array) def gather_to_worker0(self, from_array: DRef, to_array: DRef, in_group: bool = True) -> None: @@ -465,7 +467,7 @@ def gather_to_worker0(self, from_array: DRef, to_array: DRef, in_group: bool = T in_group: bool Whether the gather operation performs globally or in group as default. """ - func = self._get_cached_method("runtime.disco.gather_to_worker0") + func = self._get_cached_method("tvm.runtime.disco.gather_to_worker0") func(from_array, in_group, to_array) def allreduce( @@ -496,7 +498,7 @@ def allreduce( if op not in REDUCE_OPS: raise ValueError(f"Unsupported reduce op: {op}. Available ops are: {REDUCE_OPS.keys()}") op = ShapeTuple([REDUCE_OPS[op]]) - func = self._get_cached_method("runtime.disco.allreduce") + func = self._get_cached_method("tvm.runtime.disco.allreduce") func(src, op, in_group, dst) def allgather( @@ -518,17 +520,17 @@ def allgather( in_group : bool Whether the reduce operation performs globally or in group as default. """ - func = self._get_cached_method("runtime.disco.allgather") + func = self._get_cached_method("tvm.runtime.disco.allgather") func(src, in_group, dst) def _clear_ipc_memory_pool(self): # Clear the IPC memory allocator when the allocator exists. - name = "runtime.disco.cuda_ipc.cuda_ipc_memory_allocator_clear" + name = "tvm.runtime.disco.cuda_ipc.cuda_ipc_memory_allocator_clear" if get_global_func(name, allow_missing=True) is not None: self.call_packed(self.get_global_func(name)) -@register_object("runtime.disco.ThreadedSession") +@register_object("tvm.runtime.disco.ThreadedSession") class ThreadedSession(Session): """A Disco session backed by multi-threading.""" @@ -541,7 +543,7 @@ def __init__(self, num_workers: int, num_groups: int = 1) -> None: ) -@register_object("runtime.disco.ProcessSession") +@register_object("tvm.runtime.disco.ProcessSession") class ProcessSession(Session): """A Disco session backed by pipe-based multi-processing.""" @@ -555,7 +557,7 @@ def __init__( _ffi_api.SessionProcess, # type: ignore # pylint: disable=no-member num_workers, num_groups, - "runtime.disco.create_process_pool", + "tvm.runtime.disco.create_process_pool", entrypoint, ) self._configure_structlog() @@ -579,17 +581,17 @@ def _configure_structlog(self) -> None: full_config = (structlog.get_config(), stdlib_formatter, stdlib_level) config = pickle.dumps(full_config) - func = self.get_global_func("runtime.disco._configure_structlog") + func = self.get_global_func("tvm.runtime.disco._configure_structlog") func(config, os.getpid()) -@register_global_func("runtime.disco.create_socket_session_local_workers") +@register_global_func("tvm.runtime.disco.create_socket_session_local_workers") def _create_socket_session_local_workers(num_workers) -> Session: """Create the local session for each distributed node over socket session.""" return ProcessSession(num_workers) -@register_object("runtime.disco.SocketSession") +@register_object("tvm.runtime.disco.SocketSession") class SocketSession(Session): """A Disco session backed by socket-based multi-node communication.""" @@ -611,7 +613,7 @@ def __init__( ) -@register_global_func("runtime.disco._configure_structlog") +@register_global_func("tvm.runtime.disco._configure_structlog") def _configure_structlog(pickled_config: bytes, parent_pid: int) -> None: """Configure structlog for all disco workers @@ -646,7 +648,7 @@ def _configure_structlog(pickled_config: bytes, parent_pid: int) -> None: structlog.configure(**structlog_config) -@register_global_func("runtime.disco._import_python_module") +@register_global_func("tvm.runtime.disco._import_python_module") def _import_python_module(module_name: str) -> None: __import__(module_name) diff --git a/python/tvm/runtime/profiling/__init__.py b/python/tvm/runtime/profiling/__init__.py index 3ca831ac4200..07b9b3260950 100644 --- a/python/tvm/runtime/profiling/__init__.py +++ b/python/tvm/runtime/profiling/__init__.py @@ -22,7 +22,7 @@ from .. import Object, Device -@_ffi.register_object("runtime.profiling.Report") +@_ffi.register_object("tvm.runtime.profiling.Report") class Report(Object): """A container for information gathered during a profiling run. @@ -172,7 +172,7 @@ def from_json(cls, s): return _ffi_api.FromJSON(s) -@_ffi.register_object("runtime.profiling.Count") +@_ffi.register_object("tvm.runtime.profiling.Count") class Count(Object): """A integer count of something""" @@ -180,7 +180,7 @@ def __init__(self, count: int): self.__init_handle_by_constructor__(_ffi_api.Count, count) -@_ffi.register_object("runtime.profiling.Duration") +@_ffi.register_object("tvm.runtime.profiling.Duration") class Duration(Object): """A duration of something""" @@ -188,7 +188,7 @@ def __init__(self, duration: float): self.__init_handle_by_constructor__(_ffi_api.Duration, duration) -@_ffi.register_object("runtime.profiling.Percent") +@_ffi.register_object("tvm.runtime.profiling.Percent") class Percent(Object): """A Percent of something""" @@ -196,7 +196,7 @@ def __init__(self, percent: float): self.__init_handle_by_constructor__(_ffi_api.Percent, percent) -@_ffi.register_object("runtime.profiling.Ratio") +@_ffi.register_object("tvm.runtime.profiling.Ratio") class Ratio(Object): """A Ratio of two things""" @@ -204,12 +204,12 @@ def __init__(self, ratio: float): self.__init_handle_by_constructor__(_ffi_api.Ratio, ratio) -@_ffi.register_object("runtime.profiling.MetricCollector") +@_ffi.register_object("tvm.runtime.profiling.MetricCollector") class MetricCollector(Object): """Interface for user defined profiling metric collection.""" -@_ffi.register_object("runtime.profiling.DeviceWrapper") +@_ffi.register_object("tvm.runtime.profiling.DeviceWrapper") class DeviceWrapper(Object): """Wraps a tvm.runtime.Device""" @@ -271,9 +271,12 @@ def profile_function(mod, dev, collectors, func_name=None, warmup_iters=10): # We only enable this class when TVM is build with PAPI support -if _ffi.get_global_func("runtime.profiling.PAPIMetricCollector", allow_missing=True) is not None: +if ( + _ffi.get_global_func("tvm.runtime.profiling.PAPIMetricCollector", allow_missing=True) + is not None +): - @_ffi.register_object("runtime.profiling.PAPIMetricCollector") + @_ffi.register_object("tvm.runtime.profiling.PAPIMetricCollector") class PAPIMetricCollector(MetricCollector): """Collects performance counter information using the Performance Application Programming Interface (PAPI). diff --git a/python/tvm/runtime/profiling/_ffi_api.py b/python/tvm/runtime/profiling/_ffi_api.py index 883e3ca6e778..f4d852533173 100644 --- a/python/tvm/runtime/profiling/_ffi_api.py +++ b/python/tvm/runtime/profiling/_ffi_api.py @@ -17,4 +17,4 @@ """FFI for profiling""" import tvm_ffi -tvm_ffi.init_ffi_api("runtime.profiling", __name__) +tvm_ffi.init_ffi_api("tvm.runtime.profiling", __name__) diff --git a/python/tvm/runtime/script_printer.py b/python/tvm/runtime/script_printer.py index 7442cd99172f..4313f159180d 100644 --- a/python/tvm/runtime/script_printer.py +++ b/python/tvm/runtime/script_printer.py @@ -25,7 +25,7 @@ from . import _ffi_node_api -@register_object("script.PrinterConfig") +@register_object("tvm.script.PrinterConfig") class PrinterConfig(Object): """Configuration of TVMScript printer""" @@ -110,7 +110,7 @@ def _script(obj: Object, config: PrinterConfig) -> str: def _relax_script(obj: Object, config: PrinterConfig) -> str: - func = get_global_func("script.printer.ReprPrintRelax") + func = get_global_func("tvm.script.printer.ReprPrintRelax") return func(obj, config) diff --git a/python/tvm/runtime/support.py b/python/tvm/runtime/support.py index 4a2e9ef50847..ac65fcfbff96 100644 --- a/python/tvm/runtime/support.py +++ b/python/tvm/runtime/support.py @@ -90,7 +90,7 @@ def derived_object(cls: type[T]) -> type[T]: ------- .. code-block:: python - @register_object("meta_schedule.PyRunner") + @register_object("tvm.meta_schedule.PyRunner") class _PyRunner(meta_schedule.Runner): def __init__(self, f_run: Callable = None): self.__init_handle_by_constructor__(_ffi_api.RunnerPyRunner, f_run) diff --git a/python/tvm/runtime/vm.py b/python/tvm/runtime/vm.py index b188c6ca70c7..06c76d4e4fe4 100644 --- a/python/tvm/runtime/vm.py +++ b/python/tvm/runtime/vm.py @@ -499,6 +499,6 @@ def profile(self, func_name: str, *args): return Report.from_json(report_json) -@register_global_func("vm.builtin.debug_print") +@register_global_func("tvm.vm.builtin.debug_print") def _print(lineo: str, array) -> None: print(f"{lineo}: shape = {array.shape}, dtype = {array.dtype}, data =\n{array}") diff --git a/python/tvm/script/_ffi_api.py b/python/tvm/script/_ffi_api.py index 1354d3f2ec2c..2076990c6970 100644 --- a/python/tvm/script/_ffi_api.py +++ b/python/tvm/script/_ffi_api.py @@ -17,4 +17,4 @@ import tvm_ffi -tvm_ffi.init_ffi_api("script", __name__) +tvm_ffi.init_ffi_api("tvm.script", __name__) diff --git a/python/tvm/script/ir_builder/_ffi_api.py b/python/tvm/script/ir_builder/_ffi_api.py index c8a9597d5292..16b60b05c441 100644 --- a/python/tvm/script/ir_builder/_ffi_api.py +++ b/python/tvm/script/ir_builder/_ffi_api.py @@ -17,4 +17,4 @@ """FFI APIs for tvm.script.ir_builder""" import tvm_ffi -tvm_ffi.init_ffi_api("script.ir_builder", __name__) # pylint: disable=protected-access +tvm_ffi.init_ffi_api("tvm.script.ir_builder", __name__) # pylint: disable=protected-access diff --git a/python/tvm/script/ir_builder/base.py b/python/tvm/script/ir_builder/base.py index a6bb68e2507c..b52f847a6c89 100644 --- a/python/tvm/script/ir_builder/base.py +++ b/python/tvm/script/ir_builder/base.py @@ -23,7 +23,7 @@ from . import _ffi_api -@_register_object("script.ir_builder.IRBuilderFrame") +@_register_object("tvm.script.ir_builder.IRBuilderFrame") class IRBuilderFrame(_Object): """A stack frame of the IRBuilder used to keep track of the current scope. Furthermore, the information stored in each stack frame can be useful for context-dependent @@ -82,7 +82,7 @@ def add_callback(self, callback: Callable[[], None]) -> None: ) -@_register_object("script.ir_builder.IRBuilder") +@_register_object("tvm.script.ir_builder.IRBuilder") class IRBuilder(_Object): """A dialect-agnostic IRBuilder that constructs any IR of TVM. diff --git a/python/tvm/script/ir_builder/ir/_ffi_api.py b/python/tvm/script/ir_builder/ir/_ffi_api.py index e319c3d4612e..68da3f112c7e 100644 --- a/python/tvm/script/ir_builder/ir/_ffi_api.py +++ b/python/tvm/script/ir_builder/ir/_ffi_api.py @@ -17,4 +17,4 @@ """FFI APIs""" import tvm_ffi -tvm_ffi.init_ffi_api("script.ir_builder.ir", __name__) # pylint: disable=protected-access +tvm_ffi.init_ffi_api("tvm.script.ir_builder.ir", __name__) # pylint: disable=protected-access diff --git a/python/tvm/script/ir_builder/ir/frame.py b/python/tvm/script/ir_builder/ir/frame.py index 45b49221e34b..665889b28c21 100644 --- a/python/tvm/script/ir_builder/ir/frame.py +++ b/python/tvm/script/ir_builder/ir/frame.py @@ -21,6 +21,6 @@ from ..base import IRBuilderFrame -@_register_object("script.ir_builder.IRModuleFrame") +@_register_object("tvm.script.ir_builder.IRModuleFrame") class IRModuleFrame(IRBuilderFrame): ... diff --git a/python/tvm/script/ir_builder/relax/_ffi_api.py b/python/tvm/script/ir_builder/relax/_ffi_api.py index f6c53336ff4c..e3f7aaa2e2a5 100644 --- a/python/tvm/script/ir_builder/relax/_ffi_api.py +++ b/python/tvm/script/ir_builder/relax/_ffi_api.py @@ -17,4 +17,4 @@ """FFI APIs for tvm.script.ir_builder.relax""" import tvm_ffi -tvm_ffi.init_ffi_api("script.ir_builder.relax", __name__) # pylint: disable=protected-access +tvm_ffi.init_ffi_api("tvm.script.ir_builder.relax", __name__) # pylint: disable=protected-access diff --git a/python/tvm/script/ir_builder/relax/distributed/_ffi_api.py b/python/tvm/script/ir_builder/relax/distributed/_ffi_api.py index b82fa37e8f3f..3d335f491ba4 100644 --- a/python/tvm/script/ir_builder/relax/distributed/_ffi_api.py +++ b/python/tvm/script/ir_builder/relax/distributed/_ffi_api.py @@ -18,5 +18,5 @@ import tvm_ffi tvm_ffi.init_ffi_api( - "script.ir_builder.relax.distributed", __name__ + "tvm.script.ir_builder.relax.distributed", __name__ ) # pylint: disable=protected-access diff --git a/python/tvm/script/ir_builder/relax/frame.py b/python/tvm/script/ir_builder/relax/frame.py index ed4d948ff972..d02999308d00 100644 --- a/python/tvm/script/ir_builder/relax/frame.py +++ b/python/tvm/script/ir_builder/relax/frame.py @@ -20,36 +20,36 @@ from ..base import IRBuilderFrame -@_register_object("script.ir_builder.relax.RelaxFrame") +@_register_object("tvm.script.ir_builder.relax.RelaxFrame") class RelaxFrame(IRBuilderFrame): """The base ir_builder frame for the relax dialect.""" -@_register_object("script.ir_builder.relax.SeqExprFrame") +@_register_object("tvm.script.ir_builder.relax.SeqExprFrame") class SeqExprFrame(RelaxFrame): ... -@_register_object("script.ir_builder.relax.FunctionFrame") +@_register_object("tvm.script.ir_builder.relax.FunctionFrame") class FunctionFrame(SeqExprFrame): """The ir_builder frame for the relax function.""" -@_register_object("script.ir_builder.relax.BlockFrame") +@_register_object("tvm.script.ir_builder.relax.BlockFrame") class BlockFrame(RelaxFrame): """The ir_builder frame for relax binding blocks.""" -@_register_object("script.ir_builder.relax.IfFrame") +@_register_object("tvm.script.ir_builder.relax.IfFrame") class IfFrame(RelaxFrame): ... -@_register_object("script.ir_builder.relax.ThenFrame") +@_register_object("tvm.script.ir_builder.relax.ThenFrame") class ThenFrame(SeqExprFrame): ... -@_register_object("script.ir_builder.relax.ElseFrame") +@_register_object("tvm.script.ir_builder.relax.ElseFrame") class ElseFrame(SeqExprFrame): ... diff --git a/python/tvm/script/ir_builder/relax/ir.py b/python/tvm/script/ir_builder/relax/ir.py index 141361a729c4..453d56ca4fff 100644 --- a/python/tvm/script/ir_builder/relax/ir.py +++ b/python/tvm/script/ir_builder/relax/ir.py @@ -446,7 +446,7 @@ def call_packed( attrs_type_key = kwargs["attrs_type_key"] kwargs.pop("attrs_type_key") else: - attrs_type_key = "ir.DictAttrs" + attrs_type_key = "tvm.ir.DictAttrs" is_default = True attrs = None if kwargs or not is_default: diff --git a/python/tvm/script/ir_builder/tir/_ffi_api.py b/python/tvm/script/ir_builder/tir/_ffi_api.py index 4385b2ec13d0..9ce7168ba2c6 100644 --- a/python/tvm/script/ir_builder/tir/_ffi_api.py +++ b/python/tvm/script/ir_builder/tir/_ffi_api.py @@ -17,4 +17,4 @@ """FFI APIs""" import tvm_ffi -tvm_ffi.init_ffi_api("script.ir_builder.tir", __name__) # pylint: disable=protected-access +tvm_ffi.init_ffi_api("tvm.script.ir_builder.tir", __name__) # pylint: disable=protected-access diff --git a/python/tvm/script/ir_builder/tir/frame.py b/python/tvm/script/ir_builder/tir/frame.py index f43b4cf6ed67..705e51e915e2 100644 --- a/python/tvm/script/ir_builder/tir/frame.py +++ b/python/tvm/script/ir_builder/tir/frame.py @@ -23,97 +23,97 @@ from ..base import IRBuilderFrame -@_register_object("script.ir_builder.tir.TIRFrame") +@_register_object("tvm.script.ir_builder.tir.TIRFrame") class TIRFrame(IRBuilderFrame): ... -@_register_object("script.ir_builder.tir.PrimFuncFrame") +@_register_object("tvm.script.ir_builder.tir.PrimFuncFrame") class PrimFuncFrame(TIRFrame): ... -@_register_object("script.ir_builder.tir.BlockFrame") +@_register_object("tvm.script.ir_builder.tir.BlockFrame") class BlockFrame(TIRFrame): ... -@_register_object("script.ir_builder.tir.BlockInitFrame") +@_register_object("tvm.script.ir_builder.tir.BlockInitFrame") class BlockInitFrame(TIRFrame): ... -@_register_object("script.ir_builder.tir.ForFrame") +@_register_object("tvm.script.ir_builder.tir.ForFrame") class ForFrame(TIRFrame): def __enter__(self) -> Union[Var, List[Var]]: # type: ignore[override] super().__enter__() return self.vars if len(self.vars) > 1 else self.vars[0] -@_register_object("script.ir_builder.tir.AssertFrame") +@_register_object("tvm.script.ir_builder.tir.AssertFrame") class AssertFrame(TIRFrame): ... -@_register_object("script.ir_builder.tir.LetFrame") +@_register_object("tvm.script.ir_builder.tir.LetFrame") class LetFrame(TIRFrame): def __enter__(self) -> Var: super().__enter__() return self.var -@_register_object("script.ir_builder.tir.RealizeFrame") +@_register_object("tvm.script.ir_builder.tir.RealizeFrame") class RealizeFrame(TIRFrame): ... -@_register_object("script.ir_builder.tir.AllocateFrame") +@_register_object("tvm.script.ir_builder.tir.AllocateFrame") class AllocateFrame(TIRFrame): def __enter__(self) -> Buffer: super().__enter__() return self.buffer_var -@_register_object("script.ir_builder.tir.AllocateConstFrame") +@_register_object("tvm.script.ir_builder.tir.AllocateConstFrame") class AllocateConstFrame(TIRFrame): def __enter__(self) -> Buffer: super().__enter__() return self.buffer_var -@_register_object("script.ir_builder.tir.AttrFrame") +@_register_object("tvm.script.ir_builder.tir.AttrFrame") class AttrFrame(TIRFrame): ... -@_register_object("script.ir_builder.tir.WhileFrame") +@_register_object("tvm.script.ir_builder.tir.WhileFrame") class WhileFrame(TIRFrame): ... -@_register_object("script.ir_builder.tir.IfFrame") +@_register_object("tvm.script.ir_builder.tir.IfFrame") class IfFrame(TIRFrame): ... -@_register_object("script.ir_builder.tir.ThenFrame") +@_register_object("tvm.script.ir_builder.tir.ThenFrame") class ThenFrame(TIRFrame): ... -@_register_object("script.ir_builder.tir.ElseFrame") +@_register_object("tvm.script.ir_builder.tir.ElseFrame") class ElseFrame(TIRFrame): ... -@_register_object("script.ir_builder.tir.DeclBufferFrame") +@_register_object("tvm.script.ir_builder.tir.DeclBufferFrame") class DeclBufferFrame(TIRFrame): def __enter__(self) -> Buffer: super().__enter__() return self.buffer -@_register_object("script.ir_builder.tir.LaunchThreadFrame") +@_register_object("tvm.script.ir_builder.tir.LaunchThreadFrame") class LaunchThreadFrame(TIRFrame): def __enter__(self) -> Var: super().__enter__() diff --git a/python/tvm/script/printer/_ffi_api.py b/python/tvm/script/printer/_ffi_api.py index 967d0d824ba2..d3b71c7e121f 100644 --- a/python/tvm/script/printer/_ffi_api.py +++ b/python/tvm/script/printer/_ffi_api.py @@ -17,4 +17,4 @@ """FFI APIs for tvm.script.printer""" import tvm_ffi -tvm_ffi.init_ffi_api("script.printer", __name__) # pylint: disable=protected-access +tvm_ffi.init_ffi_api("tvm.script.printer", __name__) # pylint: disable=protected-access diff --git a/python/tvm/script/printer/doc.py b/python/tvm/script/printer/doc.py index 62d8c563dd3f..0cc7e5b6ed5e 100644 --- a/python/tvm/script/printer/doc.py +++ b/python/tvm/script/printer/doc.py @@ -27,12 +27,12 @@ from . import _ffi_api -@register_object("script.printer.Doc") +@register_object("tvm.script.printer.Doc") class Doc(Object): """Base class of all Docs""" -@register_object("script.printer.ExprDoc") +@register_object("tvm.script.printer.ExprDoc") class ExprDoc(Doc): """Base class of all expression Docs""" @@ -102,12 +102,12 @@ def __iter__(self): raise RuntimeError(f"{self.__class__} cannot be used as iterable.") -@register_object("script.printer.StmtDoc") +@register_object("tvm.script.printer.StmtDoc") class StmtDoc(Doc): """Base class of statement doc""" -@register_object("script.printer.StmtBlockDoc") +@register_object("tvm.script.printer.StmtBlockDoc") class StmtBlockDoc(Doc): """The container doc that holds a list of StmtDoc. @@ -121,7 +121,7 @@ def __init__(self, stmts: List[StmtDoc]): self.__init_handle_by_constructor__(_ffi_api.StmtBlockDoc, stmts) # type: ignore # pylint: disable=no-member -@register_object("script.printer.LiteralDoc") +@register_object("tvm.script.printer.LiteralDoc") class LiteralDoc(ExprDoc): """Doc that represents literal value""" @@ -162,7 +162,7 @@ def __init__( raise TypeError(f"Unsupported type {type(value)} for LiteralDoc") -@register_object("script.printer.IdDoc") +@register_object("tvm.script.printer.IdDoc") class IdDoc(ExprDoc): """Doc that represents identifier""" @@ -172,7 +172,7 @@ def __init__(self, name: str): self.__init_handle_by_constructor__(_ffi_api.IdDoc, name) # type: ignore # pylint: disable=no-member -@register_object("script.printer.AttrAccessDoc") +@register_object("tvm.script.printer.AttrAccessDoc") class AttrAccessDoc(ExprDoc): """Doc that represents attribute access on an expression""" @@ -183,7 +183,7 @@ def __init__(self, value: ExprDoc, name: str): self.__init_handle_by_constructor__(_ffi_api.AttrAccessDoc, value, name) # type: ignore # pylint: disable=no-member -@register_object("script.printer.IndexDoc") +@register_object("tvm.script.printer.IndexDoc") class IndexDoc(ExprDoc): """Doc that represents index access on an expression""" @@ -194,7 +194,7 @@ def __init__(self, value: ExprDoc, indices: List[Union[ExprDoc, "SliceDoc"]]): self.__init_handle_by_constructor__(_ffi_api.IndexDoc, value, indices) # type: ignore # pylint: disable=no-member -@register_object("script.printer.CallDoc") +@register_object("tvm.script.printer.CallDoc") class CallDoc(ExprDoc): """Doc that represents function call""" @@ -262,7 +262,7 @@ class OperationKind(IntEnum): # pylint: enable=invalid-name -@register_object("script.printer.OperationDoc") +@register_object("tvm.script.printer.OperationDoc") class OperationDoc(ExprDoc): """ Doc that represents operation @@ -278,7 +278,7 @@ def __init__(self, kind: OperationKind, operands: List[ExprDoc]): self.__init_handle_by_constructor__(_ffi_api.OperationDoc, kind, operands) # type: ignore # pylint: disable=no-member -@register_object("script.printer.LambdaDoc") +@register_object("tvm.script.printer.LambdaDoc") class LambdaDoc(ExprDoc): """Doc that represents lambda function""" @@ -289,7 +289,7 @@ def __init__(self, args: List[IdDoc], body: ExprDoc): self.__init_handle_by_constructor__(_ffi_api.LambdaDoc, args, body) # type: ignore # pylint: disable=no-member -@register_object("script.printer.TupleDoc") +@register_object("tvm.script.printer.TupleDoc") class TupleDoc(ExprDoc): """Doc that represents tuple literal""" @@ -299,7 +299,7 @@ def __init__(self, elements: List[ExprDoc]): self.__init_handle_by_constructor__(_ffi_api.TupleDoc, elements) # type: ignore # pylint: disable=no-member -@register_object("script.printer.ListDoc") +@register_object("tvm.script.printer.ListDoc") class ListDoc(ExprDoc): """Doc that represents list literal""" @@ -309,7 +309,7 @@ def __init__(self, elements: List[ExprDoc]): self.__init_handle_by_constructor__(_ffi_api.ListDoc, elements) # type: ignore # pylint: disable=no-member -@register_object("script.printer.DictDoc") +@register_object("tvm.script.printer.DictDoc") class DictDoc(ExprDoc): """Doc that represents dict literal""" @@ -322,7 +322,7 @@ def __init__(self, content: Dict[ExprDoc, ExprDoc]): self.__init_handle_by_constructor__(_ffi_api.DictDoc, keys, values) # type: ignore # pylint: disable=no-member -@register_object("script.printer.SliceDoc") +@register_object("tvm.script.printer.SliceDoc") class SliceDoc(ExprDoc): """ Doc that represents slice in Index expression @@ -343,7 +343,7 @@ def __init__( self.__init_handle_by_constructor__(_ffi_api.SliceDoc, start, stop, step) # type: ignore # pylint: disable=no-member -@register_object("script.printer.AssignDoc") +@register_object("tvm.script.printer.AssignDoc") class AssignDoc(StmtDoc): """Doc that represents assign statement.""" @@ -360,7 +360,7 @@ def __init__(self, lhs: ExprDoc, rhs: Optional[ExprDoc], annotation: Optional[Ex ) -@register_object("script.printer.IfDoc") +@register_object("tvm.script.printer.IfDoc") class IfDoc(StmtDoc): """Doc that represent if-then-else statement.""" @@ -377,7 +377,7 @@ def __init__(self, predicate: ExprDoc, then_branch: List[StmtDoc], else_branch: ) -@register_object("script.printer.WhileDoc") +@register_object("tvm.script.printer.WhileDoc") class WhileDoc(StmtDoc): """Doc that represents while statement.""" @@ -388,7 +388,7 @@ def __init__(self, predicate: ExprDoc, body: List[StmtDoc]): self.__init_handle_by_constructor__(_ffi_api.WhileDoc, predicate, body) # type: ignore # pylint: disable=no-member -@register_object("script.printer.ForDoc") +@register_object("tvm.script.printer.ForDoc") class ForDoc(StmtDoc): """Doc that represents for statement.""" @@ -400,7 +400,7 @@ def __init__(self, lhs: ExprDoc, rhs: ExprDoc, body: List[StmtDoc]): self.__init_handle_by_constructor__(_ffi_api.ForDoc, lhs, rhs, body) # type: ignore # pylint: disable=no-member -@register_object("script.printer.ScopeDoc") +@register_object("tvm.script.printer.ScopeDoc") class ScopeDoc(StmtDoc): """ Doc that represents special scopes. @@ -419,7 +419,7 @@ def __init__(self, lhs: Optional[ExprDoc], rhs: ExprDoc, body: List[StmtDoc]): self.__init_handle_by_constructor__(_ffi_api.ScopeDoc, lhs, rhs, body) # type: ignore # pylint: disable=no-member -@register_object("script.printer.ExprStmtDoc") +@register_object("tvm.script.printer.ExprStmtDoc") class ExprStmtDoc(StmtDoc): """Doc that represents an expression as statement.""" @@ -429,7 +429,7 @@ def __init__(self, expr: ExprDoc): self.__init_handle_by_constructor__(_ffi_api.ExprStmtDoc, expr) # type: ignore # pylint: disable=no-member -@register_object("script.printer.AssertDoc") +@register_object("tvm.script.printer.AssertDoc") class AssertDoc(StmtDoc): """Doc that represents assert statement.""" @@ -440,7 +440,7 @@ def __init__(self, test: ExprDoc, msg: Optional[ExprDoc] = None): self.__init_handle_by_constructor__(_ffi_api.AssertDoc, test, msg) # type: ignore # pylint: disable=no-member -@register_object("script.printer.ReturnDoc") +@register_object("tvm.script.printer.ReturnDoc") class ReturnDoc(StmtDoc): """Doc that represents return statement.""" @@ -450,7 +450,7 @@ def __init__(self, value: ExprDoc): self.__init_handle_by_constructor__(_ffi_api.ReturnDoc, value) # type: ignore # pylint: disable=no-member -@register_object("script.printer.FunctionDoc") +@register_object("tvm.script.printer.FunctionDoc") class FunctionDoc(StmtDoc): """Doc that represents function definition.""" @@ -478,7 +478,7 @@ def __init__( ) -@register_object("script.printer.ClassDoc") +@register_object("tvm.script.printer.ClassDoc") class ClassDoc(StmtDoc): """Doc that represents class definition.""" @@ -495,7 +495,7 @@ def __init__(self, name: IdDoc, decorators: List[ExprDoc], body: List[StmtDoc]): ) -@register_object("script.printer.CommentDoc") +@register_object("tvm.script.printer.CommentDoc") class CommentDoc(StmtDoc): """Doc that represents comment.""" @@ -505,7 +505,7 @@ def __init__(self, comment: str): ) -@register_object("script.printer.DocStringDoc") +@register_object("tvm.script.printer.DocStringDoc") class DocStringDoc(StmtDoc): """Doc that represents docstring.""" diff --git a/python/tvm/support.py b/python/tvm/support.py index d0b1540c0417..10c067630c72 100644 --- a/python/tvm/support.py +++ b/python/tvm/support.py @@ -26,7 +26,7 @@ from .runtime.module import Module from . import get_global_func -tvm_ffi.init_ffi_api("support", __name__) +tvm_ffi.init_ffi_api("tvm.support", __name__) def libinfo(): @@ -37,7 +37,7 @@ def libinfo(): info: Dict[str, str] The dictionary of compile-time info. """ - get_lib_info_func = get_global_func("support.GetLibInfo", allow_missing=True) + get_lib_info_func = get_global_func("tvm.support.GetLibInfo", allow_missing=True) if get_lib_info_func is not None: lib_info = get_lib_info_func() if lib_info is None: @@ -71,7 +71,7 @@ class FrontendTestModule(Module): """A tvm.runtime.Module whose member functions are PackedFunc.""" def __init__(self, entry_name=None): - underlying_mod = get_global_func("testing.FrontendTestModule")() + underlying_mod = get_global_func("tvm.testing.FrontendTestModule")() handle = underlying_mod.handle # Set handle to NULL to avoid cleanup in c++ runtime, transferring ownership. diff --git a/python/tvm/target/_ffi_api.py b/python/tvm/target/_ffi_api.py index 8b9f6c73bd4e..51272064a90a 100644 --- a/python/tvm/target/_ffi_api.py +++ b/python/tvm/target/_ffi_api.py @@ -18,4 +18,4 @@ import tvm_ffi -tvm_ffi.init_ffi_api("target", __name__) +tvm_ffi.init_ffi_api("tvm.target", __name__) diff --git a/python/tvm/target/datatype.py b/python/tvm/target/datatype.py index e597c8d147be..240028c5a4ed 100644 --- a/python/tvm/target/datatype.py +++ b/python/tvm/target/datatype.py @@ -57,7 +57,7 @@ def register(type_name, type_code): The type's code, which should be >= kCustomBegin. See include/tvm/runtime/data_type.h. """ - get_global_func("dtype.register_custom_type")(type_name, type_code) + get_global_func("tvm.dtype.register_custom_type")(type_name, type_code) def get_type_name(type_code): @@ -84,7 +84,7 @@ def get_type_name(type_code): The name of the custom datatype. """ - return get_global_func("dtype.get_custom_type_name")(type_code) + return get_global_func("tvm.dtype.get_custom_type_name")(type_code) def get_type_code(type_name): @@ -110,7 +110,7 @@ def get_type_code(type_name): type_code : int The type code of the custom datatype. """ - return get_global_func("dtype.get_custom_type_code")(type_name) + return get_global_func("tvm.dtype.get_custom_type_code")(type_name) def get_type_registered(type_code): diff --git a/python/tvm/target/detect_target.py b/python/tvm/target/detect_target.py index 5c61de62e4e1..ceef4aaa718a 100644 --- a/python/tvm/target/detect_target.py +++ b/python/tvm/target/detect_target.py @@ -69,7 +69,7 @@ def _detect_opencl(dev: Device) -> Target: def _detect_vulkan(dev: Device) -> Target: - f_get_target_property = get_global_func("device_api.vulkan.get_target_property") + f_get_target_property = get_global_func("tvm.device_api.vulkan.get_target_property") return Target( { "kind": "vulkan", diff --git a/python/tvm/target/target.py b/python/tvm/target/target.py index eb6e25f0450c..adc186bb04c7 100644 --- a/python/tvm/target/target.py +++ b/python/tvm/target/target.py @@ -30,7 +30,7 @@ from . import _ffi_api -@tvm_ffi.register_object("target.TargetKind") +@tvm_ffi.register_object("tvm.target.TargetKind") class TargetKind(Object): """Kind of a compilation target""" @@ -53,7 +53,7 @@ def __getattr__(self, name: str): return _ffi_api.TargetGetFeature(self.target, name) -@tvm_ffi.register_object("target.Target") +@tvm_ffi.register_object("tvm.target.Target") class Target(Object): """Target device information, use through TVM API. diff --git a/python/tvm/target/virtual_device.py b/python/tvm/target/virtual_device.py index e509c5670750..48e0afa5b1ba 100644 --- a/python/tvm/target/virtual_device.py +++ b/python/tvm/target/virtual_device.py @@ -21,7 +21,7 @@ from . import _ffi_api -@tvm_ffi.register_object("target.VirtualDevice") +@tvm_ffi.register_object("tvm.target.VirtualDevice") class VirtualDevice(tvm_ffi.core.Object): """A compile time representation for where data is to be stored at runtime, and how to compile code to compute it.""" diff --git a/python/tvm/te/_ffi_api.py b/python/tvm/te/_ffi_api.py index 172fff01d7ff..6f76a182c4ac 100644 --- a/python/tvm/te/_ffi_api.py +++ b/python/tvm/te/_ffi_api.py @@ -18,4 +18,4 @@ import tvm_ffi -tvm_ffi.init_ffi_api("te", __name__) +tvm_ffi.init_ffi_api("tvm.te", __name__) diff --git a/python/tvm/te/tensor.py b/python/tvm/te/tensor.py index 4ef1b67969c8..0efa53bc91bc 100644 --- a/python/tvm/te/tensor.py +++ b/python/tvm/te/tensor.py @@ -48,7 +48,7 @@ def dtype(self): return self.tensor.dtype -@tvm_ffi.register_object("te.Tensor") +@tvm_ffi.register_object("tvm.te.Tensor") class Tensor(DataProducer, _expr.ExprOp): """Tensor object, to construct, see function.Tensor""" @@ -92,7 +92,7 @@ def name(self): return f"{op.name}.v{self.value_index}" -@tvm_ffi.register_object("te.Operation") +@tvm_ffi.register_object("tvm.te.Operation") class Operation(Object): """Represent an operation that generates a tensor""" @@ -122,26 +122,26 @@ def input_tensors(self): return _ffi_api.OpInputTensors(self) -@tvm_ffi.register_object("te.PlaceholderOp") +@tvm_ffi.register_object("tvm.te.PlaceholderOp") class PlaceholderOp(Operation): """Placeholder operation.""" -@tvm_ffi.register_object("te.BaseComputeOp") +@tvm_ffi.register_object("tvm.te.BaseComputeOp") class BaseComputeOp(Operation): """Compute operation.""" -@tvm_ffi.register_object("te.ComputeOp") +@tvm_ffi.register_object("tvm.te.ComputeOp") class ComputeOp(BaseComputeOp): """Scalar operation.""" -@tvm_ffi.register_object("te.ScanOp") +@tvm_ffi.register_object("tvm.te.ScanOp") class ScanOp(Operation): """Scan operation.""" -@tvm_ffi.register_object("te.ExternOp") +@tvm_ffi.register_object("tvm.te.ExternOp") class ExternOp(Operation): """External operation.""" diff --git a/python/tvm/testing/_ffi_api.py b/python/tvm/testing/_ffi_api.py index b7a0b59fd0e4..7a9550aa2eac 100644 --- a/python/tvm/testing/_ffi_api.py +++ b/python/tvm/testing/_ffi_api.py @@ -21,4 +21,4 @@ import tvm_ffi.testing -tvm_ffi.init_ffi_api("testing", __name__) +tvm_ffi.init_ffi_api("tvm.testing", __name__) diff --git a/python/tvm/testing/attrs.py b/python/tvm/testing/attrs.py index 4e946ce6d4b9..4a631031d273 100644 --- a/python/tvm/testing/attrs.py +++ b/python/tvm/testing/attrs.py @@ -20,7 +20,7 @@ from ..ir import Attrs -@register_object("attrs.TestAttrs") +@register_object("tvm.attrs.TestAttrs") class TestAttrs(Attrs): """Attrs used for testing purposes""" diff --git a/python/tvm/testing/popen_pool.py b/python/tvm/testing/popen_pool.py index 8ff260a62f9c..f4ee4387577b 100644 --- a/python/tvm/testing/popen_pool.py +++ b/python/tvm/testing/popen_pool.py @@ -36,19 +36,19 @@ def after_initializer(): return TEST_GLOBAL_STATE_1, TEST_GLOBAL_STATE_2, TEST_GLOBAL_STATE_3 -@tvm_ffi.register_global_func("testing.identity_py") +@tvm_ffi.register_global_func("tvm.testing.identity_py") def identity_py(arg): return arg def register_ffi(): - @tvm_ffi.register_global_func("testing.nested_identity_py") + @tvm_ffi.register_global_func("tvm.testing.nested_identity_py") def _identity_py(arg): # pylint: disable=unused-variable return arg def call_py_ffi(arg): - _identity_py = tvm_ffi.get_global_func("testing.nested_identity_py") + _identity_py = tvm_ffi.get_global_func("tvm.testing.nested_identity_py") return _identity_py(arg) diff --git a/python/tvm/testing/runner.py b/python/tvm/testing/runner.py index be50cc8707c5..a7c56bee936f 100644 --- a/python/tvm/testing/runner.py +++ b/python/tvm/testing/runner.py @@ -137,7 +137,7 @@ def local_run( # pylint: disable=too-many-arguments,too-many-locals number=evaluator_config.number, repeat=evaluator_config.repeat, min_repeat_ms=evaluator_config.min_repeat_ms, - f_preproc="cache_flush_cpu_non_first_arg" + f_preproc="tvm.cache_flush_cpu_non_first_arg" if evaluator_config.enable_cpu_cache_flush else "", )(*args) @@ -221,7 +221,7 @@ def rpc_run( # pylint: disable=too-many-arguments,too-many-locals number=evaluator_config.number, repeat=evaluator_config.repeat, min_repeat_ms=evaluator_config.min_repeat_ms, - f_preproc="cache_flush_cpu_non_first_arg" + f_preproc="tvm.cache_flush_cpu_non_first_arg" if evaluator_config.enable_cpu_cache_flush else "", )(*args) diff --git a/python/tvm/tir/_ffi_api.py b/python/tvm/tir/_ffi_api.py index 4140cda741dd..b5cb2b9380d3 100644 --- a/python/tvm/tir/_ffi_api.py +++ b/python/tvm/tir/_ffi_api.py @@ -18,4 +18,4 @@ import tvm_ffi -tvm_ffi.init_ffi_api("tir", __name__) +tvm_ffi.init_ffi_api("tvm.tir", __name__) diff --git a/python/tvm/tir/analysis/_ffi_api.py b/python/tvm/tir/analysis/_ffi_api.py index 9e5d094c1a82..f3703dbd1d6a 100644 --- a/python/tvm/tir/analysis/_ffi_api.py +++ b/python/tvm/tir/analysis/_ffi_api.py @@ -18,4 +18,4 @@ import tvm_ffi -tvm_ffi.init_ffi_api("tir.analysis", __name__) +tvm_ffi.init_ffi_api("tvm.tir.analysis", __name__) diff --git a/python/tvm/tir/analysis/analysis.py b/python/tvm/tir/analysis/analysis.py index 8a84d3ee51fa..187f3cdd6f46 100644 --- a/python/tvm/tir/analysis/analysis.py +++ b/python/tvm/tir/analysis/analysis.py @@ -302,7 +302,7 @@ def find_anchor_block(mod: IRModule) -> Block: def has_if_then_else(stmt: Stmt) -> bool: - return tvm.ffi.get_global_func("tir.schedule.HasIfThenElse")(stmt) + return tvm.ffi.get_global_func("tvm.tir.schedule.HasIfThenElse")(stmt) def get_vtcm_compaction_passes() -> List[tvm.transform.Pass]: diff --git a/python/tvm/tir/block_dependence_info.py b/python/tvm/tir/block_dependence_info.py index 7bd6b418fc72..0bb40ec2f9aa 100644 --- a/python/tvm/tir/block_dependence_info.py +++ b/python/tvm/tir/block_dependence_info.py @@ -27,7 +27,7 @@ from . import _ffi_api -@register_object("tir.BlockDependenceInfo") +@register_object("tvm.tir.BlockDependenceInfo") class BlockDependenceInfo(Object): """ BlockDependenceInfo diff --git a/python/tvm/tir/block_scope.py b/python/tvm/tir/block_scope.py index d63771fae93e..a5b40d72ae99 100644 --- a/python/tvm/tir/block_scope.py +++ b/python/tvm/tir/block_scope.py @@ -25,7 +25,7 @@ from . import _ffi_api -@register_object("tir.StmtSRef") +@register_object("tvm.tir.StmtSRef") class StmtSRef(Object): """An object that refers to schedulable elements in the TensorIR, aka "sref". @@ -86,7 +86,7 @@ class DepKind(IntEnum): OPAQUE = 3 -@register_object("tir.Dependency") +@register_object("tvm.tir.Dependency") class Dependency(Object): """A tuple (src, dst, kind) representing certain types of dependency. For example, (A, B, kRAW) means block B depends on block A, and the dependency kind is @@ -107,7 +107,7 @@ class Dependency(Object): kind: DepKind -@register_object("tir.BlockScope") +@register_object("tvm.tir.BlockScope") class BlockScope(Object): """An object corresponds to each block sref in the sref tree, which tracks the producer-consumer dependency between blocks. diff --git a/python/tvm/tir/buffer.py b/python/tvm/tir/buffer.py index 259017608275..fb7de2601a24 100644 --- a/python/tvm/tir/buffer.py +++ b/python/tvm/tir/buffer.py @@ -25,7 +25,7 @@ from . import _ffi_api -@tvm_ffi.register_object("tir.Buffer") +@tvm_ffi.register_object("tvm.tir.Buffer") class Buffer(Object, Scriptable): """Symbolic data buffer in TVM. @@ -350,6 +350,6 @@ def decl_buffer( ) -@tvm_ffi.register_object("tir.DataProducer") +@tvm_ffi.register_object("tvm.tir.DataProducer") class DataProducer(Object): pass diff --git a/python/tvm/tir/build.py b/python/tvm/tir/build.py index 5df2663fc20b..6e1cce025dfd 100644 --- a/python/tvm/tir/build.py +++ b/python/tvm/tir/build.py @@ -124,7 +124,7 @@ def codegen_build(mod: IRModule, target: Target) -> tvm.runtime.Module: """Build a runtime module from an IRModule and a Target.""" if tvm.ir.transform.PassContext.current().config.get("tir.disable_assert", False): mod = tvm.tir.transform.SkipAssert()(mod) - build_f_name = "target.build." + target.kind.name + build_f_name = "tvm.target.build." + target.kind.name bf = tvm.get_global_func(build_f_name) if bf is None: raise ValueError(f"{build_f_name} is not enabled") @@ -239,4 +239,4 @@ def build( return tir_to_runtime(host_mod, device_mod_dict, target_host) -tvm.register_global_func("tir.build", build) +tvm.register_global_func("tvm.tir.build", build) diff --git a/python/tvm/tir/data_layout.py b/python/tvm/tir/data_layout.py index f9c0e0cdc7ce..75d01f87dd4d 100644 --- a/python/tvm/tir/data_layout.py +++ b/python/tvm/tir/data_layout.py @@ -23,7 +23,7 @@ from . import _ffi_api -@tvm_ffi.register_object("tir.Layout") +@tvm_ffi.register_object("tvm.tir.Layout") class Layout(Object): """Layout is composed of upper cases, lower cases and numbers, where upper case indicates a primal axis and @@ -81,7 +81,7 @@ def factor_of(self, axis): return _ffi_api.LayoutFactorOf(self, axis) # type: ignore -@tvm_ffi.register_object("tir.BijectiveLayout") +@tvm_ffi.register_object("tvm.tir.BijectiveLayout") class BijectiveLayout(Object): """Bijective mapping for two layouts (src-layout and dst-layout). It provides shape and index conversion between each other. diff --git a/python/tvm/tir/expr.py b/python/tvm/tir/expr.py index f5476230c19b..570c979c43c8 100644 --- a/python/tvm/tir/expr.py +++ b/python/tvm/tir/expr.py @@ -349,7 +349,7 @@ class LogicalExpr(PrimExprWithOp): pass -@tvm_ffi.register_object("tir.Var") +@tvm_ffi.register_object("tvm.tir.Var") class Var(PrimExprWithOp): """Symbolic variable. @@ -372,7 +372,7 @@ def __init__(self, name: str, dtype: Union[str, ir.Type], span: Optional[Span] = self.__init_handle_by_constructor__(_ffi_api.Var, name, dtype, span) # type: ignore -@tvm_ffi.register_object("tir.SizeVar") +@tvm_ffi.register_object("tvm.tir.SizeVar") class SizeVar(Var): """Symbolic variable to represent a tensor index size which is greater or equal to zero. @@ -394,7 +394,7 @@ def __init__(self, name: str, dtype: Union[str, ir.Type], span: Optional[Span] = self.__init_handle_by_constructor__(_ffi_api.SizeVar, name, dtype, span) # type: ignore -@tvm_ffi.register_object("tir.IterVar") +@tvm_ffi.register_object("tvm.tir.IterVar") class IterVar(ExprOp, Object, Scriptable): """Represent iteration variable. @@ -467,7 +467,7 @@ def __init__( ) -@tvm_ffi.register_object("tir.CommReducer") +@tvm_ffi.register_object("tvm.tir.CommReducer") class CommReducer(Object, Scriptable): """Commutative reduce operator @@ -507,7 +507,7 @@ def __init__( ) -@tvm_ffi.register_object("tir.Reduce") +@tvm_ffi.register_object("tvm.tir.Reduce") class Reduce(PrimExprWithOp): """Reduce node. @@ -558,7 +558,7 @@ def __init__( ) -@tvm_ffi.register_object("ir.FloatImm") +@tvm_ffi.register_object("tvm.ir.FloatImm") class FloatImm(ConstExpr): """Float constant. @@ -585,7 +585,7 @@ def __float__(self) -> float: return self.value -@tvm_ffi.register_object("ir.IntImm") +@tvm_ffi.register_object("tvm.ir.IntImm") class IntImm(ConstExpr): """Int constant. @@ -627,7 +627,7 @@ def __bool__(self) -> bool: return self.__nonzero__() -@tvm_ffi.register_object("tir.StringImm") # type: ignore +@tvm_ffi.register_object("tvm.tir.StringImm") # type: ignore class StringImm(ConstExpr): """String constant. @@ -659,7 +659,7 @@ def __hash__(self) -> int: return PrimExpr.__hash__(self) -@tvm_ffi.register_object("tir.Cast") +@tvm_ffi.register_object("tvm.tir.Cast") class Cast(PrimExprWithOp): """Cast expression. @@ -681,7 +681,7 @@ def __init__(self, dtype, value, span: Optional[Span] = None) -> None: self.__init_handle_by_constructor__(_ffi_api.Cast, dtype, value, span) # type: ignore -@tvm_ffi.register_object("tir.Add") +@tvm_ffi.register_object("tvm.tir.Add") class Add(BinaryOpExpr): """Add node. @@ -701,7 +701,7 @@ def __init__(self, a: PrimExpr, b: PrimExpr, span: Optional[Span] = None) -> Non self.__init_handle_by_constructor__(_ffi_api.Add, a, b, span) # type: ignore -@tvm_ffi.register_object("tir.Sub") +@tvm_ffi.register_object("tvm.tir.Sub") class Sub(BinaryOpExpr): """Sub node. @@ -721,7 +721,7 @@ def __init__(self, a: PrimExpr, b: PrimExpr, span: Optional[Span] = None) -> Non self.__init_handle_by_constructor__(_ffi_api.Sub, a, b, span) # type: ignore -@tvm_ffi.register_object("tir.Mul") +@tvm_ffi.register_object("tvm.tir.Mul") class Mul(BinaryOpExpr): """Mul node. @@ -741,7 +741,7 @@ def __init__(self, a: PrimExpr, b: PrimExpr, span: Optional[Span] = None) -> Non self.__init_handle_by_constructor__(_ffi_api.Mul, a, b, span) # type: ignore -@tvm_ffi.register_object("tir.Div") +@tvm_ffi.register_object("tvm.tir.Div") class Div(BinaryOpExpr): """Div node. @@ -761,7 +761,7 @@ def __init__(self, a: PrimExpr, b: PrimExpr, span: Optional[Span] = None) -> Non self.__init_handle_by_constructor__(_ffi_api.Div, a, b, span) # type: ignore -@tvm_ffi.register_object("tir.Mod") +@tvm_ffi.register_object("tvm.tir.Mod") class Mod(BinaryOpExpr): """Mod node. @@ -781,7 +781,7 @@ def __init__(self, a: PrimExpr, b: PrimExpr, span: Optional[Span] = None) -> Non self.__init_handle_by_constructor__(_ffi_api.Mod, a, b, span) # type: ignore -@tvm_ffi.register_object("tir.FloorDiv") +@tvm_ffi.register_object("tvm.tir.FloorDiv") class FloorDiv(BinaryOpExpr): """FloorDiv node. @@ -801,7 +801,7 @@ def __init__(self, a: PrimExpr, b: PrimExpr, span: Optional[Span] = None) -> Non self.__init_handle_by_constructor__(_ffi_api.FloorDiv, a, b, span) # type: ignore -@tvm_ffi.register_object("tir.FloorMod") +@tvm_ffi.register_object("tvm.tir.FloorMod") class FloorMod(BinaryOpExpr): """FloorMod node. @@ -821,7 +821,7 @@ def __init__(self, a: PrimExpr, b: PrimExpr, span: Optional[Span] = None) -> Non self.__init_handle_by_constructor__(_ffi_api.FloorMod, a, b, span) # type: ignore -@tvm_ffi.register_object("tir.Min") +@tvm_ffi.register_object("tvm.tir.Min") class Min(BinaryOpExpr): """Min node. @@ -841,7 +841,7 @@ def __init__(self, a: PrimExpr, b: PrimExpr, span: Optional[Span] = None) -> Non self.__init_handle_by_constructor__(_ffi_api.Min, a, b, span) # type: ignore -@tvm_ffi.register_object("tir.Max") +@tvm_ffi.register_object("tvm.tir.Max") class Max(BinaryOpExpr): """Max node. @@ -861,7 +861,7 @@ def __init__(self, a: PrimExpr, b: PrimExpr, span: Optional[Span] = None) -> Non self.__init_handle_by_constructor__(_ffi_api.Max, a, b, span) # type: ignore -@tvm_ffi.register_object("tir.EQ") +@tvm_ffi.register_object("tvm.tir.EQ") class EQ(CmpExpr): """EQ node. @@ -881,7 +881,7 @@ def __init__(self, a: PrimExpr, b: PrimExpr, span: Optional[Span] = None) -> Non self.__init_handle_by_constructor__(_ffi_api.EQ, a, b, span) # type: ignore -@tvm_ffi.register_object("tir.NE") +@tvm_ffi.register_object("tvm.tir.NE") class NE(CmpExpr): """NE node. @@ -901,7 +901,7 @@ def __init__(self, a: PrimExpr, b: PrimExpr, span: Optional[Span] = None) -> Non self.__init_handle_by_constructor__(_ffi_api.NE, a, b, span) # type: ignore -@tvm_ffi.register_object("tir.LT") +@tvm_ffi.register_object("tvm.tir.LT") class LT(CmpExpr): """LT node. @@ -921,7 +921,7 @@ def __init__(self, a: PrimExpr, b: PrimExpr, span: Optional[Span] = None) -> Non self.__init_handle_by_constructor__(_ffi_api.LT, a, b, span) # type: ignore -@tvm_ffi.register_object("tir.LE") +@tvm_ffi.register_object("tvm.tir.LE") class LE(CmpExpr): """LE node. @@ -941,7 +941,7 @@ def __init__(self, a: PrimExpr, b: PrimExpr, span: Optional[Span] = None) -> Non self.__init_handle_by_constructor__(_ffi_api.LE, a, b, span) # type: ignore -@tvm_ffi.register_object("tir.GT") +@tvm_ffi.register_object("tvm.tir.GT") class GT(CmpExpr): """GT node. @@ -961,7 +961,7 @@ def __init__(self, a: PrimExpr, b: PrimExpr, span: Optional[Span] = None) -> Non self.__init_handle_by_constructor__(_ffi_api.GT, a, b, span) # type: ignore -@tvm_ffi.register_object("tir.GE") +@tvm_ffi.register_object("tvm.tir.GE") class GE(CmpExpr): """GE node. @@ -981,7 +981,7 @@ def __init__(self, a: PrimExpr, b: PrimExpr, span: Optional[Span] = None) -> Non self.__init_handle_by_constructor__(_ffi_api.GE, a, b, span) # type: ignore -@tvm_ffi.register_object("tir.And") +@tvm_ffi.register_object("tvm.tir.And") class And(LogicalExpr): """And node. @@ -1001,7 +1001,7 @@ def __init__(self, a: PrimExpr, b: PrimExpr, span: Optional[Span] = None) -> Non self.__init_handle_by_constructor__(_ffi_api.And, a, b, span) # type: ignore -@tvm_ffi.register_object("tir.Or") +@tvm_ffi.register_object("tvm.tir.Or") class Or(LogicalExpr): """Or node. @@ -1024,7 +1024,7 @@ def __init__(self, a: PrimExpr, b: PrimExpr, span: Optional[Span] = None) -> Non self.__init_handle_by_constructor__(_ffi_api.Or, a, b, span) # type: ignore -@tvm_ffi.register_object("tir.Not") +@tvm_ffi.register_object("tvm.tir.Not") class Not(LogicalExpr): """Not node. @@ -1043,7 +1043,7 @@ def __init__(self, a: PrimExpr, span: Optional[Span] = None) -> None: self.__init_handle_by_constructor__(_ffi_api.Not, a, span) # type: ignore -@tvm_ffi.register_object("tir.Select") +@tvm_ffi.register_object("tvm.tir.Select") class Select(PrimExprWithOp): """Select node. @@ -1087,7 +1087,7 @@ def __init__( ) -@tvm_ffi.register_object("tir.BufferLoad") +@tvm_ffi.register_object("tvm.tir.BufferLoad") class BufferLoad(PrimExprWithOp): """Buffer load node. @@ -1122,7 +1122,7 @@ def __init__( ) -@tvm_ffi.register_object("tir.ProducerLoad") +@tvm_ffi.register_object("tvm.tir.ProducerLoad") class ProducerLoad(PrimExprWithOp): """Producer load node. @@ -1149,7 +1149,7 @@ def __init__( ) -@tvm_ffi.register_object("tir.Ramp") +@tvm_ffi.register_object("tvm.tir.Ramp") class Ramp(PrimExprWithOp): """Ramp node. @@ -1180,7 +1180,7 @@ def __init__( ) -@tvm_ffi.register_object("tir.Broadcast") +@tvm_ffi.register_object("tvm.tir.Broadcast") class Broadcast(PrimExprWithOp): """Broadcast node. @@ -1203,7 +1203,7 @@ def __init__(self, value: PrimExpr, lanes: PrimExpr, span: Optional[Span] = None self.__init_handle_by_constructor__(_ffi_api.Broadcast, value, lanes, span) # type: ignore -@tvm_ffi.register_object("tir.Shuffle") +@tvm_ffi.register_object("tvm.tir.Shuffle") class Shuffle(PrimExprWithOp): """Shuffle node. @@ -1241,7 +1241,7 @@ class CallEffectKind: Opaque = UpdateState -@tvm_ffi.register_object("tir.Call") +@tvm_ffi.register_object("tvm.tir.Call") class Call(PrimExprWithOp): """Call node. @@ -1281,7 +1281,7 @@ def __init__( self.__init_handle_by_constructor__(_ffi_api.Call, dtype, op, args, span) # type: ignore -@tvm_ffi.register_object("tir.Let") +@tvm_ffi.register_object("tvm.tir.Let") class Let(PrimExprWithOp): """Let node. diff --git a/python/tvm/tir/function.py b/python/tvm/tir/function.py index 5b365e124cfc..4535633d9f4e 100644 --- a/python/tvm/tir/function.py +++ b/python/tvm/tir/function.py @@ -34,7 +34,7 @@ from .expr import PrimExpr, Var -@tvm_ffi.register_object("tir.PrimFunc") +@tvm_ffi.register_object("tvm.tir.PrimFunc") class PrimFunc(BaseFunc, Scriptable): """A function declaration expression. @@ -82,7 +82,7 @@ def __init__( raise TypeError("params can only contain Var or Buffer") if attrs is None: - attrs = tvm.ir.make_node("ir.DictAttrs") + attrs = tvm.ir.make_node("tvm.ir.DictAttrs") self.__init_handle_by_constructor__( _ffi_api.PrimFunc, @@ -175,7 +175,7 @@ def mem_copy_16_16(a: T.handle, b: T.handle) -> None: return _ffi_api.Specialize(self, param_map) # type: ignore -@tvm_ffi.register_object("tir.TensorIntrin") +@tvm_ffi.register_object("tvm.tir.TensorIntrin") class TensorIntrin(Object): """A tensor intrinsic. @@ -231,7 +231,7 @@ def get(name: str, allow_missing: bool = False) -> Optional["TensorIntrin"]: return _ffi_api.TensorIntrinGet(name, allow_missing) # pylint: type: ignore -@tvm_ffi.register_object("tir.IndexMap") +@tvm_ffi.register_object("tvm.tir.IndexMap") class IndexMap(Object): """A mapping from multi-dimensional indices to another set of multi-dimensional indices diff --git a/python/tvm/tir/functor.py b/python/tvm/tir/functor.py index c2594835fedf..44a984ca0eec 100644 --- a/python/tvm/tir/functor.py +++ b/python/tvm/tir/functor.py @@ -143,7 +143,7 @@ def visit_add_(self, op: Add) -> PrimExpr: """ -@tvm_ffi.register_object("tir.PyStmtExprVisitor") +@tvm_ffi.register_object("tvm.tir.PyStmtExprVisitor") class _PyStmtExprVisitor(tvm_ffi.core.Object): """ An internal wrapper to interface between C++ and Python StmtExprVisitor. @@ -977,7 +977,7 @@ def visit_string_imm_(self, op: StringImm) -> None: _ffi_api.PyStmtExprVisitorDefaultVisitExpr(self._outer(), op) # type: ignore -@tvm_ffi.register_object("tir.PyStmtExprMutator") +@tvm_ffi.register_object("tvm.tir.PyStmtExprMutator") class _PyStmtExprMutator(tvm_ffi.core.Object): """ A TVM object to support customization of StmtExprMutator on the python side. diff --git a/python/tvm/tir/ir_builder.py b/python/tvm/tir/ir_builder.py index 1e9cb078308a..37df0b86ab11 100644 --- a/python/tvm/tir/ir_builder.py +++ b/python/tvm/tir/ir_builder.py @@ -503,7 +503,7 @@ def likely(self, expr): expr : Expr The expression will likely tag. """ - return _expr.Call(expr.dtype, "tir.likely", [expr]) + return _expr.Call(expr.dtype, "tvm.tir.likely", [expr]) def get(self): """Return the builded IR. diff --git a/python/tvm/tir/schedule/_ffi_api.py b/python/tvm/tir/schedule/_ffi_api.py index 5087112b892a..1fee6da1d073 100644 --- a/python/tvm/tir/schedule/_ffi_api.py +++ b/python/tvm/tir/schedule/_ffi_api.py @@ -17,4 +17,4 @@ """FFI APIs for tvm.tir.schedule""" import tvm_ffi -tvm_ffi.init_ffi_api("tir.schedule", __name__) # pylint: disable=protected-access +tvm_ffi.init_ffi_api("tvm.tir.schedule", __name__) # pylint: disable=protected-access diff --git a/python/tvm/tir/schedule/analysis.py b/python/tvm/tir/schedule/analysis.py index 66eab497eb5a..6358974451cb 100644 --- a/python/tvm/tir/schedule/analysis.py +++ b/python/tvm/tir/schedule/analysis.py @@ -62,7 +62,7 @@ def suggest_index_map( ) -@tvm_ffi.register_object("tir.schedule.TensorizeInfo") +@tvm_ffi.register_object("tvm.tir.schedule.TensorizeInfo") class TensorizeInfo(Object): """Necessary information used for tensorization.""" @@ -90,7 +90,7 @@ def get_tensorize_loop_mapping( return _ffi_api.GetTensorizeLoopMapping(sch, block, desc_func, allow_padding) # type: ignore -@tvm_ffi.register_object("tir.schedule.AutoTensorizeMappingInfo") +@tvm_ffi.register_object("tvm.tir.schedule.AutoTensorizeMappingInfo") class AutoTensorizeMappingInfo(Object): """Necessary information used to perform transformations for tensorization.""" diff --git a/python/tvm/tir/schedule/instruction.py b/python/tvm/tir/schedule/instruction.py index 918292a7bbaa..5eac3e5ebbb6 100644 --- a/python/tvm/tir/schedule/instruction.py +++ b/python/tvm/tir/schedule/instruction.py @@ -32,7 +32,7 @@ INPUT_RV_TYPE = OUTPUT_RV_TYPE = ATTR_TYPE = Any -@_register_object("tir.InstructionKind") +@_register_object("tvm.tir.InstructionKind") class InstructionKind(Object): """Kind of an instruction, e.g. Split, Reorder, etc. Besides the name, every kind of instruction has its own properties, including: @@ -88,7 +88,7 @@ def get(name: str) -> "InstructionKind": return _ffi_api.InstructionKindGet(name) # type: ignore # pylint: disable=no-member -@_register_object("tir.Instruction") +@_register_object("tvm.tir.Instruction") class Instruction(Object): """Schedule instructions each corresponds to a schedule primitive diff --git a/python/tvm/tir/schedule/schedule.py b/python/tvm/tir/schedule/schedule.py index 0d41ffe94307..cbcca804c7ff 100644 --- a/python/tvm/tir/schedule/schedule.py +++ b/python/tvm/tir/schedule/schedule.py @@ -36,7 +36,7 @@ class ScheduleError(TVMError): """Error that happens during TensorIR scheduling.""" -@_register_object("tir.LoopRV") +@_register_object("tvm.tir.LoopRV") class LoopRV(Object): """A random variable that refers to a loop""" @@ -47,7 +47,7 @@ def __init__(self) -> None: ) -@_register_object("tir.BlockRV") +@_register_object("tvm.tir.BlockRV") class BlockRV(Object): """A random variable that refers to a block""" @@ -107,7 +107,7 @@ def _get_block_default_dtype(block: Block) -> str: return "int64" -@_register_object("tir.Schedule") +@_register_object("tvm.tir.Schedule") class Schedule(Object): """The user-facing schedule class diff --git a/python/tvm/tir/schedule/state.py b/python/tvm/tir/schedule/state.py index 36436fe95783..ad35dbbc83c7 100644 --- a/python/tvm/tir/schedule/state.py +++ b/python/tvm/tir/schedule/state.py @@ -77,7 +77,7 @@ def _parse_enable_checks(enable_checks: bool) -> bool: return enable_checks -@register_object("tir.ScheduleState") +@register_object("tvm.tir.ScheduleState") class ScheduleState(Object): """The state of scheduling, which exposes a `Replace` method as the primary resort for all the scheduling primitives to manipulate the TensorIR. diff --git a/python/tvm/tir/schedule/trace.py b/python/tvm/tir/schedule/trace.py index edc537f3a296..6d054dbde9d1 100644 --- a/python/tvm/tir/schedule/trace.py +++ b/python/tvm/tir/schedule/trace.py @@ -54,7 +54,7 @@ def _json_from_tvm(obj): raise TypeError("Not supported type: " + str(type(obj))) -@_register_object("tir.Trace") +@_register_object("tvm.tir.Trace") class Trace(Object): """An execution trace of a scheduling program. diff --git a/python/tvm/tir/stmt.py b/python/tvm/tir/stmt.py index 448ace3ade63..78ecac5db94a 100644 --- a/python/tvm/tir/stmt.py +++ b/python/tvm/tir/stmt.py @@ -42,7 +42,7 @@ class Stmt(Object, Scriptable): """Base class of all the statements.""" -@tvm_ffi.register_object("tir.LetStmt") +@tvm_ffi.register_object("tvm.tir.LetStmt") class LetStmt(Stmt): """LetStmt node. @@ -72,7 +72,7 @@ def __init__(self, var: Var, value: PrimExpr, body: Stmt, span: Optional[Span] = ) -@tvm_ffi.register_object("tir.AssertStmt") +@tvm_ffi.register_object("tvm.tir.AssertStmt") class AssertStmt(Stmt): """AssertStmt node. @@ -120,7 +120,7 @@ class ForKind(IntEnum): THREAD_BINDING = 4 # pylint: disable=invalid-name -@tvm_ffi.register_object("tir.For") +@tvm_ffi.register_object("tvm.tir.For") class For(Stmt): """For node. @@ -192,7 +192,7 @@ def __init__( ) -@tvm_ffi.register_object("tir.While") +@tvm_ffi.register_object("tvm.tir.While") class While(Stmt): """While node. @@ -216,7 +216,7 @@ def __init__(self, condition: PrimExpr, body: Stmt, span: Optional[Span] = None) self.__init_handle_by_constructor__(_ffi_api.While, condition, body, span) # type: ignore -@tvm_ffi.register_object("tir.BufferStore") +@tvm_ffi.register_object("tvm.tir.BufferStore") class BufferStore(Stmt): """Buffer store node. @@ -259,7 +259,7 @@ def __init__( ) -@tvm_ffi.register_object("tir.BufferRealize") +@tvm_ffi.register_object("tvm.tir.BufferRealize") class BufferRealize(Stmt): """Buffer realize node. @@ -300,7 +300,7 @@ def __init__( ) -@tvm_ffi.register_object("tir.Allocate") +@tvm_ffi.register_object("tvm.tir.Allocate") class Allocate(Stmt): """Allocate node. @@ -360,7 +360,7 @@ def __init__( ) -@tvm_ffi.register_object("tir.AllocateConst") +@tvm_ffi.register_object("tvm.tir.AllocateConst") class AllocateConst(Stmt): """Allocate constant node. @@ -422,7 +422,7 @@ def __init__( ) -@tvm_ffi.register_object("tir.DeclBuffer") +@tvm_ffi.register_object("tvm.tir.DeclBuffer") class DeclBuffer(Stmt): """DeclBuffer node. @@ -446,7 +446,7 @@ def __init__(self, buffer: Buffer, body: Stmt, span: Optional[Span] = None) -> N self.__init_handle_by_constructor__(_ffi_api.DeclBuffer, buffer, body, span) -@tvm_ffi.register_object("tir.AttrStmt") +@tvm_ffi.register_object("tvm.tir.AttrStmt") class AttrStmt(Stmt): """AttrStmt node. @@ -482,7 +482,7 @@ def __init__( ) -@tvm_ffi.register_object("tir.SeqStmt") +@tvm_ffi.register_object("tvm.tir.SeqStmt") class SeqStmt(Stmt): """Sequence of statements. @@ -508,7 +508,7 @@ def __len__(self): return len(self.seq) -@tvm_ffi.register_object("tir.IfThenElse") +@tvm_ffi.register_object("tvm.tir.IfThenElse") class IfThenElse(Stmt): """IfThenElse node. @@ -543,7 +543,7 @@ def __init__( ) -@tvm_ffi.register_object("tir.Evaluate") +@tvm_ffi.register_object("tvm.tir.Evaluate") class Evaluate(Stmt): """Evaluate node. @@ -563,7 +563,7 @@ def __init__(self, value: PrimExpr, span: Optional[Span] = None) -> None: self.__init_handle_by_constructor__(_ffi_api.Evaluate, value, span) # type: ignore -@tvm_ffi.register_object("tir.BufferRegion") +@tvm_ffi.register_object("tvm.tir.BufferRegion") class BufferRegion(Object, Scriptable): """BufferRegion node. @@ -583,7 +583,7 @@ def __init__(self, buffer: Buffer, region: List[Range]) -> None: self.__init_handle_by_constructor__(_ffi_api.BufferRegion, buffer, region) # type: ignore -@tvm_ffi.register_object("tir.MatchBufferRegion") +@tvm_ffi.register_object("tvm.tir.MatchBufferRegion") class MatchBufferRegion(Object, Scriptable): """MatchBufferRegion node. @@ -605,7 +605,7 @@ def __init__(self, buffer: Buffer, source: BufferRegion) -> None: ) -@tvm_ffi.register_object("tir.Block") +@tvm_ffi.register_object("tvm.tir.Block") class Block(Stmt): """Block node. @@ -687,7 +687,7 @@ def __init__( ) # type: ignore -@tvm_ffi.register_object("tir.BlockRealize") +@tvm_ffi.register_object("tvm.tir.BlockRealize") class BlockRealize(Stmt): """BlockRealize node. diff --git a/python/tvm/tir/tensor_intrin/cuda.py b/python/tvm/tir/tensor_intrin/cuda.py index 7b0c71583b1a..c992dadfe209 100644 --- a/python/tvm/tir/tensor_intrin/cuda.py +++ b/python/tvm/tir/tensor_intrin/cuda.py @@ -46,7 +46,7 @@ def ldmatrix_32x8_to_shared_16x16_layout(thread_id, local_id): return row, col -@register_global_func("tir.index_map.shared_16x16_to_ldmatrix_32x8_layout") +@register_global_func("tvm.tir.index_map.shared_16x16_to_ldmatrix_32x8_layout") def index_map_shared_16x16_to_ldmatrix_32x8_layout(ind): i, j = ind[0], ind[1] thread_id, local_id = shared_16x16_to_ldmatrix_32x8_layout(i, j) @@ -1746,7 +1746,7 @@ def mma_store_desc(a: T.handle, c: T.handle) -> None: ) -@register_global_func("tir.index_map_m16n8k8.matrixC") +@register_global_func("tvm.tir.index_map_m16n8k8.matrixC") def index_map_m16n8k8_matrixC(ind): i, j = ind[0], ind[1] return convert([(i // 8) // 2, j // 8, (i // 8) % 2, (j % 8) % 2]) diff --git a/python/tvm/tir/tensor_intrin/hexagon.py b/python/tvm/tir/tensor_intrin/hexagon.py index 631d6b353240..9a0ddbd9857d 100644 --- a/python/tvm/tir/tensor_intrin/hexagon.py +++ b/python/tvm/tir/tensor_intrin/hexagon.py @@ -47,7 +47,7 @@ def sync_dma_load_impl(a: T.handle, c: T.handle) -> None: T.writes(C[0:size]) T.evaluate( T.tvm_call_packed( - "device_api.hexagon.dma_copy_dltensor", + "tvm.device_api.hexagon.dma_copy_dltensor", T.tvm_stack_make_array( T.address_of(C[0], dtype="handle"), T.tvm_stack_make_shape(size, dtype="handle"), diff --git a/python/tvm/tir/tensor_intrin/riscv_cpu.py b/python/tvm/tir/tensor_intrin/riscv_cpu.py index e0782ada4cc1..dea4ec838e1a 100644 --- a/python/tvm/tir/tensor_intrin/riscv_cpu.py +++ b/python/tvm/tir/tensor_intrin/riscv_cpu.py @@ -166,7 +166,7 @@ def rvv_vec_dot_prod_impl( return rvv_vec_dot_prod_desc, rvv_vec_dot_prod_impl -@tvm_ffi.register_global_func("tir.tensor_intrin.register_rvv_isa_intrinsics") +@tvm_ffi.register_global_func("tvm.tir.tensor_intrin.register_rvv_isa_intrinsics") def register_rvv_isa_intrinsics(target: Target, inventory_only=False) -> dict(): """Register RISCV V (vector) intrinsics [x] Implementation follows version 1.0 vector specifications: diff --git a/python/tvm/tir/tensor_intrin/rocm.py b/python/tvm/tir/tensor_intrin/rocm.py index bfac2ca1d25b..0dda585925a3 100644 --- a/python/tvm/tir/tensor_intrin/rocm.py +++ b/python/tvm/tir/tensor_intrin/rocm.py @@ -363,8 +363,8 @@ def mfma_sync_impl_integer(a: T.handle, b: T.handle, c: T.handle) -> None: C[tx, 0:local_size_out] = T.call_llvm_pure_intrin( T.llvm_lookup_intrinsic_id(mfma_intrin), - T.call_intrin("int32", "tir.reinterpret", A[tx, 0:local_size]), - T.call_intrin("int32", "tir.reinterpret", A[tx, 0:local_size]), + T.call_intrin("int32", "tvm.tir.reinterpret", A[tx, 0:local_size]), + T.call_intrin("int32", "tvm.tir.reinterpret", A[tx, 0:local_size]), C[tx, 0:local_size_out], T.int32(0), T.int32(0), diff --git a/python/tvm/tir/transform/_ffi_api.py b/python/tvm/tir/transform/_ffi_api.py index 67896ec05dda..bce522648fb7 100644 --- a/python/tvm/tir/transform/_ffi_api.py +++ b/python/tvm/tir/transform/_ffi_api.py @@ -18,4 +18,4 @@ import tvm_ffi -tvm_ffi.init_ffi_api("tir.transform", __name__) +tvm_ffi.init_ffi_api("tvm.tir.transform", __name__) diff --git a/python/tvm/tir/transform/function_pass.py b/python/tvm/tir/transform/function_pass.py index a85eabd970e1..ee2287bd4198 100644 --- a/python/tvm/tir/transform/function_pass.py +++ b/python/tvm/tir/transform/function_pass.py @@ -25,7 +25,7 @@ from . import _ffi_api -@tvm_ffi.register_object("tir.PrimFuncPass") +@tvm_ffi.register_object("tvm.tir.PrimFuncPass") class PrimFuncPass(Pass): """A pass that works on each :py:func:`tvm.tir.PrimFunc` in a module. A function pass class should be created through py:func:`tvm.tir.transform.function_pass`. diff --git a/python/tvm/tir/transform/transform.py b/python/tvm/tir/transform/transform.py index 88cf4720d3a6..40d02a2adbbc 100644 --- a/python/tvm/tir/transform/transform.py +++ b/python/tvm/tir/transform/transform.py @@ -50,7 +50,7 @@ def _transform(func, mod, ctx): return _fpass.prim_func_pass(_transform, opt_level=0, name="Apply") # type: ignore -@_ffi.register_object("tir.transform.LoopPartitionConfig") +@_ffi.register_object("tvm.tir.transform.LoopPartitionConfig") class LoopPartitionConfig(_ir.Attrs): """Config for loop partition pass""" @@ -94,7 +94,7 @@ def InjectVirtualThread(): return _ffi_api.InjectVirtualThread() # type: ignore -@_ffi.register_object("tir.transform.InjectDoubleBufferConfig") +@_ffi.register_object("tvm.tir.transform.InjectDoubleBufferConfig") class InjectDoubleBufferConfig(_ir.Attrs): """Config for inject double buffer pass""" @@ -161,7 +161,7 @@ def PointerValueTypeRewrite(): return _ffi_api.PointerValueTypeRewrite() # type: ignore -@_ffi.register_object("tir.transform.UnrollLoopConfig") +@_ffi.register_object("tvm.tir.transform.UnrollLoopConfig") class UnrollLoopConfig(_ir.Attrs): """Config for unroll loop pass""" @@ -179,7 +179,7 @@ def UnrollLoop(): return _ffi_api.UnrollLoop() # type: ignore -@_ffi.register_object("tir.transform.ReduceBranchingThroughOvercomputeConfig") +@_ffi.register_object("tvm.tir.transform.ReduceBranchingThroughOvercomputeConfig") class ReduceBranchingThroughOvercomputeConfig(_ir.Attrs): """Config for reduce branching through overcompute pass""" @@ -195,7 +195,7 @@ def ReduceBranchingThroughOvercompute(): return _ffi_api.ReduceBranchingThroughOvercompute() # type: ignore -@_ffi.register_object("tir.transform.RemoveNoOpConfig") +@_ffi.register_object("tvm.tir.transform.RemoveNoOpConfig") class RemoveNoOpConfig(_ir.Attrs): """Config for remove no op pass""" @@ -304,7 +304,7 @@ def RewriteUnsafeSelect(): return _ffi_api.RewriteUnsafeSelect() # type: ignore -@_ffi.register_object("tir.transform.SimplifyConfig") +@_ffi.register_object("tvm.tir.transform.SimplifyConfig") class SimplifyConfig(_ir.Attrs): """Config for simplify pass""" @@ -652,7 +652,7 @@ def VerifyVTCMLimit(limit=None): return _ffi_api.VerifyVTCMLimit(limit) # type: ignore -@_ffi.register_object("tir.transform.HoistIfThenElseConfig") +@_ffi.register_object("tvm.tir.transform.HoistIfThenElseConfig") class HoistIfThenElseConfig(_ir.Attrs): """Config for hoist if then else pass""" @@ -736,7 +736,7 @@ class HoistedLetBindings(enum.Flag): """ Enable all hoisting of let bindings """ -@_ffi.register_object("tir.transform.HoistExpressionConfig") +@_ffi.register_object("tvm.tir.transform.HoistExpressionConfig") class HoistExpressionConfig(_ir.Attrs): """Config for hoist expression pass""" diff --git a/python/tvm/topi/cpp/cuda.py b/python/tvm/topi/cpp/cuda.py index 21cf554add3b..844f9fa93bbc 100644 --- a/python/tvm/topi/cpp/cuda.py +++ b/python/tvm/topi/cpp/cuda.py @@ -17,4 +17,4 @@ """FFI for CUDA TOPI ops and schedules""" import tvm_ffi -tvm_ffi.init_ffi_api("topi.cuda", "tvm.topi.cpp.cuda") +tvm_ffi.init_ffi_api("tvm.topi.cuda", "tvm.topi.cpp.cuda") diff --git a/python/tvm/topi/cpp/generic.py b/python/tvm/topi/cpp/generic.py index 77dfcab58a0f..0b51388d3c28 100644 --- a/python/tvm/topi/cpp/generic.py +++ b/python/tvm/topi/cpp/generic.py @@ -17,4 +17,4 @@ """FFI for generic TOPI ops and schedules""" import tvm_ffi -tvm_ffi.init_ffi_api("topi.generic", "tvm.topi.cpp.generic") +tvm_ffi.init_ffi_api("tvm.topi.generic", "tvm.topi.cpp.generic") diff --git a/python/tvm/topi/cpp/impl.py b/python/tvm/topi/cpp/impl.py index c1783067951a..9d266b970ab5 100644 --- a/python/tvm/topi/cpp/impl.py +++ b/python/tvm/topi/cpp/impl.py @@ -17,4 +17,4 @@ """Load Lib for C++ TOPI ops and schedules""" import tvm_ffi -tvm_ffi.init_ffi_api("topi", "tvm.topi.cpp") +tvm_ffi.init_ffi_api("tvm.topi", "tvm.topi.cpp") diff --git a/python/tvm/topi/cpp/nn.py b/python/tvm/topi/cpp/nn.py index 32c24dc1ed98..63be903048d1 100644 --- a/python/tvm/topi/cpp/nn.py +++ b/python/tvm/topi/cpp/nn.py @@ -17,4 +17,4 @@ """FFI for NN TOPI ops and schedules""" import tvm_ffi -tvm_ffi.init_ffi_api("topi.nn", "tvm.topi.cpp.nn") +tvm_ffi.init_ffi_api("tvm.topi.nn", "tvm.topi.cpp.nn") diff --git a/python/tvm/topi/cpp/rocm.py b/python/tvm/topi/cpp/rocm.py index 3eb83fe689c3..be0fc7054feb 100644 --- a/python/tvm/topi/cpp/rocm.py +++ b/python/tvm/topi/cpp/rocm.py @@ -17,4 +17,4 @@ """FFI for Rocm TOPI ops and schedules""" import tvm_ffi -tvm_ffi.init_ffi_api("topi.rocm", "tvm.topi.cpp.rocm") +tvm_ffi.init_ffi_api("tvm.topi.rocm", "tvm.topi.cpp.rocm") diff --git a/python/tvm/topi/cpp/utils.py b/python/tvm/topi/cpp/utils.py index ecf341fabd5f..20e6d8a6161c 100644 --- a/python/tvm/topi/cpp/utils.py +++ b/python/tvm/topi/cpp/utils.py @@ -17,4 +17,4 @@ """FFI for TOPI utility functions""" import tvm_ffi -tvm_ffi.init_ffi_api("topi.utils", "tvm.topi.cpp.utils") +tvm_ffi.init_ffi_api("tvm.topi.utils", "tvm.topi.cpp.utils") diff --git a/python/tvm/topi/cpp/vision/__init__.py b/python/tvm/topi/cpp/vision/__init__.py index 467ce70fbd33..3ad738e6c7e5 100644 --- a/python/tvm/topi/cpp/vision/__init__.py +++ b/python/tvm/topi/cpp/vision/__init__.py @@ -21,4 +21,4 @@ from . import yolo from ...vision import nms -tvm_ffi.init_ffi_api("topi.vision", "tvm.topi.cpp.vision") +tvm_ffi.init_ffi_api("tvm.topi.vision", "tvm.topi.cpp.vision") diff --git a/python/tvm/topi/cpp/vision/yolo.py b/python/tvm/topi/cpp/vision/yolo.py index f5aa6d2d0670..ac40228a830f 100644 --- a/python/tvm/topi/cpp/vision/yolo.py +++ b/python/tvm/topi/cpp/vision/yolo.py @@ -17,4 +17,4 @@ """FFI for Yolo TOPI ops and schedules""" import tvm_ffi -tvm_ffi.init_ffi_api("topi.vision.yolo", "tvm.topi.cpp.vision.yolo") +tvm_ffi.init_ffi_api("tvm.topi.vision.yolo", "tvm.topi.cpp.vision.yolo") diff --git a/python/tvm/topi/cpp/x86.py b/python/tvm/topi/cpp/x86.py index 93cb6d96f6b8..d93c645c7c97 100644 --- a/python/tvm/topi/cpp/x86.py +++ b/python/tvm/topi/cpp/x86.py @@ -17,4 +17,4 @@ """FFI for x86 TOPI ops and schedules""" import tvm_ffi -tvm_ffi.init_ffi_api("topi.x86", "tvm.topi.cpp.x86") +tvm_ffi.init_ffi_api("tvm.topi.x86", "tvm.topi.cpp.x86") diff --git a/python/tvm/topi/slice_scatter.py b/python/tvm/topi/slice_scatter.py index d8772d0f5b7e..885c1a545abb 100644 --- a/python/tvm/topi/slice_scatter.py +++ b/python/tvm/topi/slice_scatter.py @@ -43,14 +43,14 @@ def slice_scatter(input_tensor, src, start, end, step, axis): idx = topi.arange(start=0, stop=dim_size, step=1, dtype="int64") if start != 0: - mask = topi.logical_and(mask, topi.greater_equal(idx, start)) + mask = tvm.topi.logical_and(mask, tvm.topi.greater_equal(idx, start)) if end != dim_size: - mask = topi.logical_and(mask, topi.less(idx, end)) + mask = tvm.topi.logical_and(mask, tvm.topi.less(idx, end)) if step != 1: - step_mask = topi.equal(topi.floor_mod(idx - start, step), 0) - mask = topi.logical_and(mask, step_mask) + step_mask = tvm.topi.equal(tvm.topi.floor_mod(idx - start, step), 0) + mask = tvm.topi.logical_and(mask, step_mask) mask_shape_base = [1] * len(input_tensor.shape) mask_shape_base[axis] = dim_size @@ -59,7 +59,7 @@ def slice_scatter(input_tensor, src, start, end, step, axis): mask_reshaped = topi.reshape(mask, mask_shape) idx_new_pre = idx - start + (step - 1) - idx_new_div = topi.floor_divide(idx_new_pre, step) + idx_new_div = tvm.topi.floor_divide(idx_new_pre, step) idx_new = topi.clip(idx_new_div, 0, dim_size - 1) temp = topi.take(src, idx_new, axis=axis) diff --git a/src/arith/analyzer.cc b/src/arith/analyzer.cc index f6f0b9f4d8df..1fc26f5c6728 100644 --- a/src/arith/analyzer.cc +++ b/src/arith/analyzer.cc @@ -272,7 +272,7 @@ PrimExpr Analyzer::Simplify(const PrimExpr& expr, int steps) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def_packed("arith.CreateAnalyzer", [](ffi::PackedArgs args, ffi::Any* ret) { + refl::GlobalDef().def_packed("tvm.arith.CreateAnalyzer", [](ffi::PackedArgs args, ffi::Any* ret) { using ffi::Function; using ffi::TypedFunction; auto self = std::make_shared(); diff --git a/src/arith/bound_deducer.cc b/src/arith/bound_deducer.cc index eb9edca36341..2e048b0abc9c 100644 --- a/src/arith/bound_deducer.cc +++ b/src/arith/bound_deducer.cc @@ -405,7 +405,7 @@ IntSet DeduceBound(PrimExpr v, PrimExpr e, const ffi::Map& hint_map TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("arith.DeduceBound", + refl::GlobalDef().def("tvm.arith.DeduceBound", [](PrimExpr v, PrimExpr cond, const ffi::Map hint_map, const ffi::Map relax_map) { return DeduceBound(v, cond, hint_map, relax_map); diff --git a/src/arith/canonical_simplify.cc b/src/arith/canonical_simplify.cc index f321d761198c..d8fff898a73b 100644 --- a/src/arith/canonical_simplify.cc +++ b/src/arith/canonical_simplify.cc @@ -53,7 +53,7 @@ class CanonicalExprNode : public PrimExprNode { virtual PrimExpr Normalize() const = 0; static constexpr const uint32_t _type_child_slots = 2; - TVM_FFI_DECLARE_OBJECT_INFO("arith.CanonicalExpr", CanonicalExprNode, PrimExprNode); + TVM_FFI_DECLARE_OBJECT_INFO("tvm.arith.CanonicalExpr", CanonicalExprNode, PrimExprNode); }; inline PrimExpr ModImpl(PrimExpr a, PrimExpr b, DivMode mode) { @@ -203,7 +203,7 @@ class SplitExprNode : public CanonicalExprNode { /*! \brief positive infty */ static const constexpr int64_t kPosInf = ConstIntBoundNode::kPosInf; - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("arith.SplitExpr", SplitExprNode, CanonicalExprNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.arith.SplitExpr", SplitExprNode, CanonicalExprNode); }; class SplitExpr : public PrimExpr { @@ -388,7 +388,7 @@ class SumExprNode : public CanonicalExprNode { } this->dtype = dtype; } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("arith.SumExpr", SumExprNode, CanonicalExprNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.arith.SumExpr", SumExprNode, CanonicalExprNode); private: /*! diff --git a/src/arith/const_int_bound.cc b/src/arith/const_int_bound.cc index 6dd029e136ea..d11b0f8382cf 100644 --- a/src/arith/const_int_bound.cc +++ b/src/arith/const_int_bound.cc @@ -54,7 +54,7 @@ ConstIntBound MakeConstIntBound(int64_t min_value, int64_t max_value) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("arith.ConstIntBound", MakeConstIntBound); + refl::GlobalDef().def("tvm.arith.ConstIntBound", MakeConstIntBound); } inline void PrintBoundValue(std::ostream& os, int64_t val) { @@ -807,7 +807,7 @@ class ConstIntBoundAnalyzer::Impl static ffi::Optional FindCeilLog2Arg(const CastNode* op) { if (op->dtype.is_int()) { if (auto as_call = op->value.as()) { - if (as_call->op.same_as(Op::Get("tir.ceil"))) { + if (as_call->op.same_as(Op::Get("tvm.tir.ceil"))) { PrimExpr ceil_arg = as_call->args[0]; if (auto arg_call = ceil_arg.as()) { if (arg_call->op.same_as(Op::Get("tir.log2"))) { diff --git a/src/arith/detect_common_subexpr.cc b/src/arith/detect_common_subexpr.cc index 70768128e535..ae576f076687 100644 --- a/src/arith/detect_common_subexpr.cc +++ b/src/arith/detect_common_subexpr.cc @@ -72,7 +72,7 @@ ffi::Map DetectCommonSubExpr(const PrimExpr& e, int thresh) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("arith.DetectCommonSubExpr", DetectCommonSubExpr); + refl::GlobalDef().def("tvm.arith.DetectCommonSubExpr", DetectCommonSubExpr); } } // namespace arith } // namespace tvm diff --git a/src/arith/detect_linear_equation.cc b/src/arith/detect_linear_equation.cc index 4a0b5f9cf0c3..323c57489828 100644 --- a/src/arith/detect_linear_equation.cc +++ b/src/arith/detect_linear_equation.cc @@ -294,8 +294,8 @@ ffi::Array DetectClipBound(const PrimExpr& e, const ffi::Array& v TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("arith.DetectLinearEquation", DetectLinearEquation) - .def("arith.DetectClipBound", + .def("tvm.arith.DetectLinearEquation", DetectLinearEquation) + .def("tvm.arith.DetectClipBound", [](const PrimExpr& e, const ffi::Array& vars) { return DetectClipBound(e, vars); }); } } // namespace arith diff --git a/src/arith/domain_touched.cc b/src/arith/domain_touched.cc index 3fc6d34b7071..e9e561a91edc 100644 --- a/src/arith/domain_touched.cc +++ b/src/arith/domain_touched.cc @@ -166,8 +166,8 @@ ffi::Map> DomainTouchedAccessMap(const PrimFunc& f TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("arith.DomainTouched", DomainTouched) - .def("arith.DomainTouchedAccessMap", DomainTouchedAccessMap); + .def("tvm.arith.DomainTouched", DomainTouched) + .def("tvm.arith.DomainTouchedAccessMap", DomainTouchedAccessMap); } } // namespace arith diff --git a/src/arith/int_constraints.cc b/src/arith/int_constraints.cc index e116ba9e3b7a..accb236a04b1 100644 --- a/src/arith/int_constraints.cc +++ b/src/arith/int_constraints.cc @@ -204,19 +204,20 @@ Range IntGroupBounds::FindBestRange(const ffi::Map& vranges_addl) co TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("arith.IntGroupBounds", + .def("tvm.arith.IntGroupBounds", [](PrimExpr coef, ffi::Array lower, ffi::Array equal, ffi::Array upper) { return IntGroupBounds(coef, lower, equal, upper); }) - .def("arith.IntGroupBounds_from_range", IntGroupBounds::FromRange) - .def_packed("arith.IntGroupBounds_FindBestRange", [](ffi::PackedArgs args, ffi::Any* ret) { - ICHECK(args.size() == 1 || args.size() == 2); - auto bounds = args[0].cast(); - if (args.size() == 1) { - *ret = bounds.FindBestRange(); - } else if (args.size() == 2) { - *ret = bounds.FindBestRange(args[1].cast>()); - } - }); + .def("tvm.arith.IntGroupBounds_from_range", IntGroupBounds::FromRange) + .def_packed("tvm.arith.IntGroupBounds_FindBestRange", + [](ffi::PackedArgs args, ffi::Any* ret) { + ICHECK(args.size() == 1 || args.size() == 2); + auto bounds = args[0].cast(); + if (args.size() == 1) { + *ret = bounds.FindBestRange(); + } else if (args.size() == 2) { + *ret = bounds.FindBestRange(args[1].cast>()); + } + }); } TVM_STATIC_IR_FUNCTOR(ReprPrinter, vtable) @@ -249,7 +250,7 @@ IntConstraints::IntConstraints(ffi::Array variables, ffi::Map r TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef().def( - "arith.IntConstraints", + "tvm.arith.IntConstraints", [](ffi::Array variables, ffi::Map ranges, ffi::Array relations) { return IntConstraints(variables, ranges, relations); }); @@ -295,7 +296,7 @@ IntConstraintsTransform IntConstraintsTransform::operator+( TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("arith.IntConstraintsTransform", + refl::GlobalDef().def("tvm.arith.IntConstraintsTransform", [](IntConstraints src, IntConstraints dst, ffi::Map src_to_dst, ffi::Map dst_to_src) { return IntConstraintsTransform(src, dst, src_to_dst, dst_to_src); diff --git a/src/arith/int_set.cc b/src/arith/int_set.cc index 1433ceb70fc0..32df02991102 100644 --- a/src/arith/int_set.cc +++ b/src/arith/int_set.cc @@ -64,7 +64,7 @@ IntervalSet MakeIntervalSet(PrimExpr min_value, PrimExpr max_value) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("arith.IntervalSet", MakeIntervalSet); + refl::GlobalDef().def("tvm.arith.IntervalSet", MakeIntervalSet); } IntervalSet Intersect(Analyzer* analyzer, IntervalSet a, IntervalSet b) { @@ -1237,34 +1237,34 @@ TVM_STATIC_IR_FUNCTOR(ReprPrinter, vtable) TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("arith.intset_single_point", IntSet::SinglePoint) - .def("arith.intset_vector", IntSet::Vector) - .def("arith.intset_interval", IntSet::Interval) - .def_method("arith.IntervalSetGetMin", &IntSet::min) - .def_method("arith.IntervalSetGetMax", &IntSet::max) - .def_method("arith.IntSetIsNothing", &IntSet::IsNothing) - .def_method("arith.IntSetIsEverything", &IntSet::IsEverything) - .def("arith.EstimateRegionLowerBound", + .def("tvm.arith.intset_single_point", IntSet::SinglePoint) + .def("tvm.arith.intset_vector", IntSet::Vector) + .def("tvm.arith.intset_interval", IntSet::Interval) + .def_method("tvm.arith.IntervalSetGetMin", &IntSet::min) + .def_method("tvm.arith.IntervalSetGetMax", &IntSet::max) + .def_method("tvm.arith.IntSetIsNothing", &IntSet::IsNothing) + .def_method("tvm.arith.IntSetIsEverything", &IntSet::IsEverything) + .def("tvm.arith.EstimateRegionLowerBound", [](ffi::Array region, ffi::Map var_dom, PrimExpr predicate) -> ffi::Optional> { Analyzer analyzer; return EstimateRegionLowerBound(region, var_dom, predicate, &analyzer); }) - .def("arith.EstimateRegionStrictBound", + .def("tvm.arith.EstimateRegionStrictBound", [](ffi::Array region, ffi::Map var_dom, PrimExpr predicate) -> ffi::Optional> { Analyzer analyzer; return EstimateRegionStrictBound(region, var_dom, predicate, &analyzer); }) - .def("arith.EstimateRegionUpperBound", + .def("tvm.arith.EstimateRegionUpperBound", [](ffi::Array region, ffi::Map var_dom, PrimExpr predicate) -> ffi::Optional> { Analyzer analyzer; return EstimateRegionUpperBound(region, var_dom, predicate, &analyzer); }) - .def("arith.PosInf", []() { return SymbolicLimits::pos_inf_; }) - .def("arith.NegInf", []() { return SymbolicLimits::neg_inf_; }) - .def("arith.UnionLowerBound", UnionLowerBound); + .def("tvm.arith.PosInf", []() { return SymbolicLimits::pos_inf_; }) + .def("tvm.arith.NegInf", []() { return SymbolicLimits::neg_inf_; }) + .def("tvm.arith.UnionLowerBound", UnionLowerBound); } } // namespace arith diff --git a/src/arith/interval_set.h b/src/arith/interval_set.h index b8597db7aa90..f8a80200f251 100644 --- a/src/arith/interval_set.h +++ b/src/arith/interval_set.h @@ -75,7 +75,7 @@ class IntervalSetNode : public IntSetNode { } /*! \return whether interval represent everything */ bool IsEverything() const { return is_neg_inf(min_value) && is_pos_inf(max_value); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("arith.IntervalSet", IntervalSetNode, IntSetNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.arith.IntervalSet", IntervalSetNode, IntSetNode); }; /*! diff --git a/src/arith/ir_mutator_with_analyzer.cc b/src/arith/ir_mutator_with_analyzer.cc index 59b0b0546dab..2f600d219578 100644 --- a/src/arith/ir_mutator_with_analyzer.cc +++ b/src/arith/ir_mutator_with_analyzer.cc @@ -96,7 +96,7 @@ Stmt IRMutatorWithAnalyzer::VisitStmt_(const LetStmtNode* op) { Stmt IRMutatorWithAnalyzer::VisitStmt_(const IfThenElseNode* op) { PrimExpr condition = this->VisitExpr(op->condition); PrimExpr real_condition = condition; - static auto op_likely = Op::Get("tir.likely"); + static auto op_likely = Op::Get("tvm.tir.likely"); if (auto call = condition.as()) { if (call->op.same_as(op_likely)) { diff --git a/src/arith/iter_affine_map.cc b/src/arith/iter_affine_map.cc index 3de431fb9574..1566abbc4d64 100644 --- a/src/arith/iter_affine_map.cc +++ b/src/arith/iter_affine_map.cc @@ -57,7 +57,7 @@ IterMark::IterMark(PrimExpr source, PrimExpr extent) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("arith.IterMark", + refl::GlobalDef().def("tvm.arith.IterMark", [](PrimExpr source, PrimExpr extent) { return IterMark(source, extent); }); } @@ -102,8 +102,8 @@ IterSplitExpr::IterSplitExpr(IterMark source, PrimExpr lower_factor, PrimExpr ex TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("arith.IterSplitExpr", [](IterMark source, PrimExpr lower_factor, - PrimExpr extent, PrimExpr scale) { + refl::GlobalDef().def("tvm.arith.IterSplitExpr", [](IterMark source, PrimExpr lower_factor, + PrimExpr extent, PrimExpr scale) { return IterSplitExpr(source, lower_factor, extent, scale); }); } @@ -125,7 +125,7 @@ IterSumExpr::IterSumExpr(ffi::Array args, PrimExpr base) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("arith.IterSumExpr", [](ffi::Array args, PrimExpr base) { + refl::GlobalDef().def("tvm.arith.IterSumExpr", [](ffi::Array args, PrimExpr base) { return IterSumExpr(args, base); }); } @@ -1527,7 +1527,7 @@ IterMapResult DetectIterMap(const ffi::Array& indices, TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef().def( - "arith.DetectIterMap", + "tvm.arith.DetectIterMap", [](const ffi::Array& indices, const ffi::Map& input_iters, const PrimExpr& input_pred, int check_level, bool simplify_trivial_iterators) { arith::Analyzer ana; @@ -1554,7 +1554,7 @@ IterSumExpr NormalizeToIterSum(PrimExpr index, const ffi::Map& input TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("arith.NormalizeToIterSum", + refl::GlobalDef().def("tvm.arith.NormalizeToIterSum", [](PrimExpr index, const ffi::Map& input_iters) { arith::Analyzer ana; return NormalizeToIterSum(index, input_iters, &ana); @@ -2156,7 +2156,7 @@ PrimExpr NormalizeIterMapToExpr(const PrimExpr& expr) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("arith.NormalizeIterMapToExpr", NormalizeIterMapToExpr); + refl::GlobalDef().def("tvm.arith.NormalizeIterMapToExpr", NormalizeIterMapToExpr); } ffi::Array IterMapSimplify(const ffi::Array& indices, @@ -2190,7 +2190,7 @@ ffi::Array IterMapSimplify(const ffi::Array& indices, TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef().def( - "arith.IterMapSimplify", + "tvm.arith.IterMapSimplify", [](const ffi::Array& indices, const ffi::Map& input_iters, const PrimExpr& input_pred, int check_level, bool simplify_trivial_iterators) { arith::Analyzer ana; @@ -2527,7 +2527,7 @@ ffi::Array> SubspaceDivide(const ffi::Array& bind TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef().def( - "arith.SubspaceDivide", + "tvm.arith.SubspaceDivide", [](const ffi::Array& bindings, const ffi::Map& root_iters, const ffi::Array& sub_iters, const PrimExpr& predicate, int check_level, bool simplify_trivial_iterators) { @@ -2670,7 +2670,7 @@ ffi::Map InverseAffineIterMap(const ffi::Array& iter TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("arith.InverseAffineIterMap", InverseAffineIterMap); + refl::GlobalDef().def("tvm.arith.InverseAffineIterMap", InverseAffineIterMap); } } // namespace arith diff --git a/src/arith/modular_set.cc b/src/arith/modular_set.cc index e69b8ad20e85..993a830f6048 100644 --- a/src/arith/modular_set.cc +++ b/src/arith/modular_set.cc @@ -60,7 +60,7 @@ ModularSet MakeModularSet(int64_t coeff, int64_t base) { return ModularSet(coeff TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("arith.ModularSet", MakeModularSet); + refl::GlobalDef().def("tvm.arith.ModularSet", MakeModularSet); } // internal entry for const int bound diff --git a/src/arith/narrow_predicate_expression.cc b/src/arith/narrow_predicate_expression.cc index d73364cf45ca..c4c8567c526b 100644 --- a/src/arith/narrow_predicate_expression.cc +++ b/src/arith/narrow_predicate_expression.cc @@ -216,7 +216,7 @@ PrimExpr NarrowPredicateExpression(PrimExpr expr, ffi::Map free_para TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("arith.NarrowPredicateExpression", NarrowPredicateExpression); + refl::GlobalDef().def("tvm.arith.NarrowPredicateExpression", NarrowPredicateExpression); } } // namespace arith diff --git a/src/arith/presburger_set.cc b/src/arith/presburger_set.cc index f69761259683..08ef98cda5ed 100644 --- a/src/arith/presburger_set.cc +++ b/src/arith/presburger_set.cc @@ -276,7 +276,7 @@ PresburgerSet MakePresburgerSet(const PrimExpr& constraint) { return PresburgerS TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; PresburgerSetNode::RegisterReflection(); - refl::GlobalDef().def("arith.PresburgerSet", MakePresburgerSet); + refl::GlobalDef().def("tvm.arith.PresburgerSet", MakePresburgerSet); } #endif // defined(TVM_MLIR_VERSION) && TVM_MLIR_VERSION >= 150 diff --git a/src/arith/presburger_set.h b/src/arith/presburger_set.h index 2404f36428f6..de5dde2970db 100644 --- a/src/arith/presburger_set.h +++ b/src/arith/presburger_set.h @@ -116,7 +116,7 @@ class PresburgerSetNode : public IntSetNode { return std::all_of(disjuncts.begin(), disjuncts.end(), std::mem_fn(&IntegerRelation::isIntegerEmpty)); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("arith.PresburgerSet", PresburgerSetNode, IntSetNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.arith.PresburgerSet", PresburgerSetNode, IntSetNode); private: ffi::Array vars; @@ -156,7 +156,7 @@ class PresburgerSetNode : public IntSetNode { namespace refl = tvm::ffi::reflection; refl::ObjectDef(); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("arith.PresburgerSet", PresburgerSetNode, IntSetNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.arith.PresburgerSet", PresburgerSetNode, IntSetNode); }; class PresburgerSet : public IntSet { diff --git a/src/arith/rewrite_simplify.cc b/src/arith/rewrite_simplify.cc index 65b6e408e2cb..abd430bbf666 100644 --- a/src/arith/rewrite_simplify.cc +++ b/src/arith/rewrite_simplify.cc @@ -2281,7 +2281,7 @@ PrimExpr RewriteSimplifier::Impl::VisitExpr_(const CallNode* op) { // the operator overload will eagerly constant fold. return op->args[0] << op->args[1]; } - } else if (op->op.same_as(Op::Get("tir.ceil"))) { + } else if (op->op.same_as(Op::Get("tvm.tir.ceil"))) { PrimExpr ceil_arg = op->args[0]; if (auto arg_int = op->args[0].as()) { return cast(op->dtype, IntImm(arg_int->dtype, arg_int->value)); diff --git a/src/arith/rewrite_simplify.h b/src/arith/rewrite_simplify.h index e541970a2717..94dbc018d47b 100644 --- a/src/arith/rewrite_simplify.h +++ b/src/arith/rewrite_simplify.h @@ -64,7 +64,7 @@ struct RewriteSimplifierStatsNode : Object { .def_ro("max_recursive_depth", &RewriteSimplifierStatsNode::max_recursive_depth) .def_ro("num_recursive_rewrites", &RewriteSimplifierStatsNode::num_recursive_rewrites); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("arith.RewriteSimplifierStats", RewriteSimplifierStatsNode, + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.arith.RewriteSimplifierStats", RewriteSimplifierStatsNode, Object); }; diff --git a/src/arith/scalable_expression.cc b/src/arith/scalable_expression.cc index 5c968966e2f0..bb5f60b1991a 100644 --- a/src/arith/scalable_expression.cc +++ b/src/arith/scalable_expression.cc @@ -96,7 +96,7 @@ bool TargetHasVLA(ffi::Optional target) { has_vla = Downcast(target)->GetFeature("has_sve").value_or(Bool(false)); // riscv{32,64} static auto target_has_feature_fn = - tvm::ffi::Function::GetGlobalRequired("target.target_has_feature"); + tvm::ffi::Function::GetGlobalRequired("tvm.target.target_has_feature"); has_vla |= target_has_feature_fn("v", target).cast(); } return has_vla; @@ -110,7 +110,7 @@ const std::vector GetVScaleValues(ffi::Optional target) { } if (target.defined()) { static auto llvm_get_vector_width_fn = - tvm::ffi::Function::GetGlobalRequired("target.llvm_get_vector_width"); + tvm::ffi::Function::GetGlobalRequired("tvm.target.llvm_get_vector_width"); vector_width = llvm_get_vector_width_fn(target).cast(); } // scale list with powers of two diff --git a/src/arith/solve_linear_equation.cc b/src/arith/solve_linear_equation.cc index 8143892d9abd..2cf13f13db72 100644 --- a/src/arith/solve_linear_equation.cc +++ b/src/arith/solve_linear_equation.cc @@ -459,7 +459,7 @@ IntConstraintsTransform SolveLinearEquations(const IntConstraints& system_to_sol TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef().def_packed( - "arith.SolveLinearEquations", [](ffi::PackedArgs args, ffi::Any* ret) { + "tvm.arith.SolveLinearEquations", [](ffi::PackedArgs args, ffi::Any* ret) { if (args.size() == 1) { *ret = SolveLinearEquations(args[0].cast()); } else if (args.size() == 3) { diff --git a/src/arith/solve_linear_inequality.cc b/src/arith/solve_linear_inequality.cc index a46f9e520176..9733ca56da52 100644 --- a/src/arith/solve_linear_inequality.cc +++ b/src/arith/solve_linear_inequality.cc @@ -540,7 +540,7 @@ TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() .def_packed( - "arith.SolveInequalitiesAsCondition", + "tvm.arith.SolveInequalitiesAsCondition", [](ffi::PackedArgs args, ffi::Any* ret) { IntConstraints problem; PartialSolvedInequalities ret_ineq; @@ -558,7 +558,7 @@ TVM_FFI_STATIC_INIT_BLOCK() { } *ret = AsConditions(problem->variables, ret_ineq.first, ret_ineq.second); }) - .def_packed("arith.SolveInequalitiesToRange", + .def_packed("tvm.arith.SolveInequalitiesToRange", [](ffi::PackedArgs args, ffi::Any* ret) { if (args.size() == 1) { *ret = SolveInequalitiesToRange(args[0].cast()); @@ -572,19 +572,20 @@ TVM_FFI_STATIC_INIT_BLOCK() { << args.size(); } }) - .def_packed("arith.SolveInequalitiesDeskewRange", [](ffi::PackedArgs args, ffi::Any* ret) { - if (args.size() == 1) { - *ret = SolveInequalitiesDeskewRange(args[0].cast()); - } else if (args.size() == 3) { - auto opt_map = args[1].cast>>(); - IntConstraints problem(args[0].cast>(), opt_map.value_or({}), - args[2].cast>()); - *ret = SolveInequalitiesDeskewRange(problem); - } else { - LOG(FATAL) << "arith.SolveInequalitiesDeskewRange expects 1 or 3 arguments, gets " - << args.size(); - } - }); + .def_packed( + "tvm.arith.SolveInequalitiesDeskewRange", [](ffi::PackedArgs args, ffi::Any* ret) { + if (args.size() == 1) { + *ret = SolveInequalitiesDeskewRange(args[0].cast()); + } else if (args.size() == 3) { + auto opt_map = args[1].cast>>(); + IntConstraints problem(args[0].cast>(), opt_map.value_or({}), + args[2].cast>()); + *ret = SolveInequalitiesDeskewRange(problem); + } else { + LOG(FATAL) << "arith.SolveInequalitiesDeskewRange expects 1 or 3 arguments, gets " + << args.size(); + } + }); } } // namespace arith diff --git a/src/contrib/msc/core/codegen/cpp_codegen.h b/src/contrib/msc/core/codegen/cpp_codegen.h index 99988d689a95..3fcd7e3ec350 100644 --- a/src/contrib/msc/core/codegen/cpp_codegen.h +++ b/src/contrib/msc/core/codegen/cpp_codegen.h @@ -115,7 +115,7 @@ class CppCodeGen : public BaseCodeGen { this->stack_.comment(this->Comment(node)); // process inputs and weights by tools if (use_tools) { - const auto pf = tvm::ffi::Function::GetGlobalRequired("msc_tool.codegen_tensor"); + const auto pf = tvm::ffi::Function::GetGlobalRequired("tvm.msc_tool.codegen_tensor"); for (size_t i = 0; i < node->inputs.size(); i++) { const auto& input = node->InputAt(i); ffi::Any lines = pf(GetTensorCtx(input), input->name, node->name, @@ -137,7 +137,7 @@ class CppCodeGen : public BaseCodeGen { } // process graph outputs by tools if (use_tools) { - const auto pf = tvm::ffi::Function::GetGlobalRequired("msc_tool.codegen_tensor"); + const auto pf = tvm::ffi::Function::GetGlobalRequired("tvm.msc_tool.codegen_tensor"); for (size_t i = 0; i < node->outputs.size(); i++) { int index = static_cast(i); if (graph_outputs_.count(node->OutputAt(index))) { diff --git a/src/contrib/msc/core/ir/graph.cc b/src/contrib/msc/core/ir/graph.cc index 6e69e66bca01..06be46d312e2 100644 --- a/src/contrib/msc/core/ir/graph.cc +++ b/src/contrib/msc/core/ir/graph.cc @@ -1450,13 +1450,13 @@ TVM_FFI_STATIC_INIT_BLOCK() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("msc.core.MSCTensor", + .def("tvm.msc.core.MSCTensor", [](const ffi::String& name, const DataType& dtype, const ffi::String& layout, const ffi::Array& shape, const ffi::String& alias, const ffi::Array& prims) -> MSCTensor { return MSCTensor(name, dtype, layout, shape, alias, prims); }) - .def("msc.core.MSCTensorToJson", + .def("tvm.msc.core.MSCTensorToJson", [](const MSCTensor& tensor) -> ffi::String { const auto& tensor_json = tensor->ToJson(); std::ostringstream os; @@ -1464,9 +1464,9 @@ TVM_FFI_STATIC_INIT_BLOCK() { tensor_json.Save(&writer); return os.str(); }) - .def("msc.core.MSCTensorFromJson", + .def("tvm.msc.core.MSCTensorFromJson", [](const ffi::String& tensor_json) -> MSCTensor { return MSCTensor(tensor_json); }) - .def("msc.core.MSCJoint", + .def("tvm.msc.core.MSCJoint", [](Integer index, const ffi::String& name, const ffi::String& shared_ref, const ffi::String& optype, const ffi::Map& attrs, const ffi::Array& scope, const ffi::Array& parents, @@ -1479,7 +1479,7 @@ TVM_FFI_STATIC_INIT_BLOCK() { return MSCJoint(index->value, name, shared_ref, optype, attrs, scope, inputs, outputs, weights); }) - .def("msc.core.MSCPrim", + .def("tvm.msc.core.MSCPrim", [](Integer index, const ffi::String& name, const ffi::String& optype, const ffi::Map& attrs, const ffi::Array& parents) -> MSCPrim { @@ -1489,7 +1489,7 @@ TVM_FFI_STATIC_INIT_BLOCK() { } return MSCPrim(index->value, name, optype, b_parents, attrs); }) - .def("msc.core.WeightJoint", + .def("tvm.msc.core.WeightJoint", [](Integer index, const ffi::String& name, const ffi::String& shared_ref, const ffi::String& weight_type, const MSCTensor& weight, const ffi::Array parents, const ffi::Map& attrs, @@ -1504,18 +1504,18 @@ TVM_FFI_STATIC_INIT_BLOCK() { return WeightJoint(index->value, name, shared_ref, weight_type, weight, b_parents, attrs, b_friends); }) - .def("msc.core.WeightJointSetAttr", + .def("tvm.msc.core.WeightJointSetAttr", [](const WeightJoint& node, const ffi::String& key, const ffi::String& value) { node->attrs.Set(key, value); }) - .def("msc.core.MSCGraph", + .def("tvm.msc.core.MSCGraph", [](const ffi::String& name, const ffi::Array& nodes, const ffi::Array& input_names, const ffi::Array& output_names, const ffi::Array& prims) -> MSCGraph { return MSCGraph(name, nodes, input_names, output_names, prims); }) - .def("msc.core.WeightGraph", + .def("tvm.msc.core.WeightGraph", [](const MSCGraph& graph, const ffi::Map>& main_wtypes, const ffi::Map& relation_wtypes) -> WeightGraph { @@ -1527,48 +1527,48 @@ TVM_FFI_STATIC_INIT_BLOCK() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("msc.core.MSCGraphHasNode", + .def("tvm.msc.core.MSCGraphHasNode", [](const MSCGraph& graph, const ffi::String& name) -> Bool { return Bool(graph->HasNode(name)); }) - .def("msc.core.MSCGraphFindNode", + .def("tvm.msc.core.MSCGraphFindNode", [](const MSCGraph& graph, const ffi::String& name) -> MSCJoint { return graph->FindNode(name); }) - .def("msc.core.MSCGraphFindPrim", + .def("tvm.msc.core.MSCGraphFindPrim", [](const MSCGraph& graph, const ffi::String& name) -> MSCPrim { return graph->FindPrim(name); }) - .def("msc.core.MSCGraphHasTensor", + .def("tvm.msc.core.MSCGraphHasTensor", [](const MSCGraph& graph, const ffi::String& name) -> Bool { return Bool(graph->HasTensor(name)); }) - .def("msc.core.MSCGraphFindTensor", + .def("tvm.msc.core.MSCGraphFindTensor", [](const MSCGraph& graph, const ffi::String& name) -> MSCTensor { return graph->FindTensor(name); }) - .def("msc.core.MSCGraphSetTensorAlias", + .def("tvm.msc.core.MSCGraphSetTensorAlias", [](const MSCGraph& graph, const MSCTensor& tensor, const ffi::String& alias) { tensor->alias = alias; graph->tensor_alias.Set(alias, tensor->name); }) - .def("msc.core.MSCGraphFindProducer", + .def("tvm.msc.core.MSCGraphFindProducer", [](const MSCGraph& graph, const ffi::String& name) -> MSCJoint { return graph->FindProducer(name); }) - .def("msc.core.MSCGraphFindConsumers", + .def("tvm.msc.core.MSCGraphFindConsumers", [](const MSCGraph& graph, const ffi::String& name) -> ffi::Array { return graph->FindConsumers(name); }) - .def("msc.core.MSCGraphInputAt", + .def("tvm.msc.core.MSCGraphInputAt", [](const MSCGraph& graph, int index) -> MSCTensor { return graph->InputAt(index); }) - .def("msc.core.MSCGraphOutputAt", + .def("tvm.msc.core.MSCGraphOutputAt", [](const MSCGraph& graph, int index) -> MSCTensor { return graph->OutputAt(index); }) - .def("msc.core.MSCGraphGetInputs", + .def("tvm.msc.core.MSCGraphGetInputs", [](const MSCGraph& graph) -> ffi::Array { return graph->GetInputs(); }) - .def("msc.core.MSCGraphGetOutputs", + .def("tvm.msc.core.MSCGraphGetOutputs", [](const MSCGraph& graph) -> ffi::Array { return graph->GetOutputs(); }) - .def("msc.core.MSCGraphToJson", + .def("tvm.msc.core.MSCGraphToJson", [](const MSCGraph& graph) -> ffi::String { const auto& graph_json = graph->ToJson(); std::ostringstream os; @@ -1576,9 +1576,9 @@ TVM_FFI_STATIC_INIT_BLOCK() { graph_json.Save(&writer); return os.str(); }) - .def("msc.core.MSCGraphFromJson", + .def("tvm.msc.core.MSCGraphFromJson", [](const ffi::String& graph_json) -> MSCGraph { return MSCGraph(graph_json); }) - .def("msc.core.MSCGraphToPrototxt", + .def("tvm.msc.core.MSCGraphToPrototxt", [](const MSCGraph& graph) -> ffi::String { return graph->ToPrototxt(); }); } @@ -1586,15 +1586,15 @@ TVM_FFI_STATIC_INIT_BLOCK() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("msc.core.WeightGraphHasNode", + .def("tvm.msc.core.WeightGraphHasNode", [](const WeightGraph& graph, const ffi::String& name) -> Bool { return Bool(graph->HasNode(name)); }) - .def("msc.core.WeightGraphFindNode", + .def("tvm.msc.core.WeightGraphFindNode", [](const WeightGraph& graph, const ffi::String& name) -> WeightJoint { return graph->FindNode(name); }) - .def("msc.core.WeightGraphToJson", + .def("tvm.msc.core.WeightGraphToJson", [](const WeightGraph& graph) -> ffi::String { const auto& graph_json = graph->ToJson(); std::ostringstream os; @@ -1602,48 +1602,48 @@ TVM_FFI_STATIC_INIT_BLOCK() { graph_json.Save(&writer); return os.str(); }) - .def("msc.core.WeightGraphFromJson", + .def("tvm.msc.core.WeightGraphFromJson", [](const ffi::String& graph_json) -> WeightGraph { return WeightGraph(graph_json); }) - .def("msc.core.WeightGraphToPrototxt", + .def("tvm.msc.core.WeightGraphToPrototxt", [](const WeightGraph& graph) -> ffi::String { return graph->ToPrototxt(); }) - .def("msc.core.MSCJointInputAt", + .def("tvm.msc.core.MSCJointInputAt", [](const MSCJoint& node, int index) -> MSCTensor { return node->InputAt(index); }) - .def("msc.core.MSCJointOutputAt", + .def("tvm.msc.core.MSCJointOutputAt", [](const MSCJoint& node, int index) -> MSCTensor { return node->OutputAt(index); }) - .def("msc.core.MSCJointWeightAt", + .def("tvm.msc.core.MSCJointWeightAt", [](const MSCJoint& node, const ffi::String& wtype) -> MSCTensor { return node->WeightAt(wtype); }) - .def("msc.core.MSCJointGetInputs", + .def("tvm.msc.core.MSCJointGetInputs", [](const MSCJoint& node) -> ffi::Array { return node->GetInputs(); }) - .def("msc.core.MSCJointGetOutputs", + .def("tvm.msc.core.MSCJointGetOutputs", [](const MSCJoint& node) -> ffi::Array { return node->GetOutputs(); }) - .def("msc.core.MSCJointGetWeights", + .def("tvm.msc.core.MSCJointGetWeights", [](const MSCJoint& node) -> ffi::Map { return node->weights; }) - .def("msc.core.MSCJointHasAttr", + .def("tvm.msc.core.MSCJointHasAttr", [](const MSCJoint& node, const ffi::String& key) -> Bool { return Bool(node->HasAttr(key)); }) - .def("msc.core.MSCJointGetAttrs", + .def("tvm.msc.core.MSCJointGetAttrs", [](const MSCJoint& node) -> ffi::Map { return node->attrs; }) - .def("msc.core.WeightJointHasAttr", + .def("tvm.msc.core.WeightJointHasAttr", [](const WeightJoint& node, const ffi::String& key) -> Bool { return Bool(node->HasAttr(key)); }) .def( - "msc.core.WeightJointGetAttrs", + "tvm.msc.core.WeightJointGetAttrs", [](const WeightJoint& node) -> ffi::Map { return node->attrs; }) - .def("msc.core.MSCTensorDTypeName", + .def("tvm.msc.core.MSCTensorDTypeName", [](const MSCTensor& tensor) -> ffi::String { return tensor->DTypeName(); }) - .def("msc.core.MSCTensorDimAt", + .def("tvm.msc.core.MSCTensorDimAt", [](const MSCTensor& tensor, const ffi::String& axis) -> Integer { return tensor->DimAt(axis); }) - .def("msc.core.MSCTensorGetSize", + .def("tvm.msc.core.MSCTensorGetSize", [](const MSCTensor& tensor) -> Integer { return tensor->GetSize(); }) - .def("msc.core.MSCTensorSetAlias", + .def("tvm.msc.core.MSCTensorSetAlias", [](const MSCTensor& tensor, const ffi::String& alias) { tensor->alias = alias; }) - .def("msc.core.PruneWeights", + .def("tvm.msc.core.PruneWeights", [](const MSCGraph& graph, const ffi::Map& pruned_tensors) -> MSCGraph { return PruneWeights(graph, pruned_tensors); }); } diff --git a/src/contrib/msc/core/ir/graph.h b/src/contrib/msc/core/ir/graph.h index d795bea7fa1b..31673d39b589 100644 --- a/src/contrib/msc/core/ir/graph.h +++ b/src/contrib/msc/core/ir/graph.h @@ -388,7 +388,7 @@ class MSCTensorNode : public Object { } static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind = kTVMFFISEqHashKindTreeNode; - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("msc.core.MSCTensor", MSCTensorNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.msc.core.MSCTensor", MSCTensorNode, Object); }; /*! @@ -489,7 +489,7 @@ class BaseJointNode : public Object { static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind = kTVMFFISEqHashKindTreeNode; static constexpr const uint32_t _type_child_slots = 2; - TVM_FFI_DECLARE_OBJECT_INFO("msc.core.BaseJoint", BaseJointNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO("tvm.msc.core.BaseJoint", BaseJointNode, Object); }; /*! @@ -557,7 +557,7 @@ class MSCJointNode : public BaseJointNode { } static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind = kTVMFFISEqHashKindTreeNode; - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("msc.core.MSCJoint", MSCJointNode, BaseJointNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.msc.core.MSCJoint", MSCJointNode, BaseJointNode); }; /*! @@ -626,7 +626,7 @@ class MSCPrimNode : public BaseJointNode { namespace refl = tvm::ffi::reflection; refl::ObjectDef().def_ro("optype", &MSCPrimNode::optype); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("msc.core.MSCPrim", MSCPrimNode, BaseJointNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.msc.core.MSCPrim", MSCPrimNode, BaseJointNode); }; /*! @@ -693,7 +693,7 @@ class WeightJointNode : public BaseJointNode { .def_ro("weight", &WeightJointNode::weight) .def_ro("friends", &WeightJointNode::friends); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("msc.core.WeightJoint", WeightJointNode, BaseJointNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.msc.core.WeightJoint", WeightJointNode, BaseJointNode); }; /*! @@ -760,7 +760,7 @@ class BaseGraphNode : public Object { static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind = kTVMFFISEqHashKindTreeNode; static constexpr const uint32_t _type_child_slots = 2; - TVM_FFI_DECLARE_OBJECT_INFO("msc.core.BaseGraph", BaseGraphNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO("tvm.msc.core.BaseGraph", BaseGraphNode, Object); }; /*! @@ -848,7 +848,7 @@ class MSCGraphNode : public BaseGraphNode { .def_ro("output_names", &MSCGraphNode::output_names) .def_ro("weight_holders", &MSCGraphNode::weight_holders); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("msc.core.MSCGraph", MSCGraphNode, BaseGraphNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.msc.core.MSCGraph", MSCGraphNode, BaseGraphNode); }; /*! @@ -909,7 +909,7 @@ class WeightGraphNode : public BaseGraphNode { namespace refl = tvm::ffi::reflection; refl::ObjectDef(); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("msc.core.WeightGraph", WeightGraphNode, BaseGraphNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.msc.core.WeightGraph", WeightGraphNode, BaseGraphNode); }; /*! diff --git a/src/contrib/msc/core/ir/graph_builder.cc b/src/contrib/msc/core/ir/graph_builder.cc index df7a1520ebfa..6d0b5ae3cbd5 100644 --- a/src/contrib/msc/core/ir/graph_builder.cc +++ b/src/contrib/msc/core/ir/graph_builder.cc @@ -842,7 +842,7 @@ void WeightsExtractor::VisitExpr_(const CallNode* op) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("msc.core.BuildFromRelax", + .def("tvm.msc.core.BuildFromRelax", [](const IRModule& module, const ffi::String& entry_name, const ffi::String& options) -> MSCGraph { auto builder = GraphBuilder(module, entry_name, options); @@ -853,7 +853,7 @@ TVM_FFI_STATIC_INIT_BLOCK() { return builder.Build(func); }) .def( - "msc.core.GetRelaxWeights", + "tvm.msc.core.GetRelaxWeights", [](const IRModule& module, const ffi::String& entry_name) -> ffi::Map { const auto& func = Downcast(module->Lookup(entry_name)); return WeightsExtractor(module).GetWeights(func); diff --git a/src/contrib/msc/core/ir/plugin.cc b/src/contrib/msc/core/ir/plugin.cc index 1ff3a8dc8dcd..125cefc410e7 100644 --- a/src/contrib/msc/core/ir/plugin.cc +++ b/src/contrib/msc/core/ir/plugin.cc @@ -318,14 +318,15 @@ TVM_FFI_STATIC_INIT_BLOCK() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("msc.core.RegisterPlugin", + .def("tvm.msc.core.RegisterPlugin", [](const ffi::String& name, const ffi::String& json_str) { PluginRegistry::Global()->Register(name, json_str); }) - .def("msc.core.ListPluginNames", + .def("tvm.msc.core.ListPluginNames", []() -> ffi::Array { return ListPluginNames(); }) - .def("msc.core.GetPlugin", [](const ffi::String& name) -> Plugin { return GetPlugin(name); }) - .def("msc.core.IsPlugin", + .def("tvm.msc.core.GetPlugin", + [](const ffi::String& name) -> Plugin { return GetPlugin(name); }) + .def("tvm.msc.core.IsPlugin", [](const ffi::String& name) -> Bool { return Bool(IsPlugin(name)); }); } diff --git a/src/contrib/msc/core/ir/plugin.h b/src/contrib/msc/core/ir/plugin.h index eaf3167dcf4e..993164e02a36 100644 --- a/src/contrib/msc/core/ir/plugin.h +++ b/src/contrib/msc/core/ir/plugin.h @@ -279,7 +279,7 @@ class PluginAttrNode : public Object { } static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind = kTVMFFISEqHashKindTreeNode; - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("msc.core.PluginAttr", PluginAttrNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.msc.core.PluginAttr", PluginAttrNode, Object); }; /*! @@ -347,7 +347,7 @@ class PluginTensorNode : public Object { } static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind = kTVMFFISEqHashKindTreeNode; - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("msc.core.PluginTensor", PluginTensorNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.msc.core.PluginTensor", PluginTensorNode, Object); }; /*! @@ -416,7 +416,7 @@ class PluginExternNode : public Object { } static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind = kTVMFFISEqHashKindTreeNode; - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("msc.core.PluginExtern", PluginExternNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.msc.core.PluginExtern", PluginExternNode, Object); }; /*! @@ -506,7 +506,7 @@ class PluginNode : public Object { } static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind = kTVMFFISEqHashKindTreeNode; - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("msc.core.Plugin", PluginNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.msc.core.Plugin", PluginNode, Object); }; /*! diff --git a/src/contrib/msc/core/printer/msc_doc.h b/src/contrib/msc/core/printer/msc_doc.h index fe0f6c68338f..692f5203aa7f 100644 --- a/src/contrib/msc/core/printer/msc_doc.h +++ b/src/contrib/msc/core/printer/msc_doc.h @@ -59,7 +59,8 @@ class DeclareDocNode : public ExprDocNode { .def_ro("init_args", &DeclareDocNode::init_args) .def_ro("use_constructor", &DeclareDocNode::use_constructor); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("msc.script.printer.DeclareDoc", DeclareDocNode, ExprDocNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.msc.script.printer.DeclareDoc", DeclareDocNode, + ExprDocNode); }; /*! @@ -99,7 +100,7 @@ class StrictListDocNode : public ExprDocNode { .def_ro("list", &StrictListDocNode::list) .def_ro("allow_empty", &StrictListDocNode::allow_empty); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("msc.script.printer.StrictListDoc", StrictListDocNode, + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.msc.script.printer.StrictListDoc", StrictListDocNode, ExprDocNode); }; @@ -133,7 +134,8 @@ class PointerDocNode : public ExprDocNode { namespace refl = tvm::ffi::reflection; refl::ObjectDef().def_ro("name", &PointerDocNode::name); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("msc.script.printer.PointerDoc", PointerDocNode, ExprDocNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.msc.script.printer.PointerDoc", PointerDocNode, + ExprDocNode); }; /*! @@ -172,7 +174,7 @@ class StructDocNode : public StmtDocNode { .def_ro("decorators", &StructDocNode::decorators) .def_ro("body", &StructDocNode::body); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("msc.script.printer.StructDoc", StructDocNode, StmtDocNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.msc.script.printer.StructDoc", StructDocNode, StmtDocNode); }; /*! @@ -219,7 +221,7 @@ class ConstructorDocNode : public StmtDocNode { .def_ro("args", &ConstructorDocNode::args) .def_ro("body", &ConstructorDocNode::body); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("msc.script.printer.ConstructorDoc", ConstructorDocNode, + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.msc.script.printer.ConstructorDoc", ConstructorDocNode, StmtDocNode); }; @@ -261,7 +263,7 @@ class SwitchDocNode : public StmtDocNode { .def_ro("branchs", &SwitchDocNode::branchs) .def_ro("default_branch", &SwitchDocNode::default_branch); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("msc.script.printer.SwitchDoc", SwitchDocNode, StmtDocNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.msc.script.printer.SwitchDoc", SwitchDocNode, StmtDocNode); }; /*! @@ -312,7 +314,7 @@ class LambdaDocNode : public StmtDocNode { .def_ro("refs", &LambdaDocNode::refs) .def_ro("body", &LambdaDocNode::body); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("msc.script.printer.LambdaDoc", LambdaDocNode, StmtDocNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.msc.script.printer.LambdaDoc", LambdaDocNode, StmtDocNode); }; /*! diff --git a/src/contrib/msc/core/transform/bind_named_params.cc b/src/contrib/msc/core/transform/bind_named_params.cc index 992c514ad7ef..e05891b919db 100644 --- a/src/contrib/msc/core/transform/bind_named_params.cc +++ b/src/contrib/msc/core/transform/bind_named_params.cc @@ -161,7 +161,7 @@ Pass BindNamedParams(ffi::String func_name, ffi::Map param TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.transform.BindNamedParams", BindNamedParams); + refl::GlobalDef().def("tvm.relax.transform.BindNamedParams", BindNamedParams); } } // namespace transform diff --git a/src/contrib/msc/core/transform/bind_shape.cc b/src/contrib/msc/core/transform/bind_shape.cc index c9963ba94e84..8648d245b3b7 100644 --- a/src/contrib/msc/core/transform/bind_shape.cc +++ b/src/contrib/msc/core/transform/bind_shape.cc @@ -136,7 +136,7 @@ Pass BindShape(const ffi::String& entry_name) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.transform.BindShape", BindShape); + refl::GlobalDef().def("tvm.relax.transform.BindShape", BindShape); } } // namespace transform diff --git a/src/contrib/msc/core/transform/fuse_tuple.cc b/src/contrib/msc/core/transform/fuse_tuple.cc index 6f2913ac9599..ac80d0b4f362 100644 --- a/src/contrib/msc/core/transform/fuse_tuple.cc +++ b/src/contrib/msc/core/transform/fuse_tuple.cc @@ -234,7 +234,7 @@ Pass FuseTuple(const ffi::String& target, const ffi::String& entry_name) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.transform.FuseTuple", FuseTuple); + refl::GlobalDef().def("tvm.relax.transform.FuseTuple", FuseTuple); } } // namespace transform diff --git a/src/contrib/msc/core/transform/inline_params.cc b/src/contrib/msc/core/transform/inline_params.cc index 9c5eb7536564..cb44d014fb28 100644 --- a/src/contrib/msc/core/transform/inline_params.cc +++ b/src/contrib/msc/core/transform/inline_params.cc @@ -188,7 +188,7 @@ Pass InlineParams(const ffi::String& entry_name) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.transform.InlineParams", InlineParams); + refl::GlobalDef().def("tvm.relax.transform.InlineParams", InlineParams); } } // namespace transform diff --git a/src/contrib/msc/core/transform/set_byoc_attrs.cc b/src/contrib/msc/core/transform/set_byoc_attrs.cc index 16ce44cede16..4fec913fa097 100644 --- a/src/contrib/msc/core/transform/set_byoc_attrs.cc +++ b/src/contrib/msc/core/transform/set_byoc_attrs.cc @@ -105,7 +105,7 @@ Pass SetBYOCAttrs(const ffi::String& target, const ffi::String& entry_name) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.transform.SetBYOCAttrs", SetBYOCAttrs); + refl::GlobalDef().def("tvm.relax.transform.SetBYOCAttrs", SetBYOCAttrs); } } // namespace transform diff --git a/src/contrib/msc/core/transform/set_expr_layout.cc b/src/contrib/msc/core/transform/set_expr_layout.cc index 90dd47cb2d36..e03f492260c2 100644 --- a/src/contrib/msc/core/transform/set_expr_layout.cc +++ b/src/contrib/msc/core/transform/set_expr_layout.cc @@ -1366,7 +1366,7 @@ Pass SetExprLayout(bool allow_missing, const ffi::String& entry_name) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.transform.SetExprLayout", SetExprLayout); + refl::GlobalDef().def("tvm.relax.transform.SetExprLayout", SetExprLayout); } } // namespace transform diff --git a/src/contrib/msc/core/transform/set_expr_name.cc b/src/contrib/msc/core/transform/set_expr_name.cc index d0231afedba5..d1150dddfb20 100644 --- a/src/contrib/msc/core/transform/set_expr_name.cc +++ b/src/contrib/msc/core/transform/set_expr_name.cc @@ -328,7 +328,7 @@ Pass SetRelaxExprName(const ffi::String& entry_name, const ffi::String& target, TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.transform.SetRelaxExprName", SetRelaxExprName); + refl::GlobalDef().def("tvm.relax.transform.SetRelaxExprName", SetRelaxExprName); } } // namespace transform diff --git a/src/contrib/msc/core/utils.cc b/src/contrib/msc/core/utils.cc index bc70c809af7c..9ec78f9c84d2 100644 --- a/src/contrib/msc/core/utils.cc +++ b/src/contrib/msc/core/utils.cc @@ -535,22 +535,22 @@ const DataType ExprUtils::GetDataType(const Expr& expr) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("msc.core.SpanGetAttr", SpanUtils::GetAttr) - .def("msc.core.SpanGetAttrs", SpanUtils::GetAttrs) - .def("msc.core.SpanCreateWithAttr", + .def("tvm.msc.core.SpanGetAttr", SpanUtils::GetAttr) + .def("tvm.msc.core.SpanGetAttrs", SpanUtils::GetAttrs) + .def("tvm.msc.core.SpanCreateWithAttr", [](const ffi::String& key, const ffi::String& value) -> Span { return SpanUtils::CreateWithAttr(key, value); }) - .def("msc.core.SpanSetAttr", + .def("tvm.msc.core.SpanSetAttr", [](const Span& span, const ffi::String& key, const ffi::String& value) -> Span { return SpanUtils::SetAttr(span, key, value); }) - .def("msc.core.CompareVersion", + .def("tvm.msc.core.CompareVersion", [](const ffi::Array& given_version, const ffi::Array& target_version) -> Integer { return Integer(CommonUtils::CompareVersion(given_version, target_version)); }) - .def("msc.core.ToAttrKey", + .def("tvm.msc.core.ToAttrKey", [](const ffi::String& key) -> ffi::String { return CommonUtils::ToAttrKey(key); }); } diff --git a/src/contrib/msc/framework/tensorflow/codegen.cc b/src/contrib/msc/framework/tensorflow/codegen.cc index 30488fcc9af0..684f25e3bc22 100644 --- a/src/contrib/msc/framework/tensorflow/codegen.cc +++ b/src/contrib/msc/framework/tensorflow/codegen.cc @@ -154,7 +154,7 @@ const ffi::Array TensorflowCodeGen::GetOpCodes(const MSCJoint& node) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("msc.framework.tensorflow.GetTensorflowSources", + refl::GlobalDef().def("tvm.msc.framework.tensorflow.GetTensorflowSources", [](const MSCGraph& graph, const ffi::String& codegen_config, const ffi::String& print_config) -> ffi::Map { TensorflowCodeGen codegen = TensorflowCodeGen(graph, codegen_config); diff --git a/src/contrib/msc/framework/tensorrt/codegen.cc b/src/contrib/msc/framework/tensorrt/codegen.cc index 1be8cf0836c9..19b4319f095f 100644 --- a/src/contrib/msc/framework/tensorrt/codegen.cc +++ b/src/contrib/msc/framework/tensorrt/codegen.cc @@ -120,7 +120,7 @@ void TensorRTCodeGen::CodeGenClassDefine() { stack_.func_arg("logger", "TRTLogger&").func_start(); // save codegen before build if (config()->use_tools) { - const auto pf = tvm::ffi::Function::GetGlobalRequired("msc_tool.codegen_step"); + const auto pf = tvm::ffi::Function::GetGlobalRequired("tvm.msc_tool.codegen_step"); before_build_codes_ = pf(GetStepCtx(), "before_build", graph()->name, config()->tools_tag) .cast>(); } @@ -206,7 +206,7 @@ void TensorRTCodeGen::CodeGenClassDefine() { } // save codegen after build if (config()->use_tools) { - const auto pf = tvm::ffi::Function::GetGlobalRequired("msc_tool.codegen_step"); + const auto pf = tvm::ffi::Function::GetGlobalRequired("tvm.msc_tool.codegen_step"); after_build_codes_ = pf(GetStepCtx(), "after_build", graph()->name, config()->tools_tag) .cast>(); } @@ -579,14 +579,14 @@ const ffi::Map TensorRTCodeGen::GetStepCtx() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("msc.framework.tensorrt.GetTensorRTSources", + .def("tvm.msc.framework.tensorrt.GetTensorRTSources", [](const MSCGraph& graph, const ffi::String& codegen_config, const ffi::String& print_config) -> ffi::Map { TensorRTCodeGen codegen = TensorRTCodeGen(graph, codegen_config); codegen.Init(); return codegen.GetSources(print_config); }) - .def("msc.framework.tensorrt.GetTensorRTRoot", []() -> ffi::String { + .def("tvm.msc.framework.tensorrt.GetTensorRTRoot", []() -> ffi::String { #ifdef TENSORRT_ROOT_DIR return TENSORRT_ROOT_DIR; #else @@ -615,7 +615,8 @@ ffi::Array MSCTensorRTCompiler(ffi::Array functions, MSCJSONSerializer serializer(constant_names, options); serializer.serialize(func); std::string graph_json = serializer.GetJSON(); - const auto pf = tvm::ffi::Function::GetGlobalRequired("runtime.msc_tensorrt_runtime_create"); + const auto pf = + tvm::ffi::Function::GetGlobalRequired("tvm.runtime.msc_tensorrt_runtime_create"); VLOG(1) << "Creating msc_tensorrt ffi::Module for '" << func_name << "'"; compiled_functions.push_back( pf(func_name, graph_json, serializer.GetConstantNames()).cast()); @@ -625,7 +626,7 @@ ffi::Array MSCTensorRTCompiler(ffi::Array functions, TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.ext.msc_tensorrt", MSCTensorRTCompiler); + refl::GlobalDef().def("tvm.relax.ext.msc_tensorrt", MSCTensorRTCompiler); } } // namespace msc diff --git a/src/contrib/msc/framework/tensorrt/transform_tensorrt.cc b/src/contrib/msc/framework/tensorrt/transform_tensorrt.cc index e3579ec7ef77..85dffc56295b 100644 --- a/src/contrib/msc/framework/tensorrt/transform_tensorrt.cc +++ b/src/contrib/msc/framework/tensorrt/transform_tensorrt.cc @@ -920,7 +920,7 @@ Pass TransformTensorRT(const ffi::String& config) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.transform.TransformTensorRT", TransformTensorRT); + refl::GlobalDef().def("tvm.relax.transform.TransformTensorRT", TransformTensorRT); } } // namespace transform diff --git a/src/contrib/msc/framework/torch/codegen.cc b/src/contrib/msc/framework/torch/codegen.cc index c81646f8b267..656e8332873f 100644 --- a/src/contrib/msc/framework/torch/codegen.cc +++ b/src/contrib/msc/framework/torch/codegen.cc @@ -155,7 +155,7 @@ const ffi::Array TorchCodeGen::GetOpCodes(const MSCJoint& node) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("msc.framework.torch.GetTorchSources", + refl::GlobalDef().def("tvm.msc.framework.torch.GetTorchSources", [](const MSCGraph& graph, const ffi::String& codegen_config, const ffi::String& print_config) -> ffi::Map { TorchCodeGen codegen = TorchCodeGen(graph, codegen_config); diff --git a/src/contrib/msc/framework/tvm/codegen.cc b/src/contrib/msc/framework/tvm/codegen.cc index 29445ed7ccc3..b906013b70b4 100644 --- a/src/contrib/msc/framework/tvm/codegen.cc +++ b/src/contrib/msc/framework/tvm/codegen.cc @@ -39,7 +39,7 @@ void RelaxCodeGen::CodeGenGraph() { for (const auto& i : graph()->GetInputs()) { const auto& pair = graph()->FindProducerAndIdx(i); const auto& idx_input = IdxOutputBase(pair.first, pair.second); - stack_.func_arg(idx_input, "relax.Var"); + stack_.func_arg(idx_input, "tvm.relax.Var"); idx_inputs.push_back(idx_input); } if (config()->use_plugin) { @@ -52,9 +52,9 @@ void RelaxCodeGen::CodeGenGraph() { const auto& node = graph()->FindNode(n); for (const auto& pair : node->weights) { const auto& idx_weight = IdxWeightBase(node, pair.first, false); - stack_.func_call("relax.Var", idx_weight) + stack_.func_call("tvm.relax.Var", idx_weight) .call_arg(DocUtils::ToStr(pair.second->name)) - .func_call("relax.TensorStructInfo") + .func_call("tvm.relax.TensorStructInfo") .call_arg(DocUtils::ToList(pair.second->shape, true), "") .call_arg(DocUtils::ToStr(pair.second->DTypeName())) .pop_nest() @@ -63,7 +63,7 @@ void RelaxCodeGen::CodeGenGraph() { } } stack_.comment("Define the module"); - stack_.func_call("relax.BlockBuilder", "block_builder") + stack_.func_call("tvm.relax.BlockBuilder", "block_builder") .scope_start("block_builder.function(name=\"" + graph()->name + "\", params=inputs.copy())"); if (config()->use_tools) { stack_.func_call("msc_tools.execute_step") @@ -100,7 +100,7 @@ void RelaxCodeGen::CodeGenGraph() { const auto& t_output = IdxOutputBase(e, o_idx, true); tuple_outputs.push_back(t_output); } - stack_.func_call("relax.Tuple", idx_exit).call_arg(DocUtils::ToList(tuple_outputs)); + stack_.func_call("tvm.relax.Tuple", idx_exit).call_arg(DocUtils::ToList(tuple_outputs)); stack_.func_call("emit", idx_exit, "block_builder").call_arg(idx_exit); stack_.call_arg(DocUtils::ToStr(e->name + "_exit"), "name_hint"); } @@ -136,9 +136,9 @@ void RelaxCodeGen::CodeGenInference() { } for (const auto& i : graph()->GetInputs()) { const auto& producer = graph()->FindProducer(i); - stack_.func_call("relax.Var", IdxNodeBase(producer)) + stack_.func_call("tvm.relax.Var", IdxNodeBase(producer)) .call_arg(DocUtils::ToStr(i->alias)) - .func_call("relax.TensorStructInfo") + .func_call("tvm.relax.TensorStructInfo") .call_arg(DocUtils::ToList(i->shape)) .call_arg(DocUtils::ToStr(i->DTypeName())) .pop_nest(); @@ -214,7 +214,7 @@ const ffi::Array RelaxCodeGen::GetOpCodes(const MSCJoint& node) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("msc.framework.tvm.GetRelaxSources", + refl::GlobalDef().def("tvm.msc.framework.tvm.GetRelaxSources", [](const MSCGraph& graph, const ffi::String& codegen_config, const ffi::String& print_config) -> ffi::Map { RelaxCodeGen codegen = RelaxCodeGen(graph, codegen_config); diff --git a/src/contrib/msc/framework/tvm/relax_opcode.cc b/src/contrib/msc/framework/tvm/relax_opcode.cc index da2cdfba5914..3bf80254fa04 100644 --- a/src/contrib/msc/framework/tvm/relax_opcode.cc +++ b/src/contrib/msc/framework/tvm/relax_opcode.cc @@ -102,12 +102,12 @@ class RelaxAttentionCodeGen : public RelaxOpCode { void CodeGenBuild() final { for (size_t i = 0; i < 3; i++) { const ffi::String& axes_key = i == 0 ? "axes" : "axes_" + std::to_string(i); - stack_.op_call("relax.op.permute_dims", IdxInput(i)) + stack_.op_call("tvm.relax.op.permute_dims", IdxInput(i)) .op_input_arg(i) .op_list_arg(axes_key, "axes"); } stack_.op_call().op_inputs_arg(false).op_arg("scale").op_str_arg("causal_mask"); - stack_.op_call("relax.op.permute_dims").op_output_arg().op_list_arg("axes_3", "axes"); + stack_.op_call("tvm.relax.op.permute_dims").op_output_arg().op_list_arg("axes_3", "axes"); } }; @@ -150,7 +150,7 @@ class RelaxBatchMatmulCodeGen : public RelaxOpCode { } axes.push_back(node()->InputAt(0)->Ndim() - 1); axes.push_back(node()->InputAt(0)->Ndim() - 2); - stack_.op_call("relax.op.permute_dims", IdxInput(0)) + stack_.op_call("tvm.relax.op.permute_dims", IdxInput(0)) .op_input_arg() .call_arg(DocUtils::ToList(axes)); BuilderEmit(IdxInput(0)); @@ -162,7 +162,7 @@ class RelaxBatchMatmulCodeGen : public RelaxOpCode { } axes.push_back(node()->InputAt(1)->Ndim() - 1); axes.push_back(node()->InputAt(1)->Ndim() - 2); - stack_.op_call("relax.op.permute_dims", IdxInput(1)) + stack_.op_call("tvm.relax.op.permute_dims", IdxInput(1)) .op_input_arg(1) .call_arg(DocUtils::ToList(axes)); BuilderEmit(IdxInput(1)); @@ -175,7 +175,7 @@ class RelaxBatchMatmulCodeGen : public RelaxOpCode { } axes.push_back(node()->InputAt(idx)->Ndim() - 1); axes.push_back(node()->InputAt(idx)->Ndim() - 2); - stack_.op_call("relax.op.permute_dims", IdxInput(idx)) + stack_.op_call("tvm.relax.op.permute_dims", IdxInput(idx)) .op_input_arg(idx) .call_arg(DocUtils::ToList(axes)); BuilderEmit(IdxInput(idx)); @@ -218,7 +218,7 @@ class RelaxBiasAddCodeGen : public RelaxOpCode { expand_shape.push_back(Integer(1)); } } - stack_.op_call("relax.op.reshape", IdxInput(1)) + stack_.op_call("tvm.relax.op.reshape", IdxInput(1)) .op_input_arg(1) .call_arg(DocUtils::ToList(expand_shape), "shape"); BuilderEmit(IdxInput(1)); @@ -295,7 +295,7 @@ class RelaxConvCodeGen : public RelaxOpCode { } } BuilderEmit(IdxNode()); - stack_.func_call("relax.op.reshape", "expand_bias") + stack_.func_call("tvm.relax.op.reshape", "expand_bias") .op_weight_arg("bias") .call_arg(DocUtils::ToList(expand_shape), "shape"); BuilderEmit("expand_bias"); @@ -367,13 +367,13 @@ class RelaxEmbeddingCodeGen : public RelaxOpCode { void CodeGenBuild() final { const auto& input = node()->InputAt(0); if (input->DTypeName() != "int32") { - stack_.op_call("relax.op.astype", IdxInput()) + stack_.op_call("tvm.relax.op.astype", IdxInput()) .op_input_arg() .call_arg(DocUtils::ToStr("int32")); BuilderEmit(IdxInput()); } if (input->Ndim() > 1) { - stack_.op_call("relax.op.reshape", IdxInput()) + stack_.op_call("tvm.relax.op.reshape", IdxInput()) .op_input_arg() .call_arg(DocUtils::ToList(std::vector{-1}), "shape"); BuilderEmit(IdxInput()); @@ -381,7 +381,7 @@ class RelaxEmbeddingCodeGen : public RelaxOpCode { stack_.op_call().op_weight_arg("weight").op_input_arg().op_arg("axis"); if (input->Ndim() > 1) { BuilderEmit(IdxNode()); - stack_.op_call("relax.op.reshape") + stack_.op_call("tvm.relax.op.reshape") .op_output_arg() .call_arg(DocUtils::ToList(node()->OutputAt(0)->shape)); } @@ -588,7 +588,7 @@ class RelaxScatterNDCodeGen : public RelaxOpCode { for (size_t i = 0; i < ndim - 1; i++) { axes.push_back(i); } - stack_.func_call("relax.op.permute_dims", IdxInput(1)) + stack_.func_call("tvm.relax.op.permute_dims", IdxInput(1)) .call_arg(IdxInput(1)) .call_arg(DocUtils::ToList(axes)); BuilderEmit(IdxInput(1), "permute_" + std::to_string(node()->index)); @@ -610,7 +610,7 @@ class RelaxResize2dCodeGen : public RelaxOpCode { } stack_.op_call() .op_input_arg() - .func_call("relax.ShapeExpr") + .func_call("tvm.relax.ShapeExpr") .op_list_arg("size", "values") .pop_nest() .call_arg(DocUtils::ToList(roi_list)) @@ -663,7 +663,7 @@ class RelaxStackCodeGen : public RelaxOpCode { stack_.op_call().op_inputs_arg().op_arg("axis"); BuilderEmit(IdxNode(), "cat_" + std::to_string(node()->index)); const auto& out_shape = GetPrims(node()->OutputAt(0)); - stack_.func_call("relax.op.reshape", IdxNode()) + stack_.func_call("tvm.relax.op.reshape", IdxNode()) .call_arg(IdxNode()) .call_arg(DocUtils::ToList(out_shape), "shape"); } @@ -700,7 +700,7 @@ class RelaxTriCodeGen : public RelaxOpCode { void CodeGenBuild() final { if (node()->optype == "trilu") { const ffi::String& func_name = - node()->GetTypeAttr("upper") ? "relax.op.triu" : "relax.op.tril"; + node()->GetTypeAttr("upper") ? "tvm.relax.op.triu" : "tvm.relax.op.tril"; stack_.op_call(func_name).op_input_arg().op_arg("k"); } else { stack_.op_call().op_input_arg().op_arg("k"); @@ -777,7 +777,7 @@ GetRelaxOpCodes() { map->emplace("subtract", std::make_shared("relax.op.subtract")); map->emplace("tan", std::make_shared("relax.op.tan")); map->emplace("tanh", std::make_shared("relax.op.tanh")); - map->emplace("where", std::make_shared("relax.op.where")); + map->emplace("where", std::make_shared("tvm.relax.op.where")); // reduce axis ops map->emplace("argmax", std::make_shared("relax.op.argmax", false)); @@ -790,80 +790,89 @@ GetRelaxOpCodes() { map->emplace("std", std::make_shared("relax.op.std", true)); // axis && axes ops - map->emplace("nn.log_softmax", std::make_shared("relax.op.nn.log_softmax")); - map->emplace("nn.softmax", std::make_shared("relax.op.nn.softmax")); - map->emplace("expand_dims", std::make_shared("relax.op.expand_dims")); - map->emplace("squeeze", std::make_shared("relax.op.squeeze")); + map->emplace("nn.log_softmax", std::make_shared("tvm.relax.op.nn.log_softmax")); + map->emplace("nn.softmax", std::make_shared("tvm.relax.op.nn.softmax")); + map->emplace("expand_dims", std::make_shared("tvm.relax.op.expand_dims")); + map->emplace("squeeze", std::make_shared("tvm.relax.op.squeeze")); // math ops - map->emplace("astype", std::make_shared("relax.op.astype")); - map->emplace("broadcast_to", std::make_shared("relax.op.broadcast_to")); - map->emplace("cast", std::make_shared("relax.op.astype")); - map->emplace("clip", std::make_shared("relax.op.clip")); - map->emplace("concat", std::make_shared("relax.op.concat")); - map->emplace("concatenate", std::make_shared("relax.op.concat")); - map->emplace("cumsum", std::make_shared("relax.op.cumsum")); - map->emplace("einsum", std::make_shared("relax.op.einsum")); + map->emplace("astype", std::make_shared("tvm.relax.op.astype")); + map->emplace("broadcast_to", + std::make_shared("tvm.relax.op.broadcast_to")); + map->emplace("cast", std::make_shared("tvm.relax.op.astype")); + map->emplace("clip", std::make_shared("tvm.relax.op.clip")); + map->emplace("concat", std::make_shared("tvm.relax.op.concat")); + map->emplace("concatenate", std::make_shared("tvm.relax.op.concat")); + map->emplace("cumsum", std::make_shared("tvm.relax.op.cumsum")); + map->emplace("einsum", std::make_shared("tvm.relax.op.einsum")); map->emplace("matmul", std::make_shared("relax.op.linear_algebra.matmul")); - map->emplace("permute_dims", std::make_shared("relax.op.permute_dims")); - map->emplace("repeat", std::make_shared("relax.op.repeat")); - map->emplace("reshape", std::make_shared("relax.op.reshape")); + map->emplace("permute_dims", + std::make_shared("tvm.relax.op.permute_dims")); + map->emplace("repeat", std::make_shared("tvm.relax.op.repeat")); + map->emplace("reshape", std::make_shared("tvm.relax.op.reshape")); map->emplace("scatter_elements", - std::make_shared("relax.op.scatter_elements")); - map->emplace("scatter_nd", std::make_shared("relax.op.scatter_nd")); - map->emplace("split", std::make_shared("relax.op.split")); - map->emplace("stack", std::make_shared("relax.op.concat")); + std::make_shared("tvm.relax.op.scatter_elements")); + map->emplace("scatter_nd", std::make_shared("tvm.relax.op.scatter_nd")); + map->emplace("split", std::make_shared("tvm.relax.op.split")); + map->emplace("stack", std::make_shared("tvm.relax.op.concat")); map->emplace("strided_slice", - std::make_shared("relax.op.strided_slice")); - map->emplace("take", std::make_shared("relax.op.take")); - map->emplace("tile", std::make_shared("relax.op.tile")); - map->emplace("transpose", std::make_shared("relax.op.permute_dims")); + std::make_shared("tvm.relax.op.strided_slice")); + map->emplace("take", std::make_shared("tvm.relax.op.take")); + map->emplace("tile", std::make_shared("tvm.relax.op.tile")); + map->emplace("transpose", std::make_shared("tvm.relax.op.permute_dims")); // create ops - map->emplace("constant", std::make_shared("relax.Var")); - map->emplace("full", std::make_shared("relax.op.full")); - map->emplace("ones", std::make_shared("relax.op.ones")); - map->emplace("ones_like", std::make_shared("relax.op.ones_like")); - map->emplace("tril", std::make_shared("relax.op.tril")); - map->emplace("triu", std::make_shared("relax.op.triu")); + map->emplace("constant", std::make_shared("tvm.relax.Var")); + map->emplace("full", std::make_shared("tvm.relax.op.full")); + map->emplace("ones", std::make_shared("tvm.relax.op.ones")); + map->emplace("ones_like", std::make_shared("tvm.relax.op.ones_like")); + map->emplace("tril", std::make_shared("tvm.relax.op.tril")); + map->emplace("triu", std::make_shared("tvm.relax.op.triu")); map->emplace("trilu", std::make_shared("")); - map->emplace("zeros", std::make_shared("relax.op.zeros")); - map->emplace("zeros_like", std::make_shared("relax.op.zeros_like")); + map->emplace("zeros", std::make_shared("tvm.relax.op.zeros")); + map->emplace("zeros_like", std::make_shared("tvm.relax.op.zeros_like")); // nn ops map->emplace("nn.adaptive_avg_pool2d", - std::make_shared("relax.op.nn.adaptive_avg_pool2d")); - map->emplace("nn.avg_pool2d", std::make_shared("relax.op.nn.avg_pool2d")); + std::make_shared("tvm.relax.op.nn.adaptive_avg_pool2d")); + map->emplace("nn.avg_pool2d", std::make_shared("tvm.relax.op.nn.avg_pool2d")); map->emplace("nn.batch_matmul", std::make_shared("relax.op.linear_algebra.matmul")); - map->emplace("nn.batch_norm", std::make_shared("relax.op.nn.batch_norm")); + map->emplace("nn.batch_norm", + std::make_shared("tvm.relax.op.nn.batch_norm")); map->emplace("nn.bias_add", std::make_shared("relax.op.add")); - map->emplace("nn.conv1d", std::make_shared("relax.op.nn.conv1d", false)); - map->emplace("nn.conv2d", std::make_shared("relax.op.nn.conv2d", false)); + map->emplace("nn.conv1d", std::make_shared("tvm.relax.op.nn.conv1d", false)); + map->emplace("nn.conv2d", std::make_shared("tvm.relax.op.nn.conv2d", false)); map->emplace("nn.dense", std::make_shared("relax.op.linear_algebra.linear")); map->emplace("nn.gelu", std::make_shared("relax.op.nn.gelu")); - map->emplace("nn.group_norm", std::make_shared("relax.op.nn.group_norm")); - map->emplace("nn.layer_norm", std::make_shared("relax.op.nn.layer_norm")); - map->emplace("nn.max_pool2d", std::make_shared("relax.op.nn.max_pool2d")); - map->emplace("nn.nll_loss", std::make_shared("relax.op.nn.nll_loss")); - map->emplace("nn.pad", std::make_shared("relax.op.nn.pad")); + map->emplace("nn.group_norm", + std::make_shared("tvm.relax.op.nn.group_norm")); + map->emplace("nn.layer_norm", + std::make_shared("tvm.relax.op.nn.layer_norm")); + map->emplace("nn.max_pool2d", std::make_shared("tvm.relax.op.nn.max_pool2d")); + map->emplace("nn.nll_loss", std::make_shared("tvm.relax.op.nn.nll_loss")); + map->emplace("nn.pad", std::make_shared("tvm.relax.op.nn.pad")); map->emplace("nn.relu", std::make_shared("relax.op.nn.relu")); map->emplace("nn.silu", std::make_shared("relax.op.nn.silu")); // image ops - map->emplace("image.resize2d", std::make_shared("relax.op.image.resize2d")); + map->emplace("image.resize2d", + std::make_shared("tvm.relax.op.image.resize2d")); // special op - map->emplace("get_item", std::make_shared("relax.TupleGetItem")); - map->emplace("shape", std::make_shared("relax.ShapeExpr")); - map->emplace("tuple", std::make_shared("relax.Tuple")); + map->emplace("get_item", std::make_shared("tvm.relax.TupleGetItem")); + map->emplace("shape", std::make_shared("tvm.relax.ShapeExpr")); + map->emplace("tuple", std::make_shared("tvm.relax.Tuple")); map->emplace("plugin", std::make_shared("Plugin")); // msc ops - map->emplace("msc.attention", std::make_shared("relax.op.nn.attention")); - map->emplace("msc.conv1d_bias", std::make_shared("relax.op.nn.conv1d", true)); - map->emplace("msc.conv2d_bias", std::make_shared("relax.op.nn.conv2d", true)); - map->emplace("msc.embedding", std::make_shared("relax.op.take")); + map->emplace("msc.attention", + std::make_shared("tvm.relax.op.nn.attention")); + map->emplace("msc.conv1d_bias", + std::make_shared("tvm.relax.op.nn.conv1d", true)); + map->emplace("msc.conv2d_bias", + std::make_shared("tvm.relax.op.nn.conv2d", true)); + map->emplace("msc.embedding", std::make_shared("tvm.relax.op.take")); map->emplace("msc.gelu", std::make_shared("relax.op.nn.gelu")); map->emplace("msc.linear", std::make_shared("relax.op.linear_algebra.linear")); diff --git a/src/contrib/msc/plugin/tensorrt_codegen.cc b/src/contrib/msc/plugin/tensorrt_codegen.cc index 890b9a6df7b3..c83cb05a81f4 100644 --- a/src/contrib/msc/plugin/tensorrt_codegen.cc +++ b/src/contrib/msc/plugin/tensorrt_codegen.cc @@ -887,7 +887,7 @@ void TensorRTPluginCodeGen::CodegenEnqueue(const Plugin& plugin, bool dynamic) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("msc.plugin.GetTensorRTPluginSources", + refl::GlobalDef().def("tvm.msc.plugin.GetTensorRTPluginSources", [](const ffi::String& codegen_config, const ffi::String& print_config, const ffi::String& codegen_type) -> ffi::Map { TensorRTPluginCodeGen codegen = TensorRTPluginCodeGen(codegen_config); diff --git a/src/contrib/msc/plugin/torch_codegen.cc b/src/contrib/msc/plugin/torch_codegen.cc index d5a2b5353de4..e59c872f5b93 100644 --- a/src/contrib/msc/plugin/torch_codegen.cc +++ b/src/contrib/msc/plugin/torch_codegen.cc @@ -367,7 +367,7 @@ void TorchPluginCodeGen::CodeGenConvertDepends() { } const ffi::String TorchPluginCodeGen::CodeGenOpConvert(const Plugin& plugin) { - stack_.func_def(ConverterName(plugin), "relax.Var") + stack_.func_def(ConverterName(plugin), "tvm.relax.Var") .func_arg("node", "fx.node.Node") .func_arg("ctx", "TorchFXImporter") .func_start() @@ -387,7 +387,7 @@ const ffi::String TorchPluginCodeGen::CodeGenOpConvert(const Plugin& plugin) { } stack_.assign("name", DocUtils::ToIndex("args", 1 + plugin->inputs.size() + plugin->attrs.size())); - stack_.func_call("relax.Tuple", "args") + stack_.func_call("tvm.relax.Tuple", "args") .call_arg(DocUtils::ToList(args)) .func_call("InferStructInfo" + plugin->name, "out_sinfo", "_plugin_api"); for (const auto& t : plugin->inputs) { @@ -412,7 +412,7 @@ const ffi::String TorchPluginCodeGen::CodeGenOpConvert(const Plugin& plugin) { ffi::Array outputs; for (size_t i = 0; i < plugin->outputs.size(); i++) { const auto& tensor = plugin->outputs[i]; - stack_.func_call("relax.TupleGetItem", tensor->name).call_arg("var").call_arg(i); + stack_.func_call("tvm.relax.TupleGetItem", tensor->name).call_arg("var").call_arg(i); outputs.push_back(tensor->name); } stack_.func_end(DocUtils::ToList(outputs)); @@ -498,7 +498,7 @@ void TorchPluginCodeGen::CodeGenCompute(const Plugin& plugin, const ffi::String& TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("msc.plugin.GetTorchPluginSources", + refl::GlobalDef().def("tvm.msc.plugin.GetTorchPluginSources", [](const ffi::String& codegen_config, const ffi::String& print_config, const ffi::String& codegen_type) -> ffi::Map { TorchPluginCodeGen codegen = TorchPluginCodeGen(codegen_config); diff --git a/src/contrib/msc/plugin/tvm_codegen.cc b/src/contrib/msc/plugin/tvm_codegen.cc index 7a109a147280..248706507a88 100644 --- a/src/contrib/msc/plugin/tvm_codegen.cc +++ b/src/contrib/msc/plugin/tvm_codegen.cc @@ -326,7 +326,7 @@ void TVMPluginCodeGen::CodeGenOpBuilder(const Plugin& plugin) { stack_.func_call("plugin_utils.to_expr", a->name).call_arg(a->name); args.push_back(a->name); } - stack_.func_call("relax.Tuple", "args") + stack_.func_call("tvm.relax.Tuple", "args") .call_arg(DocUtils::ToList(args)) .func_call("InferStructInfo" + plugin->name, "out_sinfo", "self._ffi_api"); for (const auto& t : plugin->inputs) { @@ -398,7 +398,7 @@ void TVMPluginCodeGen::CodeGenCompute(const Plugin& plugin, const ffi::String& d TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("msc.plugin.GetTVMPluginSources", + refl::GlobalDef().def("tvm.msc.plugin.GetTVMPluginSources", [](const ffi::String& codegen_config, const ffi::String& print_config, const ffi::String& codegen_type) -> ffi::Map { TVMPluginCodeGen codegen = TVMPluginCodeGen(codegen_config); diff --git a/src/ir/analysis.cc b/src/ir/analysis.cc index 81d6bb7e5891..9d1e90edc460 100644 --- a/src/ir/analysis.cc +++ b/src/ir/analysis.cc @@ -46,7 +46,7 @@ ffi::Map> CollectCallMap(const IRModule& mod) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("ir.analysis.CollectCallMap", CollectCallMap); + refl::GlobalDef().def("tvm.ir.analysis.CollectCallMap", CollectCallMap); } } // namespace ir diff --git a/src/ir/apply_pass_to_function.cc b/src/ir/apply_pass_to_function.cc index 3dd7c6a5ff8f..6d72cf80e3a6 100644 --- a/src/ir/apply_pass_to_function.cc +++ b/src/ir/apply_pass_to_function.cc @@ -132,7 +132,7 @@ Pass ApplyPassToFunction(Pass pass, ffi::String func_name_regex, TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("transform.ApplyPassToFunction", ApplyPassToFunction); + refl::GlobalDef().def("tvm.transform.ApplyPassToFunction", ApplyPassToFunction); } } // namespace transform diff --git a/src/ir/attrs.cc b/src/ir/attrs.cc index 748f4bf5c93f..b4fd39689f47 100644 --- a/src/ir/attrs.cc +++ b/src/ir/attrs.cc @@ -73,7 +73,7 @@ TVM_FFI_STATIC_INIT_BLOCK() { tvm::ffi::reflection::ObjectDef(); TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("ir.DictAttrsGetDict", [](DictAttrs attrs) { return attrs->dict; }); + refl::GlobalDef().def("tvm.ir.DictAttrsGetDict", [](DictAttrs attrs) { return attrs->dict; }); } } // namespace tvm diff --git a/src/ir/diagnostic.cc b/src/ir/diagnostic.cc index e20c6b8e1715..1bbb6daf9294 100644 --- a/src/ir/diagnostic.cc +++ b/src/ir/diagnostic.cc @@ -41,9 +41,10 @@ TVM_FFI_STATIC_INIT_BLOCK() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("diagnostics.Diagnostic", [](int level, Span span, ffi::String message) { - return Diagnostic(static_cast(level), span, message); - }); + refl::GlobalDef().def("tvm.diagnostics.Diagnostic", + [](int level, Span span, ffi::String message) { + return Diagnostic(static_cast(level), span, message); + }); } Diagnostic::Diagnostic(DiagnosticLevel level, Span span, const std::string& message) { @@ -117,7 +118,7 @@ TVM_DLL DiagnosticRenderer::DiagnosticRenderer( TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("diagnostics.DiagnosticRenderer", + refl::GlobalDef().def("tvm.diagnostics.DiagnosticRenderer", [](ffi::TypedFunction renderer) { return DiagnosticRenderer(renderer); }); @@ -148,7 +149,7 @@ void DiagnosticContext::Render() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef().def( - "diagnostics.DiagnosticRendererRender", + "tvm.diagnostics.DiagnosticRendererRender", [](DiagnosticRenderer renderer, DiagnosticContext ctx) { renderer.Render(ctx); }); } @@ -162,7 +163,7 @@ DiagnosticContext::DiagnosticContext(const IRModule& module, const DiagnosticRen TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("diagnostics.DiagnosticContext", + refl::GlobalDef().def("tvm.diagnostics.DiagnosticContext", [](const IRModule& module, const DiagnosticRenderer& renderer) { return DiagnosticContext(module, renderer); }); @@ -176,9 +177,9 @@ void DiagnosticContext::Emit(const Diagnostic& diagnostic) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("diagnostics.Emit", + .def("tvm.diagnostics.Emit", [](DiagnosticContext ctx, const Diagnostic& diagnostic) { return ctx.Emit(diagnostic); }) - .def("diagnostics.DiagnosticContextRender", + .def("tvm.diagnostics.DiagnosticContextRender", [](DiagnosticContext context) { return context.Render(); }); } @@ -189,8 +190,8 @@ void DiagnosticContext::EmitFatal(const Diagnostic& diagnostic) { } /* Default Terminal Renderer. */ -static const char* DEFAULT_RENDERER = "diagnostics.DefaultRenderer"; -static const char* OVERRIDE_RENDERER = "diagnostics.OverrideRenderer"; +static const char* DEFAULT_RENDERER = "tvm.diagnostics.DefaultRenderer"; +static const char* OVERRIDE_RENDERER = "tvm.diagnostics.OverrideRenderer"; DiagnosticRenderer GetRenderer() { auto override_pf = tvm::ffi::Function::GetGlobal(OVERRIDE_RENDERER); @@ -214,7 +215,7 @@ DiagnosticContext DiagnosticContext::Default(const IRModule& module) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("diagnostics.Default", + refl::GlobalDef().def("tvm.diagnostics.Default", [](const IRModule& module) { return DiagnosticContext::Default(module); }); } @@ -334,8 +335,8 @@ TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() .def(DEFAULT_RENDERER, []() { return TerminalRenderer(std::cerr); }) - .def("diagnostics.GetRenderer", []() { return GetRenderer(); }) - .def("diagnostics.ClearRenderer", + .def("tvm.diagnostics.GetRenderer", []() { return GetRenderer(); }) + .def("tvm.diagnostics.ClearRenderer", []() { tvm::ffi::Function::RemoveGlobal(OVERRIDE_RENDERER); }); } diff --git a/src/ir/env_func.cc b/src/ir/env_func.cc index 5a6e2c662b61..973e1a52ac28 100644 --- a/src/ir/env_func.cc +++ b/src/ir/env_func.cc @@ -53,21 +53,21 @@ EnvFunc EnvFunc::Get(const ffi::String& name) { return EnvFunc(CreateEnvNode(nam TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("ir.EnvFuncGet", EnvFunc::Get) - .def_packed("ir.EnvFuncCall", + .def("tvm.ir.EnvFuncGet", EnvFunc::Get) + .def_packed("tvm.ir.EnvFuncCall", [](ffi::PackedArgs args, ffi::Any* rv) { EnvFunc env = args[0].cast(); ICHECK_GE(args.size(), 1); env->func.CallPacked(args.Slice(1), rv); }) - .def("ir.EnvFuncGetFunction", [](const EnvFunc& n) { return n->func; }); + .def("tvm.ir.EnvFuncGetFunction", [](const EnvFunc& n) { return n->func; }); // override EnvFuncNode to use name as the repr refl::TypeAttrDef() - .def("__data_to_json__", + .def("tvm.__data_to_json__", [](const EnvFuncNode* node) { // simply save as the string return node->name; }) - .def("__data_from_json__", EnvFunc::Get); + .def("tvm.__data_from_json__", EnvFunc::Get); } } // namespace tvm diff --git a/src/ir/expr.cc b/src/ir/expr.cc index b856854a5d8f..b4e42e45a878 100644 --- a/src/ir/expr.cc +++ b/src/ir/expr.cc @@ -81,7 +81,7 @@ IntImm::IntImm(DataType dtype, int64_t value, Span span) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("ir.IntImm", [](DataType dtype, int64_t value, Span span) { + refl::GlobalDef().def("tvm.ir.IntImm", [](DataType dtype, int64_t value, Span span) { return IntImm(dtype, value, span); }); } @@ -184,7 +184,7 @@ FloatImm::FloatImm(DataType dtype, double value, Span span) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("ir.FloatImm", [](DataType dtype, double value, Span span) { + refl::GlobalDef().def("tvm.ir.FloatImm", [](DataType dtype, double value, Span span) { return FloatImm(dtype, value, span); }); } @@ -199,8 +199,8 @@ Range Range::FromMinExtent(PrimExpr min, PrimExpr extent, Span span) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("ir.Range_from_min_extent", Range::FromMinExtent) - .def("ir.Range", [](PrimExpr begin, ffi::Optional end, Span span) -> Range { + .def("tvm.ir.Range_from_min_extent", Range::FromMinExtent) + .def("tvm.ir.Range", [](PrimExpr begin, ffi::Optional end, Span span) -> Range { if (end.defined()) { return Range(begin, end.value(), span); } else { @@ -219,8 +219,8 @@ GlobalVar::GlobalVar(ffi::String name_hint, Span span) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("ir.GlobalVar", [](ffi::String name) { return GlobalVar(name); }) - .def("ir.DebugPrint", [](ObjectRef ref) { + .def("tvm.ir.GlobalVar", [](ffi::String name) { return GlobalVar(name); }) + .def("tvm.ir.DebugPrint", [](ObjectRef ref) { std::stringstream ss; ss << ref; return ss.str(); diff --git a/src/ir/function.cc b/src/ir/function.cc index de14d57b3ef8..31689eee864f 100644 --- a/src/ir/function.cc +++ b/src/ir/function.cc @@ -33,9 +33,9 @@ namespace tvm { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("ir.BaseFunc_Attrs", [](BaseFunc func) { return func->attrs; }) - .def("ir.BaseFuncCopy", [](BaseFunc func) { return func; }) - .def("ir.BaseFuncWithAttr", + .def("tvm.ir.BaseFunc_Attrs", [](BaseFunc func) { return func->attrs; }) + .def("tvm.ir.BaseFuncCopy", [](BaseFunc func) { return func; }) + .def("tvm.ir.BaseFuncWithAttr", [](ffi::RValueRef func_ref, ffi::String key, Any value) -> BaseFunc { BaseFunc func = *std::move(func_ref); if (func->IsInstance()) { @@ -48,14 +48,14 @@ TVM_FFI_STATIC_INIT_BLOCK() { LOG(FATAL) << "Do not support function type " << func->GetTypeKey(); } }) - .def("ir.BaseFuncWithAttrs", + .def("tvm.ir.BaseFuncWithAttrs", [](ffi::RValueRef func_ref, ffi::Map attr_map) -> BaseFunc { BaseFunc func = *std::move(func_ref); if (func->IsInstance()) { return WithAttrs(Downcast(std::move(func)), attr_map); } - if (const auto f = tvm::ffi::Function::GetGlobal("relax.FuncWithAttrs")) { + if (const auto f = tvm::ffi::Function::GetGlobal("tvm.relax.FuncWithAttrs")) { if (auto ret = (*f)(func, attr_map).cast>()) { return ret.value(); } @@ -66,7 +66,7 @@ TVM_FFI_STATIC_INIT_BLOCK() { LOG(FATAL) << "Do not support function type " << func->GetTypeKey(); TVM_FFI_UNREACHABLE(); }) - .def("ir.BaseFuncWithoutAttr", + .def("tvm.ir.BaseFuncWithoutAttr", [](ffi::RValueRef func_ref, ffi::String key) -> BaseFunc { BaseFunc func = *std::move(func_ref); if (func->IsInstance()) { diff --git a/src/ir/global_info.cc b/src/ir/global_info.cc index 151387d3c25a..4d01056d73cf 100644 --- a/src/ir/global_info.cc +++ b/src/ir/global_info.cc @@ -33,7 +33,7 @@ TVM_FFI_STATIC_INIT_BLOCK() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("ir.DummyGlobalInfo", []() { + refl::GlobalDef().def("tvm.ir.DummyGlobalInfo", []() { auto n = DummyGlobalInfo(ffi::make_object()); return n; }); @@ -49,7 +49,7 @@ VDevice::VDevice(Target tgt, int dev_id, MemoryScope mem_scope) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("ir.VDevice", [](Target tgt, int dev_id, MemoryScope mem_scope) { + refl::GlobalDef().def("tvm.ir.VDevice", [](Target tgt, int dev_id, MemoryScope mem_scope) { return VDevice(tgt, dev_id, mem_scope); }); } diff --git a/src/ir/global_var_supply.cc b/src/ir/global_var_supply.cc index 115eba152948..8ef2e2f26822 100644 --- a/src/ir/global_var_supply.cc +++ b/src/ir/global_var_supply.cc @@ -97,15 +97,16 @@ GlobalVar GlobalVarSupplyNode::FreshGlobal(ffi::String name, bool add_prefix) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("ir.GlobalVarSupply_NameSupply", + .def("tvm.ir.GlobalVarSupply_NameSupply", [](const NameSupply& name_supply) { return GlobalVarSupply(name_supply); }) - .def("ir.GlobalVarSupply_IRModule", + .def("tvm.ir.GlobalVarSupply_IRModule", [](IRModule mod) { return GlobalVarSupply(std::move(mod)); }) - .def("ir.GlobalVarSupply_IRModules", + .def("tvm.ir.GlobalVarSupply_IRModules", [](const ffi::Array& mods) { return GlobalVarSupply(mods); }) - .def_method("ir.GlobalVarSupply_FreshGlobal", &GlobalVarSupplyNode::FreshGlobal) - .def_method("ir.GlobalVarSupply_UniqueGlobalFor", &GlobalVarSupplyNode::UniqueGlobalFor) - .def_method("ir.GlobalVarSupply_ReserveGlobalVar", &GlobalVarSupplyNode::ReserveGlobalVar); + .def_method("tvm.ir.GlobalVarSupply_FreshGlobal", &GlobalVarSupplyNode::FreshGlobal) + .def_method("tvm.ir.GlobalVarSupply_UniqueGlobalFor", &GlobalVarSupplyNode::UniqueGlobalFor) + .def_method("tvm.ir.GlobalVarSupply_ReserveGlobalVar", + &GlobalVarSupplyNode::ReserveGlobalVar); } } // namespace tvm diff --git a/src/ir/instrument.cc b/src/ir/instrument.cc index 011968d105c5..6f82ff4786bb 100644 --- a/src/ir/instrument.cc +++ b/src/ir/instrument.cc @@ -83,7 +83,7 @@ class BasePassInstrumentNode : public PassInstrumentNode { * \param info The pass information. */ void RunAfterPass(const IRModule& mod, const transform::PassInfo& info) const final; - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("instrument.PassInstrument", BasePassInstrumentNode, + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.instrument.PassInstrument", BasePassInstrumentNode, PassInstrumentNode); }; @@ -179,7 +179,7 @@ void BasePassInstrumentNode::RunAfterPass(const IRModule& ir_module, TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef().def( - "instrument.PassInstrument", + "tvm.instrument.PassInstrument", [](ffi::String name, ffi::TypedFunction enter_pass_ctx, ffi::TypedFunction exit_pass_ctx, ffi::TypedFunction should_run, @@ -315,8 +315,8 @@ ffi::String RenderPassProfiles() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("instrument.RenderTimePassProfiles", RenderPassProfiles) - .def("instrument.MakePassTimingInstrument", []() { + .def("tvm.instrument.RenderTimePassProfiles", RenderPassProfiles) + .def("tvm.instrument.MakePassTimingInstrument", []() { auto run_before_pass = [](const IRModule&, const transform::PassInfo& pass_info) { PassProfile::EnterPass(pass_info->name); return true; diff --git a/src/ir/module.cc b/src/ir/module.cc index b0104ba14d17..dbd390b01821 100644 --- a/src/ir/module.cc +++ b/src/ir/module.cc @@ -228,7 +228,7 @@ IRModule IRModule::FromExpr(const RelaxExpr& expr, TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("ir.IRModule", + .def("tvm.ir.IRModule", [](tvm::ffi::Map funcs, tvm::ObjectRef attrs, ffi::Map> global_infos) { auto dict_attrs = [&attrs]() { @@ -246,19 +246,19 @@ TVM_FFI_STATIC_INIT_BLOCK() { return IRModule(funcs, {}, dict_attrs, global_infos); }) - .def("ir.Module_Clone", + .def("tvm.ir.Module_Clone", [](IRModule mod) -> IRModule { IRModule clone = mod; clone.CopyOnWrite(); return clone; }) - .def("ir.Module_Add", + .def("tvm.ir.Module_Add", [](IRModule mod, GlobalVar var, ObjectRef val, bool update) -> IRModule { ICHECK(val->IsInstance()); mod->Add(var, Downcast(val), update); return mod; }) - .def("ir.Module_Remove", + .def("tvm.ir.Module_Remove", [](IRModule mod, ffi::Variant var) -> IRModule { GlobalVar gvar = [&]() { if (auto opt = var.as()) { @@ -273,7 +273,7 @@ TVM_FFI_STATIC_INIT_BLOCK() { mod->Remove(gvar); return mod; }) - .def("ir.Module_Contains", + .def("tvm.ir.Module_Contains", [](IRModule mod, ffi::Variant var) -> bool { if (auto opt = var.as()) { return mod->functions.count(opt.value()); @@ -284,33 +284,34 @@ TVM_FFI_STATIC_INIT_BLOCK() { << "Variant didn't contain any of the allowed types"; } }) - .def_method("ir.Module_GetGlobalVar", &IRModuleNode::GetGlobalVar) - .def_method("ir.Module_GetGlobalVars", &IRModuleNode::GetGlobalVars) - .def_method("ir.Module_ContainGlobalVar", &IRModuleNode::ContainGlobalVar) - .def("ir.Module_Lookup", [](IRModule mod, GlobalVar var) { return mod->Lookup(var); }) - .def("ir.Module_Lookup_str", [](IRModule mod, ffi::String var) { return mod->Lookup(var); }) - .def("ir.Module_FromExpr", &IRModule::FromExpr) - .def("ir.Module_Update", [](IRModule mod, IRModule from) { mod->Update(from); }) - .def("ir.Module_UpdateFunction", + .def_method("tvm.ir.Module_GetGlobalVar", &IRModuleNode::GetGlobalVar) + .def_method("tvm.ir.Module_GetGlobalVars", &IRModuleNode::GetGlobalVars) + .def_method("tvm.ir.Module_ContainGlobalVar", &IRModuleNode::ContainGlobalVar) + .def("tvm.ir.Module_Lookup", [](IRModule mod, GlobalVar var) { return mod->Lookup(var); }) + .def("tvm.ir.Module_Lookup_str", + [](IRModule mod, ffi::String var) { return mod->Lookup(var); }) + .def("tvm.ir.Module_FromExpr", &IRModule::FromExpr) + .def("tvm.ir.Module_Update", [](IRModule mod, IRModule from) { mod->Update(from); }) + .def("tvm.ir.Module_UpdateFunction", [](IRModule mod, GlobalVar gv, BaseFunc func) { mod->Update(gv, func); }) - .def("ir.Module_UpdateGlobalInfo", + .def("tvm.ir.Module_UpdateGlobalInfo", [](IRModule mod, ffi::String name, ffi::Array global_info) { mod->UpdateGlobalInfo(name, global_info); }) - .def("ir.Module_GetAttrs", [](IRModule mod) -> ObjectRef { return mod->GetAttrs(); }) - .def("ir.Module_WithAttr", + .def("tvm.ir.Module_GetAttrs", [](IRModule mod) -> ObjectRef { return mod->GetAttrs(); }) + .def("tvm.ir.Module_WithAttr", [](ffi::RValueRef mod, ffi::String key, ffi::Any value) -> IRModule { return WithAttr(*std::move(mod), key, value); }) - .def("ir.Module_WithoutAttr", + .def("tvm.ir.Module_WithoutAttr", [](ffi::RValueRef mod, ffi::String key) -> IRModule { return WithoutAttr(*std::move(mod), key); }) - .def("ir.Module_WithAttrs", + .def("tvm.ir.Module_WithAttrs", [](ffi::RValueRef mod, ffi::Map attr_map) -> IRModule { return WithAttrs(*std::move(mod), attr_map); }) - .def("ir.Module_GetAttr", + .def("tvm.ir.Module_GetAttr", [](IRModule mod, ffi::String key) -> ObjectRef { return mod->GetAttr(key); }); } diff --git a/src/ir/name_supply.cc b/src/ir/name_supply.cc index e5b94dff5a06..1e1f1061da2f 100644 --- a/src/ir/name_supply.cc +++ b/src/ir/name_supply.cc @@ -95,10 +95,10 @@ TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; NameSupplyNode::RegisterReflection(); refl::GlobalDef() - .def("ir.NameSupply", [](ffi::String prefix) { return NameSupply(prefix); }) - .def_method("ir.NameSupply_FreshName", &NameSupplyNode::FreshName) - .def_method("ir.NameSupply_ReserveName", &NameSupplyNode::ReserveName) - .def_method("ir.NameSupply_ContainsName", &NameSupplyNode::ContainsName); + .def("tvm.ir.NameSupply", [](ffi::String prefix) { return NameSupply(prefix); }) + .def_method("tvm.ir.NameSupply_FreshName", &NameSupplyNode::FreshName) + .def_method("tvm.ir.NameSupply_ReserveName", &NameSupplyNode::ReserveName) + .def_method("tvm.ir.NameSupply_ContainsName", &NameSupplyNode::ContainsName); } } // namespace tvm diff --git a/src/ir/op.cc b/src/ir/op.cc index 514b45c65ad0..a5b52ccac4f1 100644 --- a/src/ir/op.cc +++ b/src/ir/op.cc @@ -83,9 +83,9 @@ void OpRegEntry::UpdateAttr(const ffi::String& key, ffi::Any value, int plevel) TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("ir.ListOpNames", []() { return OpRegistry::Global()->ListAllNames(); }) - .def("ir.GetOp", [](ffi::String name) -> Op { return Op::Get(name); }) - .def("ir.OpGetAttr", + .def("tvm.ir.ListOpNames", []() { return OpRegistry::Global()->ListAllNames(); }) + .def("tvm.ir.GetOp", [](ffi::String name) -> Op { return Op::Get(name); }) + .def("tvm.ir.OpGetAttr", [](Op op, ffi::String attr_name) -> ffi::Any { auto op_map = Op::GetAttrMap(attr_name); ffi::Any rv; @@ -94,19 +94,19 @@ TVM_FFI_STATIC_INIT_BLOCK() { } return rv; }) - .def("ir.OpHasAttr", + .def("tvm.ir.OpHasAttr", [](Op op, ffi::String attr_name) -> bool { return Op::HasAttrMap(attr_name); }) - .def("ir.OpSetAttr", + .def("tvm.ir.OpSetAttr", [](Op op, ffi::String attr_name, ffi::AnyView value, int plevel) { auto& reg = OpRegistry::Global()->RegisterOrGet(op->name).set_name(); reg.set_attr(attr_name, value, plevel); }) - .def("ir.OpResetAttr", + .def("tvm.ir.OpResetAttr", [](Op op, ffi::String attr_name) { auto& reg = OpRegistry::Global()->RegisterOrGet(op->name); reg.reset_attr(attr_name); }) - .def("ir.RegisterOp", + .def("tvm.ir.RegisterOp", [](ffi::String op_name, ffi::String descr) { const OpRegEntry* reg = OpRegistry::Global()->Get(op_name); ICHECK(reg == nullptr) @@ -114,27 +114,27 @@ TVM_FFI_STATIC_INIT_BLOCK() { auto& op = OpRegistry::Global()->RegisterOrGet(op_name).set_name(); op.describe(descr); }) - .def("ir.OpAddArgument", + .def("tvm.ir.OpAddArgument", [](Op op, ffi::String name, ffi::String type, ffi::String description) { auto& reg = OpRegistry::Global()->RegisterOrGet(op->name).set_name(); reg.add_argument(name, type, description); }) - .def("ir.OpSetSupportLevel", + .def("tvm.ir.OpSetSupportLevel", [](Op op, int level) { auto& reg = OpRegistry::Global()->RegisterOrGet(op->name).set_name(); reg.set_support_level(level); }) - .def("ir.OpSetNumInputs", + .def("tvm.ir.OpSetNumInputs", [](Op op, int n) { auto& reg = OpRegistry::Global()->RegisterOrGet(op->name).set_name(); reg.set_num_inputs(n); }) - .def("ir.OpSetAttrsTypeKey", + .def("tvm.ir.OpSetAttrsTypeKey", [](Op op, ffi::String key) { auto& reg = OpRegistry::Global()->RegisterOrGet(op->name).set_name(); reg.set_attrs_type_key(key); }) - .def("ir.RegisterOpAttr", + .def("tvm.ir.RegisterOpAttr", [](ffi::String op_name, ffi::String attr_key, ffi::AnyView value, int plevel) { auto& reg = OpRegistry::Global()->RegisterOrGet(op_name).set_name(); // enable resgiteration and override of certain properties @@ -146,19 +146,19 @@ TVM_FFI_STATIC_INIT_BLOCK() { reg.set_attr(attr_key, value, plevel); } }) - .def("ir.RegisterOpLowerIntrinsic", + .def("tvm.ir.RegisterOpLowerIntrinsic", [](ffi::String name, ffi::Function f, ffi::String target, int plevel) { tvm::OpRegEntry::RegisterOrGet(name).set_attr( target + ".FLowerIntrinsic", f, plevel); }); // override OpNode to use name as the repr refl::TypeAttrDef() - .def("__data_to_json__", + .def("tvm.__data_to_json__", [](const OpNode* node) -> ffi::String { // simply save as the string return node->name; }) - .def("__data_from_json__", [](const ffi::String& name) -> Op { return Op::Get(name); }); + .def("tvm.__data_from_json__", [](const ffi::String& name) -> Op { return Op::Get(name); }); } TVM_STATIC_IR_FUNCTOR(ReprPrinter, vtable) diff --git a/src/ir/replace_global_vars.cc b/src/ir/replace_global_vars.cc index 98b5b74c42cd..eb87a642e501 100644 --- a/src/ir/replace_global_vars.cc +++ b/src/ir/replace_global_vars.cc @@ -65,7 +65,7 @@ IRModule ReplaceGlobalVars(IRModule mod, ffi::Map replacem TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("transform.ReplaceGlobalVars", ReplaceGlobalVars); + refl::GlobalDef().def("tvm.transform.ReplaceGlobalVars", ReplaceGlobalVars); } IRModule ModuleReplaceGlobalVars( @@ -103,7 +103,7 @@ IRModule ModuleReplaceGlobalVars( TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("ir.Module_ReplaceGlobalVars", ModuleReplaceGlobalVars); + refl::GlobalDef().def("tvm.ir.Module_ReplaceGlobalVars", ModuleReplaceGlobalVars); } } // namespace transform diff --git a/src/ir/source_map.cc b/src/ir/source_map.cc index 521b02db44b5..a56c1018f2ff 100644 --- a/src/ir/source_map.cc +++ b/src/ir/source_map.cc @@ -38,12 +38,12 @@ TVM_FFI_STATIC_INIT_BLOCK() { SourceMapObj::RegisterReflection(); // overrride SourceNameNode to serialization mechanism refl::TypeAttrDef() - .def("__data_to_json__", + .def("tvm.__data_to_json__", [](const SourceNameNode* node) { // simply save as the string return node->name; }) - .def("__data_from_json__", SourceName::Get); + .def("tvm.__data_from_json__", SourceName::Get); } ObjectPtr GetSourceNameNode(const ffi::String& name) { @@ -70,7 +70,7 @@ SourceName SourceName::Get(const ffi::String& name) { return SourceName(GetSourc TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("ir.SourceName", SourceName::Get); + refl::GlobalDef().def("tvm.ir.SourceName", SourceName::Get); } TVM_STATIC_IR_FUNCTOR(ReprPrinter, vtable) @@ -143,11 +143,12 @@ SequentialSpan::SequentialSpan(std::initializer_list init) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("ir.Span", + .def("tvm.ir.Span", [](SourceName source_name, int line, int end_line, int column, int end_column) { return Span(source_name, line, end_line, column, end_column); }) - .def("ir.SequentialSpan", [](tvm::ffi::Array spans) { return SequentialSpan(spans); }); + .def("tvm.ir.SequentialSpan", + [](tvm::ffi::Array spans) { return SequentialSpan(spans); }); } TVM_STATIC_IR_FUNCTOR(ReprPrinter, vtable) @@ -228,12 +229,13 @@ void SourceMap::Add(const Source& source) { (*this)->source_map.Set(source->sour TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("SourceMapAdd", [](SourceMap map, ffi::String name, ffi::String content) { - auto src_name = SourceName::Get(name); - Source source(src_name, content); - map.Add(source); - return src_name; - }); + refl::GlobalDef().def("tvm.SourceMapAdd", + [](SourceMap map, ffi::String name, ffi::String content) { + auto src_name = SourceName::Get(name); + Source source(src_name, content); + map.Add(source); + return src_name; + }); } } // namespace tvm diff --git a/src/ir/transform.cc b/src/ir/transform.cc index 3cbf8a629fc3..82a24056c9c9 100644 --- a/src/ir/transform.cc +++ b/src/ir/transform.cc @@ -362,7 +362,7 @@ class ModulePassNode : public PassNode { * \brief Get the pass information/meta data. */ PassInfo Info() const override { return pass_info; } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("transform.ModulePass", ModulePassNode, PassNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.transform.ModulePass", ModulePassNode, PassNode); }; class ModulePass : public Pass { @@ -495,10 +495,10 @@ Pass CreateModulePass(std::function pass_func, TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("transform.PassInfo", + .def("tvm.transform.PassInfo", [](int opt_level, ffi::String name, tvm::ffi::Array required, bool traceable) { return PassInfo(opt_level, name, required, traceable); }) - .def_packed("transform.Info", [](ffi::PackedArgs args, ffi::Any* ret) { + .def_packed("tvm.transform.Info", [](ffi::PackedArgs args, ffi::Any* ret) { Pass pass = args[0].cast(); *ret = pass->Info(); }); @@ -532,7 +532,7 @@ TVM_FFI_STATIC_INIT_BLOCK() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("transform.MakeModulePass", + .def("tvm.transform.MakeModulePass", [](ffi::TypedFunction, PassContext)> pass_func, PassInfo pass_info) { auto wrapped_pass_func = [pass_func](IRModule mod, PassContext ctx) { @@ -540,7 +540,7 @@ TVM_FFI_STATIC_INIT_BLOCK() { }; return ModulePass(wrapped_pass_func, pass_info); }) - .def("transform.RunPass", + .def("tvm.transform.RunPass", [](Pass pass, ffi::RValueRef mod) { return pass(*std::move(mod)); }); } @@ -554,7 +554,7 @@ TVM_STATIC_IR_FUNCTOR(ReprPrinter, vtable) TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def_packed("transform.Sequential", [](ffi::PackedArgs args, ffi::Any* ret) { + refl::GlobalDef().def_packed("tvm.transform.Sequential", [](ffi::PackedArgs args, ffi::Any* ret) { auto passes = args[0].cast>(); int opt_level = args[1].cast(); std::string name = args[2].cast(); @@ -582,7 +582,7 @@ TVM_STATIC_IR_FUNCTOR(ReprPrinter, vtable) TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef().def( - "transform.PassContext", + "tvm.transform.PassContext", [](int opt_level, ffi::Array required, ffi::Array disabled, ffi::Array instruments, ffi::Optional> config) { @@ -625,10 +625,10 @@ class PassContext::Internal { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("transform.GetCurrentPassContext", PassContext::Current) - .def("transform.EnterPassContext", PassContext::Internal::EnterScope) - .def("transform.ExitPassContext", PassContext::Internal::ExitScope) - .def("transform.OverrideInstruments", + .def("tvm.transform.GetCurrentPassContext", PassContext::Current) + .def("tvm.transform.EnterPassContext", PassContext::Internal::EnterScope) + .def("tvm.transform.ExitPassContext", PassContext::Internal::ExitScope) + .def("tvm.transform.OverrideInstruments", [](PassContext pass_ctx, ffi::Array instruments) { pass_ctx.InstrumentExitPassContext(); pass_ctx->instruments = instruments; @@ -647,8 +647,8 @@ Pass PrintIR(ffi::String header) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("transform.PrintIR", PrintIR) - .def("transform.ListConfigs", PassContext::ListConfigs); + .def("tvm.transform.PrintIR", PrintIR) + .def("tvm.transform.ListConfigs", PassContext::ListConfigs); } } // namespace transform diff --git a/src/ir/type.cc b/src/ir/type.cc index b28e20a78f89..e39e5b246ef0 100644 --- a/src/ir/type.cc +++ b/src/ir/type.cc @@ -44,7 +44,7 @@ PrimType::PrimType(runtime::DataType dtype, Span span) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("ir.PrimType", [](runtime::DataType dtype) { return PrimType(dtype); }); + refl::GlobalDef().def("tvm.ir.PrimType", [](runtime::DataType dtype) { return PrimType(dtype); }); } PointerType::PointerType(Type element_type, ffi::String storage_scope) { @@ -60,9 +60,10 @@ PointerType::PointerType(Type element_type, ffi::String storage_scope) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("ir.PointerType", [](Type element_type, ffi::String storage_scope = "") { - return PointerType(element_type, storage_scope); - }); + refl::GlobalDef().def("tvm.ir.PointerType", + [](Type element_type, ffi::String storage_scope = "") { + return PointerType(element_type, storage_scope); + }); } FuncType::FuncType(tvm::ffi::Array arg_types, Type ret_type, Span span) { @@ -75,7 +76,7 @@ FuncType::FuncType(tvm::ffi::Array arg_types, Type ret_type, Span span) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("ir.FuncType", [](tvm::ffi::Array arg_types, Type ret_type) { + refl::GlobalDef().def("tvm.ir.FuncType", [](tvm::ffi::Array arg_types, Type ret_type) { return FuncType(arg_types, ret_type); }); } @@ -92,8 +93,8 @@ TupleType TupleType::Empty() { return TupleType(ffi::Array()); } TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("ir.TupleType", [](ffi::Array fields) { return TupleType(fields); }) - .def("ir.TensorMapType", [](Span span) { return TensorMapType(span); }); + .def("tvm.ir.TupleType", [](ffi::Array fields) { return TupleType(fields); }) + .def("tvm.ir.TensorMapType", [](Span span) { return TensorMapType(span); }); } TensorMapType::TensorMapType(Span span) { diff --git a/src/meta_schedule/arg_info.cc b/src/meta_schedule/arg_info.cc index 5c00a9bdbc4e..e934177bf78c 100644 --- a/src/meta_schedule/arg_info.cc +++ b/src/meta_schedule/arg_info.cc @@ -165,13 +165,14 @@ TVM_FFI_STATIC_INIT_BLOCK() { TensorInfoNode::RegisterReflection(); } TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def_method("meta_schedule.ArgInfoAsJSON", &ArgInfoNode::AsJSON) - .def("meta_schedule.ArgInfoFromPrimFunc", ArgInfo::FromPrimFunc) - .def("meta_schedule.ArgInfoFromEntryFunc", ArgInfo::FromEntryFunc) - .def("meta_schedule.ArgInfoFromJSON", ArgInfo::FromJSON) - .def("meta_schedule.TensorInfo", [](runtime::DataType dtype, ffi::Shape shape) -> TensorInfo { - return TensorInfo(dtype, shape); - }); + .def_method("tvm.meta_schedule.ArgInfoAsJSON", &ArgInfoNode::AsJSON) + .def("tvm.meta_schedule.ArgInfoFromPrimFunc", ArgInfo::FromPrimFunc) + .def("tvm.meta_schedule.ArgInfoFromEntryFunc", ArgInfo::FromEntryFunc) + .def("tvm.meta_schedule.ArgInfoFromJSON", ArgInfo::FromJSON) + .def("tvm.meta_schedule.TensorInfo", + [](runtime::DataType dtype, ffi::Shape shape) -> TensorInfo { + return TensorInfo(dtype, shape); + }); } } // namespace meta_schedule diff --git a/src/meta_schedule/builder/builder.cc b/src/meta_schedule/builder/builder.cc index 195547bee764..f583ebcb01bc 100644 --- a/src/meta_schedule/builder/builder.cc +++ b/src/meta_schedule/builder/builder.cc @@ -59,16 +59,16 @@ TVM_FFI_STATIC_INIT_BLOCK() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("meta_schedule.BuilderInput", + .def("tvm.meta_schedule.BuilderInput", [](IRModule mod, Target target, ffi::Optional> params) -> BuilderInput { return BuilderInput(mod, target, params); }) - .def("meta_schedule.BuilderResult", + .def("tvm.meta_schedule.BuilderResult", [](ffi::Optional artifact_path, ffi::Optional error_msg) -> BuilderResult { return BuilderResult(artifact_path, error_msg); }) - .def_method("meta_schedule.BuilderBuild", &BuilderNode::Build) - .def("meta_schedule.BuilderPyBuilder", Builder::PyBuilder); + .def_method("tvm.meta_schedule.BuilderBuild", &BuilderNode::Build) + .def("tvm.meta_schedule.BuilderPyBuilder", Builder::PyBuilder); } } // namespace meta_schedule diff --git a/src/meta_schedule/cost_model/cost_model.cc b/src/meta_schedule/cost_model/cost_model.cc index 4cc13787ae96..8da7a2eb02d9 100644 --- a/src/meta_schedule/cost_model/cost_model.cc +++ b/src/meta_schedule/cost_model/cost_model.cc @@ -74,10 +74,10 @@ TVM_STATIC_IR_FUNCTOR(ReprPrinter, vtable) TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def_method("meta_schedule.CostModelLoad", &CostModelNode::Load) - .def_method("meta_schedule.CostModelSave", &CostModelNode::Save) - .def_method("meta_schedule.CostModelUpdate", &CostModelNode::Update) - .def("meta_schedule.CostModelPredict", + .def_method("tvm.meta_schedule.CostModelLoad", &CostModelNode::Load) + .def_method("tvm.meta_schedule.CostModelSave", &CostModelNode::Save) + .def_method("tvm.meta_schedule.CostModelUpdate", &CostModelNode::Update) + .def("tvm.meta_schedule.CostModelPredict", [](CostModel model, // const TuneContext& context, // ffi::Array candidates, // @@ -85,7 +85,7 @@ TVM_FFI_STATIC_INIT_BLOCK() { std::vector result = model->Predict(context, candidates); std::copy(result.begin(), result.end(), static_cast(p_addr)); }) - .def("meta_schedule.CostModelPyCostModel", CostModel::PyCostModel); + .def("tvm.meta_schedule.CostModelPyCostModel", CostModel::PyCostModel); } } // namespace meta_schedule diff --git a/src/meta_schedule/database/database.cc b/src/meta_schedule/database/database.cc index a7548c95b6cb..0915e1b68f12 100644 --- a/src/meta_schedule/database/database.cc +++ b/src/meta_schedule/database/database.cc @@ -295,32 +295,33 @@ TVM_FFI_STATIC_INIT_BLOCK() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("meta_schedule.Workload", [](IRModule mod) { return Workload(mod); }) - .def_method("meta_schedule.WorkloadAsJSON", &WorkloadNode::AsJSON) - .def("meta_schedule.WorkloadFromJSON", &Workload::FromJSON) - .def("meta_schedule.TuningRecord", + .def("tvm.meta_schedule.Workload", [](IRModule mod) { return Workload(mod); }) + .def_method("tvm.meta_schedule.WorkloadAsJSON", &WorkloadNode::AsJSON) + .def("tvm.meta_schedule.WorkloadFromJSON", &Workload::FromJSON) + .def("tvm.meta_schedule.TuningRecord", [](tir::Trace trace, Workload workload, ffi::Optional> run_secs, ffi::Optional target, ffi::Optional> args_info) { return TuningRecord(trace, workload, run_secs, target, args_info); }) - .def_method("meta_schedule.TuningRecordAsMeasureCandidate", + .def_method("tvm.meta_schedule.TuningRecordAsMeasureCandidate", &TuningRecordNode::AsMeasureCandidate) - .def_method("meta_schedule.TuningRecordAsJSON", &TuningRecordNode::AsJSON) - .def("meta_schedule.TuningRecordFromJSON", TuningRecord::FromJSON) - .def_method("meta_schedule.DatabaseEnterWithScope", &Database::EnterWithScope) - .def_method("meta_schedule.DatabaseExitWithScope", &Database::ExitWithScope) - .def("meta_schedule.DatabaseCurrent", Database::Current) - .def_method("meta_schedule.DatabaseHasWorkload", &DatabaseNode::HasWorkload) - .def_method("meta_schedule.DatabaseCommitWorkload", &DatabaseNode::CommitWorkload) - .def_method("meta_schedule.DatabaseCommitTuningRecord", &DatabaseNode::CommitTuningRecord) - .def_method("meta_schedule.DatabaseGetTopK", &DatabaseNode::GetTopK) - .def_method("meta_schedule.DatabaseGetAllTuningRecords", &DatabaseNode::GetAllTuningRecords) - .def_method("meta_schedule.DatabaseSize", &DatabaseNode::Size) - .def_method("meta_schedule.DatabaseQueryTuningRecord", &DatabaseNode::QueryTuningRecord) - .def_method("meta_schedule.DatabaseQuerySchedule", &DatabaseNode::QuerySchedule) - .def_method("meta_schedule.DatabaseQueryIRModule", &DatabaseNode::QueryIRModule) - .def_method("meta_schedule.DatabaseDumpPruned", &DatabaseNode::DumpPruned) - .def("meta_schedule.DatabasePyDatabase", Database::PyDatabase); + .def_method("tvm.meta_schedule.TuningRecordAsJSON", &TuningRecordNode::AsJSON) + .def("tvm.meta_schedule.TuningRecordFromJSON", TuningRecord::FromJSON) + .def_method("tvm.meta_schedule.DatabaseEnterWithScope", &Database::EnterWithScope) + .def_method("tvm.meta_schedule.DatabaseExitWithScope", &Database::ExitWithScope) + .def("tvm.meta_schedule.DatabaseCurrent", Database::Current) + .def_method("tvm.meta_schedule.DatabaseHasWorkload", &DatabaseNode::HasWorkload) + .def_method("tvm.meta_schedule.DatabaseCommitWorkload", &DatabaseNode::CommitWorkload) + .def_method("tvm.meta_schedule.DatabaseCommitTuningRecord", &DatabaseNode::CommitTuningRecord) + .def_method("tvm.meta_schedule.DatabaseGetTopK", &DatabaseNode::GetTopK) + .def_method("tvm.meta_schedule.DatabaseGetAllTuningRecords", + &DatabaseNode::GetAllTuningRecords) + .def_method("tvm.meta_schedule.DatabaseSize", &DatabaseNode::Size) + .def_method("tvm.meta_schedule.DatabaseQueryTuningRecord", &DatabaseNode::QueryTuningRecord) + .def_method("tvm.meta_schedule.DatabaseQuerySchedule", &DatabaseNode::QuerySchedule) + .def_method("tvm.meta_schedule.DatabaseQueryIRModule", &DatabaseNode::QueryIRModule) + .def_method("tvm.meta_schedule.DatabaseDumpPruned", &DatabaseNode::DumpPruned) + .def("tvm.meta_schedule.DatabasePyDatabase", Database::PyDatabase); } } // namespace meta_schedule diff --git a/src/meta_schedule/database/json_database.cc b/src/meta_schedule/database/json_database.cc index 862d0fd05a10..2f8144d48777 100644 --- a/src/meta_schedule/database/json_database.cc +++ b/src/meta_schedule/database/json_database.cc @@ -89,7 +89,8 @@ class JSONDatabaseNode : public DatabaseNode { .def_ro("path_workload", &JSONDatabaseNode::path_workload) .def_ro("path_tuning_record", &JSONDatabaseNode::path_tuning_record); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("meta_schedule.JSONDatabase", JSONDatabaseNode, DatabaseNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.meta_schedule.JSONDatabase", JSONDatabaseNode, + DatabaseNode); public: bool HasWorkload(const IRModule& mod) { @@ -217,7 +218,7 @@ TVM_FFI_STATIC_INIT_BLOCK() { JSONDatabaseNode::RegisterReflection(); } TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("meta_schedule.DatabaseJSONDatabase", Database::JSONDatabase); + refl::GlobalDef().def("tvm.meta_schedule.DatabaseJSONDatabase", Database::JSONDatabase); } } // namespace meta_schedule diff --git a/src/meta_schedule/database/memory_database.cc b/src/meta_schedule/database/memory_database.cc index ef144e47631c..50280ff41f23 100644 --- a/src/meta_schedule/database/memory_database.cc +++ b/src/meta_schedule/database/memory_database.cc @@ -37,7 +37,7 @@ class MemoryDatabaseNode : public DatabaseNode { .def_ro("records", &MemoryDatabaseNode::records) .def_ro("workloads", &MemoryDatabaseNode::workloads); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("meta_schedule.MemoryDatabase", MemoryDatabaseNode, + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.meta_schedule.MemoryDatabase", MemoryDatabaseNode, DatabaseNode); public: @@ -101,7 +101,7 @@ Database Database::MemoryDatabase(ffi::String mod_eq_name) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("meta_schedule.DatabaseMemoryDatabase", Database::MemoryDatabase); + refl::GlobalDef().def("tvm.meta_schedule.DatabaseMemoryDatabase", Database::MemoryDatabase); } TVM_FFI_STATIC_INIT_BLOCK() { MemoryDatabaseNode::RegisterReflection(); } diff --git a/src/meta_schedule/database/ordered_union_database.cc b/src/meta_schedule/database/ordered_union_database.cc index ddb38af9d581..c135b081c4e6 100644 --- a/src/meta_schedule/database/ordered_union_database.cc +++ b/src/meta_schedule/database/ordered_union_database.cc @@ -32,8 +32,8 @@ class OrderedUnionDatabaseNode : public DatabaseNode { refl::ObjectDef().def_ro("databases", &OrderedUnionDatabaseNode::databases); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("meta_schedule.OrderedUnionDatabase", OrderedUnionDatabaseNode, - DatabaseNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.meta_schedule.OrderedUnionDatabase", + OrderedUnionDatabaseNode, DatabaseNode); public: ffi::Optional QueryTuningRecord(const IRModule& mod, const Target& target, @@ -85,7 +85,7 @@ Database Database::OrderedUnionDatabase(ffi::Array databases) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("meta_schedule.DatabaseOrderedUnionDatabase", + refl::GlobalDef().def("tvm.meta_schedule.DatabaseOrderedUnionDatabase", Database::OrderedUnionDatabase); } diff --git a/src/meta_schedule/database/schedule_fn_database.cc b/src/meta_schedule/database/schedule_fn_database.cc index 5825b6834b8f..0fba1dd4fab9 100644 --- a/src/meta_schedule/database/schedule_fn_database.cc +++ b/src/meta_schedule/database/schedule_fn_database.cc @@ -35,7 +35,7 @@ class ScheduleFnDatabaseNode : public DatabaseNode { refl::ObjectDef().def_ro("schedule_fn", &ScheduleFnDatabaseNode::schedule_fn); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("meta_schedule.ScheduleFnDatabase", ScheduleFnDatabaseNode, + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.meta_schedule.ScheduleFnDatabase", ScheduleFnDatabaseNode, DatabaseNode); public: @@ -104,7 +104,8 @@ Database Database::ScheduleFnDatabase(ffi::TypedFunction sc TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("meta_schedule.DatabaseScheduleFnDatabase", Database::ScheduleFnDatabase); + refl::GlobalDef().def("tvm.meta_schedule.DatabaseScheduleFnDatabase", + Database::ScheduleFnDatabase); } TVM_FFI_STATIC_INIT_BLOCK() { ScheduleFnDatabaseNode::RegisterReflection(); } diff --git a/src/meta_schedule/database/union_database.cc b/src/meta_schedule/database/union_database.cc index 125bcb7ac45f..866b82180a11 100644 --- a/src/meta_schedule/database/union_database.cc +++ b/src/meta_schedule/database/union_database.cc @@ -31,7 +31,8 @@ class UnionDatabaseNode : public DatabaseNode { namespace refl = tvm::ffi::reflection; refl::ObjectDef().def_ro("databases", &UnionDatabaseNode::databases); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("meta_schedule.UnionDatabase", UnionDatabaseNode, DatabaseNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.meta_schedule.UnionDatabase", UnionDatabaseNode, + DatabaseNode); public: ffi::Optional QueryTuningRecord(const IRModule& mod, const Target& target, @@ -86,7 +87,7 @@ Database Database::UnionDatabase(ffi::Array databases) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("meta_schedule.DatabaseUnionDatabase", Database::UnionDatabase); + refl::GlobalDef().def("tvm.meta_schedule.DatabaseUnionDatabase", Database::UnionDatabase); } TVM_FFI_STATIC_INIT_BLOCK() { UnionDatabaseNode::RegisterReflection(); } diff --git a/src/meta_schedule/extracted_task.cc b/src/meta_schedule/extracted_task.cc index 6410a50c133e..ce34e54bf2b3 100644 --- a/src/meta_schedule/extracted_task.cc +++ b/src/meta_schedule/extracted_task.cc @@ -43,7 +43,7 @@ TVM_FFI_STATIC_INIT_BLOCK() { ExtractedTaskNode::RegisterReflection(); } TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("meta_schedule.ExtractedTask", + refl::GlobalDef().def("tvm.meta_schedule.ExtractedTask", [](ffi::String task_name, IRModule mod, Target target, ffi::Array dispatched, int weight) -> ExtractedTask { return ExtractedTask(task_name, mod, target, dispatched, weight); diff --git a/src/meta_schedule/feature_extractor/feature_extractor.cc b/src/meta_schedule/feature_extractor/feature_extractor.cc index 978ba658020c..bd6147386122 100644 --- a/src/meta_schedule/feature_extractor/feature_extractor.cc +++ b/src/meta_schedule/feature_extractor/feature_extractor.cc @@ -55,8 +55,9 @@ TVM_FFI_STATIC_INIT_BLOCK() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def_method("meta_schedule.FeatureExtractorExtractFrom", &FeatureExtractorNode::ExtractFrom) - .def("meta_schedule.FeatureExtractorPyFeatureExtractor", + .def_method("tvm.meta_schedule.FeatureExtractorExtractFrom", + &FeatureExtractorNode::ExtractFrom) + .def("tvm.meta_schedule.FeatureExtractorPyFeatureExtractor", FeatureExtractor::PyFeatureExtractor); } diff --git a/src/meta_schedule/feature_extractor/per_store_feature.cc b/src/meta_schedule/feature_extractor/per_store_feature.cc index 9072ccf62a94..6c7b7af7dd65 100644 --- a/src/meta_schedule/feature_extractor/per_store_feature.cc +++ b/src/meta_schedule/feature_extractor/per_store_feature.cc @@ -1423,7 +1423,7 @@ class PerStoreFeatureNode : public FeatureExtractorNode { support::parallel_for_dynamic(0, candidates.size(), tune_context->num_threads, f); return results; } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("meta_schedule.PerStoreFeature", PerStoreFeatureNode, + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.meta_schedule.PerStoreFeature", PerStoreFeatureNode, FeatureExtractorNode); }; @@ -1450,7 +1450,7 @@ TVM_FFI_STATIC_INIT_BLOCK() { PerStoreFeatureNode::RegisterReflection(); } TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("meta_schedule.FeatureExtractorPerStoreFeature", + refl::GlobalDef().def("tvm.meta_schedule.FeatureExtractorPerStoreFeature", FeatureExtractor::PerStoreFeature); } diff --git a/src/meta_schedule/measure_callback/add_to_database.cc b/src/meta_schedule/measure_callback/add_to_database.cc index a7b455eec782..03b43a2f0050 100644 --- a/src/meta_schedule/measure_callback/add_to_database.cc +++ b/src/meta_schedule/measure_callback/add_to_database.cc @@ -62,7 +62,7 @@ class AddToDatabaseNode : public MeasureCallbackNode { refl::ObjectDef(); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("meta_schedule.AddToDatabase", AddToDatabaseNode, + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.meta_schedule.AddToDatabase", AddToDatabaseNode, MeasureCallbackNode); }; @@ -74,7 +74,7 @@ MeasureCallback MeasureCallback::AddToDatabase() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::ObjectDef(); - refl::GlobalDef().def("meta_schedule.MeasureCallbackAddToDatabase", + refl::GlobalDef().def("tvm.meta_schedule.MeasureCallbackAddToDatabase", MeasureCallback::AddToDatabase); } diff --git a/src/meta_schedule/measure_callback/measure_callback.cc b/src/meta_schedule/measure_callback/measure_callback.cc index bf5172349b13..b00bde2cd4f2 100644 --- a/src/meta_schedule/measure_callback/measure_callback.cc +++ b/src/meta_schedule/measure_callback/measure_callback.cc @@ -66,9 +66,9 @@ TVM_FFI_STATIC_INIT_BLOCK() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def_method("meta_schedule.MeasureCallbackApply", &MeasureCallbackNode::Apply) - .def("meta_schedule.MeasureCallbackPyMeasureCallback", MeasureCallback::PyMeasureCallback) - .def("meta_schedule.MeasureCallbackDefault", MeasureCallback::Default); + .def_method("tvm.meta_schedule.MeasureCallbackApply", &MeasureCallbackNode::Apply) + .def("tvm.meta_schedule.MeasureCallbackPyMeasureCallback", MeasureCallback::PyMeasureCallback) + .def("tvm.meta_schedule.MeasureCallbackDefault", MeasureCallback::Default); } } // namespace meta_schedule diff --git a/src/meta_schedule/measure_callback/remove_build_artifact.cc b/src/meta_schedule/measure_callback/remove_build_artifact.cc index 18f00efab5fc..e1f47d6b790c 100644 --- a/src/meta_schedule/measure_callback/remove_build_artifact.cc +++ b/src/meta_schedule/measure_callback/remove_build_artifact.cc @@ -29,7 +29,7 @@ class RemoveBuildArtifactNode : public MeasureCallbackNode { const ffi::Array& measure_candidates, const ffi::Array& builder_results, const ffi::Array& runner_results) final { - static auto f_rm = tvm::ffi::Function::GetGlobalRequired("meta_schedule.remove_build_dir"); + static auto f_rm = tvm::ffi::Function::GetGlobalRequired("tvm.meta_schedule.remove_build_dir"); auto _ = Profiler::TimedScope("MeasureCallback/RemoveBuildArtifact"); for (const BuilderResult& build_result : builder_results) { if (ffi::Optional path = build_result->artifact_path) { @@ -43,8 +43,8 @@ class RemoveBuildArtifactNode : public MeasureCallbackNode { refl::ObjectDef(); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("meta_schedule.RemoveBuildArtifact", RemoveBuildArtifactNode, - MeasureCallbackNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.meta_schedule.RemoveBuildArtifact", + RemoveBuildArtifactNode, MeasureCallbackNode); }; MeasureCallback MeasureCallback::RemoveBuildArtifact() { @@ -55,7 +55,7 @@ MeasureCallback MeasureCallback::RemoveBuildArtifact() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; RemoveBuildArtifactNode::RegisterReflection(); - refl::GlobalDef().def("meta_schedule.MeasureCallbackRemoveBuildArtifact", + refl::GlobalDef().def("tvm.meta_schedule.MeasureCallbackRemoveBuildArtifact", MeasureCallback::RemoveBuildArtifact); } diff --git a/src/meta_schedule/measure_callback/update_cost_model.cc b/src/meta_schedule/measure_callback/update_cost_model.cc index 845e14e1e7ea..4189ff49a997 100644 --- a/src/meta_schedule/measure_callback/update_cost_model.cc +++ b/src/meta_schedule/measure_callback/update_cost_model.cc @@ -60,7 +60,7 @@ class UpdateCostModelNode : public MeasureCallbackNode { refl::ObjectDef(); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("meta_schedule.UpdateCostModel", UpdateCostModelNode, + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.meta_schedule.UpdateCostModel", UpdateCostModelNode, MeasureCallbackNode); }; @@ -72,7 +72,7 @@ MeasureCallback MeasureCallback::UpdateCostModel() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; UpdateCostModelNode::RegisterReflection(); - refl::GlobalDef().def("meta_schedule.MeasureCallbackUpdateCostModel", + refl::GlobalDef().def("tvm.meta_schedule.MeasureCallbackUpdateCostModel", MeasureCallback::UpdateCostModel); } diff --git a/src/meta_schedule/mutator/mutate_compute_location.cc b/src/meta_schedule/mutator/mutate_compute_location.cc index 4ad979648aca..bf0823ac80b7 100644 --- a/src/meta_schedule/mutator/mutate_compute_location.cc +++ b/src/meta_schedule/mutator/mutate_compute_location.cc @@ -37,7 +37,7 @@ class MutateComputeLocationNode : public MutatorNode { namespace refl = tvm::ffi::reflection; refl::ObjectDef(); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("meta_schedule.MutateComputeLocation", + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.meta_schedule.MutateComputeLocation", MutateComputeLocationNode, MutatorNode); public: @@ -135,7 +135,7 @@ TVM_FFI_STATIC_INIT_BLOCK() { MutateComputeLocationNode::RegisterReflection(); } TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("meta_schedule.MutatorMutateComputeLocation", + refl::GlobalDef().def("tvm.meta_schedule.MutatorMutateComputeLocation", Mutator::MutateComputeLocation); } diff --git a/src/meta_schedule/mutator/mutate_parallel.cc b/src/meta_schedule/mutator/mutate_parallel.cc index 66266dd2a539..804b1b737b8e 100644 --- a/src/meta_schedule/mutator/mutate_parallel.cc +++ b/src/meta_schedule/mutator/mutate_parallel.cc @@ -176,7 +176,7 @@ class MutateParallelNode : public MutatorNode { refl::ObjectDef().def_ro("max_jobs_per_core", &MutateParallelNode::max_jobs_per_core); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("meta_schedule.MutateParallel", MutateParallelNode, + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.meta_schedule.MutateParallel", MutateParallelNode, MutatorNode); public: @@ -316,7 +316,7 @@ TVM_FFI_STATIC_INIT_BLOCK() { MutateParallelNode::RegisterReflection(); } TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("meta_schedule.MutatorMutateParallel", Mutator::MutateParallel); + refl::GlobalDef().def("tvm.meta_schedule.MutatorMutateParallel", Mutator::MutateParallel); } } // namespace meta_schedule diff --git a/src/meta_schedule/mutator/mutate_thread_binding.cc b/src/meta_schedule/mutator/mutate_thread_binding.cc index ef9c30729485..864d3546ff15 100644 --- a/src/meta_schedule/mutator/mutate_thread_binding.cc +++ b/src/meta_schedule/mutator/mutate_thread_binding.cc @@ -37,8 +37,8 @@ class MutateThreadBindingNode : public MutatorNode { namespace refl = tvm::ffi::reflection; refl::ObjectDef(); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("meta_schedule.MutateThreadBinding", MutateThreadBindingNode, - MutatorNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.meta_schedule.MutateThreadBinding", + MutateThreadBindingNode, MutatorNode); public: // Inherit from `MutatorNode` @@ -175,7 +175,7 @@ TVM_FFI_STATIC_INIT_BLOCK() { MutateThreadBindingNode::RegisterReflection(); } TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("meta_schedule.MutateThreadBinding", Mutator::MutateThreadBinding); + refl::GlobalDef().def("tvm.meta_schedule.MutateThreadBinding", Mutator::MutateThreadBinding); } } // namespace meta_schedule diff --git a/src/meta_schedule/mutator/mutate_tile_size.cc b/src/meta_schedule/mutator/mutate_tile_size.cc index e2f3689d2854..6769ad0bd214 100644 --- a/src/meta_schedule/mutator/mutate_tile_size.cc +++ b/src/meta_schedule/mutator/mutate_tile_size.cc @@ -60,7 +60,7 @@ class MutateTileSizeNode : public MutatorNode { namespace refl = tvm::ffi::reflection; refl::ObjectDef(); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("meta_schedule.MutateTileSize", MutateTileSizeNode, + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.meta_schedule.MutateTileSize", MutateTileSizeNode, MutatorNode); public: @@ -276,7 +276,7 @@ TVM_FFI_STATIC_INIT_BLOCK() { MutateTileSizeNode::RegisterReflection(); } TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("meta_schedule.MutatorMutateTileSize", Mutator::MutateTileSize); + refl::GlobalDef().def("tvm.meta_schedule.MutatorMutateTileSize", Mutator::MutateTileSize); } } // namespace meta_schedule diff --git a/src/meta_schedule/mutator/mutate_unroll.cc b/src/meta_schedule/mutator/mutate_unroll.cc index dab987708238..c7a8146d63dc 100644 --- a/src/meta_schedule/mutator/mutate_unroll.cc +++ b/src/meta_schedule/mutator/mutate_unroll.cc @@ -56,7 +56,8 @@ class MutateUnrollNode : public MutatorNode { namespace refl = tvm::ffi::reflection; refl::ObjectDef(); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("meta_schedule.MutateUnroll", MutateUnrollNode, MutatorNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.meta_schedule.MutateUnroll", MutateUnrollNode, + MutatorNode); public: struct Candidate; @@ -146,7 +147,7 @@ TVM_FFI_STATIC_INIT_BLOCK() { MutateUnrollNode::RegisterReflection(); } TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("meta_schedule.MutatorMutateUnroll", Mutator::MutateUnroll); + refl::GlobalDef().def("tvm.meta_schedule.MutatorMutateUnroll", Mutator::MutateUnroll); } } // namespace meta_schedule diff --git a/src/meta_schedule/mutator/mutator.cc b/src/meta_schedule/mutator/mutator.cc index fd8fe45bf185..254f17c4e384 100644 --- a/src/meta_schedule/mutator/mutator.cc +++ b/src/meta_schedule/mutator/mutator.cc @@ -95,20 +95,20 @@ TVM_FFI_STATIC_INIT_BLOCK() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def_method("meta_schedule.MutatorInitializeWithTuneContext", + .def_method("tvm.meta_schedule.MutatorInitializeWithTuneContext", &MutatorNode::InitializeWithTuneContext) - .def("meta_schedule.MutatorApply", + .def("tvm.meta_schedule.MutatorApply", [](Mutator self, tir::Trace trace, TRandState seed) -> ffi::Optional { TRandState seed_ = (seed != -1) ? seed : support::LinearCongruentialEngine::DeviceRandom(); return self->Apply(trace, &seed_); }) - .def_method("meta_schedule.MutatorClone", &MutatorNode::Clone) - .def("meta_schedule.MutatorPyMutator", Mutator::PyMutator) - .def("meta_schedule.MutatorDefaultLLVM", Mutator::DefaultLLVM) - .def("meta_schedule.MutatorDefaultCUDA", Mutator::DefaultCUDA) - .def("meta_schedule.MutatorDefaultCUDATensorCore", Mutator::DefaultCUDATensorCore) - .def("meta_schedule.MutatorDefaultHexagon", Mutator::DefaultHexagon); + .def_method("tvm.meta_schedule.MutatorClone", &MutatorNode::Clone) + .def("tvm.meta_schedule.MutatorPyMutator", Mutator::PyMutator) + .def("tvm.meta_schedule.MutatorDefaultLLVM", Mutator::DefaultLLVM) + .def("tvm.meta_schedule.MutatorDefaultCUDA", Mutator::DefaultCUDA) + .def("tvm.meta_schedule.MutatorDefaultCUDATensorCore", Mutator::DefaultCUDATensorCore) + .def("tvm.meta_schedule.MutatorDefaultHexagon", Mutator::DefaultHexagon); } } // namespace meta_schedule diff --git a/src/meta_schedule/postproc/disallow_async_strided_mem_copy.cc b/src/meta_schedule/postproc/disallow_async_strided_mem_copy.cc index 9f59404de5ef..41bc1028ad46 100644 --- a/src/meta_schedule/postproc/disallow_async_strided_mem_copy.cc +++ b/src/meta_schedule/postproc/disallow_async_strided_mem_copy.cc @@ -179,7 +179,7 @@ class DisallowAsyncStridedMemCopyNode : public PostprocNode { refl::ObjectDef(); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("meta_schedule.DisallowAsyncStridedMemCopy", + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.meta_schedule.DisallowAsyncStridedMemCopy", DisallowAsyncStridedMemCopyNode, PostprocNode); private: @@ -195,7 +195,7 @@ Postproc Postproc::DisallowAsyncStridedMemCopy() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; DisallowAsyncStridedMemCopyNode::RegisterReflection(); - refl::GlobalDef().def("meta_schedule.PostprocDisallowAsyncStridedMemCopy", + refl::GlobalDef().def("tvm.meta_schedule.PostprocDisallowAsyncStridedMemCopy", Postproc::DisallowAsyncStridedMemCopy); } diff --git a/src/meta_schedule/postproc/disallow_dynamic_loop.cc b/src/meta_schedule/postproc/disallow_dynamic_loop.cc index df7344455e6d..2e03be7ff16f 100644 --- a/src/meta_schedule/postproc/disallow_dynamic_loop.cc +++ b/src/meta_schedule/postproc/disallow_dynamic_loop.cc @@ -80,8 +80,8 @@ class DisallowDynamicLoopNode : public PostprocNode { refl::ObjectDef(); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("meta_schedule.DisallowDynamicLoop", DisallowDynamicLoopNode, - PostprocNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.meta_schedule.DisallowDynamicLoop", + DisallowDynamicLoopNode, PostprocNode); }; Postproc Postproc::DisallowDynamicLoop() { @@ -92,7 +92,8 @@ Postproc Postproc::DisallowDynamicLoop() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; DisallowDynamicLoopNode::RegisterReflection(); - refl::GlobalDef().def("meta_schedule.PostprocDisallowDynamicLoop", Postproc::DisallowDynamicLoop); + refl::GlobalDef().def("tvm.meta_schedule.PostprocDisallowDynamicLoop", + Postproc::DisallowDynamicLoop); } } // namespace meta_schedule diff --git a/src/meta_schedule/postproc/postproc.cc b/src/meta_schedule/postproc/postproc.cc index 41557830afb6..2995ca70eb89 100644 --- a/src/meta_schedule/postproc/postproc.cc +++ b/src/meta_schedule/postproc/postproc.cc @@ -127,15 +127,15 @@ TVM_FFI_STATIC_INIT_BLOCK() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def_method("meta_schedule.PostprocInitializeWithTuneContext", + .def_method("tvm.meta_schedule.PostprocInitializeWithTuneContext", &PostprocNode::InitializeWithTuneContext) - .def_method("meta_schedule.PostprocApply", &PostprocNode::Apply) - .def_method("meta_schedule.PostprocClone", &PostprocNode::Clone) - .def("meta_schedule.PostprocPyPostproc", Postproc::PyPostproc) - .def("meta_schedule.PostprocDefaultLLVM", Postproc::DefaultLLVM) - .def("meta_schedule.PostprocDefaultCUDA", Postproc::DefaultCUDA) - .def("meta_schedule.PostprocDefaultCUDATensorCore", Postproc::DefaultCUDATensorCore) - .def("meta_schedule.PostprocDefaultHexagon", Postproc::DefaultHexagon); + .def_method("tvm.meta_schedule.PostprocApply", &PostprocNode::Apply) + .def_method("tvm.meta_schedule.PostprocClone", &PostprocNode::Clone) + .def("tvm.meta_schedule.PostprocPyPostproc", Postproc::PyPostproc) + .def("tvm.meta_schedule.PostprocDefaultLLVM", Postproc::DefaultLLVM) + .def("tvm.meta_schedule.PostprocDefaultCUDA", Postproc::DefaultCUDA) + .def("tvm.meta_schedule.PostprocDefaultCUDATensorCore", Postproc::DefaultCUDATensorCore) + .def("tvm.meta_schedule.PostprocDefaultHexagon", Postproc::DefaultHexagon); } } // namespace meta_schedule diff --git a/src/meta_schedule/postproc/rewrite_cooperative_fetch.cc b/src/meta_schedule/postproc/rewrite_cooperative_fetch.cc index ae7b693efd94..72858a6f9289 100644 --- a/src/meta_schedule/postproc/rewrite_cooperative_fetch.cc +++ b/src/meta_schedule/postproc/rewrite_cooperative_fetch.cc @@ -140,7 +140,7 @@ class RewriteCooperativeFetchNode : public PostprocNode { return Postproc(n); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("meta_schedule.RewriteCooperativeFetch", + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.meta_schedule.RewriteCooperativeFetch", RewriteCooperativeFetchNode, PostprocNode); private: @@ -239,7 +239,7 @@ TVM_FFI_STATIC_INIT_BLOCK() { RewriteCooperativeFetchNode::RegisterReflection(); TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("meta_schedule.PostprocRewriteCooperativeFetch", + refl::GlobalDef().def("tvm.meta_schedule.PostprocRewriteCooperativeFetch", Postproc::RewriteCooperativeFetch); } diff --git a/src/meta_schedule/postproc/rewrite_layout.cc b/src/meta_schedule/postproc/rewrite_layout.cc index 17acdcc9bf2f..73ed8ab8b4b4 100644 --- a/src/meta_schedule/postproc/rewrite_layout.cc +++ b/src/meta_schedule/postproc/rewrite_layout.cc @@ -270,7 +270,8 @@ class RewriteLayoutNode : public PostprocNode { refl::ObjectDef(); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("meta_schedule.RewriteLayout", RewriteLayoutNode, PostprocNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.meta_schedule.RewriteLayout", RewriteLayoutNode, + PostprocNode); }; Postproc Postproc::RewriteLayout() { @@ -281,7 +282,7 @@ Postproc Postproc::RewriteLayout() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; RewriteLayoutNode::RegisterReflection(); - refl::GlobalDef().def("meta_schedule.PostprocRewriteLayout", Postproc::RewriteLayout); + refl::GlobalDef().def("tvm.meta_schedule.PostprocRewriteLayout", Postproc::RewriteLayout); } } // namespace meta_schedule diff --git a/src/meta_schedule/postproc/rewrite_parallel_vectorize_unroll.cc b/src/meta_schedule/postproc/rewrite_parallel_vectorize_unroll.cc index d833af614221..4b986c7e74e2 100644 --- a/src/meta_schedule/postproc/rewrite_parallel_vectorize_unroll.cc +++ b/src/meta_schedule/postproc/rewrite_parallel_vectorize_unroll.cc @@ -461,7 +461,7 @@ class RewriteParallelVectorizeUnrollNode : public PostprocNode { refl::ObjectDef(); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("meta_schedule.RewriteParallelVectorizeUnroll", + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.meta_schedule.RewriteParallelVectorizeUnroll", RewriteParallelVectorizeUnrollNode, PostprocNode); }; @@ -474,7 +474,7 @@ Postproc Postproc::RewriteParallelVectorizeUnroll() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; RewriteParallelVectorizeUnrollNode::RegisterReflection(); - refl::GlobalDef().def("meta_schedule.PostprocRewriteParallelVectorizeUnroll", + refl::GlobalDef().def("tvm.meta_schedule.PostprocRewriteParallelVectorizeUnroll", Postproc::RewriteParallelVectorizeUnroll); } diff --git a/src/meta_schedule/postproc/rewrite_reduction_block.cc b/src/meta_schedule/postproc/rewrite_reduction_block.cc index fffef8ba6856..135d9a4f1902 100644 --- a/src/meta_schedule/postproc/rewrite_reduction_block.cc +++ b/src/meta_schedule/postproc/rewrite_reduction_block.cc @@ -126,7 +126,7 @@ class RewriteReductionBlockNode : public PostprocNode { return Postproc(n); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("meta_schedule.RewriteReductionBlock", + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.meta_schedule.RewriteReductionBlock", RewriteReductionBlockNode, PostprocNode); }; @@ -180,7 +180,7 @@ Postproc Postproc::RewriteReductionBlock() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; RewriteReductionBlockNode::RegisterReflection(); - refl::GlobalDef().def("meta_schedule.PostprocRewriteReductionBlock", + refl::GlobalDef().def("tvm.meta_schedule.PostprocRewriteReductionBlock", Postproc::RewriteReductionBlock); } diff --git a/src/meta_schedule/postproc/rewrite_tensorize.cc b/src/meta_schedule/postproc/rewrite_tensorize.cc index 473731b5a7b5..a5a1b90d5719 100644 --- a/src/meta_schedule/postproc/rewrite_tensorize.cc +++ b/src/meta_schedule/postproc/rewrite_tensorize.cc @@ -79,7 +79,7 @@ class RewriteTensorizeNode : public PostprocNode { bool vectorize_init_loop = false; - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("meta_schedule.RewriteTensorize", RewriteTensorizeNode, + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.meta_schedule.RewriteTensorize", RewriteTensorizeNode, PostprocNode); }; @@ -113,7 +113,7 @@ Postproc Postproc::RewriteTensorize(bool vectorize_init_loop) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; RewriteTensorizeNode::RegisterReflection(); - refl::GlobalDef().def("meta_schedule.PostprocRewriteTensorize", Postproc::RewriteTensorize); + refl::GlobalDef().def("tvm.meta_schedule.PostprocRewriteTensorize", Postproc::RewriteTensorize); } } // namespace meta_schedule diff --git a/src/meta_schedule/postproc/rewrite_unbound_block.cc b/src/meta_schedule/postproc/rewrite_unbound_block.cc index 98e3db2522f1..35588992e681 100644 --- a/src/meta_schedule/postproc/rewrite_unbound_block.cc +++ b/src/meta_schedule/postproc/rewrite_unbound_block.cc @@ -114,8 +114,8 @@ class RewriteUnboundBlockNode : public PostprocNode { namespace refl = tvm::ffi::reflection; refl::ObjectDef(); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("meta_schedule.RewriteUnboundBlock", RewriteUnboundBlockNode, - PostprocNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.meta_schedule.RewriteUnboundBlock", + RewriteUnboundBlockNode, PostprocNode); }; bool RewriteUnboundBlockNode::Apply(const tir::Schedule& sch) { @@ -149,7 +149,8 @@ TVM_FFI_STATIC_INIT_BLOCK() { RewriteUnboundBlockNode::RegisterReflection(); } TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("meta_schedule.PostprocRewriteUnboundBlock", Postproc::RewriteUnboundBlock); + refl::GlobalDef().def("tvm.meta_schedule.PostprocRewriteUnboundBlock", + Postproc::RewriteUnboundBlock); } } // namespace meta_schedule diff --git a/src/meta_schedule/postproc/verify_gpu_code.cc b/src/meta_schedule/postproc/verify_gpu_code.cc index 04a9cf2ea79b..5a15143c056f 100644 --- a/src/meta_schedule/postproc/verify_gpu_code.cc +++ b/src/meta_schedule/postproc/verify_gpu_code.cc @@ -212,7 +212,8 @@ class VerifyGPUCodeNode : public PostprocNode { refl::ObjectDef(); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("meta_schedule.VerifyGPUCode", VerifyGPUCodeNode, PostprocNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.meta_schedule.VerifyGPUCode", VerifyGPUCodeNode, + PostprocNode); }; Postproc Postproc::VerifyGPUCode() { @@ -223,7 +224,7 @@ Postproc Postproc::VerifyGPUCode() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; VerifyGPUCodeNode::RegisterReflection(); - refl::GlobalDef().def("meta_schedule.PostprocVerifyGPUCode", Postproc::VerifyGPUCode); + refl::GlobalDef().def("tvm.meta_schedule.PostprocVerifyGPUCode", Postproc::VerifyGPUCode); } } // namespace meta_schedule diff --git a/src/meta_schedule/postproc/verify_vtcm_limit.cc b/src/meta_schedule/postproc/verify_vtcm_limit.cc index f0fe8be1c1c9..c611ebf1068c 100644 --- a/src/meta_schedule/postproc/verify_vtcm_limit.cc +++ b/src/meta_schedule/postproc/verify_vtcm_limit.cc @@ -65,7 +65,7 @@ class VerifyVTCMLimitNode : public PostprocNode { refl::ObjectDef(); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("meta_schedule.VerifyVTCMLimit", VerifyVTCMLimitNode, + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.meta_schedule.VerifyVTCMLimit", VerifyVTCMLimitNode, PostprocNode); }; @@ -77,7 +77,7 @@ Postproc Postproc::VerifyVTCMLimit() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; VerifyVTCMLimitNode::RegisterReflection(); - refl::GlobalDef().def("meta_schedule.PostprocVerifyVTCMLimit", Postproc::VerifyVTCMLimit); + refl::GlobalDef().def("tvm.meta_schedule.PostprocVerifyVTCMLimit", Postproc::VerifyVTCMLimit); } } // namespace meta_schedule diff --git a/src/meta_schedule/profiler.cc b/src/meta_schedule/profiler.cc index e0bbc904c2c1..a1908ff2fad3 100644 --- a/src/meta_schedule/profiler.cc +++ b/src/meta_schedule/profiler.cc @@ -127,13 +127,13 @@ TVM_FFI_STATIC_INIT_BLOCK() { ProfilerNode::RegisterReflection(); } TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("meta_schedule.Profiler", []() -> Profiler { return Profiler(); }) - .def_method("meta_schedule.ProfilerEnterWithScope", &Profiler::EnterWithScope) - .def_method("meta_schedule.ProfilerExitWithScope", &Profiler::ExitWithScope) - .def("meta_schedule.ProfilerCurrent", Profiler::Current) - .def_method("meta_schedule.ProfilerGet", &ProfilerNode::Get) - .def_method("meta_schedule.ProfilerTable", &ProfilerNode::Table) - .def("meta_schedule.ProfilerTimedScope", ProfilerTimedScope); + .def("tvm.meta_schedule.Profiler", []() -> Profiler { return Profiler(); }) + .def_method("tvm.meta_schedule.ProfilerEnterWithScope", &Profiler::EnterWithScope) + .def_method("tvm.meta_schedule.ProfilerExitWithScope", &Profiler::ExitWithScope) + .def("tvm.meta_schedule.ProfilerCurrent", Profiler::Current) + .def_method("tvm.meta_schedule.ProfilerGet", &ProfilerNode::Get) + .def_method("tvm.meta_schedule.ProfilerTable", &ProfilerNode::Table) + .def("tvm.meta_schedule.ProfilerTimedScope", ProfilerTimedScope); } } // namespace meta_schedule diff --git a/src/meta_schedule/runner/runner.cc b/src/meta_schedule/runner/runner.cc index 1b9a3ea9a9c5..e52091f7f749 100644 --- a/src/meta_schedule/runner/runner.cc +++ b/src/meta_schedule/runner/runner.cc @@ -66,20 +66,20 @@ TVM_FFI_STATIC_INIT_BLOCK() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("meta_schedule.RunnerInput", + .def("tvm.meta_schedule.RunnerInput", [](ffi::String artifact_path, ffi::String device_type, ffi::Array args_info) -> RunnerInput { return RunnerInput(artifact_path, device_type, args_info); }) - .def("meta_schedule.RunnerResult", + .def("tvm.meta_schedule.RunnerResult", [](ffi::Optional> run_secs, ffi::Optional error_msg) -> RunnerResult { return RunnerResult(run_secs, error_msg); }) - .def("meta_schedule.RunnerFuture", + .def("tvm.meta_schedule.RunnerFuture", [](RunnerFuture::FDone f_done, RunnerFuture::FResult f_result) -> RunnerFuture { return RunnerFuture(f_done, f_result); }) - .def_method("meta_schedule.RunnerFutureDone", &RunnerFutureNode::Done) - .def_method("meta_schedule.RunnerFutureResult", &RunnerFutureNode::Result) - .def_method("meta_schedule.RunnerRun", &RunnerNode::Run) - .def("meta_schedule.RunnerPyRunner", Runner::PyRunner); + .def_method("tvm.meta_schedule.RunnerFutureDone", &RunnerFutureNode::Done) + .def_method("tvm.meta_schedule.RunnerFutureResult", &RunnerFutureNode::Result) + .def_method("tvm.meta_schedule.RunnerRun", &RunnerNode::Run) + .def("tvm.meta_schedule.RunnerPyRunner", Runner::PyRunner); } } // namespace meta_schedule diff --git a/src/meta_schedule/schedule/cpu/winograd.cc b/src/meta_schedule/schedule/cpu/winograd.cc index c3fd12e282b3..88487dacbf9f 100644 --- a/src/meta_schedule/schedule/cpu/winograd.cc +++ b/src/meta_schedule/schedule/cpu/winograd.cc @@ -63,7 +63,7 @@ static ffi::Array ScheduleDataPack(tir::Schedule sch, tir::BlockRV TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("meta_schedule.cpu.conv2d_nhwc_winograd_data_pack", + .def("tvm.meta_schedule.cpu.conv2d_nhwc_winograd_data_pack", [](Schedule sch, BlockRV data_pack) -> ffi::Array { BlockRV input_tile = GetWinogradProducerAndInlineConst(sch, data_pack); BlockRV data_pad = GetWinogradProducerAndInlineConst(sch, input_tile); @@ -74,13 +74,13 @@ TVM_FFI_STATIC_INIT_BLOCK() { /*preserve_unit_loops=*/true); return {sch}; }) - .def("meta_schedule.cpu.conv2d_nhwc_winograd_inverse", + .def("tvm.meta_schedule.cpu.conv2d_nhwc_winograd_inverse", [](Schedule sch, BlockRV block) -> ffi::Array { GetWinogradProducerAndInlineConst(sch, block); ScheduleDataPack(sch, block, {2, 3}, {0, 1, 4, 5}); return {sch}; }) - .def("meta_schedule.cpu.conv2d_nchw_winograd_data_pack", + .def("tvm.meta_schedule.cpu.conv2d_nchw_winograd_data_pack", [](Schedule sch, BlockRV data_pack) -> ffi::Array { BlockRV input_tile = GetWinogradProducerAndInlineConst(sch, data_pack); BlockRV data_pad = GetWinogradProducerAndInlineConst(sch, input_tile); @@ -91,7 +91,7 @@ TVM_FFI_STATIC_INIT_BLOCK() { /*preserve_unit_loops=*/true); return {sch}; }) - .def("meta_schedule.cpu.conv2d_nchw_winograd_inverse", + .def("tvm.meta_schedule.cpu.conv2d_nchw_winograd_inverse", [](Schedule sch, BlockRV block) -> ffi::Array { GetWinogradProducerAndInlineConst(sch, block); ScheduleDataPack(sch, block, {0, 1}, {2, 3, 4, 5}); diff --git a/src/meta_schedule/schedule/cuda/winograd.cc b/src/meta_schedule/schedule/cuda/winograd.cc index 74a70da58b36..18a9a31201ff 100644 --- a/src/meta_schedule/schedule/cuda/winograd.cc +++ b/src/meta_schedule/schedule/cuda/winograd.cc @@ -67,7 +67,7 @@ static ffi::Array ScheduleDataPack(tir::Schedule sch, tir::BlockRV TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("meta_schedule.cuda.conv2d_nhwc_winograd_data_pack", + .def("tvm.meta_schedule.cuda.conv2d_nhwc_winograd_data_pack", [](Schedule sch, BlockRV data_pack) -> ffi::Array { BlockRV input_tile = GetWinogradProducerAndInlineConst(sch, data_pack); BlockRV data_pad = GetWinogradProducerAndInlineConst(sch, input_tile); @@ -91,7 +91,7 @@ TVM_FFI_STATIC_INIT_BLOCK() { } return {sch}; }) - .def("meta_schedule.cuda.conv2d_nhwc_winograd_inverse", + .def("tvm.meta_schedule.cuda.conv2d_nhwc_winograd_inverse", [](Schedule sch, BlockRV inverse) -> ffi::Array { GetWinogradProducerAndInlineConst(sch, inverse); ScheduleDataPack(sch, inverse, /*tiled=*/{2, 3}, /*unrolled=*/{0, 1, 4, 5}); @@ -103,7 +103,7 @@ TVM_FFI_STATIC_INIT_BLOCK() { max_threadblocks, max_threads_per_block); return {sch}; }) - .def("meta_schedule.cuda.conv2d_nchw_winograd_data_pack", + .def("tvm.meta_schedule.cuda.conv2d_nchw_winograd_data_pack", [](Schedule sch, BlockRV data_pack) -> ffi::Array { int64_t max_threadblocks = 256; int64_t max_threads_per_block = 1024; @@ -133,7 +133,7 @@ TVM_FFI_STATIC_INIT_BLOCK() { } return {sch}; }) - .def("meta_schedule.cuda.conv2d_nchw_winograd_inverse", + .def("tvm.meta_schedule.cuda.conv2d_nchw_winograd_inverse", [](Schedule sch, BlockRV inverse) -> ffi::Array { GetWinogradProducerAndInlineConst(sch, inverse); // loops on top of the inverse block: [CO, P, tile_size, tile_size, alpha, alpha] diff --git a/src/meta_schedule/schedule_rule/add_rfactor.cc b/src/meta_schedule/schedule_rule/add_rfactor.cc index fad3279eb792..c4f1ed5c1a3b 100644 --- a/src/meta_schedule/schedule_rule/add_rfactor.cc +++ b/src/meta_schedule/schedule_rule/add_rfactor.cc @@ -64,7 +64,8 @@ class AddRFactorNode : public ScheduleRuleNode { .def_ro("max_jobs_per_core", &AddRFactorNode::max_jobs_per_core) .def_ro("max_innermost_factor", &AddRFactorNode::max_innermost_factor); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("meta_schedule.AddRFactor", AddRFactorNode, ScheduleRuleNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.meta_schedule.AddRFactor", AddRFactorNode, + ScheduleRuleNode); }; ScheduleRule ScheduleRule::AddRFactor(int max_jobs_per_core, @@ -126,7 +127,7 @@ TVM_FFI_STATIC_INIT_BLOCK() { AddRFactorNode::RegisterReflection(); } TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("meta_schedule.ScheduleRuleAddRFactor", ScheduleRule::AddRFactor); + refl::GlobalDef().def("tvm.meta_schedule.ScheduleRuleAddRFactor", ScheduleRule::AddRFactor); } } // namespace meta_schedule diff --git a/src/meta_schedule/schedule_rule/apply_custom_rule.cc b/src/meta_schedule/schedule_rule/apply_custom_rule.cc index 927ce3656c2f..5686754e8a4c 100644 --- a/src/meta_schedule/schedule_rule/apply_custom_rule.cc +++ b/src/meta_schedule/schedule_rule/apply_custom_rule.cc @@ -78,7 +78,7 @@ class ApplyCustomRuleNode : public ScheduleRuleNode { namespace refl = tvm::ffi::reflection; refl::ObjectDef().def_ro("target_", &ApplyCustomRuleNode::target_); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("meta_schedule.ApplyCustomRule", ApplyCustomRuleNode, + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.meta_schedule.ApplyCustomRule", ApplyCustomRuleNode, ScheduleRuleNode); }; @@ -95,7 +95,8 @@ TVM_FFI_STATIC_INIT_BLOCK() { ApplyCustomRuleNode::RegisterReflection(); } TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("meta_schedule.ScheduleRuleApplyCustomRule", ScheduleRule::ApplyCustomRule); + refl::GlobalDef().def("tvm.meta_schedule.ScheduleRuleApplyCustomRule", + ScheduleRule::ApplyCustomRule); } } // namespace meta_schedule diff --git a/src/meta_schedule/schedule_rule/auto_bind.cc b/src/meta_schedule/schedule_rule/auto_bind.cc index 1ab276c5bec7..9d1d4aaa433f 100644 --- a/src/meta_schedule/schedule_rule/auto_bind.cc +++ b/src/meta_schedule/schedule_rule/auto_bind.cc @@ -60,7 +60,7 @@ class AutoBindNode : public ScheduleRuleNode { namespace refl = tvm::ffi::reflection; refl::ObjectDef(); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("meta_schedule.AutoBind", AutoBindNode, ScheduleRuleNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.meta_schedule.AutoBind", AutoBindNode, ScheduleRuleNode); }; ffi::Array AutoBindNode::Apply(const tir::Schedule& sch, @@ -84,7 +84,7 @@ TVM_FFI_STATIC_INIT_BLOCK() { AutoBindNode::RegisterReflection(); } TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("meta_schedule.ScheduleRuleAutoBind", ScheduleRule::AutoBind); + refl::GlobalDef().def("tvm.meta_schedule.ScheduleRuleAutoBind", ScheduleRule::AutoBind); } } // namespace meta_schedule diff --git a/src/meta_schedule/schedule_rule/auto_inline.cc b/src/meta_schedule/schedule_rule/auto_inline.cc index 3d5fc8798c13..a19003743671 100644 --- a/src/meta_schedule/schedule_rule/auto_inline.cc +++ b/src/meta_schedule/schedule_rule/auto_inline.cc @@ -95,7 +95,8 @@ class AutoInlineNode : public ScheduleRuleNode { .def_ro("require_ordered", &AutoInlineNode::require_ordered) .def_ro("disallow_op", &AutoInlineNode::disallow_op); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("meta_schedule.AutoInline", AutoInlineNode, ScheduleRuleNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.meta_schedule.AutoInline", AutoInlineNode, + ScheduleRuleNode); }; inline InlineType AutoInlineNode::CheckInline(const tir::Schedule& sch, @@ -197,7 +198,7 @@ TVM_FFI_STATIC_INIT_BLOCK() { AutoInlineNode::RegisterReflection(); } TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("meta_schedule.ScheduleRuleAutoInline", ScheduleRule::AutoInline); + refl::GlobalDef().def("tvm.meta_schedule.ScheduleRuleAutoInline", ScheduleRule::AutoInline); } /*! \brief Inline blocks that produce a constant scalar. */ @@ -232,7 +233,7 @@ class InlineConstantScalarsNode : public ScheduleRuleNode { namespace refl = tvm::ffi::reflection; refl::ObjectDef(); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("meta_schedule.InlineConstantScalars", + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.meta_schedule.InlineConstantScalars", InlineConstantScalarsNode, ScheduleRuleNode); }; @@ -245,7 +246,7 @@ TVM_FFI_STATIC_INIT_BLOCK() { InlineConstantScalarsNode::RegisterReflection(); } TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("meta_schedule.ScheduleRuleInlineConstantScalars", + refl::GlobalDef().def("tvm.meta_schedule.ScheduleRuleInlineConstantScalars", ScheduleRule::InlineConstantScalars); } } // namespace meta_schedule diff --git a/src/meta_schedule/schedule_rule/cross_thread_reduction.cc b/src/meta_schedule/schedule_rule/cross_thread_reduction.cc index 17e9552dcb60..79524d06b76c 100644 --- a/src/meta_schedule/schedule_rule/cross_thread_reduction.cc +++ b/src/meta_schedule/schedule_rule/cross_thread_reduction.cc @@ -282,8 +282,8 @@ class CrossThreadReductionNode : public ScheduleRuleNode { .def_ro("warp_size", &CrossThreadReductionNode::warp_size) .def_ro("thread_extents", &CrossThreadReductionNode::thread_extents); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("meta_schedule.CrossThreadReduction", CrossThreadReductionNode, - ScheduleRuleNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.meta_schedule.CrossThreadReduction", + CrossThreadReductionNode, ScheduleRuleNode); }; ScheduleRule ScheduleRule::CrossThreadReduction(ffi::Array thread_extents) { @@ -299,7 +299,7 @@ TVM_FFI_STATIC_INIT_BLOCK() { CrossThreadReductionNode::RegisterReflection(); } TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("meta_schedule.ScheduleRuleCrossThreadReduction", + refl::GlobalDef().def("tvm.meta_schedule.ScheduleRuleCrossThreadReduction", ScheduleRule::CrossThreadReduction); } diff --git a/src/meta_schedule/schedule_rule/multi_level_tiling.cc b/src/meta_schedule/schedule_rule/multi_level_tiling.cc index ea78c4f6e3d3..ef2b7388ccc4 100644 --- a/src/meta_schedule/schedule_rule/multi_level_tiling.cc +++ b/src/meta_schedule/schedule_rule/multi_level_tiling.cc @@ -409,7 +409,7 @@ ScheduleRule ScheduleRule::MultiLevelTiling( TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("meta_schedule.ScheduleRuleMultiLevelTiling", + refl::GlobalDef().def("tvm.meta_schedule.ScheduleRuleMultiLevelTiling", ScheduleRule::MultiLevelTiling); } diff --git a/src/meta_schedule/schedule_rule/multi_level_tiling.h b/src/meta_schedule/schedule_rule/multi_level_tiling.h index 028d1aecbf45..174c19369905 100644 --- a/src/meta_schedule/schedule_rule/multi_level_tiling.h +++ b/src/meta_schedule/schedule_rule/multi_level_tiling.h @@ -124,7 +124,7 @@ class StateNode : public Object { virtual State Copy() const; static constexpr const bool _type_mutable = true; - TVM_FFI_DECLARE_OBJECT_INFO("meta_schedule.State", StateNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO("tvm.meta_schedule.State", StateNode, Object); }; /*! \brief Managed reference to StateNode */ @@ -227,7 +227,7 @@ class MultiLevelTilingNode : public ScheduleRuleNode { .def_ro("tile_binds", &MultiLevelTilingNode::tile_binds) .def_ro("max_innermost_factor", &MultiLevelTilingNode::max_innermost_factor); } - TVM_FFI_DECLARE_OBJECT_INFO("meta_schedule.MultiLevelTiling", MultiLevelTilingNode, + TVM_FFI_DECLARE_OBJECT_INFO("tvm.meta_schedule.MultiLevelTiling", MultiLevelTilingNode, ScheduleRuleNode); }; diff --git a/src/meta_schedule/schedule_rule/multi_level_tiling_tensor_core.cc b/src/meta_schedule/schedule_rule/multi_level_tiling_tensor_core.cc index c58e81dc3343..ea10ed2e769c 100644 --- a/src/meta_schedule/schedule_rule/multi_level_tiling_tensor_core.cc +++ b/src/meta_schedule/schedule_rule/multi_level_tiling_tensor_core.cc @@ -96,7 +96,7 @@ class TensorCoreStateNode : public StateNode { refl::ObjectDef(); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("meta_schedule.TensorCoreState", TensorCoreStateNode, + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.meta_schedule.TensorCoreState", TensorCoreStateNode, StateNode); }; @@ -203,7 +203,7 @@ class MultiLevelTilingTensorCoreNode : public MultiLevelTilingNode { refl::ObjectDef(); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("meta_schedule.MultiLevelTilingTensorCore", + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.meta_schedule.MultiLevelTilingTensorCore", MultiLevelTilingTensorCoreNode, MultiLevelTilingNode); private: @@ -941,7 +941,7 @@ TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; MultiLevelTilingTensorCoreNode::RegisterReflection(); TensorCoreStateNode::RegisterReflection(); - refl::GlobalDef().def("meta_schedule.ScheduleRuleMultiLevelTilingTensorCore", + refl::GlobalDef().def("tvm.meta_schedule.ScheduleRuleMultiLevelTilingTensorCore", ScheduleRule::MultiLevelTilingTensorCore); } diff --git a/src/meta_schedule/schedule_rule/multi_level_tiling_wide_vector.cc b/src/meta_schedule/schedule_rule/multi_level_tiling_wide_vector.cc index 080e1c9c0fbf..115da2b1bc9e 100644 --- a/src/meta_schedule/schedule_rule/multi_level_tiling_wide_vector.cc +++ b/src/meta_schedule/schedule_rule/multi_level_tiling_wide_vector.cc @@ -45,7 +45,7 @@ class MultiLevelTilingWideVectorNode : public MultiLevelTilingNode { refl::ObjectDef(); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("meta_schedule.MultiLevelTilingWideVector", + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.meta_schedule.MultiLevelTilingWideVector", MultiLevelTilingWideVectorNode, MultiLevelTilingNode); protected: @@ -136,7 +136,7 @@ ScheduleRule ScheduleRule::MultiLevelTilingWideVector( TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; MultiLevelTilingWideVectorNode::RegisterReflection(); - refl::GlobalDef().def("meta_schedule.ScheduleRuleMultiLevelTilingWideVector", + refl::GlobalDef().def("tvm.meta_schedule.ScheduleRuleMultiLevelTilingWideVector", ScheduleRule::MultiLevelTilingWideVector); } diff --git a/src/meta_schedule/schedule_rule/multi_level_tiling_with_intrin.cc b/src/meta_schedule/schedule_rule/multi_level_tiling_with_intrin.cc index 4a375689e493..16a1cb78d3cd 100644 --- a/src/meta_schedule/schedule_rule/multi_level_tiling_with_intrin.cc +++ b/src/meta_schedule/schedule_rule/multi_level_tiling_with_intrin.cc @@ -93,7 +93,7 @@ class MultiLevelTilingWithIntrinNode : public MultiLevelTilingNode { /*! \brief The name of a tensor intrinsic. */ ffi::String intrin_name; - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("meta_schedule.MultiLevelTilingWithIntrin", + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.meta_schedule.MultiLevelTilingWithIntrin", MultiLevelTilingWithIntrinNode, MultiLevelTilingNode); }; @@ -114,7 +114,7 @@ ScheduleRule ScheduleRule::MultiLevelTilingWithIntrin( TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; MultiLevelTilingWithIntrinNode::RegisterReflection(); - refl::GlobalDef().def("meta_schedule.ScheduleRuleMultiLevelTilingWithIntrin", + refl::GlobalDef().def("tvm.meta_schedule.ScheduleRuleMultiLevelTilingWithIntrin", ScheduleRule::MultiLevelTilingWithIntrin); } diff --git a/src/meta_schedule/schedule_rule/parallel_vectorize_unroll.cc b/src/meta_schedule/schedule_rule/parallel_vectorize_unroll.cc index 9216c70e3328..94f02df3175c 100644 --- a/src/meta_schedule/schedule_rule/parallel_vectorize_unroll.cc +++ b/src/meta_schedule/schedule_rule/parallel_vectorize_unroll.cc @@ -118,7 +118,7 @@ class ParallelizeVectorizeUnrollNode : public ScheduleRuleNode { .def_ro("unroll_max_steps", &ParallelizeVectorizeUnrollNode::unroll_max_steps) .def_ro("unroll_explicit", &ParallelizeVectorizeUnrollNode::unroll_explicit); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("meta_schedule.ParallelizeVectorizeUnroll", + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.meta_schedule.ParallelizeVectorizeUnroll", ParallelizeVectorizeUnrollNode, ScheduleRuleNode); }; @@ -139,7 +139,7 @@ TVM_FFI_STATIC_INIT_BLOCK() { ParallelizeVectorizeUnrollNode::RegisterReflection TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("meta_schedule.ScheduleRuleParallelizeVectorizeUnroll", + refl::GlobalDef().def("tvm.meta_schedule.ScheduleRuleParallelizeVectorizeUnroll", ScheduleRule::ParallelizeVectorizeUnroll); } diff --git a/src/meta_schedule/schedule_rule/random_compute_location.cc b/src/meta_schedule/schedule_rule/random_compute_location.cc index 2c9975fcf916..50c0fcff784e 100644 --- a/src/meta_schedule/schedule_rule/random_compute_location.cc +++ b/src/meta_schedule/schedule_rule/random_compute_location.cc @@ -117,7 +117,7 @@ class RandomComputeLocationNode : public ScheduleRuleNode { namespace refl = tvm::ffi::reflection; refl::ObjectDef(); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("meta_schedule.RandomComputeLocation", + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.meta_schedule.RandomComputeLocation", RandomComputeLocationNode, ScheduleRuleNode); }; @@ -129,7 +129,7 @@ TVM_FFI_STATIC_INIT_BLOCK() { RandomComputeLocationNode::RegisterReflection(); } TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("meta_schedule.ScheduleRuleRandomComputeLocation", + refl::GlobalDef().def("tvm.meta_schedule.ScheduleRuleRandomComputeLocation", ScheduleRule::RandomComputeLocation); } } // namespace meta_schedule diff --git a/src/meta_schedule/schedule_rule/schedule_rule.cc b/src/meta_schedule/schedule_rule/schedule_rule.cc index 9eac4ad57b20..30795f0d9c2d 100644 --- a/src/meta_schedule/schedule_rule/schedule_rule.cc +++ b/src/meta_schedule/schedule_rule/schedule_rule.cc @@ -322,7 +322,7 @@ ffi::Array ScheduleRule::DefaultRISCV(const int vlen) { /*max_innermost_factor=*/Integer(64))); auto current_target = tvm::Target::Current(); const auto reg_rvv_intrinsics = - tvm::ffi::Function::GetGlobalRequired("tir.tensor_intrin.register_rvv_isa_intrinsics"); + tvm::ffi::Function::GetGlobalRequired("tvm.tir.tensor_intrin.register_rvv_isa_intrinsics"); const auto rvv_kernels_inventory = reg_rvv_intrinsics(current_target, /* inventory_only */ true) .cast>(); for (const auto& intrin : rvv_kernels_inventory) { @@ -467,16 +467,17 @@ TVM_FFI_STATIC_INIT_BLOCK() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def_method("meta_schedule.ScheduleRuleInitializeWithTuneContext", + .def_method("tvm.meta_schedule.ScheduleRuleInitializeWithTuneContext", &ScheduleRuleNode::InitializeWithTuneContext) - .def_method("meta_schedule.ScheduleRuleApply", &ScheduleRuleNode::Apply) - .def_method("meta_schedule.ScheduleRuleClone", &ScheduleRuleNode::Clone) - .def("meta_schedule.ScheduleRulePyScheduleRule", ScheduleRule::PyScheduleRule) - .def("meta_schedule.ScheduleRuleDefaultLLVM", ScheduleRule::DefaultLLVM) - .def("meta_schedule.ScheduleRuleDefaultCUDA", ScheduleRule::DefaultCUDA) - .def("meta_schedule.ScheduleRuleDefaultCUDATensorCore", ScheduleRule::DefaultCUDATensorCore) - .def("meta_schedule.ScheduleRuleDefaultHexagon", ScheduleRule::DefaultHexagon) - .def("meta_schedule.ScheduleRuleDefaultARM", ScheduleRule::DefaultARM); + .def_method("tvm.meta_schedule.ScheduleRuleApply", &ScheduleRuleNode::Apply) + .def_method("tvm.meta_schedule.ScheduleRuleClone", &ScheduleRuleNode::Clone) + .def("tvm.meta_schedule.ScheduleRulePyScheduleRule", ScheduleRule::PyScheduleRule) + .def("tvm.meta_schedule.ScheduleRuleDefaultLLVM", ScheduleRule::DefaultLLVM) + .def("tvm.meta_schedule.ScheduleRuleDefaultCUDA", ScheduleRule::DefaultCUDA) + .def("tvm.meta_schedule.ScheduleRuleDefaultCUDATensorCore", + ScheduleRule::DefaultCUDATensorCore) + .def("tvm.meta_schedule.ScheduleRuleDefaultHexagon", ScheduleRule::DefaultHexagon) + .def("tvm.meta_schedule.ScheduleRuleDefaultARM", ScheduleRule::DefaultARM); } } // namespace meta_schedule diff --git a/src/meta_schedule/search_strategy/evolutionary_search.cc b/src/meta_schedule/search_strategy/evolutionary_search.cc index 8aa5aca45059..a4e83a34a3a1 100644 --- a/src/meta_schedule/search_strategy/evolutionary_search.cc +++ b/src/meta_schedule/search_strategy/evolutionary_search.cc @@ -395,7 +395,7 @@ class EvolutionarySearchNode : public SearchStrategyNode { .def_ro("genetic_max_fail_count", &EvolutionarySearchNode::genetic_max_fail_count) .def_ro("eps_greedy", &EvolutionarySearchNode::eps_greedy); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("meta_schedule.EvolutionarySearch", EvolutionarySearchNode, + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.meta_schedule.EvolutionarySearch", EvolutionarySearchNode, SearchStrategyNode); void InitializeWithTuneContext(const TuneContext& ctx) final { @@ -807,10 +807,10 @@ TVM_FFI_STATIC_INIT_BLOCK() { EvolutionarySearchNode::RegisterReflection(); } TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("meta_schedule.SearchStrategyEvolutionarySearch", SearchStrategy::EvolutionarySearch) - .def("meta_schedule.SearchStrategyEvolutionarySearchSampleInitPopulation", + .def("tvm.meta_schedule.SearchStrategyEvolutionarySearch", SearchStrategy::EvolutionarySearch) + .def("tvm.meta_schedule.SearchStrategyEvolutionarySearchSampleInitPopulation", EvolutionarySearchSampleInitPopulation) - .def("meta_schedule.SearchStrategyEvolutionarySearchEvolveWithCostModel", + .def("tvm.meta_schedule.SearchStrategyEvolutionarySearchEvolveWithCostModel", EvolutionarySearchEvolveWithCostModel); } diff --git a/src/meta_schedule/search_strategy/replay_func.cc b/src/meta_schedule/search_strategy/replay_func.cc index 9082c6c3a90f..37cabacf6164 100644 --- a/src/meta_schedule/search_strategy/replay_func.cc +++ b/src/meta_schedule/search_strategy/replay_func.cc @@ -66,7 +66,8 @@ class ReplayFuncNode : public SearchStrategyNode { namespace refl = tvm::ffi::reflection; refl::ObjectDef(); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("meta_schedule.ReplayFunc", ReplayFuncNode, SearchStrategyNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.meta_schedule.ReplayFunc", ReplayFuncNode, + SearchStrategyNode); void InitializeWithTuneContext(const TuneContext& ctx) final { CHECK(ctx->mod.defined()) << "ValueError: TuneContext.mod is not defined"; @@ -166,7 +167,7 @@ TVM_FFI_STATIC_INIT_BLOCK() { ReplayFuncNode::RegisterReflection(); } TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("meta_schedule.SearchStrategyReplayFunc", SearchStrategy::ReplayFunc); + refl::GlobalDef().def("tvm.meta_schedule.SearchStrategyReplayFunc", SearchStrategy::ReplayFunc); } } // namespace meta_schedule diff --git a/src/meta_schedule/search_strategy/replay_trace.cc b/src/meta_schedule/search_strategy/replay_trace.cc index 7898b171d357..8881c3912404 100644 --- a/src/meta_schedule/search_strategy/replay_trace.cc +++ b/src/meta_schedule/search_strategy/replay_trace.cc @@ -81,7 +81,7 @@ class ReplayTraceNode : public SearchStrategyNode { namespace refl = tvm::ffi::reflection; refl::ObjectDef().def_ro("max_fail_count", &ReplayTraceNode::max_fail_count); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("meta_schedule.ReplayTrace", ReplayTraceNode, + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.meta_schedule.ReplayTrace", ReplayTraceNode, SearchStrategyNode); void InitializeWithTuneContext(const TuneContext& ctx) final { @@ -194,7 +194,7 @@ TVM_FFI_STATIC_INIT_BLOCK() { ReplayTraceNode::RegisterReflection(); } TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("meta_schedule.SearchStrategyReplayTrace", SearchStrategy::ReplayTrace); + refl::GlobalDef().def("tvm.meta_schedule.SearchStrategyReplayTrace", SearchStrategy::ReplayTrace); } } // namespace meta_schedule diff --git a/src/meta_schedule/search_strategy/search_strategy.cc b/src/meta_schedule/search_strategy/search_strategy.cc index 3273e70ac1b8..a3133bb45254 100644 --- a/src/meta_schedule/search_strategy/search_strategy.cc +++ b/src/meta_schedule/search_strategy/search_strategy.cc @@ -93,20 +93,20 @@ TVM_FFI_STATIC_INIT_BLOCK() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("meta_schedule.MeasureCandidate", + .def("tvm.meta_schedule.MeasureCandidate", [](tir::Schedule sch, ffi::Optional> args_info) -> MeasureCandidate { return MeasureCandidate(sch, args_info.value_or({})); }) - .def("meta_schedule.SearchStrategyPySearchStrategy", SearchStrategy::PySearchStrategy) - .def_method("meta_schedule.SearchStrategyInitializeWithTuneContext", + .def("tvm.meta_schedule.SearchStrategyPySearchStrategy", SearchStrategy::PySearchStrategy) + .def_method("tvm.meta_schedule.SearchStrategyInitializeWithTuneContext", &SearchStrategyNode::InitializeWithTuneContext) - .def_method("meta_schedule.SearchStrategyPreTuning", &SearchStrategyNode::PreTuning) - .def_method("meta_schedule.SearchStrategyPostTuning", &SearchStrategyNode::PostTuning) - .def_method("meta_schedule.SearchStrategyGenerateMeasureCandidates", + .def_method("tvm.meta_schedule.SearchStrategyPreTuning", &SearchStrategyNode::PreTuning) + .def_method("tvm.meta_schedule.SearchStrategyPostTuning", &SearchStrategyNode::PostTuning) + .def_method("tvm.meta_schedule.SearchStrategyGenerateMeasureCandidates", &SearchStrategyNode::GenerateMeasureCandidates) - .def_method("meta_schedule.SearchStrategyNotifyRunnerResults", + .def_method("tvm.meta_schedule.SearchStrategyNotifyRunnerResults", &SearchStrategyNode::NotifyRunnerResults) - .def_method("meta_schedule.SearchStrategyClone", &SearchStrategyNode::Clone); + .def_method("tvm.meta_schedule.SearchStrategyClone", &SearchStrategyNode::Clone); } } // namespace meta_schedule diff --git a/src/meta_schedule/space_generator/post_order_apply.cc b/src/meta_schedule/space_generator/post_order_apply.cc index e3786a4d6188..92125b2be9ba 100644 --- a/src/meta_schedule/space_generator/post_order_apply.cc +++ b/src/meta_schedule/space_generator/post_order_apply.cc @@ -100,7 +100,7 @@ class PostOrderApplyNode : public SpaceGeneratorNode { CloneRules(this, n.get()); return SpaceGenerator(n); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("meta_schedule.PostOrderApply", PostOrderApplyNode, + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.meta_schedule.PostOrderApply", PostOrderApplyNode, SpaceGeneratorNode); }; @@ -120,7 +120,7 @@ TVM_FFI_STATIC_INIT_BLOCK() { PostOrderApplyNode::RegisterReflection(); } TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("meta_schedule.SpaceGeneratorPostOrderApply", + refl::GlobalDef().def("tvm.meta_schedule.SpaceGeneratorPostOrderApply", SpaceGenerator::PostOrderApply); } diff --git a/src/meta_schedule/space_generator/schedule_fn.cc b/src/meta_schedule/space_generator/schedule_fn.cc index 7d22635b76f2..531dc0d398b2 100644 --- a/src/meta_schedule/space_generator/schedule_fn.cc +++ b/src/meta_schedule/space_generator/schedule_fn.cc @@ -83,7 +83,8 @@ class ScheduleFnNode : public SpaceGeneratorNode { return SpaceGenerator(n); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("meta_schedule.ScheduleFn", ScheduleFnNode, SpaceGeneratorNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.meta_schedule.ScheduleFn", ScheduleFnNode, + SpaceGeneratorNode); }; SpaceGenerator SpaceGenerator::ScheduleFn( @@ -101,7 +102,7 @@ SpaceGenerator SpaceGenerator::ScheduleFn( TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; ScheduleFnNode::RegisterReflection(); - refl::GlobalDef().def("meta_schedule.SpaceGeneratorScheduleFn", SpaceGenerator::ScheduleFn); + refl::GlobalDef().def("tvm.meta_schedule.SpaceGeneratorScheduleFn", SpaceGenerator::ScheduleFn); } } // namespace meta_schedule diff --git a/src/meta_schedule/space_generator/space_generator.cc b/src/meta_schedule/space_generator/space_generator.cc index 9e458a3ad7cf..6067e332b908 100644 --- a/src/meta_schedule/space_generator/space_generator.cc +++ b/src/meta_schedule/space_generator/space_generator.cc @@ -27,7 +27,7 @@ namespace meta_schedule { ffi::String GetRuleKindFromTarget(const Target& target) { if (target->kind->name == "llvm") { static auto target_has_feature_fn_ptr = - tvm::ffi::Function::GetGlobalRequired("target.target_has_feature"); + tvm::ffi::Function::GetGlobalRequired("tvm.target.target_has_feature"); bool have_avx512vnni = target_has_feature_fn_ptr("avx512vnni", target).cast(); bool have_avxvnni = target_has_feature_fn_ptr("avxvnni", target).cast(); if (have_avx512vnni || have_avxvnni) { @@ -123,7 +123,7 @@ void SpaceGeneratorNode::InitializeWithTuneContext(const TuneContext& context) { default_mutator_probs = Mutator::DefaultLLVM(); } else if (kind == "rvv") { static auto llvm_get_vector_width = - tvm::ffi::Function::GetGlobalRequired("target.llvm_get_vector_width"); + tvm::ffi::Function::GetGlobalRequired("tvm.target.llvm_get_vector_width"); const int vlen = llvm_get_vector_width(context->target.value()).cast(); default_sch_rules = ScheduleRule::DefaultRISCV(vlen); default_postprocs = Postproc::DefaultRISCV(); @@ -209,12 +209,12 @@ TVM_FFI_STATIC_INIT_BLOCK() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def_method("meta_schedule.SpaceGeneratorInitializeWithTuneContext", + .def_method("tvm.meta_schedule.SpaceGeneratorInitializeWithTuneContext", &SpaceGeneratorNode::InitializeWithTuneContext) - .def_method("meta_schedule.SpaceGeneratorGenerateDesignSpace", + .def_method("tvm.meta_schedule.SpaceGeneratorGenerateDesignSpace", &SpaceGeneratorNode::GenerateDesignSpace) - .def("meta_schedule.SpaceGeneratorPySpaceGenerator", SpaceGenerator::PySpaceGenerator) - .def_method("meta_schedule.SpaceGeneratorClone", &SpaceGeneratorNode::Clone); + .def("tvm.meta_schedule.SpaceGeneratorPySpaceGenerator", SpaceGenerator::PySpaceGenerator) + .def_method("tvm.meta_schedule.SpaceGeneratorClone", &SpaceGeneratorNode::Clone); } } // namespace meta_schedule diff --git a/src/meta_schedule/space_generator/space_generator_union.cc b/src/meta_schedule/space_generator/space_generator_union.cc index 026daa68a762..aa92b73feb25 100644 --- a/src/meta_schedule/space_generator/space_generator_union.cc +++ b/src/meta_schedule/space_generator/space_generator_union.cc @@ -62,8 +62,8 @@ class SpaceGeneratorUnionNode : public SpaceGeneratorNode { CloneRules(this, n.get()); return SpaceGenerator(n); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("meta_schedule.SpaceGeneratorUnion", SpaceGeneratorUnionNode, - SpaceGeneratorNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.meta_schedule.SpaceGeneratorUnion", + SpaceGeneratorUnionNode, SpaceGeneratorNode); }; /*! @@ -87,7 +87,7 @@ TVM_FFI_STATIC_INIT_BLOCK() { SpaceGeneratorUnionNode::RegisterReflection(); } TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("meta_schedule.SpaceGeneratorSpaceGeneratorUnion", + refl::GlobalDef().def("tvm.meta_schedule.SpaceGeneratorSpaceGeneratorUnion", SpaceGenerator::SpaceGeneratorUnion); } diff --git a/src/meta_schedule/task_scheduler/gradient_based.cc b/src/meta_schedule/task_scheduler/gradient_based.cc index babf521c280c..779aa84d4323 100644 --- a/src/meta_schedule/task_scheduler/gradient_based.cc +++ b/src/meta_schedule/task_scheduler/gradient_based.cc @@ -39,7 +39,7 @@ class GradientBasedNode final : public TaskSchedulerNode { .def_ro("alpha", &GradientBasedNode::alpha) .def_ro("window_size", &GradientBasedNode::window_size); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("meta_schedule.GradientBased", GradientBasedNode, + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.meta_schedule.GradientBased", GradientBasedNode, TaskSchedulerNode); public: @@ -147,7 +147,8 @@ TVM_FFI_STATIC_INIT_BLOCK() { GradientBasedNode::RegisterReflection(); } TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("meta_schedule.TaskSchedulerGradientBased", TaskScheduler::GradientBased); + refl::GlobalDef().def("tvm.meta_schedule.TaskSchedulerGradientBased", + TaskScheduler::GradientBased); } } // namespace meta_schedule diff --git a/src/meta_schedule/task_scheduler/round_robin.cc b/src/meta_schedule/task_scheduler/round_robin.cc index c3b95a7cc4c6..d49259f5c440 100644 --- a/src/meta_schedule/task_scheduler/round_robin.cc +++ b/src/meta_schedule/task_scheduler/round_robin.cc @@ -33,7 +33,8 @@ class RoundRobinNode final : public TaskSchedulerNode { namespace refl = tvm::ffi::reflection; refl::ObjectDef().def_ro("task_id", &RoundRobinNode::task_id); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("meta_schedule.RoundRobin", RoundRobinNode, TaskSchedulerNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.meta_schedule.RoundRobin", RoundRobinNode, + TaskSchedulerNode); protected: int NextTaskId() final { @@ -66,7 +67,7 @@ TVM_FFI_STATIC_INIT_BLOCK() { RoundRobinNode::RegisterReflection(); } TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("meta_schedule.TaskSchedulerRoundRobin", TaskScheduler::RoundRobin); + refl::GlobalDef().def("tvm.meta_schedule.TaskSchedulerRoundRobin", TaskScheduler::RoundRobin); } } // namespace meta_schedule diff --git a/src/meta_schedule/task_scheduler/task_scheduler.cc b/src/meta_schedule/task_scheduler/task_scheduler.cc index 85c6d71b4307..e1ca9ce510a6 100644 --- a/src/meta_schedule/task_scheduler/task_scheduler.cc +++ b/src/meta_schedule/task_scheduler/task_scheduler.cc @@ -374,13 +374,14 @@ void PyTaskSchedulerNode::Tune(ffi::Array tasks, ffi::Array mod, ffi::Optional target, ffi::Optional space_generator, ffi::Optional search_strategy, ffi::Optional task_name, @@ -78,9 +78,9 @@ TVM_FFI_STATIC_INIT_BLOCK() { return TuneContext(mod, target, space_generator, search_strategy, task_name, num_threads, rand_state, logger); }) - .def("meta_schedule._SHash2Hex", SHash2Hex) - .def_method("meta_schedule.TuneContextInitialize", &TuneContextNode::Initialize) - .def_method("meta_schedule.TuneContextClone", &TuneContextNode::Clone); + .def("tvm.meta_schedule._SHash2Hex", SHash2Hex) + .def_method("tvm.meta_schedule.TuneContextInitialize", &TuneContextNode::Initialize) + .def_method("tvm.meta_schedule.TuneContextClone", &TuneContextNode::Clone); } } // namespace meta_schedule diff --git a/src/meta_schedule/utils.h b/src/meta_schedule/utils.h index ee94b1d2ab5e..de6341c494cb 100644 --- a/src/meta_schedule/utils.h +++ b/src/meta_schedule/utils.h @@ -125,7 +125,7 @@ class PyLogMessage { */ inline bool using_ipython() { bool flag = false; - const auto f_using_ipython = tvm::ffi::Function::GetGlobal("meta_schedule.using_ipython"); + const auto f_using_ipython = tvm::ffi::Function::GetGlobal("tvm.meta_schedule.using_ipython"); if (f_using_ipython) { flag = (*f_using_ipython)().cast(); } @@ -138,7 +138,7 @@ inline bool using_ipython() { */ inline void print_interactive_table(const ffi::String& data) { const auto f_print_interactive_table = - tvm::ffi::Function::GetGlobal("meta_schedule.print_interactive_table"); + tvm::ffi::Function::GetGlobal("tvm.meta_schedule.print_interactive_table"); ICHECK(f_print_interactive_table.has_value()) << "Cannot find print_interactive_table function in registry."; (*f_print_interactive_table)(data); @@ -379,7 +379,7 @@ struct ThreadedTraceApply { inline int GetTargetNumCores(const Target& target) { int num_cores = target->GetAttr("num-cores").value_or(-1).IntValue(); if (num_cores == -1) { - static const auto f_cpu_count = tvm::ffi::Function::GetGlobal("meta_schedule.cpu_count"); + static const auto f_cpu_count = tvm::ffi::Function::GetGlobal("tvm.meta_schedule.cpu_count"); ICHECK(f_cpu_count.has_value()) << "ValueError: Cannot find the packed function \"meta_schedule._cpu_count\""; num_cores = (*f_cpu_count)(false).cast(); @@ -543,7 +543,7 @@ inline ScheduleRule GetDefaultAutoInline(const std::string& target_name) { LOG(FATAL) << "ValueError: Unsupported target: " << target_name; } for (const ScheduleRule& rule : rules) { - if (rule->GetTypeKey() == "meta_schedule.AutoInline") { + if (rule->GetTypeKey() == "tvm.meta_schedule.AutoInline") { return rule; } } diff --git a/src/node/reflection.cc b/src/node/reflection.cc index 2565a02b64a5..469441d2f2a5 100644 --- a/src/node/reflection.cc +++ b/src/node/reflection.cc @@ -54,7 +54,7 @@ void MakeNode(const ffi::PackedArgs& args, ffi::Any* rv) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def_packed("node.MakeNode", MakeNode); + refl::GlobalDef().def_packed("tvm.node.MakeNode", MakeNode); } } // namespace tvm diff --git a/src/node/repr_printer.cc b/src/node/repr_printer.cc index b60583c6ab85..855c6f2222fa 100644 --- a/src/node/repr_printer.cc +++ b/src/node/repr_printer.cc @@ -129,7 +129,7 @@ TVM_STATIC_IR_FUNCTOR(ReprPrinter, vtable) TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("node.AsRepr", [](ffi::Any obj) { + refl::GlobalDef().def("tvm.node.AsRepr", [](ffi::Any obj) { std::ostringstream os; os << obj; return os.str(); diff --git a/src/node/script_printer.cc b/src/node/script_printer.cc index 36c61d78b345..1e70ec305056 100644 --- a/src/node/script_printer.cc +++ b/src/node/script_printer.cc @@ -148,9 +148,9 @@ ffi::Array PrinterConfigNode::GetBuiltinKeywords() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("node.PrinterConfig", + .def("tvm.node.PrinterConfig", [](ffi::Map config_dict) { return PrinterConfig(config_dict); }) - .def("node.TVMScriptPrinterScript", TVMScriptPrinter::Script); + .def("tvm.node.TVMScriptPrinterScript", TVMScriptPrinter::Script); } } // namespace tvm diff --git a/src/node/serialization.cc b/src/node/serialization.cc index 2faf8d170bd8..d6c5de84862f 100644 --- a/src/node/serialization.cc +++ b/src/node/serialization.cc @@ -42,6 +42,6 @@ Any LoadJSON(std::string json_str) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("node.SaveJSON", SaveJSON).def("node.LoadJSON", LoadJSON); + refl::GlobalDef().def("tvm.node.SaveJSON", SaveJSON).def("tvm.node.LoadJSON", LoadJSON); } } // namespace tvm diff --git a/src/node/structural_equal.cc b/src/node/structural_equal.cc index e33d7c774687..56b013ff9b09 100644 --- a/src/node/structural_equal.cc +++ b/src/node/structural_equal.cc @@ -76,8 +76,8 @@ bool NodeStructuralEqualAdapter(const Any& lhs, const Any& rhs, bool assert_mode TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("node.StructuralEqual", NodeStructuralEqualAdapter) - .def("node.GetFirstStructuralMismatch", ffi::StructuralEqual::GetFirstMismatch); + .def("tvm.node.StructuralEqual", NodeStructuralEqualAdapter) + .def("tvm.node.GetFirstStructuralMismatch", ffi::StructuralEqual::GetFirstMismatch); } bool StructuralEqual::operator()(const ffi::Any& lhs, const ffi::Any& rhs, diff --git a/src/node/structural_hash.cc b/src/node/structural_hash.cc index aa02d097e966..18e1a2c0528b 100644 --- a/src/node/structural_hash.cc +++ b/src/node/structural_hash.cc @@ -43,25 +43,25 @@ namespace tvm { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("node.StructuralHash", + refl::GlobalDef().def("tvm.node.StructuralHash", [](const Any& object, bool map_free_vars) -> int64_t { return ffi::StructuralHash::Hash(object, map_free_vars); }); refl::TypeAttrDef() - .def("__data_to_json__", + .def("tvm.__data_to_json__", [](const ffi::ModuleObj* node) { std::string bytes = codegen::SerializeModuleToBytes(ffi::GetRef(node), /*export_dso*/ false); return ffi::Base64Encode(ffi::Bytes(bytes)); }) - .def("__data_from_json__", [](const ffi::String& base64_bytes) { + .def("tvm.__data_from_json__", [](const ffi::String& base64_bytes) { ffi::Bytes bytes = ffi::Base64Decode(base64_bytes); ffi::Module rtmod = codegen::DeserializeModuleFromBytes(bytes.operator std::string()); return rtmod; }); refl::TypeAttrDef() - .def("__data_to_json__", + .def("tvm.__data_to_json__", [](const runtime::Tensor::Container* node) { std::string blob; dmlc::MemoryStringStream mstrm(&blob); @@ -70,7 +70,7 @@ TVM_FFI_STATIC_INIT_BLOCK() { b64strm.Finish(); return ffi::String(blob); }) - .def("__data_from_json__", [](const std::string& blob) { + .def("tvm.__data_from_json__", [](const std::string& blob) { dmlc::MemoryStringStream mstrm(const_cast(&blob)); support::Base64InStream b64strm(&mstrm); b64strm.InitPosition(); diff --git a/src/relax/analysis/analysis.cc b/src/relax/analysis/analysis.cc index a61d548443a3..abb3d10d3658 100644 --- a/src/relax/analysis/analysis.cc +++ b/src/relax/analysis/analysis.cc @@ -205,11 +205,11 @@ bool ContainsImpureCall(const Expr& expr, const ffi::Optional& own_name) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("relax.analysis.free_vars", FreeVars) - .def("relax.analysis.bound_vars", BoundVars) - .def("relax.analysis.all_vars", AllVars) - .def("relax.analysis.all_global_vars", AllGlobalVars) - .def("relax.analysis.contains_impure_call", ContainsImpureCall); + .def("tvm.relax.analysis.free_vars", FreeVars) + .def("tvm.relax.analysis.bound_vars", BoundVars) + .def("tvm.relax.analysis.all_vars", AllVars) + .def("tvm.relax.analysis.all_global_vars", AllGlobalVars) + .def("tvm.relax.analysis.contains_impure_call", ContainsImpureCall); } } // namespace relax diff --git a/src/relax/analysis/computable_at_compile_time.cc b/src/relax/analysis/computable_at_compile_time.cc index 954240c19189..cdcf0e83b496 100644 --- a/src/relax/analysis/computable_at_compile_time.cc +++ b/src/relax/analysis/computable_at_compile_time.cc @@ -95,7 +95,7 @@ ffi::Array ComputableAtCompileTime(const Function& func) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.analysis.computable_at_compile_time", ComputableAtCompileTime); + refl::GlobalDef().def("tvm.relax.analysis.computable_at_compile_time", ComputableAtCompileTime); } } // namespace relax diff --git a/src/relax/analysis/detect_recursion.cc b/src/relax/analysis/detect_recursion.cc index 7b2a5f516e92..1fa5113903b4 100644 --- a/src/relax/analysis/detect_recursion.cc +++ b/src/relax/analysis/detect_recursion.cc @@ -395,7 +395,7 @@ tvm::ffi::Array> DetectRecursion(const IRModule& m) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.analysis.detect_recursion", DetectRecursion); + refl::GlobalDef().def("tvm.relax.analysis.detect_recursion", DetectRecursion); } } // namespace relax diff --git a/src/relax/analysis/layout_transformation.cc b/src/relax/analysis/layout_transformation.cc index 5bd5568a93a3..5bd759ab4ff1 100644 --- a/src/relax/analysis/layout_transformation.cc +++ b/src/relax/analysis/layout_transformation.cc @@ -617,7 +617,7 @@ ffi::Map> SuggestLayoutTransforms TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.analysis.suggest_layout_transforms", + refl::GlobalDef().def("tvm.relax.analysis.suggest_layout_transforms", [](PrimFunc fn, ffi::Array write_buffer_transformations) { return SuggestLayoutTransforms(fn, write_buffer_transformations); }); diff --git a/src/relax/analysis/struct_info_analysis.cc b/src/relax/analysis/struct_info_analysis.cc index 3952b1ce4a6e..c8e1b635798b 100644 --- a/src/relax/analysis/struct_info_analysis.cc +++ b/src/relax/analysis/struct_info_analysis.cc @@ -75,7 +75,7 @@ Type GetStaticType(const StructInfo& info) { return StaticTypeDeriver()(info); } TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.analysis.GetStaticType", + refl::GlobalDef().def("tvm.relax.analysis.GetStaticType", [](const StructInfo& info) { return GetStaticType(info); }); } @@ -293,7 +293,7 @@ StructInfo EraseToWellDefined(const StructInfo& info, ffi::Map shape_var_map, ffi::Map var_map) { return EraseToWellDefined(info, shape_var_map, var_map); }); } @@ -605,7 +605,7 @@ BaseCheckResult StructInfoBaseCheck(const StructInfo& base, const StructInfo& de TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.analysis.StructInfoBaseCheck", + refl::GlobalDef().def("tvm.relax.analysis.StructInfoBaseCheck", [](const StructInfo& base, const StructInfo& derived) -> int { return static_cast(StructInfoBaseCheck(base, derived)); }); @@ -618,7 +618,7 @@ bool IsBaseOf(const StructInfo& base, const StructInfo& derived, arith::Analyzer TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef().def( - "relax.StructInfoIsBaseOf", + "tvm.relax.StructInfoIsBaseOf", [](const StructInfo& base, const StructInfo& derived) { return IsBaseOf(base, derived); }); } @@ -970,7 +970,7 @@ StructInfo DeriveCallRetStructInfo(const FuncStructInfo& finfo, const Call& call TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.analysis.DeriveCallRetStructInfo", + refl::GlobalDef().def("tvm.relax.analysis.DeriveCallRetStructInfo", [](const FuncStructInfo& finfo, const Call& call, const BlockBuilder& ctx) { return DeriveCallRetStructInfo(finfo, call, ctx); }); @@ -1177,7 +1177,7 @@ StructInfo StructInfoLCA(const StructInfo& lhs, const StructInfo& rhs, arith::An TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef().def( - "relax.analysis.StructInfoLCA", + "tvm.relax.analysis.StructInfoLCA", [](const StructInfo& lhs, const StructInfo& rhs) { return StructInfoLCA(lhs, rhs); }); } @@ -1262,8 +1262,8 @@ ffi::Array DefinableTIRVarsInStructInfo(const StructInfo& sinfo) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("relax.analysis.TIRVarsInStructInfo", TIRVarsInStructInfo) - .def("relax.analysis.DefinableTIRVarsInStructInfo", DefinableTIRVarsInStructInfo); + .def("tvm.relax.analysis.TIRVarsInStructInfo", TIRVarsInStructInfo) + .def("tvm.relax.analysis.DefinableTIRVarsInStructInfo", DefinableTIRVarsInStructInfo); } class NonNegativeExpressionCollector : relax::StructInfoVisitor { @@ -1310,7 +1310,7 @@ ffi::Array CollectNonNegativeExpressions(const StructInfo& sinfo) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.analysis.CollectNonNegativeExpressions", + refl::GlobalDef().def("tvm.relax.analysis.CollectNonNegativeExpressions", CollectNonNegativeExpressions); } @@ -1463,8 +1463,8 @@ ffi::Array FreeSymbolicVars(const Expr& expr) { return SymbolicVarColl TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("relax.analysis.DefinedSymbolicVars", DefinedSymbolicVars) - .def("relax.analysis.FreeSymbolicVars", FreeSymbolicVars); + .def("tvm.relax.analysis.DefinedSymbolicVars", DefinedSymbolicVars) + .def("tvm.relax.analysis.FreeSymbolicVars", FreeSymbolicVars); } } // namespace relax diff --git a/src/relax/analysis/tir_op_pattern_kind.cc b/src/relax/analysis/tir_op_pattern_kind.cc index 58c47529a103..86ba8b532310 100644 --- a/src/relax/analysis/tir_op_pattern_kind.cc +++ b/src/relax/analysis/tir_op_pattern_kind.cc @@ -541,7 +541,7 @@ bool HasReshapePattern(const PrimFunc& func) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.analysis.has_reshape_pattern", HasReshapePattern); + refl::GlobalDef().def("tvm.relax.analysis.has_reshape_pattern", HasReshapePattern); } } // namespace relax diff --git a/src/relax/analysis/udchain.cc b/src/relax/analysis/udchain.cc index bbdbb7b644ef..9ad7a6f921fc 100644 --- a/src/relax/analysis/udchain.cc +++ b/src/relax/analysis/udchain.cc @@ -121,7 +121,7 @@ ffi::Map> DataflowBlockUseDef(const DataflowBlock& dfb) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.analysis.udchain", DataflowBlockUseDef); + refl::GlobalDef().def("tvm.relax.analysis.udchain", DataflowBlockUseDef); } VarUsageInfo CollectVarUsage(const Expr& expr) { return UDChain::Collect(expr); } diff --git a/src/relax/analysis/var2value.cc b/src/relax/analysis/var2value.cc index 17a439b408ff..08f2c15d4d22 100644 --- a/src/relax/analysis/var2value.cc +++ b/src/relax/analysis/var2value.cc @@ -61,7 +61,7 @@ ffi::Map AnalyzeVar2Value(const IRModule& m) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.analysis.get_var2val", + refl::GlobalDef().def("tvm.relax.analysis.get_var2val", [](const Function& f) { return AnalyzeVar2Value(f); }); } @@ -91,7 +91,7 @@ ffi::Map> NameToBinding(const Function& fn) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.analysis.name_to_binding", NameToBinding); + refl::GlobalDef().def("tvm.relax.analysis.name_to_binding", NameToBinding); } } // namespace relax diff --git a/src/relax/analysis/well_formed.cc b/src/relax/analysis/well_formed.cc index 0cfc9efad835..da4ee81e070e 100644 --- a/src/relax/analysis/well_formed.cc +++ b/src/relax/analysis/well_formed.cc @@ -652,7 +652,7 @@ bool WellFormed(ffi::Variant obj, bool check_struct_info) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.analysis.well_formed", WellFormed); + refl::GlobalDef().def("tvm.relax.analysis.well_formed", WellFormed); } } // namespace relax diff --git a/src/relax/backend/adreno/annotate_custom_storage.cc b/src/relax/backend/adreno/annotate_custom_storage.cc index 887b81872940..0917debd9a16 100644 --- a/src/relax/backend/adreno/annotate_custom_storage.cc +++ b/src/relax/backend/adreno/annotate_custom_storage.cc @@ -745,7 +745,7 @@ Pass AnnotateCustomMemoryScope(Target target) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.backend.adreno.transform.AnnotateCustomMemoryScope", + refl::GlobalDef().def("tvm.relax.backend.adreno.transform.AnnotateCustomMemoryScope", AnnotateCustomMemoryScope); } } // namespace transform diff --git a/src/relax/backend/adreno/fold_vdevice_scope_change.cc b/src/relax/backend/adreno/fold_vdevice_scope_change.cc index c59beae78e96..ab060f48ed22 100644 --- a/src/relax/backend/adreno/fold_vdevice_scope_change.cc +++ b/src/relax/backend/adreno/fold_vdevice_scope_change.cc @@ -183,7 +183,7 @@ Pass FoldVDeviceScopeChange() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.backend.adreno.transform.FoldVDeviceScopeChange", + refl::GlobalDef().def("tvm.relax.backend.adreno.transform.FoldVDeviceScopeChange", FoldVDeviceScopeChange); } } // namespace transform diff --git a/src/relax/backend/contrib/clml/codegen.cc b/src/relax/backend/contrib/clml/codegen.cc index 362621f4238e..3cdf0abaa72d 100644 --- a/src/relax/backend/contrib/clml/codegen.cc +++ b/src/relax/backend/contrib/clml/codegen.cc @@ -48,7 +48,7 @@ struct OpenCLMLCompilerConfigNode : public AttrsNodeReflAdapter OpenCLMLCompiler(ffi::Array functions, serializer.serialize(func); std::string graph_json = serializer.GetJSON(); auto constant_names = serializer.GetConstantNames(); - const auto pf = tvm::ffi::Function::GetGlobalRequired("runtime.clml_runtime_create"); + const auto pf = tvm::ffi::Function::GetGlobalRequired("tvm.runtime.clml_runtime_create"); std::string func_name = GetExtSymbol(func); VLOG(1) << "Creating clml ffi::Module for '" << func_name << "'"; compiled_functions.push_back(pf(func_name, graph_json, constant_names).cast()); @@ -331,7 +331,7 @@ ffi::Array OpenCLMLCompiler(ffi::Array functions, TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.ext.openclml", OpenCLMLCompiler); + refl::GlobalDef().def("tvm.relax.ext.openclml", OpenCLMLCompiler); } /*! @@ -361,8 +361,8 @@ Integer GetOpenCLMLVersion() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("relax.is_openclml_runtime_enabled", IsOpenCLMLRuntimeEnabled) - .def("relax.get_openclml_version", GetOpenCLMLVersion); + .def("tvm.relax.is_openclml_runtime_enabled", IsOpenCLMLRuntimeEnabled) + .def("tvm.relax.get_openclml_version", GetOpenCLMLVersion); } } // namespace contrib diff --git a/src/relax/backend/contrib/cublas/codegen.cc b/src/relax/backend/contrib/cublas/codegen.cc index ab8336bfd5b2..a6709ca6e1a7 100644 --- a/src/relax/backend/contrib/cublas/codegen.cc +++ b/src/relax/backend/contrib/cublas/codegen.cc @@ -119,7 +119,7 @@ ffi::Array CublasCompiler(ffi::Array functions, serializer.serialize(func); auto graph_json = serializer.GetJSON(); auto constant_names = serializer.GetConstantNames(); - const auto pf = tvm::ffi::Function::GetGlobalRequired("runtime.CublasJSONRuntimeCreate"); + const auto pf = tvm::ffi::Function::GetGlobalRequired("tvm.runtime.CublasJSONRuntimeCreate"); auto func_name = GetExtSymbol(func); compiled_functions.push_back(pf(func_name, graph_json, constant_names).cast()); } @@ -129,7 +129,7 @@ ffi::Array CublasCompiler(ffi::Array functions, TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.ext.cublas", CublasCompiler); + refl::GlobalDef().def("tvm.relax.ext.cublas", CublasCompiler); } } // namespace contrib diff --git a/src/relax/backend/contrib/cudnn/codegen.cc b/src/relax/backend/contrib/cudnn/codegen.cc index 0773a627accd..cc24d7fb08bc 100644 --- a/src/relax/backend/contrib/cudnn/codegen.cc +++ b/src/relax/backend/contrib/cudnn/codegen.cc @@ -143,7 +143,7 @@ ffi::Array cuDNNCompiler(ffi::Array functions, serializer.serialize(func); auto graph_json = serializer.GetJSON(); auto constant_names = serializer.GetConstantNames(); - const auto pf = tvm::ffi::Function::GetGlobalRequired("runtime.cuDNNJSONRuntimeCreate"); + const auto pf = tvm::ffi::Function::GetGlobalRequired("tvm.runtime.cuDNNJSONRuntimeCreate"); auto func_name = GetExtSymbol(func); compiled_functions.push_back(pf(func_name, graph_json, constant_names).cast()); } @@ -153,7 +153,7 @@ ffi::Array cuDNNCompiler(ffi::Array functions, TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.ext.cudnn", cuDNNCompiler); + refl::GlobalDef().def("tvm.relax.ext.cudnn", cuDNNCompiler); } } // namespace contrib diff --git a/src/relax/backend/contrib/cutlass/codegen.cc b/src/relax/backend/contrib/cutlass/codegen.cc index 69da3d6058ed..02bf5058e9bd 100644 --- a/src/relax/backend/contrib/cutlass/codegen.cc +++ b/src/relax/backend/contrib/cutlass/codegen.cc @@ -68,7 +68,7 @@ ffi::Module Finalize(const std::string& code, const ffi::Array& fun default_headers << "#include \n"; default_headers << "#include \n"; - const auto pf = tvm::ffi::Function::GetGlobalRequired("runtime.CSourceModuleCreate"); + const auto pf = tvm::ffi::Function::GetGlobalRequired("tvm.runtime.CSourceModuleCreate"); VLOG(1) << "Generated CUTLASS code:" << std::endl << code; return pf(default_headers.str() + code, "cu", func_names, /*const_vars=*/ffi::Array()) @@ -86,7 +86,7 @@ class CodegenResultNode : public Object { .def_ro("code", &CodegenResultNode::code) .def_ro("headers", &CodegenResultNode::headers); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("contrib.cutlass.CodegenResult", CodegenResultNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.contrib.cutlass.CodegenResult", CodegenResultNode, Object); }; class CodegenResult : public ObjectRef { @@ -105,7 +105,7 @@ TVM_FFI_STATIC_INIT_BLOCK() { CodegenResultNode::RegisterReflection(); } TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("contrib.cutlass.CodegenResult", + refl::GlobalDef().def("tvm.contrib.cutlass.CodegenResult", [](ffi::String code, ffi::Array headers) { return CodegenResult(code, headers); }); @@ -135,7 +135,7 @@ GenerateBodyOutput GenerateBody(const std::string& func_name, const std::string& decl_stream << ");"; const auto instantiate_template_func = - tvm::ffi::Function::GetGlobalRequired("contrib.cutlass.instantiate_template"); + tvm::ffi::Function::GetGlobalRequired("tvm.contrib.cutlass.instantiate_template"); CodegenResult codegen_res = instantiate_template_func(func_name, attrs, func_args).cast(); ret.decl = codegen_res->code; @@ -375,7 +375,7 @@ class CutlassModuleCodegen { ffi::Array CUTLASSCompiler(ffi::Array functions, ffi::Map options, ffi::Map /*unused*/) { - const auto tune_func = tvm::ffi::Function::GetGlobal("contrib.cutlass.tune_relax_function"); + const auto tune_func = tvm::ffi::Function::GetGlobal("tvm.contrib.cutlass.tune_relax_function"); ICHECK(tune_func.has_value()) << "The packed function contrib.cutlass.tune_relax_function not found, " "please import tvm.contrib.cutlass.build"; @@ -383,7 +383,7 @@ ffi::Array CUTLASSCompiler(ffi::Array functions, auto annotated_functions = (*tune_func)(functions, options).cast>(); auto source_mod = CutlassModuleCodegen().CreateCSourceModule(annotated_functions, options); - const auto pf = tvm::ffi::Function::GetGlobal("contrib.cutlass.compile"); + const auto pf = tvm::ffi::Function::GetGlobal("tvm.contrib.cutlass.compile"); ICHECK(pf.has_value()) << "The packed function contrib.cutlass.compile not found, please import " "tvm.contrib.cutlass.build"; ffi::Module cutlass_mod = (*pf)(source_mod, options).cast(); @@ -393,7 +393,7 @@ ffi::Array CUTLASSCompiler(ffi::Array functions, TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.ext.cutlass", CUTLASSCompiler); + refl::GlobalDef().def("tvm.relax.ext.cutlass", CUTLASSCompiler); } } // namespace contrib diff --git a/src/relax/backend/contrib/dnnl/codegen.cc b/src/relax/backend/contrib/dnnl/codegen.cc index e903ed885296..4127ff21211f 100644 --- a/src/relax/backend/contrib/dnnl/codegen.cc +++ b/src/relax/backend/contrib/dnnl/codegen.cc @@ -91,7 +91,7 @@ ffi::Array DNNLCompiler(ffi::Array functions, serializer.serialize(func); auto graph_json = serializer.GetJSON(); auto constant_names = serializer.GetConstantNames(); - const auto pf = tvm::ffi::Function::GetGlobalRequired("runtime.DNNLJSONRuntimeCreate"); + const auto pf = tvm::ffi::Function::GetGlobalRequired("tvm.runtime.DNNLJSONRuntimeCreate"); auto func_name = GetExtSymbol(func); compiled_functions.push_back(pf(func_name, graph_json, constant_names).cast()); } @@ -101,7 +101,7 @@ ffi::Array DNNLCompiler(ffi::Array functions, TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.ext.dnnl", DNNLCompiler); + refl::GlobalDef().def("tvm.relax.ext.dnnl", DNNLCompiler); } } // namespace contrib diff --git a/src/relax/backend/contrib/hipblas/codegen.cc b/src/relax/backend/contrib/hipblas/codegen.cc index 09a0f0026789..71ba0c2c4021 100644 --- a/src/relax/backend/contrib/hipblas/codegen.cc +++ b/src/relax/backend/contrib/hipblas/codegen.cc @@ -97,7 +97,7 @@ ffi::Array HipblasCompiler(ffi::Array functions, serializer.serialize(func); auto graph_json = serializer.GetJSON(); auto constant_names = serializer.GetConstantNames(); - const auto pf = tvm::ffi::Function::GetGlobalRequired("runtime.HipblasJSONRuntimeCreate"); + const auto pf = tvm::ffi::Function::GetGlobalRequired("tvm.runtime.HipblasJSONRuntimeCreate"); auto func_name = GetExtSymbol(func); compiled_functions.push_back(pf(func_name, graph_json, constant_names).cast()); } @@ -107,7 +107,7 @@ ffi::Array HipblasCompiler(ffi::Array functions, TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.ext.hipblas", HipblasCompiler); + refl::GlobalDef().def("tvm.relax.ext.hipblas", HipblasCompiler); } } // namespace contrib diff --git a/src/relax/backend/contrib/nnapi/codegen.cc b/src/relax/backend/contrib/nnapi/codegen.cc index 92933ba070b9..9ebde8d1c312 100644 --- a/src/relax/backend/contrib/nnapi/codegen.cc +++ b/src/relax/backend/contrib/nnapi/codegen.cc @@ -259,7 +259,7 @@ ffi::Array NNAPICompiler(ffi::Array functions, serializer.serialize(func); auto graph_json = serializer.GetJSON(); auto constant_names = serializer.GetConstantNames(); - const auto pf = tvm::ffi::Function::GetGlobalRequired("runtime.nnapi_runtime_create"); + const auto pf = tvm::ffi::Function::GetGlobalRequired("tvm.runtime.nnapi_runtime_create"); auto func_name = GetExtSymbol(func); auto result = pf(func_name, graph_json, constant_names); tvm::ffi::Module mod = result.cast(); @@ -271,7 +271,7 @@ ffi::Array NNAPICompiler(ffi::Array functions, TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.ext.nnapi", NNAPICompiler); + refl::GlobalDef().def("tvm.relax.ext.nnapi", NNAPICompiler); } } // namespace contrib diff --git a/src/relax/backend/contrib/tensorrt/codegen.cc b/src/relax/backend/contrib/tensorrt/codegen.cc index 0adeb2d47570..0f8585116c48 100644 --- a/src/relax/backend/contrib/tensorrt/codegen.cc +++ b/src/relax/backend/contrib/tensorrt/codegen.cc @@ -70,7 +70,7 @@ struct TensorRTCompilerConfigNode : public AttrsNodeReflAdapter TensorRTCompiler(ffi::Array functions, std::string graph_json = serializer.GetJSON(); VLOG(1) << "TensorRT JSON:" << std::endl << graph_json; auto constant_names = serializer.GetConstantNames(); - const auto pf = tvm::ffi::Function::GetGlobalRequired("runtime.tensorrt_runtime_create"); + const auto pf = tvm::ffi::Function::GetGlobalRequired("tvm.runtime.tensorrt_runtime_create"); std::string func_name = GetExtSymbol(func); VLOG(1) << "Creating tensorrt ffi::Module for '" << func_name << "'"; compiled_functions.push_back(pf(func_name, graph_json, constant_names).cast()); @@ -246,7 +246,7 @@ ffi::Array TensorRTCompiler(ffi::Array functions, TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.ext.tensorrt", TensorRTCompiler); + refl::GlobalDef().def("tvm.relax.ext.tensorrt", TensorRTCompiler); } /*! @@ -277,8 +277,8 @@ ffi::Array GetTensorRTVersion() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("relax.is_tensorrt_runtime_enabled", IsTensorRTRuntimeEnabled) - .def("relax.get_tensorrt_version", GetTensorRTVersion); + .def("tvm.relax.is_tensorrt_runtime_enabled", IsTensorRTRuntimeEnabled) + .def("tvm.relax.get_tensorrt_version", GetTensorRTVersion); } } // namespace contrib diff --git a/src/relax/backend/contrib/utils.cc b/src/relax/backend/contrib/utils.cc index 1840986c019d..218d959c60d8 100644 --- a/src/relax/backend/contrib/utils.cc +++ b/src/relax/backend/contrib/utils.cc @@ -78,7 +78,7 @@ bool EndsWithPattern(const std::string& str, const std::string& pattern) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.contrib.extract_arg_idx", ExtractArgIdx); + refl::GlobalDef().def("tvm.relax.contrib.extract_arg_idx", ExtractArgIdx); } } // namespace backend diff --git a/src/relax/backend/pattern_registry.cc b/src/relax/backend/pattern_registry.cc index c11ef6a35e07..1eee0622b24d 100644 --- a/src/relax/backend/pattern_registry.cc +++ b/src/relax/backend/pattern_registry.cc @@ -72,10 +72,10 @@ ffi::Optional GetPattern(const ffi::String& pattern_name) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("relax.backend.RegisterPatterns", RegisterPatterns) - .def("relax.backend.RemovePatterns", RemovePatterns) - .def("relax.backend.GetPatternsWithPrefix", GetPatternsWithPrefix) - .def("relax.backend.GetPattern", GetPattern); + .def("tvm.relax.backend.RegisterPatterns", RegisterPatterns) + .def("tvm.relax.backend.RemovePatterns", RemovePatterns) + .def("tvm.relax.backend.GetPatternsWithPrefix", GetPatternsWithPrefix) + .def("tvm.relax.backend.GetPattern", GetPattern); } } // namespace backend diff --git a/src/relax/backend/task_extraction.cc b/src/relax/backend/task_extraction.cc index 71c024b9d7a0..8e1677d1bf5a 100644 --- a/src/relax/backend/task_extraction.cc +++ b/src/relax/backend/task_extraction.cc @@ -143,8 +143,8 @@ class TaskExtractor : public ExprVisitor { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.backend.MetaScheduleExtractTask", [](IRModule mod, Target target, - ffi::String mod_eq_name) { + refl::GlobalDef().def("tvm.relax.backend.MetaScheduleExtractTask", [](IRModule mod, Target target, + ffi::String mod_eq_name) { return TaskExtractor::ExtractTask(std::move(mod), std::move(target), std::move(mod_eq_name)); }); } diff --git a/src/relax/backend/vm/codegen_vm.cc b/src/relax/backend/vm/codegen_vm.cc index e2d9b5b068b7..5ae6bde13aed 100644 --- a/src/relax/backend/vm/codegen_vm.cc +++ b/src/relax/backend/vm/codegen_vm.cc @@ -76,7 +76,7 @@ class CodeGenVM : public ExprFunctor { return arg; } else { RegName dst_reg = NewRegister(); - builder_->EmitCall("vm.builtin.copy", {arg}, dst_reg); + builder_->EmitCall("tvm.vm.builtin.copy", {arg}, dst_reg); return Instruction::Arg::Register(dst_reg); } } @@ -119,7 +119,7 @@ class CodeGenVM : public ExprFunctor { // "del" operator. These bindings may be removable by using // relax.transform.CanonicalizeBindings earlier in lowering. RegName new_reg = NewRegister(); - builder_->EmitCall("vm.builtin.copy", {value}, new_reg); + builder_->EmitCall("tvm.vm.builtin.copy", {value}, new_reg); value = Instruction::Arg::Register(new_reg); } @@ -168,7 +168,7 @@ class CodeGenVM : public ExprFunctor { // Reserve a register for cond RegName cond_reg = NewRegister(); - builder_->EmitCall("vm.builtin.read_if_cond", {cond_value}, cond_reg); + builder_->EmitCall("tvm.vm.builtin.read_if_cond", {cond_value}, cond_reg); // obtain the temp exec in progress. vm::VMExecutable* exec = builder_->exec(); @@ -182,7 +182,7 @@ class CodeGenVM : public ExprFunctor { // Reserve a register for return size_t merge_register = NewRegister(); // Copy the output from true branch to merge register - builder_->EmitCall("vm.builtin.copy", {true_value}, merge_register); + builder_->EmitCall("tvm.vm.builtin.copy", {true_value}, merge_register); // Record the offset of Goto instruction size_t goto_offset = exec->instr_offset.size(); @@ -194,7 +194,7 @@ class CodeGenVM : public ExprFunctor { Instruction::Arg false_value = this->VisitExpr(ife->false_branch); // Copy the output data of false branch to merge register - builder_->EmitCall("vm.builtin.copy", {false_value}, merge_register); + builder_->EmitCall("tvm.vm.builtin.copy", {false_value}, merge_register); // Update the offsets of the If instruction emitted above // Jump to the behind of the next goto instruction @@ -256,7 +256,7 @@ class CodeGenVM : public ExprFunctor { args.push_back(this->VisitExpr(arg)); } size_t dst_register = NewRegister(); - builder_->EmitCall("vm.builtin.make_tuple", args, dst_register); + builder_->EmitCall("tvm.vm.builtin.make_tuple", args, dst_register); return Instruction::Arg::Register(dst_register); } @@ -268,7 +268,7 @@ class CodeGenVM : public ExprFunctor { args.push_back(builder_->ConvertConstant(expr->index)); size_t dst_register = NewRegister(); - builder_->EmitCall("vm.builtin.tuple_getitem", args, dst_register); + builder_->EmitCall("tvm.vm.builtin.tuple_getitem", args, dst_register); return Instruction::Arg::Register(dst_register); } @@ -329,7 +329,7 @@ class CodeGenVM : public ExprFunctor { for (auto arg : call_node->args) { args.push_back(this->VisitExpr(arg)); } - builder_->EmitCall("vm.builtin.alloc_storage", args, dst_reg); + builder_->EmitCall("tvm.vm.builtin.alloc_storage", args, dst_reg); } void EmitAllocTensor(const Call& call_node, RegName dst_reg) { @@ -339,7 +339,7 @@ class CodeGenVM : public ExprFunctor { for (Expr arg : call_node->args) { args.push_back(this->VisitExpr(arg)); } - builder_->EmitCall("vm.builtin.alloc_tensor", args, dst_reg); + builder_->EmitCall("tvm.vm.builtin.alloc_tensor", args, dst_reg); } RegName EmitKillObject(const Call& call_node) { @@ -350,7 +350,7 @@ class CodeGenVM : public ExprFunctor { << "but argument " << call_node->args[0] << " produced VM instruction of type " << arg.kind(); RegName dst_reg = arg.value(); - builder_->EmitCall("vm.builtin.null_value", {}, dst_reg); + builder_->EmitCall("tvm.vm.builtin.null_value", {}, dst_reg); return dst_reg; } @@ -378,7 +378,7 @@ class CodeGenVM : public ExprFunctor { std::vector closure_args = { Instruction::Arg::Register(Instruction::kVMRegister), func}; std::copy(args.begin(), args.end(), std::back_inserter(closure_args)); - builder_->EmitCall("vm.builtin.invoke_closure", closure_args, dst_reg); + builder_->EmitCall("tvm.vm.builtin.invoke_closure", closure_args, dst_reg); } } @@ -428,7 +428,7 @@ IRModule VMCodeGen(ExecBuilder exec_builder, IRModule mod) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.VMCodeGen", VMCodeGen); + refl::GlobalDef().def("tvm.relax.VMCodeGen", VMCodeGen); } /*! @@ -497,7 +497,7 @@ ffi::Module VMLink(ExecBuilder builder, Target target, ffi::Optional(const Expr&)> { tir::Stmt body = WithNewScope([&]() { ffi::Optional ret = ExprFunctor::VisitExpr(func->body); if (ret.defined()) { - this->EmitCallPacked("vm.builtin.copy", {ret.value()}, ret_reg); + this->EmitCallPacked("tvm.vm.builtin.copy", {ret.value()}, ret_reg); } }); @@ -211,7 +211,7 @@ class CodeGenVMTIR : public ExprFunctor(const Expr&)> { // "del" operator. These bindings may be removable by using // relax.transform.CanonicalizeBindings earlier in lowering. auto new_reg = NewRegister(); - EmitCallPacked("vm.builtin.copy", {value.value()}, new_reg); + EmitCallPacked("tvm.vm.builtin.copy", {value.value()}, new_reg); value = RegListGet(new_reg); } @@ -259,15 +259,15 @@ class CodeGenVMTIR : public ExprFunctor(const Expr&)> { PrimExpr cond_value = this->VisitExpr(op->cond).value(); cond_value = tir::Call(DataType::Bool(), tir::builtin::tvm_call_packed(), - {tir::StringImm("vm.builtin.read_if_cond"), cond_value}); + {tir::StringImm("tvm.vm.builtin.read_if_cond"), cond_value}); tir::Stmt true_branch = WithNewScope([&]() { PrimExpr true_value = this->VisitExpr(op->true_branch).value(); - this->EmitCallPacked("vm.builtin.copy", {true_value}, merge_register); + this->EmitCallPacked("tvm.vm.builtin.copy", {true_value}, merge_register); }); tir::Stmt false_branch = WithNewScope([&]() { PrimExpr false_value = this->VisitExpr(op->false_branch).value(); - this->EmitCallPacked("vm.builtin.copy", {false_value}, merge_register); + this->EmitCallPacked("tvm.vm.builtin.copy", {false_value}, merge_register); }); this->EmitStmt(tir::IfThenElse(cond_value, true_branch, false_branch)); return RegListGet(merge_register); @@ -313,7 +313,7 @@ class CodeGenVMTIR : public ExprFunctor(const Expr&)> { args.push_back(this->VisitExpr(arg).value()); } int32_t dst_register = NewRegister(); - this->EmitCallPacked("vm.builtin.make_tuple", args, dst_register); + this->EmitCallPacked("tvm.vm.builtin.make_tuple", args, dst_register); return RegListGet(dst_register); } @@ -324,7 +324,7 @@ class CodeGenVMTIR : public ExprFunctor(const Expr&)> { args.push_back(ConstInt64(expr->index)); int64_t dst_register = NewRegister(); - this->EmitCallPacked("vm.builtin.tuple_getitem", args, dst_register); + this->EmitCallPacked("tvm.vm.builtin.tuple_getitem", args, dst_register); return RegListGet(dst_register); } @@ -397,7 +397,7 @@ class CodeGenVMTIR : public ExprFunctor(const Expr&)> { for (Expr arg : call_node->args) { args.push_back(this->VisitExpr(arg).value()); } - this->EmitCallPacked("vm.builtin.alloc_storage", args, dst_reg); + this->EmitCallPacked("tvm.vm.builtin.alloc_storage", args, dst_reg); } void EmitAllocTensor(const Call& call_node, int64_t dst_reg) { @@ -407,7 +407,7 @@ class CodeGenVMTIR : public ExprFunctor(const Expr&)> { for (Expr arg : call_node->args) { args.push_back(this->VisitExpr(arg).value()); } - this->EmitCallPacked("vm.builtin.alloc_tensor", args, dst_reg); + this->EmitCallPacked("tvm.vm.builtin.alloc_tensor", args, dst_reg); } int64_t EmitKillObject(const Call& call_node) { @@ -425,7 +425,7 @@ class CodeGenVMTIR : public ExprFunctor(const Expr&)> { ICHECK(p_dst_reg->dtype == DataType::Int(32)); int64_t dst_reg = p_dst_reg->value; - this->EmitCallPacked("vm.builtin.null_value", {}, dst_reg); + this->EmitCallPacked("tvm.vm.builtin.null_value", {}, dst_reg); return dst_reg; } @@ -469,7 +469,7 @@ class CodeGenVMTIR : public ExprFunctor(const Expr&)> { for (auto arg : args) { all_args.push_back(arg); } - this->EmitCallPacked("vm.builtin.invoke_closure", all_args, dst_reg); + this->EmitCallPacked("tvm.vm.builtin.invoke_closure", all_args, dst_reg); } } @@ -534,7 +534,7 @@ IRModule VMTIRCodeGen(ExecBuilder exec_builder, IRModule mod) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.VMTIRCodeGen", VMTIRCodeGen); + refl::GlobalDef().def("tvm.relax.VMTIRCodeGen", VMTIRCodeGen); } } // namespace codegen_vm diff --git a/src/relax/backend/vm/exec_builder.cc b/src/relax/backend/vm/exec_builder.cc index b893b48830ce..c8cbe3a72ca2 100644 --- a/src/relax/backend/vm/exec_builder.cc +++ b/src/relax/backend/vm/exec_builder.cc @@ -322,25 +322,25 @@ void ExecBuilderNode::Formalize() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("relax.ExecBuilderCreate", ExecBuilderNode::Create) - .def_packed("relax.ExecBuilderConvertConstant", + .def("tvm.relax.ExecBuilderCreate", ExecBuilderNode::Create) + .def_packed("tvm.relax.ExecBuilderConvertConstant", [](ffi::PackedArgs args, ffi::Any* ret) { ExecBuilder builder = args[0].cast(); ffi::Any rt; rt = args[1]; *ret = builder->ConvertConstant(rt).data(); }) - .def("relax.ExecBuilderEmitFunction", + .def("tvm.relax.ExecBuilderEmitFunction", [](ExecBuilder builder, ffi::String func, int64_t num_inputs, ffi::Optional> param_names) { builder->EmitFunction(func, num_inputs, param_names); }) - .def_method("relax.ExecBuilderEndFunction", &ExecBuilderNode::EndFunction) - .def("relax.ExecBuilderDeclareFunction", + .def_method("tvm.relax.ExecBuilderEndFunction", &ExecBuilderNode::EndFunction) + .def("tvm.relax.ExecBuilderDeclareFunction", [](ExecBuilder builder, ffi::String name, int32_t kind) { builder->DeclareFunction(name, static_cast(kind)); }) - .def("relax.ExecBuilderEmitCall", + .def("tvm.relax.ExecBuilderEmitCall", [](ExecBuilder builder, ffi::String name, ffi::Array args, int64_t dst) { std::vector args_; for (size_t i = 0; i < args.size(); ++i) { @@ -349,31 +349,31 @@ TVM_FFI_STATIC_INIT_BLOCK() { auto dst_ = Instruction::Arg::Register(dst); builder->EmitCall(name, args_, dst_.value()); }) - .def("relax.ExecBuilderEmitRet", + .def("tvm.relax.ExecBuilderEmitRet", [](ExecBuilder builder, int64_t data) { builder->EmitRet(Instruction::Arg::FromData(data)); }) - .def_method("relax.ExecBuilderEmitGoto", &ExecBuilderNode::EmitGoto) - .def("relax.ExecBuilderEmitIf", + .def_method("tvm.relax.ExecBuilderEmitGoto", &ExecBuilderNode::EmitGoto) + .def("tvm.relax.ExecBuilderEmitIf", [](ExecBuilder builder, int64_t data, vm::Index false_offset) { builder->EmitIf(Instruction::Arg::FromData(data), false_offset); }) - .def("relax.ExecBuilderR", + .def("tvm.relax.ExecBuilderR", [](ExecBuilder builder, int64_t value) { return Instruction::Arg::Register(value).data(); }) - .def("relax.ExecBuilderImm", + .def("tvm.relax.ExecBuilderImm", [](ExecBuilder builder, int64_t value) { return Instruction::Arg::Immediate(value).data(); }) - .def("relax.ExecBuilderC", + .def("tvm.relax.ExecBuilderC", [](ExecBuilder builder, int64_t value) { return Instruction::Arg::ConstIdx(value).data(); }) .def( - "relax.ExecBuilderF", + "tvm.relax.ExecBuilderF", [](ExecBuilder builder, ffi::String value) { return builder->GetFunction(value).data(); }) - .def("relax.ExecBuilderGet", [](ExecBuilder builder) { + .def("tvm.relax.ExecBuilderGet", [](ExecBuilder builder) { ObjectPtr p_exec = builder->Get(); return ffi::Module(p_exec); }); diff --git a/src/relax/backend/vm/lower_runtime_builtin.cc b/src/relax/backend/vm/lower_runtime_builtin.cc index 71b8413e9889..125e3f8d4782 100644 --- a/src/relax/backend/vm/lower_runtime_builtin.cc +++ b/src/relax/backend/vm/lower_runtime_builtin.cc @@ -231,14 +231,14 @@ class LowerRuntimeBuiltinMutator : public ExprMutator { const Op& vm_kill_object_op_ = Op::Get("relax.vm.kill_object"); // Function to compute allocated shape. const ExternFunc builtin_compute_alloc_shape_{"vm.builtin.compute_alloc_shape"}; - const ExternFunc builtin_call_tir_dyn_{"vm.builtin.call_tir_dyn"}; - const ExternFunc builtin_reshape_{"vm.builtin.reshape"}; - const ExternFunc builtin_shape_of_{"vm.builtin.shape_of"}; - const ExternFunc builtin_tensor_to_shape_{"vm.builtin.tensor_to_shape"}; - const ExternFunc builtin_call_py_func_{"vm.builtin.call_py_func"}; - const ExternFunc builtin_to_device_{"vm.builtin.to_device"}; - const ExternFunc builtin_make_closure_{"vm.builtin.make_closure"}; - const ExternFunc builtin_invoke_closure_{"vm.builtin.invoke_closure"}; + const ExternFunc builtin_call_tir_dyn_{"tvm.vm.builtin.call_tir_dyn"}; + const ExternFunc builtin_reshape_{"tvm.vm.builtin.reshape"}; + const ExternFunc builtin_shape_of_{"tvm.vm.builtin.shape_of"}; + const ExternFunc builtin_tensor_to_shape_{"tvm.vm.builtin.tensor_to_shape"}; + const ExternFunc builtin_call_py_func_{"tvm.vm.builtin.call_py_func"}; + const ExternFunc builtin_to_device_{"tvm.vm.builtin.to_device"}; + const ExternFunc builtin_make_closure_{"tvm.vm.builtin.make_closure"}; + const ExternFunc builtin_invoke_closure_{"tvm.vm.builtin.invoke_closure"}; }; Expr LowerRuntimeBuiltin(const Expr& e) { return LowerRuntimeBuiltinMutator().VisitExpr(e); } @@ -254,7 +254,7 @@ Pass LowerRuntimeBuiltin() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.transform.LowerRuntimeBuiltin", LowerRuntimeBuiltin); + refl::GlobalDef().def("tvm.relax.transform.LowerRuntimeBuiltin", LowerRuntimeBuiltin); } } // namespace transform diff --git a/src/relax/backend/vm/vm_shape_lower.cc b/src/relax/backend/vm/vm_shape_lower.cc index bbc227d1d559..63f1cf2614f8 100644 --- a/src/relax/backend/vm/vm_shape_lower.cc +++ b/src/relax/backend/vm/vm_shape_lower.cc @@ -793,17 +793,17 @@ class VMShapeLowerMutator const StructInfo object_sinfo_ = ObjectStructInfo(); const StructInfo void_sinfo_ = TupleStructInfo(ffi::Array({})); // check function - const ExternFunc builtin_alloc_shape_heap_{"vm.builtin.alloc_shape_heap"}; - const ExternFunc builtin_match_shape_{"vm.builtin.match_shape"}; - const ExternFunc builtin_make_shape_{"vm.builtin.make_shape"}; - const ExternFunc builtin_check_shape_info_{"vm.builtin.check_shape_info"}; - const ExternFunc builtin_match_prim_value_{"vm.builtin.match_prim_value"}; - const ExternFunc builtin_make_prim_value_{"vm.builtin.make_prim_value"}; - const ExternFunc builtin_check_prim_value_info_{"vm.builtin.check_prim_value_info"}; - const ExternFunc builtin_check_tensor_info_{"vm.builtin.check_tensor_info"}; - const ExternFunc builtin_check_tuple_info_{"vm.builtin.check_tuple_info"}; - const ExternFunc builtin_check_func_info_{"vm.builtin.check_func_info"}; - const ExternFunc builtin_tuple_getitem_{"vm.builtin.tuple_getitem"}; + const ExternFunc builtin_alloc_shape_heap_{"tvm.vm.builtin.alloc_shape_heap"}; + const ExternFunc builtin_match_shape_{"tvm.vm.builtin.match_shape"}; + const ExternFunc builtin_make_shape_{"tvm.vm.builtin.make_shape"}; + const ExternFunc builtin_check_shape_info_{"tvm.vm.builtin.check_shape_info"}; + const ExternFunc builtin_match_prim_value_{"tvm.vm.builtin.match_prim_value"}; + const ExternFunc builtin_make_prim_value_{"tvm.vm.builtin.make_prim_value"}; + const ExternFunc builtin_check_prim_value_info_{"tvm.vm.builtin.check_prim_value_info"}; + const ExternFunc builtin_check_tensor_info_{"tvm.vm.builtin.check_tensor_info"}; + const ExternFunc builtin_check_tuple_info_{"tvm.vm.builtin.check_tuple_info"}; + const ExternFunc builtin_check_func_info_{"tvm.vm.builtin.check_func_info"}; + const ExternFunc builtin_tuple_getitem_{"tvm.vm.builtin.tuple_getitem"}; }; namespace transform { @@ -817,7 +817,7 @@ Pass VMShapeLower(bool emit_err_ctx) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.transform.VMShapeLower", + refl::GlobalDef().def("tvm.relax.transform.VMShapeLower", [](bool emit_err_ctx) { return VMShapeLower(emit_err_ctx); }); } diff --git a/src/relax/distributed/global_info.cc b/src/relax/distributed/global_info.cc index 408d31680c79..5dacd98e0184 100644 --- a/src/relax/distributed/global_info.cc +++ b/src/relax/distributed/global_info.cc @@ -62,7 +62,7 @@ DeviceMesh::DeviceMesh(ffi::Shape shape, Range device_range) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef().def( - "relax.distributed.DeviceMesh", + "tvm.relax.distributed.DeviceMesh", [](ffi::Shape shape, ffi::Array device_ids, ffi::Optional device_range) { if (device_range.defined()) return DeviceMesh(shape, device_range.value()); diff --git a/src/relax/distributed/struct_info.cc b/src/relax/distributed/struct_info.cc index 5c51920fa7e6..d802ddd238b9 100644 --- a/src/relax/distributed/struct_info.cc +++ b/src/relax/distributed/struct_info.cc @@ -51,8 +51,8 @@ PlacementSpec PlacementSpec::Replica() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("relax.distributed.Sharding", [](int axis) { return PlacementSpec::Sharding(axis); }) - .def("relax.distributed.Replica", []() { return PlacementSpec::Replica(); }); + .def("tvm.relax.distributed.Sharding", [](int axis) { return PlacementSpec::Sharding(axis); }) + .def("tvm.relax.distributed.Replica", []() { return PlacementSpec::Replica(); }); } ffi::String PlacementNode::ToString() const { @@ -112,8 +112,8 @@ Placement Placement::FromText(ffi::String text_repr) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("relax.distributed.PlacementFromText", Placement::FromText) - .def("relax.distributed.Placement", + .def("tvm.relax.distributed.PlacementFromText", Placement::FromText) + .def("tvm.relax.distributed.Placement", [](ffi::Array dim_specs) { return Placement(dim_specs); }); } @@ -138,7 +138,7 @@ DTensorStructInfo::DTensorStructInfo(TensorStructInfo tensor_sinfo, DeviceMesh d TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef().def( - "relax.distributed.DTensorStructInfo", + "tvm.relax.distributed.DTensorStructInfo", [](TensorStructInfo tensor_sinfo, DeviceMesh device_mesh, Placement placement, Span span) { return DTensorStructInfo(tensor_sinfo, device_mesh, placement, span); }); diff --git a/src/relax/distributed/transform/legalize_redistribute.cc b/src/relax/distributed/transform/legalize_redistribute.cc index aaac39c61b20..d171b00f9dd1 100644 --- a/src/relax/distributed/transform/legalize_redistribute.cc +++ b/src/relax/distributed/transform/legalize_redistribute.cc @@ -118,7 +118,8 @@ Pass LegalizeRedistribute() { } TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.distributed.transform.LegalizeRedistribute", LegalizeRedistribute); + refl::GlobalDef().def("tvm.relax.distributed.transform.LegalizeRedistribute", + LegalizeRedistribute); } } // namespace transform diff --git a/src/relax/distributed/transform/lower_distir.cc b/src/relax/distributed/transform/lower_distir.cc index 7930e2dfe7fc..932cf5cc72bb 100644 --- a/src/relax/distributed/transform/lower_distir.cc +++ b/src/relax/distributed/transform/lower_distir.cc @@ -232,9 +232,9 @@ class DistIRSharder : public ExprMutator { } else if (const auto* extern_func = call->op.as()) { auto new_call_node = ffi::make_object(*call); if (extern_func->global_symbol == "vm.builtin.distributed.attention_kv_cache_append") { - new_call_node->op = ExternFunc("vm.builtin.attention_kv_cache_append"); + new_call_node->op = ExternFunc("tvm.vm.builtin.attention_kv_cache_append"); } else if (extern_func->global_symbol == "vm.builtin.distributed.attention_kv_cache_view") { - new_call_node->op = ExternFunc("vm.builtin.attention_kv_cache_view"); + new_call_node->op = ExternFunc("tvm.vm.builtin.attention_kv_cache_view"); auto orig_shape = Downcast(call->args[1]); const auto* out_sinfo = GetStructInfoAs(binding_var); ICHECK(out_sinfo); @@ -266,7 +266,7 @@ Pass LowerDistIR() { } TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.distributed.transform.LowerDistIR", LowerDistIR); + refl::GlobalDef().def("tvm.relax.distributed.transform.LowerDistIR", LowerDistIR); } } // namespace transform diff --git a/src/relax/distributed/transform/lower_global_view_to_local_view.cc b/src/relax/distributed/transform/lower_global_view_to_local_view.cc index 837f2f0a5dcb..179ed6751388 100644 --- a/src/relax/distributed/transform/lower_global_view_to_local_view.cc +++ b/src/relax/distributed/transform/lower_global_view_to_local_view.cc @@ -434,7 +434,7 @@ Pass LowerGlobalViewToLocalView() { } TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.distributed.transform.LowerGlobalViewToLocalView", + refl::GlobalDef().def("tvm.relax.distributed.transform.LowerGlobalViewToLocalView", LowerGlobalViewToLocalView); } } // namespace transform diff --git a/src/relax/distributed/transform/propagate_sharding.cc b/src/relax/distributed/transform/propagate_sharding.cc index 1ff614c019c8..e1d0fbd2730d 100644 --- a/src/relax/distributed/transform/propagate_sharding.cc +++ b/src/relax/distributed/transform/propagate_sharding.cc @@ -463,9 +463,9 @@ class DistributedIRBuilder : public ExprMutator { } if (const auto* extern_func = new_call->op.as()) { - if (extern_func->global_symbol == "vm.builtin.attention_kv_cache_append") { + if (extern_func->global_symbol == "tvm.vm.builtin.attention_kv_cache_append") { n->op = ExternFunc("vm.builtin.distributed.attention_kv_cache_append"); - } else if (extern_func->global_symbol == "vm.builtin.attention_kv_cache_view") { + } else if (extern_func->global_symbol == "tvm.vm.builtin.attention_kv_cache_view") { n->op = ExternFunc("vm.builtin.distributed.attention_kv_cache_view"); } } @@ -619,7 +619,7 @@ Pass PropagateSharding() { } TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.distributed.transform.PropagateSharding", PropagateSharding); + refl::GlobalDef().def("tvm.relax.distributed.transform.PropagateSharding", PropagateSharding); } } // namespace transform diff --git a/src/relax/ir/binding_rewrite.cc b/src/relax/ir/binding_rewrite.cc index 0bbfef31b83a..5adeea320830 100644 --- a/src/relax/ir/binding_rewrite.cc +++ b/src/relax/ir/binding_rewrite.cc @@ -54,7 +54,7 @@ DataflowBlockRewrite::DataflowBlockRewrite(DataflowBlock dfb, Function root_fn) TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.DataflowBlockRewrite", [](DataflowBlock dfb, Function root_fn) { + refl::GlobalDef().def("tvm.relax.DataflowBlockRewrite", [](DataflowBlock dfb, Function root_fn) { return DataflowBlockRewrite(dfb, root_fn); }); } @@ -115,7 +115,7 @@ void DataflowBlockRewriteNode::ReplaceAllUses(Var old_var, Var new_var) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.dfb_rewrite_replace_all_uses", + refl::GlobalDef().def("tvm.relax.dfb_rewrite_replace_all_uses", [](DataflowBlockRewrite rwt, Var old_var, Var new_var) { rwt->ReplaceAllUses(old_var, new_var); }); @@ -187,9 +187,9 @@ void DataflowBlockRewriteNode::Add(Binding binding) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("relax.dfb_rewrite_add_binding", + .def("tvm.relax.dfb_rewrite_add_binding", [](DataflowBlockRewrite rwt, Binding vb) { rwt->Add(vb); }) - .def("relax.dfb_rewrite_add", + .def("tvm.relax.dfb_rewrite_add", [](DataflowBlockRewrite rwt, Expr expr, ffi::Optional name, bool is_dfvar) { if (name.has_value()) { rwt->Add(name.value(), expr, is_dfvar); @@ -303,7 +303,7 @@ void DataflowBlockRewriteNode::RemoveUnused(Var unused, bool allow_undef) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.dfb_rewrite_remove_unused", + refl::GlobalDef().def("tvm.relax.dfb_rewrite_remove_unused", [](DataflowBlockRewrite rwt, Var unused, bool allow_undef) { rwt->RemoveUnused(unused, allow_undef); }); @@ -328,7 +328,7 @@ void DataflowBlockRewriteNode::RemoveAllUnused() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.dfb_rewrite_remove_all_unused", + refl::GlobalDef().def("tvm.relax.dfb_rewrite_remove_all_unused", [](DataflowBlockRewrite rwt) { rwt->RemoveAllUnused(); }); } @@ -351,7 +351,7 @@ Expr RemoveAllUnused(Expr expr) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.analysis.remove_all_unused", RemoveAllUnused); + refl::GlobalDef().def("tvm.relax.analysis.remove_all_unused", RemoveAllUnused); } IRModule DataflowBlockRewriteNode::MutateIRModule(IRModule irmod) { @@ -370,7 +370,7 @@ IRModule DataflowBlockRewriteNode::MutateIRModule(IRModule irmod) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef().def( - "relax.dfb_rewrite_mutate_irmodule", + "tvm.relax.dfb_rewrite_mutate_irmodule", [](DataflowBlockRewrite rwt, IRModule irmod) { return rwt->MutateIRModule(irmod); }); } diff --git a/src/relax/ir/block_builder.cc b/src/relax/ir/block_builder.cc index 09f404d29cbd..dcf69d603abb 100644 --- a/src/relax/ir/block_builder.cc +++ b/src/relax/ir/block_builder.cc @@ -1057,40 +1057,40 @@ TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::ObjectDef(); refl::GlobalDef() - .def("relax.BlockBuilderCreate", + .def("tvm.relax.BlockBuilderCreate", [](ffi::Optional mod) { return BlockBuilder::Create(mod); }) - .def_method("relax.BlockBuilderBeginDataflowBlock", &BlockBuilderNode::BeginDataflowBlock) - .def_method("relax.BlockBuilderBeginBindingBlock", &BlockBuilderNode::BeginBindingBlock) - .def_method("relax.BlockBuilderEndBlock", &BlockBuilderNode::EndBlock) - .def_method("relax.BlockBuilderNormalize", &BlockBuilderNode::Normalize) - .def("relax.BlockBuilderEmit", + .def_method("tvm.relax.BlockBuilderBeginDataflowBlock", &BlockBuilderNode::BeginDataflowBlock) + .def_method("tvm.relax.BlockBuilderBeginBindingBlock", &BlockBuilderNode::BeginBindingBlock) + .def_method("tvm.relax.BlockBuilderEndBlock", &BlockBuilderNode::EndBlock) + .def_method("tvm.relax.BlockBuilderNormalize", &BlockBuilderNode::Normalize) + .def("tvm.relax.BlockBuilderEmit", [](BlockBuilder builder, Expr expr, ffi::String name_hint) { return builder->Emit(expr, name_hint); }) - .def("relax.BlockBuilderEmitMatchCast", + .def("tvm.relax.BlockBuilderEmitMatchCast", [](BlockBuilder builder, Expr value, StructInfo struct_info, ffi::String name_hint) { return builder->EmitMatchCast(value, struct_info, name_hint); }) - .def("relax.BlockBuilderEmitOutput", + .def("tvm.relax.BlockBuilderEmitOutput", [](BlockBuilder builder, const Expr& output, ffi::String name_hint) { return builder->EmitOutput(output, name_hint); }) - .def("relax.BlockBuilderEmitNormalized", + .def("tvm.relax.BlockBuilderEmitNormalized", [](BlockBuilder builder, Binding binding) { return builder->EmitNormalized(binding); }) - .def("relax.BlockBuilderGetUniqueName", + .def("tvm.relax.BlockBuilderGetUniqueName", [](BlockBuilder builder, ffi::String name_hint) { return builder->name_supply()->FreshName(name_hint, /*add_prefix*/ false, /*add_underscore*/ false); }) - .def_method("relax.BlockBuilderAddFunction", &BlockBuilderNode::AddFunction) - .def_method("relax.BlockBuilderUpdateFunction", &BlockBuilderNode::UpdateFunction) - .def_method("relax.BlockBuilderGetContextIRModule", &BlockBuilderNode::GetContextIRModule) - .def_method("relax.BlockBuilderFinalize", &BlockBuilderNode::Finalize) - .def_method("relax.BlockBuilderCurrentBlockIsDataFlow", + .def_method("tvm.relax.BlockBuilderAddFunction", &BlockBuilderNode::AddFunction) + .def_method("tvm.relax.BlockBuilderUpdateFunction", &BlockBuilderNode::UpdateFunction) + .def_method("tvm.relax.BlockBuilderGetContextIRModule", &BlockBuilderNode::GetContextIRModule) + .def_method("tvm.relax.BlockBuilderFinalize", &BlockBuilderNode::Finalize) + .def_method("tvm.relax.BlockBuilderCurrentBlockIsDataFlow", &BlockBuilderNode::CurrentBlockIsDataFlow) - .def_method("relax.BlockBuilderLookupBinding", &BlockBuilderNode::LookupBinding) - .def_method("relax.BlockBuilderBeginScope", &BlockBuilderNode::BeginScope) - .def_method("relax.BlockBuilderEndScope", &BlockBuilderNode::EndScope); + .def_method("tvm.relax.BlockBuilderLookupBinding", &BlockBuilderNode::LookupBinding) + .def_method("tvm.relax.BlockBuilderBeginScope", &BlockBuilderNode::BeginScope) + .def_method("tvm.relax.BlockBuilderEndScope", &BlockBuilderNode::EndScope); } } // namespace relax } // namespace tvm diff --git a/src/relax/ir/dataflow_block_rewriter.cc b/src/relax/ir/dataflow_block_rewriter.cc index 249ec14f89dd..9467346506f7 100644 --- a/src/relax/ir/dataflow_block_rewriter.cc +++ b/src/relax/ir/dataflow_block_rewriter.cc @@ -367,7 +367,7 @@ ffi::Optional> MatchGraph(const PatternContext& ctx, TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef().def( - "relax.dpl.match_dfb", + "tvm.relax.dpl.match_dfb", [](const PatternContext& ctx, const DataflowBlock& dfb) { return MatchGraph(ctx, dfb); }); } @@ -385,8 +385,8 @@ class PatternContextRewriterNode : public PatternMatchingRewriterNode { .def_ro("pattern", &PatternContextRewriterNode::pattern) .def_ro("rewriter_func", &PatternContextRewriterNode::rewriter_func); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.dpl.PatternContextRewriter", PatternContextRewriterNode, - PatternMatchingRewriterNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.dpl.PatternContextRewriter", + PatternContextRewriterNode, PatternMatchingRewriterNode); private: ffi::Optional> MatchBindings(const ffi::Array& bindings) const { @@ -456,7 +456,7 @@ Function RewriteBindings( TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.dpl.rewrite_bindings", RewriteBindings); + refl::GlobalDef().def("tvm.relax.dpl.rewrite_bindings", RewriteBindings); } TVM_FFI_STATIC_INIT_BLOCK() { PatternContextRewriterNode::RegisterReflection(); } diff --git a/src/relax/ir/dataflow_expr_rewriter.cc b/src/relax/ir/dataflow_expr_rewriter.cc index 4aca923a4b80..0831855afd4b 100644 --- a/src/relax/ir/dataflow_expr_rewriter.cc +++ b/src/relax/ir/dataflow_expr_rewriter.cc @@ -195,14 +195,14 @@ void RewriteSpec::Append(RewriteSpec other) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("relax.dpl.PatternMatchingRewriterFromPattern", + .def("tvm.relax.dpl.PatternMatchingRewriterFromPattern", [](DFPattern pattern, ffi::TypedFunction(Expr, ffi::Map)> func) { return PatternMatchingRewriter::FromPattern(pattern, func); }) - .def("relax.dpl.PatternMatchingRewriterFromModule", + .def("tvm.relax.dpl.PatternMatchingRewriterFromModule", [](IRModule mod) { return PatternMatchingRewriter::FromModule(mod); }) - .def("relax.dpl.PatternMatchingRewriterApply", + .def("tvm.relax.dpl.PatternMatchingRewriterApply", [](PatternMatchingRewriter rewriter, ffi::Variant obj) -> ffi::Variant { if (auto expr = obj.as()) { @@ -260,7 +260,7 @@ ffi::Optional ExprPatternRewriterNode::RewriteExpr( TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef().def( - "relax.dpl.PatternRewriter", + "tvm.relax.dpl.PatternRewriter", [](DFPattern pattern, ffi::TypedFunction(Expr, ffi::Map)> func) { return ExprPatternRewriter(pattern, func); @@ -312,7 +312,7 @@ RewriteSpec OrRewriterNode::RewriteBindings(const ffi::Array& bindings) TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.dpl.OrRewriter", + refl::GlobalDef().def("tvm.relax.dpl.OrRewriter", [](PatternMatchingRewriter lhs, PatternMatchingRewriter rhs) { return OrRewriter(lhs, rhs); }); @@ -611,7 +611,7 @@ std::optional> TupleRewriterNode::TryMatchByBindingIndex( TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef().def( - "relax.dpl.TupleRewriter", + "tvm.relax.dpl.TupleRewriter", [](ffi::Array patterns, ffi::TypedFunction(Expr, ffi::Map)> func) { return TupleRewriter(patterns, func); @@ -809,7 +809,7 @@ ffi::Optional> ExtractMatchedExpr( TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.dpl.extract_matched_expr", ExtractMatchedExpr); + refl::GlobalDef().def("tvm.relax.dpl.extract_matched_expr", ExtractMatchedExpr); } bool MatchExpr(DFPattern pattern, Expr expr, ffi::Optional> bindings_opt) { @@ -818,7 +818,7 @@ bool MatchExpr(DFPattern pattern, Expr expr, ffi::Optional> TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.dpl.match_expr", MatchExpr); + refl::GlobalDef().def("tvm.relax.dpl.match_expr", MatchExpr); } /*! @@ -1095,7 +1095,7 @@ Function RewriteCall(const DFPattern& pat, TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.dpl.rewrite_call", RewriteCall); + refl::GlobalDef().def("tvm.relax.dpl.rewrite_call", RewriteCall); } TVM_FFI_STATIC_INIT_BLOCK() { diff --git a/src/relax/ir/dataflow_pattern.cc b/src/relax/ir/dataflow_pattern.cc index 99e7dc6dfe05..bb8c019da581 100644 --- a/src/relax/ir/dataflow_pattern.cc +++ b/src/relax/ir/dataflow_pattern.cc @@ -70,7 +70,7 @@ ExternFuncPattern::ExternFuncPattern(ffi::String global_symbol) { } TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.dpl.ExternFuncPattern", + refl::GlobalDef().def("tvm.relax.dpl.ExternFuncPattern", [](ffi::String global_symbol) { return ExternFuncPattern(global_symbol); }); } RELAX_PATTERN_PRINTER_DEF(ExternFuncPatternNode, [](auto p, auto node) { @@ -84,7 +84,7 @@ VarPattern::VarPattern(ffi::String name_hint) { } TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.dpl.VarPattern", + refl::GlobalDef().def("tvm.relax.dpl.VarPattern", [](ffi::String name_hint) { return VarPattern(name_hint); }); } RELAX_PATTERN_PRINTER_DEF(VarPatternNode, [](auto p, auto node) { @@ -93,7 +93,7 @@ RELAX_PATTERN_PRINTER_DEF(VarPatternNode, [](auto p, auto node) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.dpl.DataflowVarPattern", + refl::GlobalDef().def("tvm.relax.dpl.DataflowVarPattern", [](ffi::String name_hint) { return DataflowVarPattern(name_hint); }); } DataflowVarPattern::DataflowVarPattern(ffi::String name_hint) { @@ -112,7 +112,7 @@ GlobalVarPattern::GlobalVarPattern(ffi::String name_hint) { } TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.dpl.GlobalVarPattern", + refl::GlobalDef().def("tvm.relax.dpl.GlobalVarPattern", [](ffi::String name_hint) { return GlobalVarPattern(name_hint); }); } RELAX_PATTERN_PRINTER_DEF(GlobalVarPatternNode, [](auto p, auto node) { @@ -126,13 +126,13 @@ ExprPattern::ExprPattern(Expr expr) { } TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.dpl.ExprPattern", [](Expr e) { return ExprPattern(e); }); + refl::GlobalDef().def("tvm.relax.dpl.ExprPattern", [](Expr e) { return ExprPattern(e); }); } RELAX_PATTERN_PRINTER_DEF(ExprPatternNode, [](auto p, auto node) { p->Print(node->expr); }); TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.dpl.ConstantPattern", []() { + refl::GlobalDef().def("tvm.relax.dpl.ConstantPattern", []() { auto c = ConstantPattern(ffi::make_object()); return c; }); @@ -149,7 +149,7 @@ CallPattern::CallPattern(DFPattern op, ffi::Array args, bool varg_def } TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.dpl.CallPattern", + refl::GlobalDef().def("tvm.relax.dpl.CallPattern", [](DFPattern op, ffi::Array args, bool varg_default_wildcard) { return CallPattern(op, args, varg_default_wildcard); }); @@ -174,7 +174,7 @@ PrimArrPattern::PrimArrPattern(ffi::Array arr) { } TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.dpl.PrimArrPattern", + refl::GlobalDef().def("tvm.relax.dpl.PrimArrPattern", [](ffi::Array arr) { return PrimArrPattern(std::move(arr)); }); } RELAX_PATTERN_PRINTER_DEF(PrimArrPatternNode, [](auto p, auto node) { @@ -190,7 +190,7 @@ FunctionPattern::FunctionPattern(ffi::Array params, DFPattern body) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef().def( - "relax.dpl.FunctionPattern", + "tvm.relax.dpl.FunctionPattern", [](ffi::Array params, DFPattern body) { return FunctionPattern(params, body); }); } RELAX_PATTERN_PRINTER_DEF(FunctionPatternNode, [](auto p, auto node) { @@ -204,7 +204,7 @@ TuplePattern::TuplePattern(tvm::ffi::Array fields) { } TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.dpl.TuplePattern", + refl::GlobalDef().def("tvm.relax.dpl.TuplePattern", [](tvm::ffi::Array fields) { return TuplePattern(fields); }); } RELAX_PATTERN_PRINTER_DEF(TuplePatternNode, [](auto p, auto node) { @@ -218,9 +218,9 @@ UnorderedTuplePattern::UnorderedTuplePattern(tvm::ffi::Array fields) } TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.dpl.UnorderedTuplePattern", [](tvm::ffi::Array fields) { - return UnorderedTuplePattern(fields); - }); + refl::GlobalDef().def( + "tvm.relax.dpl.UnorderedTuplePattern", + [](tvm::ffi::Array fields) { return UnorderedTuplePattern(fields); }); } RELAX_PATTERN_PRINTER_DEF(UnorderedTuplePatternNode, [](auto p, auto node) { p->stream << "UnorderedTuplePattern(" << node->fields << ")"; @@ -234,7 +234,7 @@ TupleGetItemPattern::TupleGetItemPattern(DFPattern tuple, int index) { } TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.dpl.TupleGetItemPattern", [](DFPattern tuple, int index) { + refl::GlobalDef().def("tvm.relax.dpl.TupleGetItemPattern", [](DFPattern tuple, int index) { return TupleGetItemPattern(tuple, index); }); } @@ -250,7 +250,7 @@ AndPattern::AndPattern(DFPattern left, DFPattern right) { } TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.dpl.AndPattern", + refl::GlobalDef().def("tvm.relax.dpl.AndPattern", [](DFPattern left, DFPattern right) { return AndPattern(left, right); }); } RELAX_PATTERN_PRINTER_DEF(AndPatternNode, [](auto p, auto node) { @@ -265,7 +265,7 @@ OrPattern::OrPattern(DFPattern left, DFPattern right) { } TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.dpl.OrPattern", + refl::GlobalDef().def("tvm.relax.dpl.OrPattern", [](DFPattern left, DFPattern right) { return OrPattern(left, right); }); } RELAX_PATTERN_PRINTER_DEF(OrPatternNode, [](auto p, auto node) { @@ -279,7 +279,7 @@ NotPattern::NotPattern(DFPattern reject) { } TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.dpl.NotPattern", + refl::GlobalDef().def("tvm.relax.dpl.NotPattern", [](DFPattern reject) { return NotPattern(reject); }); } RELAX_PATTERN_PRINTER_DEF(NotPatternNode, @@ -288,7 +288,7 @@ RELAX_PATTERN_PRINTER_DEF(NotPatternNode, WildcardPattern::WildcardPattern() { data_ = ffi::make_object(); } TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.dpl.WildcardPattern", []() { return WildcardPattern(); }); + refl::GlobalDef().def("tvm.relax.dpl.WildcardPattern", []() { return WildcardPattern(); }); } RELAX_PATTERN_PRINTER_DEF(WildcardPatternNode, [](auto p, auto node) { p->stream << "*"; }); @@ -300,7 +300,7 @@ StructInfoPattern::StructInfoPattern(DFPattern pattern, StructInfo struct_info) } TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.dpl.StructInfoPattern", + refl::GlobalDef().def("tvm.relax.dpl.StructInfoPattern", [](DFPattern pattern, StructInfo struct_info) { return StructInfoPattern(pattern, struct_info); }); @@ -319,7 +319,7 @@ ShapePattern::ShapePattern(DFPattern pattern, ffi::Array shape) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef().def( - "relax.dpl.ShapePattern", + "tvm.relax.dpl.ShapePattern", [](DFPattern pattern, ffi::Array shape) { return ShapePattern(pattern, shape); }); } RELAX_PATTERN_PRINTER_DEF(ShapePatternNode, [](auto p, auto node) { @@ -337,7 +337,7 @@ SameShapeConstraint::SameShapeConstraint(ffi::Array args) { } TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.dpl.SameShapeConstraint", + refl::GlobalDef().def("tvm.relax.dpl.SameShapeConstraint", [](ffi::Array args) { return SameShapeConstraint(args); }); } RELAX_PATTERN_PRINTER_DEF(SameShapeConstraintNode, [](auto p, auto node) { @@ -359,7 +359,7 @@ DataTypePattern::DataTypePattern(DFPattern pattern, DataType dtype) { } TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.dpl.DataTypePattern", [](DFPattern pattern, DataType dtype) { + refl::GlobalDef().def("tvm.relax.dpl.DataTypePattern", [](DFPattern pattern, DataType dtype) { return DataTypePattern(pattern, dtype); }); } @@ -375,7 +375,7 @@ AttrPattern::AttrPattern(DFPattern pattern, DictAttrs attrs) { } TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.dpl.AttrPattern", [](DFPattern pattern, DictAttrs attrs) { + refl::GlobalDef().def("tvm.relax.dpl.AttrPattern", [](DFPattern pattern, DictAttrs attrs) { return AttrPattern(pattern, attrs); }); } @@ -550,7 +550,7 @@ PatternSeq PatternSeq::dup() const { } TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.dpl.PatternSeq", + refl::GlobalDef().def("tvm.relax.dpl.PatternSeq", [](ffi::Array patterns, bool only_used_by) { return PatternSeq(std::move(patterns), only_used_by); }); @@ -568,9 +568,9 @@ RELAX_PATTERN_PRINTER_DEF(PatternSeqNode, [](auto p, auto node) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("relax.dpl.used_by", + .def("tvm.relax.dpl.used_by", [](PatternSeq lhs, PatternSeq rhs, int index) { return lhs.UsedBy(rhs, index); }) - .def("relax.dpl.only_used_by", + .def("tvm.relax.dpl.only_used_by", [](PatternSeq lhs, PatternSeq rhs, int index) { return lhs.OnlyUsedBy(rhs, index); }); } @@ -685,12 +685,12 @@ DFPattern DFPattern::dup() const { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("relax.dpl.dup_pattern", [](DFPattern pattern) { return pattern.dup(); }) - .def("relax.dpl.dup_seq", [](PatternSeq seq) { return seq.dup(); }) - .def("relax.dpl.PatternContext", [](bool incre) { return PatternContext(incre); }) - .def("relax.dpl.current_context", [] { return PatternContext::Current(); }) - .def("relax.dpl.enter_context", [](const PatternContext& ctx) { ctx.EnterWithScope(); }) - .def("relax.dpl.exit_context", [](const PatternContext& ctx) { ctx.ExitWithScope(); }); + .def("tvm.relax.dpl.dup_pattern", [](DFPattern pattern) { return pattern.dup(); }) + .def("tvm.relax.dpl.dup_seq", [](PatternSeq seq) { return seq.dup(); }) + .def("tvm.relax.dpl.PatternContext", [](bool incre) { return PatternContext(incre); }) + .def("tvm.relax.dpl.current_context", [] { return PatternContext::Current(); }) + .def("tvm.relax.dpl.enter_context", [](const PatternContext& ctx) { ctx.EnterWithScope(); }) + .def("tvm.relax.dpl.exit_context", [](const PatternContext& ctx) { ctx.ExitWithScope(); }); } } // namespace relax diff --git a/src/relax/ir/dataflow_rewriter.h b/src/relax/ir/dataflow_rewriter.h index 85f892e3815b..7722849ad25f 100644 --- a/src/relax/ir/dataflow_rewriter.h +++ b/src/relax/ir/dataflow_rewriter.h @@ -60,7 +60,7 @@ class PatternMatchingRewriterNode : public tvm::transform::PassNode { IRModule operator()(IRModule mod, const tvm::transform::PassContext& pass_ctx) const override; tvm::transform::PassInfo Info() const override; - TVM_FFI_DECLARE_OBJECT_INFO("relax.dpl.PatternMatchingRewriter", PatternMatchingRewriterNode, + TVM_FFI_DECLARE_OBJECT_INFO("tvm.relax.dpl.PatternMatchingRewriter", PatternMatchingRewriterNode, PassNode); }; @@ -98,7 +98,7 @@ class ExprPatternRewriterNode : public PatternMatchingRewriterNode { .def_ro("pattern", &ExprPatternRewriterNode::pattern) .def_ro("func", &ExprPatternRewriterNode::func); } - TVM_FFI_DECLARE_OBJECT_INFO("relax.dpl.ExprPatternRewriter", ExprPatternRewriterNode, + TVM_FFI_DECLARE_OBJECT_INFO("tvm.relax.dpl.ExprPatternRewriter", ExprPatternRewriterNode, PatternMatchingRewriterNode); }; @@ -126,7 +126,8 @@ class OrRewriterNode : public PatternMatchingRewriterNode { .def_ro("lhs", &OrRewriterNode::lhs) .def_ro("rhs", &OrRewriterNode::rhs); } - TVM_FFI_DECLARE_OBJECT_INFO("relax.dpl.OrRewriter", OrRewriterNode, PatternMatchingRewriterNode); + TVM_FFI_DECLARE_OBJECT_INFO("tvm.relax.dpl.OrRewriter", OrRewriterNode, + PatternMatchingRewriterNode); }; class OrRewriter : public PatternMatchingRewriter { @@ -151,7 +152,7 @@ class TupleRewriterNode : public PatternMatchingRewriterNode { .def_ro("patterns", &TupleRewriterNode::patterns) .def_ro("func", &TupleRewriterNode::func); } - TVM_FFI_DECLARE_OBJECT_INFO("relax.dpl.TupleRewriter", TupleRewriterNode, + TVM_FFI_DECLARE_OBJECT_INFO("tvm.relax.dpl.TupleRewriter", TupleRewriterNode, PatternMatchingRewriterNode); private: diff --git a/src/relax/ir/emit_te.cc b/src/relax/ir/emit_te.cc index ee10a97aa0e7..109b0ee0ac47 100644 --- a/src/relax/ir/emit_te.cc +++ b/src/relax/ir/emit_te.cc @@ -75,7 +75,7 @@ te::Tensor TETensor(Expr value, ffi::Map tir_var_map, std::s TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.TETensor", TETensor); + refl::GlobalDef().def("tvm.relax.TETensor", TETensor); } } // namespace relax diff --git a/src/relax/ir/emit_te.h b/src/relax/ir/emit_te.h index f09dcb7f8230..48bb5ea6e863 100644 --- a/src/relax/ir/emit_te.h +++ b/src/relax/ir/emit_te.h @@ -55,7 +55,7 @@ class RXPlaceholderOpNode : public te::PlaceholderOpNode { // FFI system configuration for structural equality and hashing static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind = kTVMFFISEqHashKindTreeNode; - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.TEPlaceholderOp", RXPlaceholderOpNode, + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.TEPlaceholderOp", RXPlaceholderOpNode, te::PlaceholderOpNode); }; diff --git a/src/relax/ir/expr.cc b/src/relax/ir/expr.cc index 2c681b00bc22..f80c29aada0d 100644 --- a/src/relax/ir/expr.cc +++ b/src/relax/ir/expr.cc @@ -121,8 +121,8 @@ Call WithFields(Call call, ffi::Optional opt_op, ffi::Optional args, Attrs attrs, - ffi::Array sinfo_args, Span span) { + refl::GlobalDef().def("tvm.relax.Call", [](Expr op, ffi::Array args, Attrs attrs, + ffi::Array sinfo_args, Span span) { return Call(op, args, attrs, sinfo_args, span); }); } @@ -158,9 +158,10 @@ If WithFields(If if_expr, ffi::Optional opt_cond, ffi::Optional opt_ TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.If", [](Expr cond, Expr true_branch, Expr false_branch, Span span) { - return If(cond, true_branch, false_branch, span); - }); + refl::GlobalDef().def("tvm.relax.If", + [](Expr cond, Expr true_branch, Expr false_branch, Span span) { + return If(cond, true_branch, false_branch, span); + }); } Tuple::Tuple(tvm::ffi::Array fields, Span span) { @@ -185,8 +186,9 @@ Tuple::Tuple(tvm::ffi::Array fields, Span span) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def( - "relax.Tuple", [](tvm::ffi::Array fields, Span span) { return Tuple(fields, span); }); + refl::GlobalDef().def("tvm.relax.Tuple", [](tvm::ffi::Array fields, Span span) { + return Tuple(fields, span); + }); } Tuple WithFields(Tuple tuple, ffi::Optional> opt_fields, @@ -249,7 +251,7 @@ TupleGetItem WithFields(TupleGetItem tuple_get_item, ffi::Optional opt_tup TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.TupleGetItem", [](Expr tuple, int index, Span span) { + refl::GlobalDef().def("tvm.relax.TupleGetItem", [](Expr tuple, int index, Span span) { return TupleGetItem(tuple, index, span); }); } @@ -272,7 +274,7 @@ ShapeExpr::ShapeExpr(ffi::Array values, Span span) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.ShapeExpr", [](ffi::Array values, Span span) { + refl::GlobalDef().def("tvm.relax.ShapeExpr", [](ffi::Array values, Span span) { return ShapeExpr(values, span); }); } @@ -307,10 +309,12 @@ VarNode* Var::CopyOnWrite() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("relax.Var", [](ffi::String name_hint, ffi::Optional struct_info_annotation, - Span span) { return Var(name_hint, struct_info_annotation, span); }) - .def("relax.VarFromId", [](Id vid, ffi::Optional struct_info_annotation, - Span span) { return Var(vid, struct_info_annotation, span); }); + .def("tvm.relax.Var", + [](ffi::String name_hint, ffi::Optional struct_info_annotation, Span span) { + return Var(name_hint, struct_info_annotation, span); + }) + .def("tvm.relax.VarFromId", [](Id vid, ffi::Optional struct_info_annotation, + Span span) { return Var(vid, struct_info_annotation, span); }); } DataflowVar::DataflowVar(Id vid, ffi::Optional struct_info_annotation, Span span) { @@ -325,11 +329,11 @@ DataflowVar::DataflowVar(Id vid, ffi::Optional struct_info_annotatio TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("relax.DataflowVar", + .def("tvm.relax.DataflowVar", [](ffi::String name_hint, ffi::Optional struct_info_annotation, Span span) { return DataflowVar(name_hint, struct_info_annotation, span); }) - .def("relax.DataflowVarFromId", + .def("tvm.relax.DataflowVarFromId", [](Id vid, ffi::Optional struct_info_annotation, Span span) { return DataflowVar(vid, struct_info_annotation, span); }); @@ -360,7 +364,7 @@ Constant::Constant(runtime::Tensor data, ffi::Optional struct_info_a TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef().def( - "relax.Constant", + "tvm.relax.Constant", [](runtime::Tensor data, ffi::Optional struct_info_annotation = std::nullopt, Span span = Span()) { return Constant(data, struct_info_annotation, span); }); } @@ -379,7 +383,7 @@ PrimValue PrimValue::Int64(int64_t value, Span span) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.PrimValue", + refl::GlobalDef().def("tvm.relax.PrimValue", [](PrimExpr value, Span span) { return PrimValue(value, span); }); } @@ -393,7 +397,7 @@ StringImm::StringImm(ffi::String value, Span span) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.StringImm", + refl::GlobalDef().def("tvm.relax.StringImm", [](ffi::String value, Span span) { return StringImm(value, span); }); } @@ -407,7 +411,7 @@ DataTypeImm::DataTypeImm(DataType value, Span span) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.DataTypeImm", + refl::GlobalDef().def("tvm.relax.DataTypeImm", [](DataType value, Span span) { return DataTypeImm(value, span); }); } @@ -423,7 +427,7 @@ MatchCast::MatchCast(Var var, Expr value, StructInfo struct_info, Span span) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.MatchCast", + refl::GlobalDef().def("tvm.relax.MatchCast", [](Var var, Expr value, StructInfo struct_info, Span span) { return MatchCast(var, value, struct_info, span); }); @@ -439,7 +443,7 @@ VarBinding::VarBinding(Var var, Expr value, Span span) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.VarBinding", [](Var var, Expr value, Span span) { + refl::GlobalDef().def("tvm.relax.VarBinding", [](Var var, Expr value, Span span) { return VarBinding(var, value, span); }); } @@ -500,7 +504,7 @@ BindingBlockNode* BindingBlock::CopyOnWrite() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.BindingBlock", [](ffi::Array bindings, Span span) { + refl::GlobalDef().def("tvm.relax.BindingBlock", [](ffi::Array bindings, Span span) { return BindingBlock(bindings, span); }); } @@ -514,7 +518,7 @@ DataflowBlock::DataflowBlock(ffi::Array bindings, Span span) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.DataflowBlock", [](ffi::Array bindings, Span span) { + refl::GlobalDef().def("tvm.relax.DataflowBlock", [](ffi::Array bindings, Span span) { return DataflowBlock(bindings, span); }); } @@ -537,9 +541,8 @@ SeqExpr::SeqExpr(ffi::Array blocks, Expr body, Span span) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.SeqExpr", [](ffi::Array blocks, Expr body, Span span) { - return SeqExpr(blocks, body, span); - }); + refl::GlobalDef().def("tvm.relax.SeqExpr", [](ffi::Array blocks, Expr body, + Span span) { return SeqExpr(blocks, body, span); }); } Function::Function(ffi::Array params, Expr body, ffi::Optional ret_struct_info, @@ -612,9 +615,9 @@ Function::Function(ffi::Array params, Expr body, ffi::Optional TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.Function", [](ffi::Array params, Expr body, - ffi::Optional ret_struct_info, - bool is_pure, DictAttrs attrs, Span span) { + refl::GlobalDef().def("tvm.relax.Function", [](ffi::Array params, Expr body, + ffi::Optional ret_struct_info, + bool is_pure, DictAttrs attrs, Span span) { return Function(params, body, ret_struct_info, is_pure, attrs, span); }); } @@ -653,8 +656,8 @@ Function Function::CreateEmpty(ffi::Array params, StructInfo ret_struct_inf TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef().def( - "relax.FunctionCreateEmpty", [](ffi::Array params, StructInfo ret_struct_info, - bool is_pure, DictAttrs attrs, Span span) { + "tvm.relax.FunctionCreateEmpty", [](ffi::Array params, StructInfo ret_struct_info, + bool is_pure, DictAttrs attrs, Span span) { return Function::CreateEmpty(params, ret_struct_info, is_pure, attrs, span); }); } @@ -702,14 +705,15 @@ ExternFunc::ExternFunc(ffi::String global_symbol, StructInfo struct_info, Span s TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.ExternFunc", [](ffi::String global_symbol, - ffi::Optional struct_info, Span span) { - if (struct_info.defined()) { - return ExternFunc(global_symbol, struct_info.value(), span); - } else { - return ExternFunc(global_symbol, span); - } - }); + refl::GlobalDef().def( + "tvm.relax.ExternFunc", + [](ffi::String global_symbol, ffi::Optional struct_info, Span span) { + if (struct_info.defined()) { + return ExternFunc(global_symbol, struct_info.value(), span); + } else { + return ExternFunc(global_symbol, span); + } + }); } Expr GetShapeOf(const Expr& expr) { @@ -730,27 +734,28 @@ Expr GetShapeOf(const Expr& expr) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("relax.GetShapeOf", [](const Expr& expr) { return GetShapeOf(expr); }) - .def("relax.FuncWithAttr", + .def("tvm.relax.GetShapeOf", [](const Expr& expr) { return GetShapeOf(expr); }) + .def("tvm.relax.FuncWithAttr", [](BaseFunc func, ffi::String key, ObjectRef value) -> ffi::Optional { if (func->IsInstance()) { return WithAttr(Downcast(std::move(func)), key, value); } return std::nullopt; }) - .def("relax.FuncWithAttrs", + .def("tvm.relax.FuncWithAttrs", [](BaseFunc func, ffi::Map attr_map) -> ffi::Optional { if (func->IsInstance()) { return WithAttrs(Downcast(std::move(func)), attr_map); } return std::nullopt; }) - .def("relax.FuncWithoutAttr", [](BaseFunc func, ffi::String key) -> ffi::Optional { - if (func->IsInstance()) { - return WithoutAttr(Downcast(std::move(func)), key); - } - return std::nullopt; - }); + .def("tvm.relax.FuncWithoutAttr", + [](BaseFunc func, ffi::String key) -> ffi::Optional { + if (func->IsInstance()) { + return WithoutAttr(Downcast(std::move(func)), key); + } + return std::nullopt; + }); } } // namespace relax diff --git a/src/relax/ir/expr_functor.cc b/src/relax/ir/expr_functor.cc index 6ebc56feebe2..52a7c4f2e0d7 100644 --- a/src/relax/ir/expr_functor.cc +++ b/src/relax/ir/expr_functor.cc @@ -329,7 +329,7 @@ void PostOrderVisit(const Expr& e, std::function fvisit) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.analysis.post_order_visit", [](Expr expr, ffi::Function f) { + refl::GlobalDef().def("tvm.relax.analysis.post_order_visit", [](Expr expr, ffi::Function f) { PostOrderVisit(expr, [f](const Expr& n) { f(n); }); }); } diff --git a/src/relax/ir/py_expr_functor.cc b/src/relax/ir/py_expr_functor.cc index b7d61bfda8ec..5b50d90ff5e1 100644 --- a/src/relax/ir/py_expr_functor.cc +++ b/src/relax/ir/py_expr_functor.cc @@ -143,7 +143,7 @@ class PyExprVisitorNode : public Object, public ExprVisitor { } static constexpr const bool _type_mutable = true; - TVM_FFI_DECLARE_OBJECT_INFO("expr_functor.PyExprVisitor", PyExprVisitorNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO("tvm.expr_functor.PyExprVisitor", PyExprVisitorNode, Object); private: // initialize the vtable. @@ -406,7 +406,7 @@ class PyExprMutatorNode : public Object, public ExprMutator { } static constexpr const bool _type_mutable = true; - TVM_FFI_DECLARE_OBJECT_INFO("expr_functor.PyExprMutator", PyExprMutatorNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO("tvm.expr_functor.PyExprMutator", PyExprMutatorNode, Object); private: // initialize the vtable. @@ -556,20 +556,20 @@ TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::ObjectDef(); refl::GlobalDef() - .def("relax.MakePyExprVisitor", PyExprVisitor::MakePyExprVisitor) - .def("relax.PyExprVisitorVisitExpr", + .def("tvm.relax.MakePyExprVisitor", PyExprVisitor::MakePyExprVisitor) + .def("tvm.relax.PyExprVisitorVisitExpr", [](PyExprVisitor visitor, const Expr& expr) { visitor->VisitExpr(expr); }) - .def("relax.PyExprVisitorVisitBinding", + .def("tvm.relax.PyExprVisitorVisitBinding", [](PyExprVisitor visitor, const Binding& binding) { visitor->VisitBinding(binding); }) - .def("relax.PyExprVisitorVisitBindingBlock", + .def("tvm.relax.PyExprVisitorVisitBindingBlock", [](PyExprVisitor visitor, const BindingBlock& block) { visitor->VisitBindingBlock(block); }) - .def("relax.PyExprVisitorVisitVarDef", + .def("tvm.relax.PyExprVisitorVisitVarDef", [](PyExprVisitor visitor, const Var& var) { visitor->VisitVarDef(var); }) - .def("relax.ExprVisitorVisitExpr", + .def("tvm.relax.ExprVisitorVisitExpr", [](PyExprVisitor visitor, const Expr& expr) { visitor->ExprVisitor::VisitExpr(expr); }) - .def("relax.ExprVisitorVisitBinding", + .def("tvm.relax.ExprVisitorVisitBinding", [](PyExprVisitor visitor, const Binding& binding) { if (const auto* ptr = binding.as()) { visitor->ExprVisitor::VisitBinding_(ptr); @@ -579,7 +579,7 @@ TVM_FFI_STATIC_INIT_BLOCK() { LOG(FATAL) << "unreachable"; } }) - .def("relax.ExprVisitorVisitBindingBlock", + .def("tvm.relax.ExprVisitorVisitBindingBlock", [](PyExprVisitor visitor, const BindingBlock& block) { if (const auto* ptr = block.as()) { visitor->ExprVisitor::VisitBindingBlock_(ptr); @@ -589,7 +589,7 @@ TVM_FFI_STATIC_INIT_BLOCK() { LOG(FATAL) << "TypeError: Invalid type: " << block->GetTypeKey(); } }) - .def("relax.ExprVisitorVisitVarDef", + .def("tvm.relax.ExprVisitorVisitVarDef", [](PyExprVisitor visitor, const Var& var) { if (const auto* node = var.as()) { visitor->ExprVisitor::VisitVarDef_(node); @@ -599,24 +599,24 @@ TVM_FFI_STATIC_INIT_BLOCK() { LOG(FATAL) << "TypeError: Invalid type: " << var->GetTypeKey(); } }) - .def("relax.ExprVisitorVisitSpan", + .def("tvm.relax.ExprVisitorVisitSpan", [](PyExprVisitor visitor, const Span& span) { visitor->ExprVisitor::VisitSpan(span); }) - .def("relax.MakePyExprMutator", PyExprMutator::MakePyExprMutator) - .def("relax.PyExprMutatorVisitExpr", + .def("tvm.relax.MakePyExprMutator", PyExprMutator::MakePyExprMutator) + .def("tvm.relax.PyExprMutatorVisitExpr", [](PyExprMutator mutator, const Expr& expr) { return mutator->VisitExpr(expr); }) - .def("relax.PyExprMutatorVisitBinding", + .def("tvm.relax.PyExprMutatorVisitBinding", [](PyExprMutator mutator, const Binding& binding) { mutator->VisitBinding(binding); }) - .def("relax.PyExprMutatorVisitBindingBlock", + .def("tvm.relax.PyExprMutatorVisitBindingBlock", [](PyExprMutator mutator, const BindingBlock& block) { return mutator->VisitBindingBlock(block); }) - .def("relax.PyExprMutatorVisitVarDef", + .def("tvm.relax.PyExprMutatorVisitVarDef", [](PyExprMutator mutator, const Var& var) { return mutator->VisitVarDef(var); }) - .def("relax.ExprMutatorVisitExpr", + .def("tvm.relax.ExprMutatorVisitExpr", [](PyExprMutator mutator, const Expr& expr) { return mutator->ExprMutator::VisitExpr(expr); }) - .def("relax.ExprMutatorVisitBinding", + .def("tvm.relax.ExprMutatorVisitBinding", [](PyExprMutator mutator, const Binding& binding) { if (const auto* ptr = binding.as()) { return mutator->ExprMutator::VisitBinding_(ptr); @@ -626,7 +626,7 @@ TVM_FFI_STATIC_INIT_BLOCK() { LOG(FATAL) << "unreachable"; } }) - .def("relax.ExprMutatorVisitBindingBlock", + .def("tvm.relax.ExprMutatorVisitBindingBlock", [](PyExprMutator mutator, const BindingBlock& block) { if (const auto* node = block.as()) { return mutator->ExprMutator::VisitBindingBlock_(node); @@ -636,7 +636,7 @@ TVM_FFI_STATIC_INIT_BLOCK() { LOG(FATAL) << "TypeError: Invalid type: " << block->GetTypeKey(); } }) - .def("relax.ExprMutatorVisitVarDef", + .def("tvm.relax.ExprMutatorVisitVarDef", [](PyExprMutator mutator, const Var& var) { if (const auto* node = var.as()) { return mutator->ExprMutator::VisitVarDef_(node); @@ -647,19 +647,19 @@ TVM_FFI_STATIC_INIT_BLOCK() { } }) .def( - "relax.PyExprMutatorVisitExprPostOrder", + "tvm.relax.PyExprMutatorVisitExprPostOrder", [](PyExprMutator mutator, const Expr& expr) { return mutator->VisitExprPostOrder(expr); }) - .def("relax.PyExprMutatorVisitWithNewScope", + .def("tvm.relax.PyExprMutatorVisitWithNewScope", [](PyExprMutator mutator, const Expr& expr) { return mutator->VisitWithNewScope(expr); }) - .def("relax.PyExprMutatorLookupBinding", + .def("tvm.relax.PyExprMutatorLookupBinding", [](PyExprMutator mutator, const Var& var) { return mutator->LookupBinding(var); }) - .def("relax.PyExprMutatorWithStructInfo", + .def("tvm.relax.PyExprMutatorWithStructInfo", [](PyExprMutator mutator, Var var, StructInfo sinfo) { return mutator->WithStructInfo(var, sinfo); }) - .def("relax.PyExprMutatorSetVarRemap", + .def("tvm.relax.PyExprMutatorSetVarRemap", [](PyExprMutator mutator, Id id, Var var) { return mutator->var_remap_[id] = var; }) - .def("relax.PyExprMutatorGetVarRemap", + .def("tvm.relax.PyExprMutatorGetVarRemap", [](PyExprMutator mutator, Id id) { return mutator->var_remap_[id]; }); } diff --git a/src/relax/ir/struct_info.cc b/src/relax/ir/struct_info.cc index 22ed4e9ea382..cbbb89dc68e0 100644 --- a/src/relax/ir/struct_info.cc +++ b/src/relax/ir/struct_info.cc @@ -48,7 +48,8 @@ ObjectStructInfo::ObjectStructInfo(Span span) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.ObjectStructInfo", [](Span span) { return ObjectStructInfo(span); }); + refl::GlobalDef().def("tvm.relax.ObjectStructInfo", + [](Span span) { return ObjectStructInfo(span); }); } // Prim @@ -71,9 +72,9 @@ PrimStructInfo::PrimStructInfo(DataType dtype, Span span) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("relax.PrimStructInfoFromDtype", + .def("tvm.relax.PrimStructInfoFromDtype", [](DataType dtype, Span span) { return PrimStructInfo(dtype, span); }) - .def("relax.PrimStructInfoFromValue", + .def("tvm.relax.PrimStructInfoFromValue", [](PrimExpr value, Span span) { return PrimStructInfo(value, span); }); } @@ -103,15 +104,15 @@ ShapeStructInfo::ShapeStructInfo(int ndim, Span span) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def( - "relax.ShapeStructInfo", [](ffi::Optional> values, int ndim, Span span) { - if (values.defined()) { - CHECK_EQ(ndim, kUnknownNDim) << "ValueError: Cannot both specify values and ndim"; - return ShapeStructInfo(values.value(), span); - } else { - return ShapeStructInfo(ndim, span); - } - }); + refl::GlobalDef().def("tvm.relax.ShapeStructInfo", [](ffi::Optional> values, + int ndim, Span span) { + if (values.defined()) { + CHECK_EQ(ndim, kUnknownNDim) << "ValueError: Cannot both specify values and ndim"; + return ShapeStructInfo(values.value(), span); + } else { + return ShapeStructInfo(ndim, span); + } + }); } // Tensor @@ -147,8 +148,8 @@ TensorStructInfo::TensorStructInfo(DataType dtype, int ndim, ffi::Optional shape, ffi::Optional dtype, - int ndim, VDevice vdevice, Span span) { + "tvm.relax.TensorStructInfo", [](ffi::Optional shape, ffi::Optional dtype, + int ndim, VDevice vdevice, Span span) { if (shape.defined()) { CHECK_EQ(ndim, kUnknownNDim) << "ValueError: Cannot both specify shape and ndim"; return TensorStructInfo(shape.value(), dtype.value_or(DataType::Void()), vdevice, span); @@ -168,7 +169,7 @@ TupleStructInfo::TupleStructInfo(ffi::Array fields, Span span) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.TupleStructInfo", [](ffi::Array fields, Span span) { + refl::GlobalDef().def("tvm.relax.TupleStructInfo", [](ffi::Array fields, Span span) { return TupleStructInfo(fields, span); }); } @@ -205,11 +206,11 @@ FuncStructInfo FuncStructInfo::OpaqueFunc(StructInfo ret, bool purity, Span span TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("relax.FuncStructInfo", + .def("tvm.relax.FuncStructInfo", [](ffi::Array params, StructInfo ret, bool purity, Span span) { return FuncStructInfo(params, ret, purity, span); }) - .def("relax.FuncStructInfoOpaqueFunc", + .def("tvm.relax.FuncStructInfoOpaqueFunc", [](ffi::Optional ret, ffi::Optional derive_func, bool purity, Span span) { if (derive_func.defined()) { @@ -235,9 +236,9 @@ void UpdateStructInfo(Expr expr, StructInfo struct_info) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("relax.UpdateStructInfo", + .def("tvm.relax.UpdateStructInfo", [](Expr expr, StructInfo struct_info) { UpdateStructInfo(expr, struct_info); }) - .def("ir.ExprStructInfo", [](Expr expr) { return GetStructInfo(expr); }); + .def("tvm.ir.ExprStructInfo", [](Expr expr) { return GetStructInfo(expr); }); } } // namespace relax diff --git a/src/relax/ir/transform.cc b/src/relax/ir/transform.cc index 39c754361360..52c15f004ab9 100644 --- a/src/relax/ir/transform.cc +++ b/src/relax/ir/transform.cc @@ -81,7 +81,7 @@ class FunctionPassNode : public tvm::transform::PassNode { * \brief Get the pass information/meta data. */ PassInfo Info() const override { return pass_info; } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.FunctionPass", FunctionPassNode, PassNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.FunctionPass", FunctionPassNode, PassNode); private: }; @@ -167,7 +167,7 @@ Pass CreateFunctionPass(std::function TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef().def( - "relax.transform.MakeFunctionPass", + "tvm.relax.transform.MakeFunctionPass", [](ffi::TypedFunction, IRModule, PassContext)> pass_func, PassInfo pass_info) { auto wrapped_pass_func = [pass_func](Function func, IRModule mod, PassContext ctx) { @@ -217,7 +217,7 @@ class DataflowBlockPassNode : public tvm::transform::PassNode { IRModule operator()(IRModule mod, const PassContext& pass_ctx) const final; PassInfo Info() const override { return pass_info; } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.DataflowBlockPass", DataflowBlockPassNode, PassNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.DataflowBlockPass", DataflowBlockPassNode, PassNode); }; /*! \brief Helper to apply the passed function to dataflow blocks.*/ @@ -389,7 +389,7 @@ Pass CreateDataflowBlockPass( TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef().def( - "relax.transform.MakeDataflowBlockPass", + "tvm.relax.transform.MakeDataflowBlockPass", [](ffi::TypedFunction, IRModule, PassContext)> pass_func, PassInfo pass_info) { diff --git a/src/relax/ir/type.cc b/src/relax/ir/type.cc index faa0814f4c9d..7ffe4710c8f8 100644 --- a/src/relax/ir/type.cc +++ b/src/relax/ir/type.cc @@ -44,7 +44,7 @@ ShapeType::ShapeType(int ndim, Span span) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.ShapeType", + refl::GlobalDef().def("tvm.relax.ShapeType", [](int ndim, Span span) { return ShapeType(ndim, span); }); } @@ -56,7 +56,7 @@ ObjectType::ObjectType(Span span) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.ObjectType", [](Span span) { return ObjectType(span); }); + refl::GlobalDef().def("tvm.relax.ObjectType", [](Span span) { return ObjectType(span); }); } TensorType::TensorType(int ndim, DataType dtype, Span span) { @@ -77,7 +77,7 @@ TensorType TensorType::CreateUnknownNDim(DataType dtype, Span span) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.TensorType", [](int ndim, DataType dtype, Span span) { + refl::GlobalDef().def("tvm.relax.TensorType", [](int ndim, DataType dtype, Span span) { return TensorType(ndim, dtype, span); }); } @@ -90,7 +90,7 @@ PackedFuncType::PackedFuncType(Span span) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.PackedFuncType", [](Span span) { return PackedFuncType(span); }); + refl::GlobalDef().def("tvm.relax.PackedFuncType", [](Span span) { return PackedFuncType(span); }); } } // namespace relax diff --git a/src/relax/op/ccl/ccl.cc b/src/relax/op/ccl/ccl.cc index 29036f42f846..cf04bc0d8c32 100644 --- a/src/relax/op/ccl/ccl.cc +++ b/src/relax/op/ccl/ccl.cc @@ -45,7 +45,7 @@ Expr allreduce(Expr x, ffi::String op_type, bool in_group) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.ccl.allreduce", allreduce); + refl::GlobalDef().def("tvm.relax.op.ccl.allreduce", allreduce); } StructInfo InferStructInfoAllReduce(const Call& call, const BlockBuilder& ctx) { @@ -74,7 +74,7 @@ Expr allgather(Expr x, int num_workers, bool in_group) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.ccl.allgather", allgather); + refl::GlobalDef().def("tvm.relax.op.ccl.allgather", allgather); } StructInfo InferStructInfoAllGather(const Call& call, const BlockBuilder& ctx) { @@ -108,7 +108,7 @@ Expr broadcast_from_worker0(Expr x) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.ccl.broadcast_from_worker0", broadcast_from_worker0); + refl::GlobalDef().def("tvm.relax.op.ccl.broadcast_from_worker0", broadcast_from_worker0); } StructInfo InferStructInfoBroadcastFromZero(const Call& call, const BlockBuilder& ctx) { @@ -136,7 +136,7 @@ Expr scatter_from_worker0(Expr data, int num_workers, int axis) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.ccl.scatter_from_worker0", scatter_from_worker0); + refl::GlobalDef().def("tvm.relax.op.ccl.scatter_from_worker0", scatter_from_worker0); } StructInfo InferStructInfoScatter(const Call& call, const BlockBuilder& ctx) { diff --git a/src/relax/op/distributed/distributed.cc b/src/relax/op/distributed/distributed.cc index 636891366194..8ef1170b00e7 100644 --- a/src/relax/op/distributed/distributed.cc +++ b/src/relax/op/distributed/distributed.cc @@ -53,7 +53,7 @@ Expr annotate_sharding(Expr input, distributed::DeviceMesh device_mesh, TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.dist.annotate_sharding", annotate_sharding); + refl::GlobalDef().def("tvm.relax.op.dist.annotate_sharding", annotate_sharding); } StructInfo InferStructInfoAnnotateSharding(const Call& call, const BlockBuilder& ctx) { @@ -81,7 +81,7 @@ Expr redistribute(Expr input, distributed::DeviceMesh device_mesh, TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.dist.redistribute", redistribute); + refl::GlobalDef().def("tvm.relax.op.dist.redistribute", redistribute); } StructInfo InferDistStructInfoRedistribute(const Call& call, const BlockBuilder& ctx) { @@ -150,7 +150,7 @@ Expr MakeCallTIRLocalView(Expr func, Tuple args, TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.dist.call_tir_local_view", MakeCallTIRLocalView); + refl::GlobalDef().def("tvm.relax.op.dist.call_tir_local_view", MakeCallTIRLocalView); } StructInfo InferStructInfoRtoS(const Call& call, const BlockBuilder& ctx) { @@ -222,7 +222,7 @@ Expr redistribute_replica_to_shard(Expr input, int num_workers, int axis) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.dist.redistribute_replica_to_shard", + refl::GlobalDef().def("tvm.relax.op.dist.redistribute_replica_to_shard", redistribute_replica_to_shard); } diff --git a/src/relax/op/image/resize.cc b/src/relax/op/image/resize.cc index 59d845d867f6..8df77fa0c5e7 100644 --- a/src/relax/op/image/resize.cc +++ b/src/relax/op/image/resize.cc @@ -56,7 +56,7 @@ Expr resize2d(Expr data, Expr size, ffi::Array roi, ffi::String layout TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.image.resize2d", resize2d); + refl::GlobalDef().def("tvm.relax.op.image.resize2d", resize2d); } StructInfo InferStructInfoResize2D(const Call& call, const BlockBuilder& ctx) { @@ -166,7 +166,7 @@ Expr grid_sample(Expr data, Expr grid, ffi::String method, ffi::String layout, TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.image.grid_sample", grid_sample); + refl::GlobalDef().def("tvm.relax.op.image.grid_sample", grid_sample); } StructInfo InferStructInfoGridSample(const Call& call, const BlockBuilder& ctx) { diff --git a/src/relax/op/memory/view.cc b/src/relax/op/memory/view.cc index 04a845bd816d..9e1c26506855 100644 --- a/src/relax/op/memory/view.cc +++ b/src/relax/op/memory/view.cc @@ -45,7 +45,7 @@ Expr view(Expr x, ffi::Optional shape, ffi::Optional dtype, TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.memory.view", view); + refl::GlobalDef().def("tvm.relax.op.memory.view", view); } StructInfo InferStructInfoView(const Call& call, const BlockBuilder& ctx) { @@ -348,7 +348,7 @@ Expr LowerBuiltinView(const BlockBuilder& bb, const Call& call) { infer_sinfo_env_func = EnvFunc::Get("tvm.relax.struct_info.infer_view_sinfo"); auto runtime_view_sinfo = FuncStructInfo::OpaqueFunc(infer_sinfo_env_func, true); - ExternFunc runtime_view_func("runtime.TVMTensorCreateView", runtime_view_sinfo); + ExternFunc runtime_view_func("tvm.runtime.TVMTensorCreateView", runtime_view_sinfo); return Call(runtime_view_func, {data, shape, dtype, relative_byte_offset}); } @@ -372,7 +372,7 @@ Expr ensure_zero_offset(const Expr& x) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.memory.ensure_zero_offset", ensure_zero_offset); + refl::GlobalDef().def("tvm.relax.op.memory.ensure_zero_offset", ensure_zero_offset); } StructInfo InferStructInfoEnsureZeroOffset(const Call& call, const BlockBuilder& ctx) { @@ -385,7 +385,7 @@ StructInfo InferStructInfoEnsureZeroOffset(const Call& call, const BlockBuilder& } Expr LowerBuiltinEnsureZeroOffset(const BlockBuilder& bb, const Call& call) { - const ExternFunc builtin_ensure_zero_offset_{"vm.builtin.ensure_zero_offset"}; + const ExternFunc builtin_ensure_zero_offset_{"tvm.vm.builtin.ensure_zero_offset"}; return Call(builtin_ensure_zero_offset_, call->args, Attrs(), {GetStructInfo(call)}); } diff --git a/src/relax/op/nn/attention.cc b/src/relax/op/nn/attention.cc index bf384e863443..b2ec437f31ff 100644 --- a/src/relax/op/nn/attention.cc +++ b/src/relax/op/nn/attention.cc @@ -61,8 +61,8 @@ Expr attention_var_len(Expr query, Expr key, Expr value, Expr seqstart_q, Expr s TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("relax.op.nn.attention", attention) - .def("relax.op.nn.attention_var_len", attention_var_len); + .def("tvm.relax.op.nn.attention", attention) + .def("tvm.relax.op.nn.attention_var_len", attention_var_len); } StructInfo InferStructInfoAttention(const Call& call, const BlockBuilder& ctx) { diff --git a/src/relax/op/nn/convolution.cc b/src/relax/op/nn/convolution.cc index 49e92719ba15..13c4e29f7e05 100644 --- a/src/relax/op/nn/convolution.cc +++ b/src/relax/op/nn/convolution.cc @@ -63,7 +63,7 @@ Expr conv1d(Expr data, Expr weight, ffi::Array strides, ffi::Array strides, ffi::Array strides, ffi::Array strides, TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.nn.conv1d_transpose", conv1d_transpose); + refl::GlobalDef().def("tvm.relax.op.nn.conv1d_transpose", conv1d_transpose); } StructInfo InferStructInfoConv1dTranspose(const Call& call, const BlockBuilder& ctx) { @@ -763,7 +763,7 @@ Expr conv2d_transpose(Expr data, Expr weight, ffi::Array strides, TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.nn.conv2d_transpose", conv2d_transpose); + refl::GlobalDef().def("tvm.relax.op.nn.conv2d_transpose", conv2d_transpose); } StructInfo InferStructInfoConv2dTranspose(const Call& call, const BlockBuilder& ctx) { diff --git a/src/relax/op/nn/nn.cc b/src/relax/op/nn/nn.cc index f4b9fe400bee..eb16ffb9e19f 100644 --- a/src/relax/op/nn/nn.cc +++ b/src/relax/op/nn/nn.cc @@ -69,7 +69,7 @@ Expr leakyrelu(Expr data, double alpha) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.nn.leakyrelu", leakyrelu); + refl::GlobalDef().def("tvm.relax.op.nn.leakyrelu", leakyrelu); } TVM_REGISTER_OP("relax.nn.leakyrelu") @@ -92,7 +92,7 @@ Expr softplus(Expr data, double beta, double threshold) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.nn.softplus", softplus); + refl::GlobalDef().def("tvm.relax.op.nn.softplus", softplus); } TVM_REGISTER_OP("relax.nn.softplus") @@ -114,7 +114,7 @@ Expr prelu(Expr data, Expr alpha, int axis = 1) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.nn.prelu", prelu); + refl::GlobalDef().def("tvm.relax.op.nn.prelu", prelu); } StructInfo InferStructInfoPRelu(const Call& call, const BlockBuilder& ctx) { @@ -178,7 +178,7 @@ Expr softmax(Expr data, int axis) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.nn.softmax", softmax); + refl::GlobalDef().def("tvm.relax.op.nn.softmax", softmax); } StructInfo InferStructInfoSoftmax(const Call& call, const BlockBuilder& ctx) { @@ -239,7 +239,7 @@ Expr log_softmax(Expr data, int axis) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.nn.log_softmax", log_softmax); + refl::GlobalDef().def("tvm.relax.op.nn.log_softmax", log_softmax); } TVM_REGISTER_OP("relax.nn.log_softmax") @@ -262,7 +262,7 @@ Expr pad(Expr data, ffi::Array pad_width, ffi::String pad_mode, double TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.nn.pad", pad); + refl::GlobalDef().def("tvm.relax.op.nn.pad", pad); } StructInfo InferStructInfoPad(const Call& call, const BlockBuilder& ctx) { @@ -307,7 +307,7 @@ Expr pixel_shuffle(Expr data, int upscale_factor) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.nn.pixel_shuffle", pixel_shuffle); + refl::GlobalDef().def("tvm.relax.op.nn.pixel_shuffle", pixel_shuffle); } StructInfo InferStructInfoPixelShuffle(const Call& call, const BlockBuilder& ctx) { @@ -459,7 +459,7 @@ Expr batch_norm(Expr data, Expr gamma, Expr beta, Expr moving_mean, Expr moving_ } TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.nn.batch_norm", batch_norm); + refl::GlobalDef().def("tvm.relax.op.nn.batch_norm", batch_norm); } StructInfo InferStructInfoBatchNorm(const Call& call, const BlockBuilder& ctx) { @@ -538,7 +538,7 @@ Expr layer_norm(Expr data, Expr gamma, Expr beta, ffi::Array axes, doub TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.nn.layer_norm", layer_norm); + refl::GlobalDef().def("tvm.relax.op.nn.layer_norm", layer_norm); } StructInfo InferStructInfoLayerNorm(const Call& call, const BlockBuilder& ctx) { @@ -608,7 +608,7 @@ Expr group_norm(Expr data, Expr gamma, Expr beta, int num_groups, int channel_ax TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.nn.group_norm", group_norm); + refl::GlobalDef().def("tvm.relax.op.nn.group_norm", group_norm); } StructInfo InferStructInfoGroupNorm(const Call& call, const BlockBuilder& ctx) { @@ -721,7 +721,7 @@ Expr instance_norm(Expr data, Expr gamma, Expr beta, int channel_axis, ffi::Arra TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.nn.instance_norm", instance_norm); + refl::GlobalDef().def("tvm.relax.op.nn.instance_norm", instance_norm); } StructInfo InferStructInfoInstanceNorm(const Call& call, const BlockBuilder& ctx) { @@ -819,7 +819,7 @@ Expr rms_norm(Expr data, Expr weight, ffi::Array axes, double epsilon) TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.nn.rms_norm", rms_norm); + refl::GlobalDef().def("tvm.relax.op.nn.rms_norm", rms_norm); } StructInfo InferStructInfoRMSNorm(const Call& call, const BlockBuilder& ctx) { @@ -879,7 +879,7 @@ Expr dropout(Expr data, double rate) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.nn.dropout", dropout); + refl::GlobalDef().def("tvm.relax.op.nn.dropout", dropout); } StructInfo InferStructInfoDropout(const Call& call, const BlockBuilder& ctx) { @@ -950,7 +950,7 @@ Expr cross_entropy_with_logits(Expr predictions, Expr labels) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.nn.cross_entropy_with_logits", cross_entropy_with_logits); + refl::GlobalDef().def("tvm.relax.op.nn.cross_entropy_with_logits", cross_entropy_with_logits); } TVM_REGISTER_OP("relax.nn.cross_entropy_with_logits") @@ -985,7 +985,7 @@ Expr nll_loss(Expr predictions, Expr targets, ffi::Optional weights, ffi:: TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.nn.nll_loss", nll_loss); + refl::GlobalDef().def("tvm.relax.op.nn.nll_loss", nll_loss); } StructInfo InferStructInfoNLLLoss(const Call& call, const BlockBuilder& ctx) { diff --git a/src/relax/op/nn/pooling.cc b/src/relax/op/nn/pooling.cc index 584135520000..932d4ca319a5 100644 --- a/src/relax/op/nn/pooling.cc +++ b/src/relax/op/nn/pooling.cc @@ -75,7 +75,7 @@ Expr max_pool1d(Expr data, ffi::Array pool_size, ffi::Array stri TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.nn.max_pool1d", max_pool1d); + refl::GlobalDef().def("tvm.relax.op.nn.max_pool1d", max_pool1d); } StructInfo InferStructInfoPool1D(const Call& call, const BlockBuilder& ctx) { @@ -191,7 +191,7 @@ Expr max_pool2d(Expr data, ffi::Array pool_size, ffi::Array stri TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.nn.max_pool2d", max_pool2d); + refl::GlobalDef().def("tvm.relax.op.nn.max_pool2d", max_pool2d); } StructInfo InferStructInfoPool2D(const Call& call, const BlockBuilder& ctx) { @@ -334,7 +334,7 @@ Expr max_pool3d(Expr data, ffi::Array pool_size, ffi::Array stri TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.nn.max_pool3d", max_pool3d); + refl::GlobalDef().def("tvm.relax.op.nn.max_pool3d", max_pool3d); } StructInfo InferStructInfoPool3D(const Call& call, const BlockBuilder& ctx) { @@ -424,7 +424,7 @@ Expr avg_pool1d(Expr data, ffi::Array pool_size, ffi::Array stri TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.nn.avg_pool1d", avg_pool1d); + refl::GlobalDef().def("tvm.relax.op.nn.avg_pool1d", avg_pool1d); } TVM_REGISTER_OP("relax.nn.avg_pool1d") @@ -446,7 +446,7 @@ Expr avg_pool2d(Expr data, ffi::Array pool_size, ffi::Array stri TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.nn.avg_pool2d", avg_pool2d); + refl::GlobalDef().def("tvm.relax.op.nn.avg_pool2d", avg_pool2d); } TVM_REGISTER_OP("relax.nn.avg_pool2d") @@ -468,7 +468,7 @@ Expr avg_pool3d(Expr data, ffi::Array pool_size, ffi::Array stri TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.nn.avg_pool3d", avg_pool3d); + refl::GlobalDef().def("tvm.relax.op.nn.avg_pool3d", avg_pool3d); } TVM_REGISTER_OP("relax.nn.avg_pool3d") @@ -501,7 +501,7 @@ Expr adaptive_avg_pool1d(Expr data, ffi::Optional> output_siz TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.nn.adaptive_avg_pool1d", adaptive_avg_pool1d); + refl::GlobalDef().def("tvm.relax.op.nn.adaptive_avg_pool1d", adaptive_avg_pool1d); } StructInfo InferStructInfoAdaptiveAvgPool1D(const Call& call, const BlockBuilder& ctx) { @@ -586,7 +586,7 @@ Expr adaptive_avg_pool2d(Expr data, ffi::Optional> output_siz TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.nn.adaptive_avg_pool2d", adaptive_avg_pool2d); + refl::GlobalDef().def("tvm.relax.op.nn.adaptive_avg_pool2d", adaptive_avg_pool2d); } StructInfo InferStructInfoAdaptiveAvgPool2D(const Call& call, const BlockBuilder& ctx) { @@ -688,7 +688,7 @@ Expr adaptive_avg_pool3d(Expr data, ffi::Optional> output_siz TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.nn.adaptive_avg_pool3d", adaptive_avg_pool3d); + refl::GlobalDef().def("tvm.relax.op.nn.adaptive_avg_pool3d", adaptive_avg_pool3d); } StructInfo InferStructInfoAdaptiveAvgPool3D(const Call& call, const BlockBuilder& ctx) { diff --git a/src/relax/op/op.cc b/src/relax/op/op.cc index 54f9da4c786f..114dc7b41057 100644 --- a/src/relax/op/op.cc +++ b/src/relax/op/op.cc @@ -130,7 +130,7 @@ Expr MakeCallPurePacked(const Expr& callee, ffi::Array args, const Attrs& TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.call_pure_packed", MakeCallPurePacked); + refl::GlobalDef().def("tvm.relax.op.call_pure_packed", MakeCallPurePacked); } // call_inplace_packed @@ -250,7 +250,7 @@ Expr MakeCallInplacePacked(Expr func, ffi::Array args, ffi::Array TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.call_inplace_packed", MakeCallInplacePacked); + refl::GlobalDef().def("tvm.relax.op.call_inplace_packed", MakeCallInplacePacked); } // call_tir @@ -615,7 +615,7 @@ Expr MakeCallTIR(Expr func, Tuple args, ffi::Array out_sinfo_l TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.call_tir", MakeCallTIR); + refl::GlobalDef().def("tvm.relax.op.call_tir", MakeCallTIR); } // call_tir_with_grad @@ -668,7 +668,7 @@ Expr MakeCallTIRWithGrad(Expr func, Tuple args, ffi::Array out TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.call_tir_with_grad", MakeCallTIRWithGrad); + refl::GlobalDef().def("tvm.relax.op.call_tir_with_grad", MakeCallTIRWithGrad); } // call_tir_inplace @@ -811,7 +811,7 @@ Expr MakeCallTIRInplace(Expr func, Tuple args, ffi::Array inplace_indic TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.call_tir_inplace", MakeCallTIRInplace); + refl::GlobalDef().def("tvm.relax.op.call_tir_inplace", MakeCallTIRInplace); } // call_dps_packed @@ -855,7 +855,7 @@ Expr MakeCallDPSPacked(Expr func, Tuple args, ffi::Array out_s TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.call_dps_packed", MakeCallDPSPacked); + refl::GlobalDef().def("tvm.relax.op.call_dps_packed", MakeCallDPSPacked); } // call_py_func @@ -919,7 +919,7 @@ Expr MakeCallPyFunc(StringImm func_name, Tuple args, ffi::Array sinfo_ TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.call_builtin_with_ctx", MakeCallBuiltinWithCtx); + refl::GlobalDef().def("tvm.relax.op.call_builtin_with_ctx", MakeCallBuiltinWithCtx); } TVM_REGISTER_OP("relax.null_value") @@ -963,7 +963,7 @@ Expr MakeCallNullValue() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.null_value", MakeCallNullValue); + refl::GlobalDef().def("tvm.relax.op.null_value", MakeCallNullValue); } // print @@ -974,7 +974,7 @@ TVM_REGISTER_OP("relax.print") "The first value is Python-style format string to use to print. The others " "are values to print") .set_attr("FInferStructInfo", ReturnVoidStructInfo) - .set_attr("FCallPacked", "relax.run.print") + .set_attr("FCallPacked", "tvm.relax.run.print") .set_attr("FPurity", Bool(false)); Expr MakePrint(ffi::Array vals, StringImm format) { @@ -989,7 +989,7 @@ Expr MakePrint(ffi::Array vals, StringImm format) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.print", MakePrint); + refl::GlobalDef().def("tvm.relax.op.print", MakePrint); } // assert_op @@ -1020,7 +1020,7 @@ TVM_REGISTER_OP("relax.assert_op") "Python-style format string to use for displaying an error message, if the " "assert fails. The others are used as format arguments if there is an error.") .set_attr("FInferStructInfo", InferAssertStructInfo) - .set_attr("FCallPacked", "relax.run.assert_op") + .set_attr("FCallPacked", "tvm.relax.run.assert_op") .set_attr("FPurity", Bool(false)); Expr MakeAssertOp(Expr condition, ffi::Array vals, StringImm format) { @@ -1035,7 +1035,7 @@ Expr MakeAssertOp(Expr condition, ffi::Array vals, StringImm format) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.assert_op", MakeAssertOp); + refl::GlobalDef().def("tvm.relax.op.assert_op", MakeAssertOp); } // make_closure @@ -1054,7 +1054,7 @@ Expr MakeClosure(Expr func, Tuple args) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.make_closure", MakeClosure); + refl::GlobalDef().def("tvm.relax.op.make_closure", MakeClosure); } // invoke_closure @@ -1084,7 +1084,7 @@ Expr InvokeClosure(Expr closure, Tuple args, ffi::Array sinfo_args) TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.invoke_closure", InvokeClosure); + refl::GlobalDef().def("tvm.relax.op.invoke_closure", InvokeClosure); } // invoke_pure_closure @@ -1103,7 +1103,7 @@ Expr InvokePureClosure(Expr closure, Tuple args, ffi::Array sinfo_ar TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.invoke_pure_closure", InvokePureClosure); + refl::GlobalDef().def("tvm.relax.op.invoke_pure_closure", InvokePureClosure); } // shape_of @@ -1121,7 +1121,7 @@ Expr MakeShapeOf(Expr expr) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.shape_of", MakeShapeOf); + refl::GlobalDef().def("tvm.relax.op.shape_of", MakeShapeOf); } // tensor_to_shape @@ -1158,7 +1158,7 @@ Expr MakeTensorToShape(Expr expr) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.tensor_to_shape", MakeTensorToShape); + refl::GlobalDef().def("tvm.relax.op.tensor_to_shape", MakeTensorToShape); } // shape_to_tensor @@ -1175,7 +1175,7 @@ TVM_REGISTER_OP("relax.shape_to_tensor") .set_num_inputs(1) .add_argument("input", "Expr", "The input expression") .set_attr("FInferStructInfo", ReturnShapeToTensorStructInfo) - .set_attr("FCallPacked", "relax.run.shape_to_tensor") + .set_attr("FCallPacked", "tvm.relax.run.shape_to_tensor") .set_attr("FPurity", Bool(true)); Expr MakeShapeToTensor(Expr expr) { @@ -1185,7 +1185,7 @@ Expr MakeShapeToTensor(Expr expr) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.shape_to_tensor", MakeShapeToTensor); + refl::GlobalDef().def("tvm.relax.op.shape_to_tensor", MakeShapeToTensor); } // alloc_tensor @@ -1225,7 +1225,7 @@ Expr MakeAllocTensor(Expr shape, DataTypeImm dtype, PrimValue runtime_device_ind TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.builtin.alloc_tensor", MakeAllocTensor); + refl::GlobalDef().def("tvm.relax.op.builtin.alloc_tensor", MakeAllocTensor); } // memory planning alloc_storage @@ -1253,7 +1253,7 @@ Expr MakeAllocStorage(Expr size, PrimValue virtual_device_index, StringImm stora TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.memory.alloc_storage", MakeAllocStorage); + refl::GlobalDef().def("tvm.relax.op.memory.alloc_storage", MakeAllocStorage); } // memory planning alloc_tensor @@ -1287,7 +1287,7 @@ Expr MakeMemAllocTensor(Expr storage, PrimValue offset, Expr shape, DataTypeImm TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.memory.alloc_tensor", MakeMemAllocTensor); + refl::GlobalDef().def("tvm.relax.op.memory.alloc_tensor", MakeMemAllocTensor); } // memory planning kill_storage @@ -1306,7 +1306,7 @@ Expr MakeMemKillStorage(Expr storage) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.memory.kill_storage", MakeMemKillStorage); + refl::GlobalDef().def("tvm.relax.op.memory.kill_storage", MakeMemKillStorage); } // memory planning kill_tensor @@ -1325,7 +1325,7 @@ Expr MakeMemKillTensor(Expr tensor) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.memory.kill_tensor", MakeMemKillTensor); + refl::GlobalDef().def("tvm.relax.op.memory.kill_tensor", MakeMemKillTensor); } // vm alloc_storage @@ -1352,7 +1352,7 @@ Expr MakeVMAllocStorage(Expr size, PrimValue runtime_device_index, DataTypeImm d TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.vm.alloc_storage", MakeVMAllocStorage); + refl::GlobalDef().def("tvm.relax.op.vm.alloc_storage", MakeVMAllocStorage); } // vm alloc_tensor @@ -1393,7 +1393,7 @@ Expr MakeVMAllocTensor(Expr storage, PrimValue offset, Expr shape, DataTypeImm d TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.vm.alloc_tensor", MakeVMAllocTensor); + refl::GlobalDef().def("tvm.relax.op.vm.alloc_tensor", MakeVMAllocTensor); } // vm kill_object @@ -1412,7 +1412,7 @@ Expr MakeVMKillObject(Expr obj) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.vm.kill_object", MakeVMKillObject); + refl::GlobalDef().def("tvm.relax.op.vm.kill_object", MakeVMKillObject); } // vm call_tir_dyn @@ -1433,7 +1433,7 @@ Expr MakeCallTIRDyn(Expr func, Tuple args) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.vm.call_tir_dyn", MakeCallTIRDyn); + refl::GlobalDef().def("tvm.relax.op.vm.call_tir_dyn", MakeCallTIRDyn); } // builtin stop_lift_params @@ -1454,7 +1454,7 @@ Expr MakeStopLiftParams(Expr x) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.builtin.stop_lift_params", MakeStopLiftParams); + refl::GlobalDef().def("tvm.relax.op.builtin.stop_lift_params", MakeStopLiftParams); } // to_vdevice @@ -1487,7 +1487,7 @@ Expr MakeToVDevice(Expr data, VDevice dst_vdev) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.to_vdevice", MakeToVDevice); + refl::GlobalDef().def("tvm.relax.op.to_vdevice", MakeToVDevice); } // hint_on_device @@ -1517,14 +1517,15 @@ Expr MakeHintOnDevice(Expr data, Device device, ffi::String memory_scope = "glob TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def_packed("relax.op.hint_on_device", [](ffi::PackedArgs args, ffi::Any* ret) { - if (args.size() == 3) { - *ret = MakeHintOnDevice(args[0].cast(), args[1].cast(), - args[2].cast()); - } else { - *ret = MakeHintOnDevice(args[0].cast(), args[1].cast()); - } - }); + refl::GlobalDef().def_packed( + "tvm.relax.op.hint_on_device", [](ffi::PackedArgs args, ffi::Any* ret) { + if (args.size() == 3) { + *ret = MakeHintOnDevice(args[0].cast(), args[1].cast(), + args[2].cast()); + } else { + *ret = MakeHintOnDevice(args[0].cast(), args[1].cast()); + } + }); } } // namespace relax diff --git a/src/relax/op/op_common.h b/src/relax/op/op_common.h index 5a556cbd7413..f294ca1678de 100644 --- a/src/relax/op/op_common.h +++ b/src/relax/op/op_common.h @@ -173,16 +173,16 @@ std::tuple GetArgStructInfo(const Call& call, const BlockBuilder& c /*! * \brief Quick helper macro to expose a make-function to construct the operator. * \param OpName The name of the operator as well as the make-function name, which will - * be prepended with a prefix "relax.op." as the FFI identifier string for the make function, + * be prepended with a prefix "tvm.relax.op." as the FFI identifier string for the make function, * \param OpRegName The identifier of the operator in the registry. */ -#define RELAX_UNARY_OP_INTERFACE(OpName, OpRegName) \ - Expr OpName(Expr x) { \ - static const Op& op = Op::Get("relax." OpRegName); \ - return Call(op, {std::move(x)}, Attrs(), {}); \ - } \ - TVM_FFI_STATIC_INIT_BLOCK() { \ - tvm::ffi::reflection::GlobalDef().def("relax.op." OpRegName, OpName); \ +#define RELAX_UNARY_OP_INTERFACE(OpName, OpRegName) \ + Expr OpName(Expr x) { \ + static const Op& op = Op::Get("relax." OpRegName); \ + return Call(op, {std::move(x)}, Attrs(), {}); \ + } \ + TVM_FFI_STATIC_INIT_BLOCK() { \ + tvm::ffi::reflection::GlobalDef().def("tvm.relax.op." OpRegName, OpName); \ } /************ Utilities ************/ diff --git a/src/relax/op/tensor/binary.h b/src/relax/op/tensor/binary.h index b5650fad2735..5653a69f5e1d 100644 --- a/src/relax/op/tensor/binary.h +++ b/src/relax/op/tensor/binary.h @@ -34,7 +34,8 @@ namespace relax { * - Expose a make function to construct the node. * - Register op to the registry. * \param OpName The name of operator to register. The name passed in will - * 1. be prepended with a prefix "relax.op." as the FFI identifier string for the make function, + * 1. be prepended with a prefix "tvm.relax.op." as the FFI identifier string for the make + * function, * 2. be prepended with a prefix "relax." as the identifier string in the operator registry. */ #define RELAX_REGISTER_BINARY_OP_AND_IMPL(OpName) \ @@ -43,7 +44,7 @@ namespace relax { return Call(op, {x1, x2}, Attrs(), {}); \ } \ TVM_FFI_STATIC_INIT_BLOCK() { \ - tvm::ffi::reflection::GlobalDef().def("relax.op." #OpName, OpName); \ + tvm::ffi::reflection::GlobalDef().def("tvm.relax.op." #OpName, OpName); \ } \ TVM_REGISTER_OP("relax." #OpName) \ .set_num_inputs(2) \ diff --git a/src/relax/op/tensor/create.cc b/src/relax/op/tensor/create.cc index a9a0872d683a..902b48d6826d 100644 --- a/src/relax/op/tensor/create.cc +++ b/src/relax/op/tensor/create.cc @@ -64,7 +64,7 @@ Expr full(ffi::Variant> shape, Expr fill_value, TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.full", full); + refl::GlobalDef().def("tvm.relax.op.full", full); } StructInfo InferStructInfoFull(const Call& call, const BlockBuilder& ctx) { @@ -109,7 +109,7 @@ Expr full_like(Expr x, Expr fill_value, ffi::Optional dtype) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.full_like", full_like); + refl::GlobalDef().def("tvm.relax.op.full_like", full_like); } StructInfo InferStructInfoFullLike(const Call& call, const BlockBuilder& ctx) { @@ -190,7 +190,7 @@ Expr ones_like(Expr x, ffi::Optional dtype) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.ones", ones).def("relax.op.ones_like", ones_like); + refl::GlobalDef().def("tvm.relax.op.ones", ones).def("tvm.relax.op.ones_like", ones_like); } TVM_REGISTER_OP("relax.ones") @@ -227,7 +227,7 @@ Expr zeros_like(Expr x, ffi::Optional dtype) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.zeros", zeros).def("relax.op.zeros_like", zeros_like); + refl::GlobalDef().def("tvm.relax.op.zeros", zeros).def("tvm.relax.op.zeros_like", zeros_like); } TVM_REGISTER_OP("relax.zeros") @@ -262,7 +262,7 @@ Expr eye_like(Expr x, PrimValue k, ffi::Optional dtype) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.eye", eye).def("relax.op.eye_like", eye_like); + refl::GlobalDef().def("tvm.relax.op.eye", eye).def("tvm.relax.op.eye_like", eye_like); } StructInfo InferStructInfoEye(const Call& call, const BlockBuilder& ctx) { @@ -341,7 +341,7 @@ Expr arange(PrimValue start, PrimValue stop, PrimValue step, DataType dtype) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.arange", arange); + refl::GlobalDef().def("tvm.relax.op.arange", arange); } StructInfo InferStructInfoArange(const Call& call, const BlockBuilder& ctx) { @@ -398,7 +398,7 @@ Expr hamming_window(PrimValue window_size, PrimValue periodic, PrimValue alpha, TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.hamming_window", hamming_window); + refl::GlobalDef().def("tvm.relax.op.hamming_window", hamming_window); } StructInfo InferStructInfoHammingWindow(const Call& call, const BlockBuilder& ctx) { @@ -459,8 +459,8 @@ Expr triu(Expr x, int k) { return triu(x, relax::PrimValue::Int64(k)); } TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("relax.op.tril", static_cast(tril)) - .def("relax.op.triu", static_cast(triu)); + .def("tvm.relax.op.tril", static_cast(tril)) + .def("tvm.relax.op.triu", static_cast(triu)); } StructInfo InferStructInfoTrilTriu(const Call& call, const BlockBuilder& ctx) { diff --git a/src/relax/op/tensor/datatype.cc b/src/relax/op/tensor/datatype.cc index f12be685bdbc..516d68ac1dd4 100644 --- a/src/relax/op/tensor/datatype.cc +++ b/src/relax/op/tensor/datatype.cc @@ -48,7 +48,7 @@ Expr astype(Expr x, DataType dtype) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.astype", astype); + refl::GlobalDef().def("tvm.relax.op.astype", astype); } StructInfo InferStructInfoAstype(const Call& call, const BlockBuilder& ctx) { @@ -80,7 +80,7 @@ Expr MakeWrapParam(Expr data, DataType dtype) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.wrap_param", MakeWrapParam); + refl::GlobalDef().def("tvm.relax.op.wrap_param", MakeWrapParam); } StructInfo InferStructInfoWrapParam(const Call& call, const BlockBuilder& ctx) { diff --git a/src/relax/op/tensor/grad.cc b/src/relax/op/tensor/grad.cc index 52a218b730d0..010662d225a4 100644 --- a/src/relax/op/tensor/grad.cc +++ b/src/relax/op/tensor/grad.cc @@ -39,7 +39,7 @@ Expr no_grad(Expr input) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.grad.no_grad", no_grad); + refl::GlobalDef().def("tvm.relax.op.grad.no_grad", no_grad); } StructInfo InferStructInfoNoGrad(const Call& call, const BlockBuilder& ctx) { @@ -60,7 +60,7 @@ Expr start_checkpoint(Expr input) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.grad.start_checkpoint", start_checkpoint); + refl::GlobalDef().def("tvm.relax.op.grad.start_checkpoint", start_checkpoint); } StructInfo InferStructInfoStartCheckpoint(const Call& call, const BlockBuilder& ctx) { @@ -85,7 +85,7 @@ Expr end_checkpoint(Expr input) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.grad.end_checkpoint", end_checkpoint); + refl::GlobalDef().def("tvm.relax.op.grad.end_checkpoint", end_checkpoint); } StructInfo InferStructInfoEndCheckpoint(const Call& call, const BlockBuilder& ctx) { @@ -123,7 +123,7 @@ Expr nll_loss_backward(Expr output_grad, Expr predictions, Expr targets, TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.grad.nll_loss_backward", nll_loss_backward); + refl::GlobalDef().def("tvm.relax.op.grad.nll_loss_backward", nll_loss_backward); } StructInfo InferStructInfoNLLLossBackward(const Call& call, const BlockBuilder& ctx) { @@ -160,7 +160,7 @@ Expr max_pool2d_backward(Expr output_grad, Expr data, ffi::Array pool_si TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.grad.max_pool2d_backward", max_pool2d_backward); + refl::GlobalDef().def("tvm.relax.op.grad.max_pool2d_backward", max_pool2d_backward); } StructInfo InferStructInfoMaxPool2DBackward(const Call& call, const BlockBuilder& ctx) { @@ -195,7 +195,7 @@ Expr avg_pool2d_backward(Expr output_grad, Expr data, ffi::Array pool_si TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.grad.avg_pool2d_backward", avg_pool2d_backward); + refl::GlobalDef().def("tvm.relax.op.grad.avg_pool2d_backward", avg_pool2d_backward); } StructInfo InferStructInfoAvgPool2DBackward(const Call& call, const BlockBuilder& ctx) { @@ -222,7 +222,7 @@ Expr take_backward(Expr output_grad, Expr x, Expr indices, ffi::Optional axis, ffi::String mode) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.take", take); + refl::GlobalDef().def("tvm.relax.op.take", take); } StructInfo InferStructInfoTake(const Call& call, const BlockBuilder& ctx) { @@ -181,7 +181,7 @@ Expr strided_slice(Expr x, Expr axes, Expr begin, Expr end, ffi::Optional TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.strided_slice", strided_slice); + refl::GlobalDef().def("tvm.relax.op.strided_slice", strided_slice); } /* \brief Helper function to unpack a relax::Tuple @@ -492,7 +492,7 @@ Expr dynamic_strided_slice(Expr x, // TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.dynamic_strided_slice", dynamic_strided_slice); + refl::GlobalDef().def("tvm.relax.op.dynamic_strided_slice", dynamic_strided_slice); } StructInfo InferStructInfoDynStridedSlice(const Call& call, const BlockBuilder& ctx) { diff --git a/src/relax/op/tensor/linear_algebra.cc b/src/relax/op/tensor/linear_algebra.cc index 06b7856dd239..1ce509fba6ff 100644 --- a/src/relax/op/tensor/linear_algebra.cc +++ b/src/relax/op/tensor/linear_algebra.cc @@ -51,7 +51,7 @@ Expr matmul(Expr x1, Expr x2, ffi::Optional out_dtype) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.matmul", matmul); + refl::GlobalDef().def("tvm.relax.op.matmul", matmul); } StructInfo InferStructInfoMatmul(const Call& call, const BlockBuilder& ctx) { @@ -185,7 +185,7 @@ Expr einsum(Expr operands, ffi::String subscripts) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.einsum", einsum); + refl::GlobalDef().def("tvm.relax.op.einsum", einsum); } StructInfo InferStructInfoEinsum(const Call& call, const BlockBuilder& ctx) { @@ -270,7 +270,7 @@ Expr outer(Expr x1, Expr x2) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.outer", outer); + refl::GlobalDef().def("tvm.relax.op.outer", outer); } StructInfo InferStructInfoOuter(const Call& call, const BlockBuilder& ctx) { diff --git a/src/relax/op/tensor/manipulate.cc b/src/relax/op/tensor/manipulate.cc index 1aab52ac56a5..4017d30b08a3 100644 --- a/src/relax/op/tensor/manipulate.cc +++ b/src/relax/op/tensor/manipulate.cc @@ -66,7 +66,7 @@ Expr broadcast_to(Expr x, Expr shape) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.broadcast_to", broadcast_to); + refl::GlobalDef().def("tvm.relax.op.broadcast_to", broadcast_to); } StructInfo InferStructInfoBroadcastTo(const Call& call, const BlockBuilder& ctx) { @@ -151,7 +151,7 @@ Expr concat(Expr tensors, ffi::Optional axis) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.concat", concat); + refl::GlobalDef().def("tvm.relax.op.concat", concat); } ffi::Optional> CheckConcatOutputShape( @@ -414,7 +414,7 @@ Expr expand_dims(Expr x, ffi::Array axis) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.expand_dims", expand_dims); + refl::GlobalDef().def("tvm.relax.op.expand_dims", expand_dims); } StructInfo InferStructInfoExpandDims(const Call& call, const BlockBuilder& ctx) { @@ -523,7 +523,7 @@ Expr flatten(Expr x) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.flatten", flatten); + refl::GlobalDef().def("tvm.relax.op.flatten", flatten); } StructInfo InferStructInfoFlatten(const Call& call, const BlockBuilder& ctx) { @@ -561,7 +561,7 @@ Expr index_tensor(Expr first, Expr tensors) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.index_tensor", index_tensor); + refl::GlobalDef().def("tvm.relax.op.index_tensor", index_tensor); } StructInfo InferStructInfoIndexTensor(const Call& call, const BlockBuilder& ctx) { @@ -718,7 +718,7 @@ Expr layout_transform(Expr x, tir::IndexMap index_map, ffi::Optional TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.layout_transform", layout_transform); + refl::GlobalDef().def("tvm.relax.op.layout_transform", layout_transform); } StructInfo InferStructInfoLayoutTransform(const Call& call, const BlockBuilder& ctx) { @@ -787,7 +787,7 @@ Expr permute_dims(Expr x, ffi::Optional> axes) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.permute_dims", permute_dims); + refl::GlobalDef().def("tvm.relax.op.permute_dims", permute_dims); } bool IsIdentityPermutation(const std::vector& permutation) { @@ -999,7 +999,7 @@ Expr reshape(Expr x, ffi::Variant> shape) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.reshape", reshape); + refl::GlobalDef().def("tvm.relax.op.reshape", reshape); } StructInfo InferStructInfoReshape(const Call& call, const BlockBuilder& ctx) { @@ -1088,7 +1088,7 @@ Expr split(Expr x, ffi::Variant> indices_or_sections, TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.split", split); + refl::GlobalDef().def("tvm.relax.op.split", split); } StructInfo InferStructInfoSplit(const Call& call, const BlockBuilder& ctx) { @@ -1244,7 +1244,7 @@ Expr squeeze(Expr x, ffi::Optional> axis) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.squeeze", squeeze); + refl::GlobalDef().def("tvm.relax.op.squeeze", squeeze); } StructInfo InferStructInfoSqueeze(const Call& call, const BlockBuilder& ctx) { @@ -1443,7 +1443,7 @@ Expr stack(Expr tensors, ffi::Optional axis) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.stack", stack); + refl::GlobalDef().def("tvm.relax.op.stack", stack); } ffi::Optional> CheckStackOutputShape( @@ -1652,7 +1652,7 @@ Expr collapse_sum_like(Expr data, Expr collapse_target) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.collapse_sum_like", collapse_sum_like); + refl::GlobalDef().def("tvm.relax.op.collapse_sum_like", collapse_sum_like); } StructInfo InferStructInfoCollapseSumLike(const Call& call, const BlockBuilder& ctx) { @@ -1701,7 +1701,7 @@ Expr collapse_sum_to(Expr data, Expr shape) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.collapse_sum_to", collapse_sum_to); + refl::GlobalDef().def("tvm.relax.op.collapse_sum_to", collapse_sum_to); } StructInfo InferStructInfoCollapseSumTo(const Call& call, const BlockBuilder& ctx) { @@ -1758,7 +1758,7 @@ Expr repeat(Expr data, int repeats, ffi::Optional axis) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.repeat", repeat); + refl::GlobalDef().def("tvm.relax.op.repeat", repeat); } StructInfo InferStructInfoRepeat(const Call& call, const BlockBuilder& ctx) { @@ -1883,7 +1883,7 @@ Expr tile(Expr data, ffi::Array repeats) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.tile", tile); + refl::GlobalDef().def("tvm.relax.op.tile", tile); } StructInfo InferStructInfoTile(const Call& call, const BlockBuilder& ctx) { @@ -1948,7 +1948,7 @@ Expr flip(Expr data, Integer axis) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.flip", flip); + refl::GlobalDef().def("tvm.relax.op.flip", flip); } StructInfo InferStructInfoFlip(const Call& call, const BlockBuilder& ctx) { @@ -1987,7 +1987,7 @@ Expr gather_elements(Expr data, Expr indices, int axis) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.gather_elements", gather_elements); + refl::GlobalDef().def("tvm.relax.op.gather_elements", gather_elements); } StructInfo InferStructInfoGatherElements(const Call& call, const BlockBuilder& ctx) { @@ -2058,7 +2058,7 @@ Expr gather_nd(Expr data, Expr indices, int batch_dims) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.gather_nd", gather_nd); + refl::GlobalDef().def("tvm.relax.op.gather_nd", gather_nd); } StructInfo InferStructInfoGatherND(const Call& call, const BlockBuilder& ctx) { @@ -2154,7 +2154,7 @@ Expr index_put(Expr data, Expr indices, Expr values, bool accumulate) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.index_put", index_put); + refl::GlobalDef().def("tvm.relax.op.index_put", index_put); } StructInfo InferStructInfoIndexPut(const Call& call, const BlockBuilder& ctx) { @@ -2303,7 +2303,7 @@ Expr meshgrid(Expr tensors, ffi::Optional indexing) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.meshgrid", meshgrid); + refl::GlobalDef().def("tvm.relax.op.meshgrid", meshgrid); } StructInfo InferStructInfoMeshgrid(const Call& call, const BlockBuilder& ctx) { @@ -2409,7 +2409,7 @@ Expr scatter_elements(Expr data, Expr indices, Expr updates, int axis, ffi::Stri TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.scatter_elements", scatter_elements); + refl::GlobalDef().def("tvm.relax.op.scatter_elements", scatter_elements); } StructInfo InferStructInfoScatterElements(const Call& call, const BlockBuilder& ctx) { @@ -2523,7 +2523,7 @@ Expr scatter_nd(Expr data, Expr indices, Expr updates, ffi::String reduction) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.scatter_nd", scatter_nd); + refl::GlobalDef().def("tvm.relax.op.scatter_nd", scatter_nd); } StructInfo InferStructInfoScatterND(const Call& call, const BlockBuilder& ctx) { @@ -2660,7 +2660,7 @@ Expr slice_scatter(Expr input, Expr src, int axis, PrimValue start, PrimValue en TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.slice_scatter", slice_scatter); + refl::GlobalDef().def("tvm.relax.op.slice_scatter", slice_scatter); } StructInfo InferStructInfoSliceScatter(const Call& call, const BlockBuilder& ctx) { @@ -2827,7 +2827,7 @@ Expr one_hot(Expr indices, PrimValue on_value, PrimValue off_value, int depth, i TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.one_hot", one_hot); + refl::GlobalDef().def("tvm.relax.op.one_hot", one_hot); } StructInfo InferStructInfoOneHot(const Call& call, const BlockBuilder& ctx) { diff --git a/src/relax/op/tensor/qdq.cc b/src/relax/op/tensor/qdq.cc index 406868ab4bfc..f37c1dca9d16 100644 --- a/src/relax/op/tensor/qdq.cc +++ b/src/relax/op/tensor/qdq.cc @@ -48,7 +48,7 @@ Expr quantize(Expr data, Expr scale, Expr zero_point, int axis, DataType out_dty TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.quantize", quantize); + refl::GlobalDef().def("tvm.relax.op.quantize", quantize); } StructInfo InferStructInfoQuantize(const Call& call, const BlockBuilder& ctx) { @@ -134,7 +134,7 @@ Expr dequantize(Expr data, Expr scale, Expr zero_point, int axis, DataType out_d TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.dequantize", dequantize); + refl::GlobalDef().def("tvm.relax.op.dequantize", dequantize); } StructInfo InferStructInfoDequantize(const Call& call, const BlockBuilder& ctx) { diff --git a/src/relax/op/tensor/sampling.cc b/src/relax/op/tensor/sampling.cc index ca5635baa74b..b95cb5d2dc5e 100644 --- a/src/relax/op/tensor/sampling.cc +++ b/src/relax/op/tensor/sampling.cc @@ -47,7 +47,7 @@ Expr multinomial_from_uniform(Expr prob, Expr uniform_sample, Expr sample_indice TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.multinomial_from_uniform", multinomial_from_uniform); + refl::GlobalDef().def("tvm.relax.op.multinomial_from_uniform", multinomial_from_uniform); } StructInfo InferStructInfoMultinomialFromUniform(const Call& call, const BlockBuilder& ctx) { diff --git a/src/relax/op/tensor/search.cc b/src/relax/op/tensor/search.cc index 0cd221d53d1c..586fdd0d90f9 100644 --- a/src/relax/op/tensor/search.cc +++ b/src/relax/op/tensor/search.cc @@ -49,7 +49,7 @@ Expr bucketize(Expr input_tensor, Expr boundaries, bool out_int32, bool right) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.bucketize", bucketize); + refl::GlobalDef().def("tvm.relax.op.bucketize", bucketize); } StructInfo InferStructInfoBucketize(const Call& call, const BlockBuilder& ctx) { @@ -95,7 +95,7 @@ Expr where(Expr condition, Expr x1, Expr x2) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.where", where); + refl::GlobalDef().def("tvm.relax.op.where", where); } StructInfo InferStructInfoWhere(const Call& call, const BlockBuilder& ctx) { @@ -256,7 +256,7 @@ StructInfo InferStructInfoArgmaxArgmin(const Call& call, const BlockBuilder& ctx return Call(op, {std::move(x)}, Attrs(attrs)); \ } \ TVM_FFI_STATIC_INIT_BLOCK() { \ - tvm::ffi::reflection::GlobalDef().def("relax.op." #OpName, OpName); \ + tvm::ffi::reflection::GlobalDef().def("tvm.relax.op." #OpName, OpName); \ } \ TVM_REGISTER_OP("relax." #OpName) \ .set_num_inputs(1) \ diff --git a/src/relax/op/tensor/set.cc b/src/relax/op/tensor/set.cc index d80c73b1317d..60c41627aba6 100644 --- a/src/relax/op/tensor/set.cc +++ b/src/relax/op/tensor/set.cc @@ -50,7 +50,7 @@ Expr unique(Expr x, PrimValue sorted, PrimValue return_index, PrimValue return_i TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.unique", unique); + refl::GlobalDef().def("tvm.relax.op.unique", unique); } StructInfo InferStructInfoUnique(const Call& call, const BlockBuilder& ctx) { @@ -140,7 +140,7 @@ TVM_REGISTER_OP("relax.unique") "flattened input " "are returned.") .set_attr("FInferStructInfo", InferStructInfoUnique) - .set_attr("FCallPacked", "relax.run.unique") + .set_attr("FCallPacked", "tvm.relax.run.unique") .set_attr("FPurity", Bool(true)); /* relax.nonzero */ @@ -151,7 +151,7 @@ Expr nonzero(Expr x) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.nonzero", nonzero); + refl::GlobalDef().def("tvm.relax.op.nonzero", nonzero); } StructInfo InferStructInfoNonzero(const Call& call, const BlockBuilder& ctx) { @@ -163,7 +163,7 @@ TVM_REGISTER_OP("relax.nonzero") .set_num_inputs(1) .add_argument("x", "Tensor", "The input tensor") .set_attr("FInferStructInfo", InferStructInfoNonzero) - .set_attr("FCallPacked", "relax.run.nonzero") + .set_attr("FCallPacked", "tvm.relax.run.nonzero") .set_attr("FPurity", Bool(true)); } // namespace relax diff --git a/src/relax/op/tensor/sorting.cc b/src/relax/op/tensor/sorting.cc index db0bd8a8c700..a5b35a328a07 100644 --- a/src/relax/op/tensor/sorting.cc +++ b/src/relax/op/tensor/sorting.cc @@ -50,7 +50,7 @@ Expr sort(Expr data, int axis, bool descending) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.sort", sort); + refl::GlobalDef().def("tvm.relax.op.sort", sort); } StructInfo InferStructInfoSort(const Call& call, const BlockBuilder& ctx) { @@ -78,7 +78,7 @@ Expr argsort(Expr data, int axis, bool descending, DataType dtype) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.argsort", argsort); + refl::GlobalDef().def("tvm.relax.op.argsort", argsort); } StructInfo InferStructInfoArgsort(const Call& call, const BlockBuilder& ctx) { @@ -114,7 +114,7 @@ Expr topk(Expr data, int k, int axis, ffi::String ret_type, bool largest, DataTy TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.topk", topk); + refl::GlobalDef().def("tvm.relax.op.topk", topk); } StructInfo InferStructInfoTopK(const Call& call, const BlockBuilder& ctx) { diff --git a/src/relax/op/tensor/statistical.cc b/src/relax/op/tensor/statistical.cc index 621c23d36310..05ab301fc606 100644 --- a/src/relax/op/tensor/statistical.cc +++ b/src/relax/op/tensor/statistical.cc @@ -194,7 +194,7 @@ Expr cumprod(Expr data, ffi::Optional axis, ffi::Optional dty TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.cumprod", cumprod); + refl::GlobalDef().def("tvm.relax.op.cumprod", cumprod); } TVM_REGISTER_OP("relax.cumprod") @@ -217,7 +217,7 @@ Expr cumsum(Expr data, ffi::Optional axis, ffi::Optional dtyp TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.cumsum", cumsum); + refl::GlobalDef().def("tvm.relax.op.cumsum", cumsum); } TVM_REGISTER_OP("relax.cumsum") diff --git a/src/relax/op/tensor/statistical.h b/src/relax/op/tensor/statistical.h index a80ef728683a..c27a68687dd5 100644 --- a/src/relax/op/tensor/statistical.h +++ b/src/relax/op/tensor/statistical.h @@ -39,7 +39,8 @@ namespace relax { * - Expose a make function to construct the node. * - Register op to the registry. * \param OpName The name of operator to register. The name passed in will - * 1. be prepended with a prefix "relax.op." as the FFI identifier string for the make function, + * 1. be prepended with a prefix "tvm.relax.op." as the FFI identifier string for the make + * function, * 2. be prepended with a prefix "relax." as the identifier string in the operator registry. */ #define RELAX_REGISTER_STATISTICAL_OP_INTERFACE(OpName) \ @@ -51,7 +52,7 @@ namespace relax { return Call(op, {std::move(x)}, Attrs{attrs}, {}); \ } \ TVM_FFI_STATIC_INIT_BLOCK() { \ - tvm::ffi::reflection::GlobalDef().def("relax.op." #OpName, OpName); \ + tvm::ffi::reflection::GlobalDef().def("tvm.relax.op." #OpName, OpName); \ } \ TVM_REGISTER_OP("relax." #OpName) \ .set_num_inputs(1) \ diff --git a/src/relax/op/tensor/ternary.cc b/src/relax/op/tensor/ternary.cc index a38585cb507a..1428539b5e3b 100644 --- a/src/relax/op/tensor/ternary.cc +++ b/src/relax/op/tensor/ternary.cc @@ -147,7 +147,7 @@ Expr ewise_fma(Expr x1, Expr x2, Expr x3) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.ewise_fma", ewise_fma); + refl::GlobalDef().def("tvm.relax.op.ewise_fma", ewise_fma); } } // namespace relax diff --git a/src/relax/op/tensor/unary.cc b/src/relax/op/tensor/unary.cc index 50f5ce2bf35f..e5a1aa1fb4c9 100644 --- a/src/relax/op/tensor/unary.cc +++ b/src/relax/op/tensor/unary.cc @@ -89,7 +89,7 @@ Expr clip(Expr x, Expr min, Expr max) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.clip", clip); + refl::GlobalDef().def("tvm.relax.op.clip", clip); } /***************** Check operators *****************/ diff --git a/src/relax/op/vision/nms.cc b/src/relax/op/vision/nms.cc index 2a1ad8f40aa4..0fc83127d85f 100644 --- a/src/relax/op/vision/nms.cc +++ b/src/relax/op/vision/nms.cc @@ -52,7 +52,7 @@ Expr all_class_non_max_suppression(Expr boxes, Expr scores, Expr max_output_boxe TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.op.vision.all_class_non_max_suppression", + refl::GlobalDef().def("tvm.relax.op.vision.all_class_non_max_suppression", all_class_non_max_suppression); } diff --git a/src/relax/testing/transform.cc b/src/relax/testing/transform.cc index c8d7078258a8..96571a867e8a 100644 --- a/src/relax/testing/transform.cc +++ b/src/relax/testing/transform.cc @@ -38,7 +38,7 @@ tvm::transform::Pass ApplyEmptyCppMutator() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.testing.transform.ApplyEmptyCppMutator", ApplyEmptyCppMutator); + refl::GlobalDef().def("tvm.relax.testing.transform.ApplyEmptyCppMutator", ApplyEmptyCppMutator); } } // namespace testing diff --git a/src/relax/training/utils.cc b/src/relax/training/utils.cc index 26290775fe64..c3a9f4fc9ba4 100644 --- a/src/relax/training/utils.cc +++ b/src/relax/training/utils.cc @@ -218,7 +218,7 @@ Pass AppendLoss(ffi::String func_name, Function loss_function, int num_backbone_ TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.training.AppendLoss", AppendLoss); + refl::GlobalDef().def("tvm.relax.training.AppendLoss", AppendLoss); } } // namespace transform diff --git a/src/relax/transform/adjust_matmul_order.cc b/src/relax/transform/adjust_matmul_order.cc index 889272019174..95bfabe12998 100644 --- a/src/relax/transform/adjust_matmul_order.cc +++ b/src/relax/transform/adjust_matmul_order.cc @@ -234,7 +234,7 @@ Pass AdjustMatmulOrder() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.transform.AdjustMatmulOrder", AdjustMatmulOrder); + refl::GlobalDef().def("tvm.relax.transform.AdjustMatmulOrder", AdjustMatmulOrder); } } // namespace transform diff --git a/src/relax/transform/allocate_workspace.cc b/src/relax/transform/allocate_workspace.cc index 4e71e0c3eb43..b5db2be5d9b3 100644 --- a/src/relax/transform/allocate_workspace.cc +++ b/src/relax/transform/allocate_workspace.cc @@ -204,7 +204,7 @@ Pass AllocateWorkspace() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.transform.AllocateWorkspace", AllocateWorkspace); + refl::GlobalDef().def("tvm.relax.transform.AllocateWorkspace", AllocateWorkspace); } } // namespace transform diff --git a/src/relax/transform/alter_op_impl.cc b/src/relax/transform/alter_op_impl.cc index a612ef83bde0..d4d18d2f5708 100644 --- a/src/relax/transform/alter_op_impl.cc +++ b/src/relax/transform/alter_op_impl.cc @@ -449,7 +449,7 @@ Pass AlterOpImpl( TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.transform.AlterOpImpl", AlterOpImpl); + refl::GlobalDef().def("tvm.relax.transform.AlterOpImpl", AlterOpImpl); } } // namespace transform diff --git a/src/relax/transform/annotate_tir_op_pattern.cc b/src/relax/transform/annotate_tir_op_pattern.cc index f5b1061b6708..3045e2d6a2e1 100644 --- a/src/relax/transform/annotate_tir_op_pattern.cc +++ b/src/relax/transform/annotate_tir_op_pattern.cc @@ -50,7 +50,7 @@ Pass AnnotateTIROpPattern() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.transform.AnnotateTIROpPattern", AnnotateTIROpPattern); + refl::GlobalDef().def("tvm.relax.transform.AnnotateTIROpPattern", AnnotateTIROpPattern); } } // namespace transform diff --git a/src/relax/transform/attach_attr_layout_free_buffers.cc b/src/relax/transform/attach_attr_layout_free_buffers.cc index 064ff015eedf..f66ef8e9c7f0 100644 --- a/src/relax/transform/attach_attr_layout_free_buffers.cc +++ b/src/relax/transform/attach_attr_layout_free_buffers.cc @@ -108,7 +108,8 @@ Pass AttachAttrLayoutFreeBuffers() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.transform.AttachAttrLayoutFreeBuffers", AttachAttrLayoutFreeBuffers); + refl::GlobalDef().def("tvm.relax.transform.AttachAttrLayoutFreeBuffers", + AttachAttrLayoutFreeBuffers); } } // namespace transform } // namespace relax diff --git a/src/relax/transform/attach_global_symbol.cc b/src/relax/transform/attach_global_symbol.cc index 0079b504989a..c6de4c30b3a5 100644 --- a/src/relax/transform/attach_global_symbol.cc +++ b/src/relax/transform/attach_global_symbol.cc @@ -83,7 +83,7 @@ Pass AttachGlobalSymbol() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.transform.AttachGlobalSymbol", AttachGlobalSymbol); + refl::GlobalDef().def("tvm.relax.transform.AttachGlobalSymbol", AttachGlobalSymbol); } } // namespace transform } // namespace relax diff --git a/src/relax/transform/bind_params.cc b/src/relax/transform/bind_params.cc index 4ad9b3ab5051..ff4dd70ff28a 100644 --- a/src/relax/transform/bind_params.cc +++ b/src/relax/transform/bind_params.cc @@ -199,7 +199,7 @@ IRModule BindParam(IRModule m, ffi::String func_name, ffi::Map b TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.FunctionBindParams", FunctionBindParams); + refl::GlobalDef().def("tvm.relax.FunctionBindParams", FunctionBindParams); } namespace transform { @@ -213,7 +213,7 @@ Pass BindParams(ffi::String func_name, ffi::Map params) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.transform.BindParams", BindParams); + refl::GlobalDef().def("tvm.relax.transform.BindParams", BindParams); } } // namespace transform diff --git a/src/relax/transform/bind_symbolic_vars.cc b/src/relax/transform/bind_symbolic_vars.cc index 04a4b0819cda..b3f79ed8b72f 100644 --- a/src/relax/transform/bind_symbolic_vars.cc +++ b/src/relax/transform/bind_symbolic_vars.cc @@ -153,7 +153,7 @@ IRModule ModuleBindSymbolicVars( TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.FunctionBindSymbolicVars", FunctionBindSymbolicVars); + refl::GlobalDef().def("tvm.relax.FunctionBindSymbolicVars", FunctionBindSymbolicVars); } namespace transform { @@ -179,7 +179,7 @@ Pass BindSymbolicVars(ffi::Map, PrimExpr> bi TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.transform.BindSymbolicVars", BindSymbolicVars); + refl::GlobalDef().def("tvm.relax.transform.BindSymbolicVars", BindSymbolicVars); } } // namespace transform diff --git a/src/relax/transform/bundle_model_params.cc b/src/relax/transform/bundle_model_params.cc index 877f3d7dea35..61c8a0189e55 100644 --- a/src/relax/transform/bundle_model_params.cc +++ b/src/relax/transform/bundle_model_params.cc @@ -118,7 +118,7 @@ Pass BundleModelParams(ffi::Optional param_tuple_name) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.transform.BundleModelParams", BundleModelParams); + refl::GlobalDef().def("tvm.relax.transform.BundleModelParams", BundleModelParams); } } // namespace transform diff --git a/src/relax/transform/call_tir_rewrite.cc b/src/relax/transform/call_tir_rewrite.cc index d4763b44b713..e97478407a90 100644 --- a/src/relax/transform/call_tir_rewrite.cc +++ b/src/relax/transform/call_tir_rewrite.cc @@ -186,7 +186,7 @@ Pass CallTIRRewrite() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.transform.CallTIRRewrite", CallTIRRewrite); + refl::GlobalDef().def("tvm.relax.transform.CallTIRRewrite", CallTIRRewrite); } } // namespace transform diff --git a/src/relax/transform/canonicalize_bindings.cc b/src/relax/transform/canonicalize_bindings.cc index decbecd3098b..ec785bbb747c 100644 --- a/src/relax/transform/canonicalize_bindings.cc +++ b/src/relax/transform/canonicalize_bindings.cc @@ -594,7 +594,7 @@ Pass CanonicalizeBindings() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.transform.CanonicalizeBindings", CanonicalizeBindings); + refl::GlobalDef().def("tvm.relax.transform.CanonicalizeBindings", CanonicalizeBindings); } } // namespace transform diff --git a/src/relax/transform/combine_parallel_matmul.cc b/src/relax/transform/combine_parallel_matmul.cc index c60864d671c5..a2681a8a315c 100644 --- a/src/relax/transform/combine_parallel_matmul.cc +++ b/src/relax/transform/combine_parallel_matmul.cc @@ -390,7 +390,7 @@ Pass CombineParallelMatmul(FCheck check) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.transform.CombineParallelMatmul", CombineParallelMatmul); + refl::GlobalDef().def("tvm.relax.transform.CombineParallelMatmul", CombineParallelMatmul); } } // namespace transform diff --git a/src/relax/transform/compute_prim_value.cc b/src/relax/transform/compute_prim_value.cc index 7129af2236c1..006a1b92c901 100644 --- a/src/relax/transform/compute_prim_value.cc +++ b/src/relax/transform/compute_prim_value.cc @@ -89,7 +89,7 @@ Pass ComputePrimValue() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.transform.ComputePrimValue", ComputePrimValue); + refl::GlobalDef().def("tvm.relax.transform.ComputePrimValue", ComputePrimValue); } } // namespace transform diff --git a/src/relax/transform/convert_dataflow.cc b/src/relax/transform/convert_dataflow.cc index ac95acce63f2..3958b859d5c8 100644 --- a/src/relax/transform/convert_dataflow.cc +++ b/src/relax/transform/convert_dataflow.cc @@ -162,7 +162,7 @@ Pass ConvertToDataflow(int min_size) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.transform.ConvertToDataflow", ConvertToDataflow); + refl::GlobalDef().def("tvm.relax.transform.ConvertToDataflow", ConvertToDataflow); } } // namespace transform diff --git a/src/relax/transform/convert_layout.cc b/src/relax/transform/convert_layout.cc index c543799e3b0d..bc8d51c25d32 100644 --- a/src/relax/transform/convert_layout.cc +++ b/src/relax/transform/convert_layout.cc @@ -355,7 +355,7 @@ Pass ConvertLayout(ffi::Map> desired_layout TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.transform.ConvertLayout", ConvertLayout); + refl::GlobalDef().def("tvm.relax.transform.ConvertLayout", ConvertLayout); } } // namespace transform diff --git a/src/relax/transform/dataflow_inplace.cc b/src/relax/transform/dataflow_inplace.cc index 3b56d6ca1d81..67241f9ab0d0 100644 --- a/src/relax/transform/dataflow_inplace.cc +++ b/src/relax/transform/dataflow_inplace.cc @@ -531,7 +531,8 @@ class InplaceOpportunityNode : public Object { .def_ro("binding_idx", &InplaceOpportunityNode::binding_idx) .def_ro("arg_idxs", &InplaceOpportunityNode::arg_idxs); } - TVM_FFI_DECLARE_OBJECT_INFO("relax.transform.InplaceOpportunity", InplaceOpportunityNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO("tvm.relax.transform.InplaceOpportunity", InplaceOpportunityNode, + Object); }; TVM_FFI_STATIC_INIT_BLOCK() { InplaceOpportunityNode::RegisterReflection(); } @@ -1022,10 +1023,10 @@ ffi::Array> DataflowInplaceAnalysis(const Dataflo TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("relax.testing.transform.DataflowLivenessAnalysis", DataflowLivenessAnalysis) - .def("relax.testing.transform.DataflowAliasAnalysis", DataflowAliasAnalysis) - .def("relax.testing.transform.DataflowInplaceAnalysis", DataflowInplaceAnalysis) - .def("relax.testing.transform.SingleInplaceCall", + .def("tvm.relax.testing.transform.DataflowLivenessAnalysis", DataflowLivenessAnalysis) + .def("tvm.relax.testing.transform.DataflowAliasAnalysis", DataflowAliasAnalysis) + .def("tvm.relax.testing.transform.DataflowInplaceAnalysis", DataflowInplaceAnalysis) + .def("tvm.relax.testing.transform.SingleInplaceCall", [](const IRModule& mod, const Call& call, const ffi::Array& inplace_indices) -> ffi::Array { ModuleInplaceTransformer transformer(mod); @@ -1037,7 +1038,7 @@ TVM_FFI_STATIC_INIT_BLOCK() { // actually exposed TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.transform.DataflowUseInplaceCalls", DataflowUseInplaceCalls); + refl::GlobalDef().def("tvm.relax.transform.DataflowUseInplaceCalls", DataflowUseInplaceCalls); } } // namespace transform diff --git a/src/relax/transform/dead_code_elimination.cc b/src/relax/transform/dead_code_elimination.cc index fbb077ddf941..f9e35e1039a1 100644 --- a/src/relax/transform/dead_code_elimination.cc +++ b/src/relax/transform/dead_code_elimination.cc @@ -144,7 +144,7 @@ Pass DeadCodeElimination(ffi::Array entry_functions) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.transform.DeadCodeElimination", DeadCodeElimination); + refl::GlobalDef().def("tvm.relax.transform.DeadCodeElimination", DeadCodeElimination); } } // namespace transform diff --git a/src/relax/transform/decompose_ops.cc b/src/relax/transform/decompose_ops.cc index 81d4d3881ede..6813cda8e4ee 100644 --- a/src/relax/transform/decompose_ops.cc +++ b/src/relax/transform/decompose_ops.cc @@ -144,11 +144,11 @@ Expr TensorToShape(const Call& call_node, const BlockBuilder& builder) { const ShapeStructInfoNode* sinfo = GetStructInfoAs(call_node); ICHECK(sinfo); // call builtin function that converts tensor to shape tuple - // TODO(@sunggg): Register operator for "vm.builtin.tensor_to_shape" + // TODO(@sunggg): Register operator for "tvm.vm.builtin.tensor_to_shape" static const Op& call_pure_packed_op = Op::Get("relax.call_pure_packed"); Var call = - builder->Emit(Call(call_pure_packed_op, {ExternFunc("vm.builtin.tensor_to_shape"), expr}, {}, - {ffi::GetRef(sinfo)})); + builder->Emit(Call(call_pure_packed_op, {ExternFunc("tvm.vm.builtin.tensor_to_shape"), expr}, + {}, {ffi::GetRef(sinfo)})); // Operators like reshape take the output of `TensorToShape` as their output shape. // Because TOPI expects to have such output shape in symbolic shape at least (i.e., @@ -254,8 +254,8 @@ Pass DecomposeOpsForTraining(ffi::Optional func_name) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("relax.transform.DecomposeOpsForInference", DecomposeOpsForInference) - .def("relax.transform.DecomposeOpsForTraining", DecomposeOpsForTraining); + .def("tvm.relax.transform.DecomposeOpsForInference", DecomposeOpsForInference) + .def("tvm.relax.transform.DecomposeOpsForTraining", DecomposeOpsForTraining); } } // namespace transform diff --git a/src/relax/transform/eliminate_common_subexpr.cc b/src/relax/transform/eliminate_common_subexpr.cc index e893b5151b52..ac313362f17a 100644 --- a/src/relax/transform/eliminate_common_subexpr.cc +++ b/src/relax/transform/eliminate_common_subexpr.cc @@ -224,7 +224,7 @@ Pass EliminateCommonSubexpr(bool call_only) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.transform.EliminateCommonSubexpr", EliminateCommonSubexpr); + refl::GlobalDef().def("tvm.relax.transform.EliminateCommonSubexpr", EliminateCommonSubexpr); } } // namespace transform diff --git a/src/relax/transform/expand_matmul_of_sum.cc b/src/relax/transform/expand_matmul_of_sum.cc index 5504c2a59942..926cf15535f1 100644 --- a/src/relax/transform/expand_matmul_of_sum.cc +++ b/src/relax/transform/expand_matmul_of_sum.cc @@ -107,7 +107,7 @@ Pass ExpandMatmulOfSum() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.transform.ExpandMatmulOfSum", ExpandMatmulOfSum); + refl::GlobalDef().def("tvm.relax.transform.ExpandMatmulOfSum", ExpandMatmulOfSum); } } // namespace transform diff --git a/src/relax/transform/expand_tuple_arguments.cc b/src/relax/transform/expand_tuple_arguments.cc index 0239652c791a..6b7b4a43c158 100644 --- a/src/relax/transform/expand_tuple_arguments.cc +++ b/src/relax/transform/expand_tuple_arguments.cc @@ -181,7 +181,7 @@ Pass ExpandTupleArguments() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.transform.ExpandTupleArguments", ExpandTupleArguments); + refl::GlobalDef().def("tvm.relax.transform.ExpandTupleArguments", ExpandTupleArguments); } } // namespace transform diff --git a/src/relax/transform/few_shot_tuning.cc b/src/relax/transform/few_shot_tuning.cc index 6c213a9504a8..b14c9182e705 100644 --- a/src/relax/transform/few_shot_tuning.cc +++ b/src/relax/transform/few_shot_tuning.cc @@ -30,14 +30,14 @@ tir::PrimFunc FewShotTunePrimFunc(const tir::PrimFunc& prim_func, const Target& int64_t valid_count, bool benchmark) { // fetch a local builder static const auto f_get_local_builder = - tvm::ffi::Function::GetGlobalRequired("meta_schedule.builder.get_local_builder"); + tvm::ffi::Function::GetGlobalRequired("tvm.meta_schedule.builder.get_local_builder"); meta_schedule::Builder builder = f_get_local_builder().cast(); ICHECK(builder.defined()) << "ValueError: The local builder is not defined!"; // fetch a local runner meta_schedule::Runner runner{ffi::UnsafeInit()}; if (benchmark) { static const auto f_get_local_runner = - tvm::ffi::Function::GetGlobalRequired("meta_schedule.runner.get_local_runner"); + tvm::ffi::Function::GetGlobalRequired("tvm.meta_schedule.runner.get_local_runner"); runner = f_get_local_runner().cast(); ICHECK(runner.defined()) << "ValueError: The local runner is not defined!"; } @@ -45,7 +45,8 @@ tir::PrimFunc FewShotTunePrimFunc(const tir::PrimFunc& prim_func, const Target& IRModule mod = IRModule(ffi::Map( {{GlobalVar("main"), WithAttr(prim_func, tvm::attr::kGlobalSymbol, ffi::String("main"))}})); // fetch the number of physical cores - static const auto f_cpu_count = tvm::ffi::Function::GetGlobalRequired("meta_schedule.cpu_count"); + static const auto f_cpu_count = + tvm::ffi::Function::GetGlobalRequired("tvm.meta_schedule.cpu_count"); int num_threads = f_cpu_count(false).cast(); // store the results ffi::Array results; @@ -176,7 +177,7 @@ Pass FewShotTuning(int valid_count, bool benchmark) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.transform.FewShotTuning", FewShotTuning); + refl::GlobalDef().def("tvm.relax.transform.FewShotTuning", FewShotTuning); } } // namespace transform diff --git a/src/relax/transform/fold_constant.cc b/src/relax/transform/fold_constant.cc index b714d4924359..481691189f4c 100644 --- a/src/relax/transform/fold_constant.cc +++ b/src/relax/transform/fold_constant.cc @@ -118,7 +118,7 @@ class ConstantFolder : public ExprMutator { // already scheduled to only work on GPU, we will need to skip this in the const folder for // now // TODO(Hongyi): further check and narrow the scope of foldable function - const auto pf = tvm::ffi::Function::GetGlobalRequired("tir.build"); + const auto pf = tvm::ffi::Function::GetGlobalRequired("tvm.tir.build"); func = WithAttr(func, tvm::attr::kGlobalSymbol, ffi::String("tir_function")); ffi::Module rt_module = pf(func, eval_cpu_target).cast(); build_func = rt_module->GetFunction("tir_function"); @@ -297,7 +297,7 @@ class ConstantFolder : public ExprMutator { is_known &= (val.dtype() == DataType::Int(64)); } if (is_known) { - const auto func = tvm::ffi::Function::GetGlobalRequired("relax.run.shape_to_tensor"); + const auto func = tvm::ffi::Function::GetGlobalRequired("tvm.relax.run.shape_to_tensor"); runtime::Tensor vals = func(arr).cast(); return Constant(vals); } @@ -332,7 +332,7 @@ Pass FoldConstant() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.transform.FoldConstant", FoldConstant); + refl::GlobalDef().def("tvm.relax.transform.FoldConstant", FoldConstant); } } // namespace transform diff --git a/src/relax/transform/fuse_ops.cc b/src/relax/transform/fuse_ops.cc index 561695787de8..e2151d953b63 100644 --- a/src/relax/transform/fuse_ops.cc +++ b/src/relax/transform/fuse_ops.cc @@ -1413,7 +1413,7 @@ FusionPattern::FusionPattern(ffi::String name, DFPattern pattern, TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef().def( - "relax.transform.FusionPattern", + "tvm.relax.transform.FusionPattern", [](ffi::String name, DFPattern pattern, ffi::Map annotation_patterns, ffi::Optional check, ffi::Optional attrs_getter) { return FusionPattern(name, pattern, annotation_patterns, check, attrs_getter); @@ -1449,7 +1449,7 @@ Pass FuseOps(int fuse_opt_level) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.transform.FuseOps", FuseOps); + refl::GlobalDef().def("tvm.relax.transform.FuseOps", FuseOps); } Pass FuseOpsByPattern(const tvm::ffi::Array& patterns, bool bind_constants, @@ -1467,7 +1467,7 @@ Pass FuseOpsByPattern(const tvm::ffi::Array& patterns, bool bind_ TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.transform.FuseOpsByPattern", FuseOpsByPattern); + refl::GlobalDef().def("tvm.relax.transform.FuseOpsByPattern", FuseOpsByPattern); } } // namespace transform diff --git a/src/relax/transform/fuse_tir.cc b/src/relax/transform/fuse_tir.cc index 549cd2197b4b..c33c3d6e0bb9 100644 --- a/src/relax/transform/fuse_tir.cc +++ b/src/relax/transform/fuse_tir.cc @@ -1307,7 +1307,7 @@ Pass FuseTIR() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.transform.FuseTIR", FuseTIR); + refl::GlobalDef().def("tvm.relax.transform.FuseTIR", FuseTIR); } } // namespace transform diff --git a/src/relax/transform/gradient.cc b/src/relax/transform/gradient.cc index 15bf6a273a3f..15d0c89824a1 100644 --- a/src/relax/transform/gradient.cc +++ b/src/relax/transform/gradient.cc @@ -792,7 +792,7 @@ Pass Gradient(ffi::String func_name, ffi::Optional> require_grad TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.transform.Gradient", Gradient); + refl::GlobalDef().def("tvm.relax.transform.Gradient", Gradient); } } // namespace transform diff --git a/src/relax/transform/infer_layout_utils.h b/src/relax/transform/infer_layout_utils.h index 973e46b45c4e..444e41d15622 100644 --- a/src/relax/transform/infer_layout_utils.h +++ b/src/relax/transform/infer_layout_utils.h @@ -69,7 +69,7 @@ class LayoutDecisionNode : public Object { .def_ro("is_unknown_dim", &LayoutDecisionNode::is_unknown_dim); } - TVM_FFI_DECLARE_OBJECT_INFO("relax.transform.LayoutDecision", LayoutDecisionNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO("tvm.relax.transform.LayoutDecision", LayoutDecisionNode, Object); }; class LayoutDecision : public ObjectRef { @@ -117,7 +117,8 @@ class InferLayoutOutputNode : public Object { .def_ro("new_args", &InferLayoutOutputNode::new_args); } - TVM_FFI_DECLARE_OBJECT_INFO("relax.transform.InferLayoutOutput", InferLayoutOutputNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO("tvm.relax.transform.InferLayoutOutput", InferLayoutOutputNode, + Object); }; class InferLayoutOutput : public ObjectRef { diff --git a/src/relax/transform/inline_functions.cc b/src/relax/transform/inline_functions.cc index f3f21cc7843d..a0f241ac3160 100644 --- a/src/relax/transform/inline_functions.cc +++ b/src/relax/transform/inline_functions.cc @@ -168,7 +168,7 @@ Function FunctionInlineFunctions( TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.FunctionInlineFunctions", FunctionInlineFunctions); + refl::GlobalDef().def("tvm.relax.FunctionInlineFunctions", FunctionInlineFunctions); } namespace transform { @@ -226,7 +226,7 @@ Pass InlinePrivateFunctions() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.transform.InlinePrivateFunctions", InlinePrivateFunctions); + refl::GlobalDef().def("tvm.relax.transform.InlinePrivateFunctions", InlinePrivateFunctions); } } // namespace transform diff --git a/src/relax/transform/kill_after_last_use.cc b/src/relax/transform/kill_after_last_use.cc index e1e8a5d87998..c54ffdecdf7d 100644 --- a/src/relax/transform/kill_after_last_use.cc +++ b/src/relax/transform/kill_after_last_use.cc @@ -269,7 +269,7 @@ Pass KillAfterLastUse() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.transform.KillAfterLastUse", KillAfterLastUse); + refl::GlobalDef().def("tvm.relax.transform.KillAfterLastUse", KillAfterLastUse); } } // namespace transform diff --git a/src/relax/transform/lambda_lift.cc b/src/relax/transform/lambda_lift.cc index e77b0a266038..168747c394db 100644 --- a/src/relax/transform/lambda_lift.cc +++ b/src/relax/transform/lambda_lift.cc @@ -502,7 +502,7 @@ Pass LambdaLift() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.transform.LambdaLift", LambdaLift); + refl::GlobalDef().def("tvm.relax.transform.LambdaLift", LambdaLift); } } // namespace transform diff --git a/src/relax/transform/lazy_transform_params.cc b/src/relax/transform/lazy_transform_params.cc index bc6f4530db59..618951f58d03 100644 --- a/src/relax/transform/lazy_transform_params.cc +++ b/src/relax/transform/lazy_transform_params.cc @@ -263,7 +263,7 @@ Pass LazyGetInput() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.transform.LazyGetInput", LazyGetInput); + refl::GlobalDef().def("tvm.relax.transform.LazyGetInput", LazyGetInput); } Pass LazySetOutput() { @@ -281,7 +281,7 @@ Pass LazySetOutput() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.transform.LazySetOutput", LazySetOutput); + refl::GlobalDef().def("tvm.relax.transform.LazySetOutput", LazySetOutput); } } // namespace transform diff --git a/src/relax/transform/legalize_ops.cc b/src/relax/transform/legalize_ops.cc index 75e0776418ed..edd4b3dba228 100644 --- a/src/relax/transform/legalize_ops.cc +++ b/src/relax/transform/legalize_ops.cc @@ -425,7 +425,7 @@ Pass LegalizeOps(ffi::Optional> cmap, TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.transform.LegalizeOps", LegalizeOps); + refl::GlobalDef().def("tvm.relax.transform.LegalizeOps", LegalizeOps); } } // namespace transform diff --git a/src/relax/transform/lift_transform_params.cc b/src/relax/transform/lift_transform_params.cc index f7c49d0da8df..9cb79250fd7a 100644 --- a/src/relax/transform/lift_transform_params.cc +++ b/src/relax/transform/lift_transform_params.cc @@ -667,7 +667,7 @@ class ConsumeBundledParams : public ExprMutator { public: void VisitBinding_(const VarBindingNode* binding, const TupleGetItemNode* tuple_get_item) final { static const auto& call_pure_packed = Op::Get("relax.call_pure_packed"); - static const auto& builtin_tuple_reset_item = ExternFunc("vm.builtin.tuple_reset_item"); + static const auto& builtin_tuple_reset_item = ExternFunc("tvm.vm.builtin.tuple_reset_item"); if (tuple_get_item->tuple.same_as(params_)) { if (auto it = param_remap_.find(tuple_get_item->index); it != param_remap_.end()) { ReEmitBinding(binding, it->second); @@ -870,7 +870,7 @@ Pass LiftTransformParams(ffi::Variant> shared_tran TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.transform.LiftTransformParams", LiftTransformParams); + refl::GlobalDef().def("tvm.relax.transform.LiftTransformParams", LiftTransformParams); } } // namespace transform diff --git a/src/relax/transform/lower_alloc_tensor.cc b/src/relax/transform/lower_alloc_tensor.cc index d1e61b1c5748..8aec6f656369 100644 --- a/src/relax/transform/lower_alloc_tensor.cc +++ b/src/relax/transform/lower_alloc_tensor.cc @@ -102,7 +102,7 @@ Pass LowerAllocTensor() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.transform.LowerAllocTensor", LowerAllocTensor); + refl::GlobalDef().def("tvm.relax.transform.LowerAllocTensor", LowerAllocTensor); } } // namespace transform diff --git a/src/relax/transform/merge_composite_functions.cc b/src/relax/transform/merge_composite_functions.cc index e8a9b74d94c4..4f43e2fcc372 100644 --- a/src/relax/transform/merge_composite_functions.cc +++ b/src/relax/transform/merge_composite_functions.cc @@ -424,7 +424,7 @@ Pass MergeCompositeFunctions() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.transform.MergeCompositeFunctions", MergeCompositeFunctions); + refl::GlobalDef().def("tvm.relax.transform.MergeCompositeFunctions", MergeCompositeFunctions); } } // namespace transform diff --git a/src/relax/transform/meta_schedule.cc b/src/relax/transform/meta_schedule.cc index dd5b93267476..22960902a198 100644 --- a/src/relax/transform/meta_schedule.cc +++ b/src/relax/transform/meta_schedule.cc @@ -181,9 +181,9 @@ Pass MetaScheduleTuneTIR(ffi::String work_dir, Integer max_trials_global) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("relax.transform.MetaScheduleApplyDatabase", MetaScheduleApplyDatabase) - .def("relax.transform.MetaScheduleTuneIRMod", MetaScheduleTuneIRMod) - .def("relax.transform.MetaScheduleTuneTIR", MetaScheduleTuneTIR); + .def("tvm.relax.transform.MetaScheduleApplyDatabase", MetaScheduleApplyDatabase) + .def("tvm.relax.transform.MetaScheduleTuneIRMod", MetaScheduleTuneIRMod) + .def("tvm.relax.transform.MetaScheduleTuneTIR", MetaScheduleTuneTIR); } } // namespace transform } // namespace relax diff --git a/src/relax/transform/normalize.cc b/src/relax/transform/normalize.cc index e764e333f721..20d14ee60852 100644 --- a/src/relax/transform/normalize.cc +++ b/src/relax/transform/normalize.cc @@ -282,7 +282,7 @@ Pass Normalize() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.transform.Normalize", Normalize); + refl::GlobalDef().def("tvm.relax.transform.Normalize", Normalize); } Pass NormalizeGlobalVar() { @@ -296,7 +296,7 @@ Pass NormalizeGlobalVar() { } TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.transform.NormalizeGlobalVar", NormalizeGlobalVar); + refl::GlobalDef().def("tvm.relax.transform.NormalizeGlobalVar", NormalizeGlobalVar); } } // namespace transform diff --git a/src/relax/transform/realize_vdevice.cc b/src/relax/transform/realize_vdevice.cc index 7f1042d57ecc..4e4f305d8346 100644 --- a/src/relax/transform/realize_vdevice.cc +++ b/src/relax/transform/realize_vdevice.cc @@ -420,7 +420,7 @@ Pass RealizeVDevice() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.transform.RealizeVDevice", RealizeVDevice); + refl::GlobalDef().def("tvm.relax.transform.RealizeVDevice", RealizeVDevice); } } // namespace transform diff --git a/src/relax/transform/remove_purity_checking.cc b/src/relax/transform/remove_purity_checking.cc index aaa38fcda7ce..3df938480aaa 100644 --- a/src/relax/transform/remove_purity_checking.cc +++ b/src/relax/transform/remove_purity_checking.cc @@ -91,7 +91,7 @@ Pass RemovePurityChecking() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.transform.RemovePurityChecking", RemovePurityChecking); + refl::GlobalDef().def("tvm.relax.transform.RemovePurityChecking", RemovePurityChecking); } } // namespace transform diff --git a/src/relax/transform/remove_unused_outputs.cc b/src/relax/transform/remove_unused_outputs.cc index 83170abd635b..b7a94151914d 100644 --- a/src/relax/transform/remove_unused_outputs.cc +++ b/src/relax/transform/remove_unused_outputs.cc @@ -339,7 +339,7 @@ Pass RemoveUnusedOutputs() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.transform.RemoveUnusedOutputs", RemoveUnusedOutputs); + refl::GlobalDef().def("tvm.relax.transform.RemoveUnusedOutputs", RemoveUnusedOutputs); } } // namespace transform diff --git a/src/relax/transform/remove_unused_parameters.cc b/src/relax/transform/remove_unused_parameters.cc index 5003dec8a8d2..469d8a25f6fc 100644 --- a/src/relax/transform/remove_unused_parameters.cc +++ b/src/relax/transform/remove_unused_parameters.cc @@ -253,7 +253,7 @@ Pass RemoveUnusedParameters() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.transform.RemoveUnusedParameters", RemoveUnusedParameters); + refl::GlobalDef().def("tvm.relax.transform.RemoveUnusedParameters", RemoveUnusedParameters); } } // namespace transform diff --git a/src/relax/transform/reorder_permute_dims_after_concat.cc b/src/relax/transform/reorder_permute_dims_after_concat.cc index 73bc1853816e..e292406ced02 100644 --- a/src/relax/transform/reorder_permute_dims_after_concat.cc +++ b/src/relax/transform/reorder_permute_dims_after_concat.cc @@ -177,7 +177,7 @@ Pass ReorderPermuteDimsAfterConcat() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.transform.ReorderPermuteDimsAfterConcat", + refl::GlobalDef().def("tvm.relax.transform.ReorderPermuteDimsAfterConcat", ReorderPermuteDimsAfterConcat); } diff --git a/src/relax/transform/reorder_take_after_matmul.cc b/src/relax/transform/reorder_take_after_matmul.cc index 25f245101b1b..0b19a6c5def2 100644 --- a/src/relax/transform/reorder_take_after_matmul.cc +++ b/src/relax/transform/reorder_take_after_matmul.cc @@ -159,7 +159,7 @@ Pass ReorderTakeAfterMatmul() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.transform.ReorderTakeAfterMatmul", ReorderTakeAfterMatmul); + refl::GlobalDef().def("tvm.relax.transform.ReorderTakeAfterMatmul", ReorderTakeAfterMatmul); } } // namespace transform diff --git a/src/relax/transform/rewrite_cuda_graph.cc b/src/relax/transform/rewrite_cuda_graph.cc index 8ecfabd7c27a..4e3982d74942 100644 --- a/src/relax/transform/rewrite_cuda_graph.cc +++ b/src/relax/transform/rewrite_cuda_graph.cc @@ -773,9 +773,10 @@ class CUDAGraphRewriter : public ExprMutator { void LaunchSubgraph(const VarBindingNode* op, const LiftedFunctionRewritePlan* plan) { static const auto& call_builtin_with_ctx_op = Op::Get("relax.call_builtin_with_ctx"); - static const auto& builtin_run_or_capture = ExternFunc("vm.builtin.cuda_graph.run_or_capture"); + static const auto& builtin_run_or_capture = + ExternFunc("tvm.vm.builtin.cuda_graph.run_or_capture"); static const auto& builtin_get_cached_alloc = - ExternFunc("vm.builtin.cuda_graph.get_cached_alloc"); + ExternFunc("tvm.vm.builtin.cuda_graph.get_cached_alloc"); Expr launch_subgraph; if (plan->is_alloc) { @@ -902,7 +903,7 @@ Pass RewriteCUDAGraph() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.transform.RewriteCUDAGraph", RewriteCUDAGraph); + refl::GlobalDef().def("tvm.relax.transform.RewriteCUDAGraph", RewriteCUDAGraph); } } // namespace transform diff --git a/src/relax/transform/rewrite_dataflow_reshape.cc b/src/relax/transform/rewrite_dataflow_reshape.cc index fdaa2b927e2e..25140d578d52 100644 --- a/src/relax/transform/rewrite_dataflow_reshape.cc +++ b/src/relax/transform/rewrite_dataflow_reshape.cc @@ -168,7 +168,7 @@ Pass RewriteDataflowReshape() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.transform.RewriteDataflowReshape", RewriteDataflowReshape); + refl::GlobalDef().def("tvm.relax.transform.RewriteDataflowReshape", RewriteDataflowReshape); } } // namespace transform diff --git a/src/relax/transform/run_codegen.cc b/src/relax/transform/run_codegen.cc index 71d557d031cf..6314f1e9c403 100644 --- a/src/relax/transform/run_codegen.cc +++ b/src/relax/transform/run_codegen.cc @@ -131,7 +131,8 @@ class CodeGenRunner : ExprMutator { extern_funcs_[gvar_node] = new_func; // Remove the global symbol and codegen attributes from the function so that it can be // removed the module. - const auto RemoveFuncAttrFunc = tvm::ffi::Function::GetGlobal("ir.BaseFuncWithoutAttr"); + const auto RemoveFuncAttrFunc = + tvm::ffi::Function::GetGlobal("tvm.ir.BaseFuncWithoutAttr"); ICHECK(RemoveFuncAttrFunc.has_value()); func = (*RemoveFuncAttrFunc)(func, tvm::attr::kGlobalSymbol).cast(); func = (*RemoveFuncAttrFunc)(func, attr::kCodegen).cast(); @@ -226,7 +227,7 @@ Pass RunCodegen( TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.transform.RunCodegen", RunCodegen); + refl::GlobalDef().def("tvm.relax.transform.RunCodegen", RunCodegen); } } // namespace transform diff --git a/src/relax/transform/specialize_primfunc_based_on_callsite.cc b/src/relax/transform/specialize_primfunc_based_on_callsite.cc index 6258e14b666d..4cad14fc2838 100644 --- a/src/relax/transform/specialize_primfunc_based_on_callsite.cc +++ b/src/relax/transform/specialize_primfunc_based_on_callsite.cc @@ -166,7 +166,7 @@ Pass SpecializePrimFuncBasedOnCallSite() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.transform.SpecializePrimFuncBasedOnCallSite", + refl::GlobalDef().def("tvm.relax.transform.SpecializePrimFuncBasedOnCallSite", SpecializePrimFuncBasedOnCallSite); } } // namespace transform diff --git a/src/relax/transform/split_call_tir_by_pattern.cc b/src/relax/transform/split_call_tir_by_pattern.cc index 00c6efb192a3..9ce084d7fc64 100644 --- a/src/relax/transform/split_call_tir_by_pattern.cc +++ b/src/relax/transform/split_call_tir_by_pattern.cc @@ -781,7 +781,7 @@ Pass SplitCallTIRByPattern(ffi::Array patterns, FCodegen fcodegen) { } TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.transform.SplitCallTIRByPattern", SplitCallTIRByPattern); + refl::GlobalDef().def("tvm.relax.transform.SplitCallTIRByPattern", SplitCallTIRByPattern); } } // namespace transform diff --git a/src/relax/transform/split_layout_rewrite_preproc.cc b/src/relax/transform/split_layout_rewrite_preproc.cc index 1da49c1d7de3..96a3cd9988b2 100644 --- a/src/relax/transform/split_layout_rewrite_preproc.cc +++ b/src/relax/transform/split_layout_rewrite_preproc.cc @@ -343,7 +343,7 @@ Pass SplitLayoutRewritePreproc() { } TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.transform.SplitLayoutRewritePreproc", SplitLayoutRewritePreproc); + refl::GlobalDef().def("tvm.relax.transform.SplitLayoutRewritePreproc", SplitLayoutRewritePreproc); } } // namespace transform } // namespace tvm diff --git a/src/relax/transform/static_plan_block_memory.cc b/src/relax/transform/static_plan_block_memory.cc index fc3c2259ff9a..d6784a440e91 100644 --- a/src/relax/transform/static_plan_block_memory.cc +++ b/src/relax/transform/static_plan_block_memory.cc @@ -120,7 +120,7 @@ class StorageTokenNode : public Object { } static constexpr const bool _type_mutable = true; - TVM_FFI_DECLARE_OBJECT_INFO("relax.transform.StorageToken", StorageTokenNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO("tvm.relax.transform.StorageToken", StorageTokenNode, Object); }; /*! @@ -987,7 +987,7 @@ Pass StaticPlanBlockMemory() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.transform.StaticPlanBlockMemory", StaticPlanBlockMemory); + refl::GlobalDef().def("tvm.relax.transform.StaticPlanBlockMemory", StaticPlanBlockMemory); } } // namespace transform diff --git a/src/relax/transform/to_mixed_precision.cc b/src/relax/transform/to_mixed_precision.cc index 66a148e593ca..4dd4ac67806c 100644 --- a/src/relax/transform/to_mixed_precision.cc +++ b/src/relax/transform/to_mixed_precision.cc @@ -622,7 +622,7 @@ Pass ToMixedPrecision(const DataType& out_dtype, TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.transform.ToMixedPrecision", ToMixedPrecision); + refl::GlobalDef().def("tvm.relax.transform.ToMixedPrecision", ToMixedPrecision); } } // namespace transform diff --git a/src/relax/transform/to_non_dataflow.cc b/src/relax/transform/to_non_dataflow.cc index b9345744320c..971a9791e3fd 100644 --- a/src/relax/transform/to_non_dataflow.cc +++ b/src/relax/transform/to_non_dataflow.cc @@ -64,7 +64,7 @@ Pass ToNonDataflow() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.transform.ToNonDataflow", ToNonDataflow); + refl::GlobalDef().def("tvm.relax.transform.ToNonDataflow", ToNonDataflow); } } // namespace transform diff --git a/src/relax/transform/topological_sort.cc b/src/relax/transform/topological_sort.cc index 114af668b980..40a02f7b7763 100644 --- a/src/relax/transform/topological_sort.cc +++ b/src/relax/transform/topological_sort.cc @@ -346,7 +346,7 @@ Pass TopologicalSort(TraversalOrder order, StartingLocation starting_location) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef().def( - "relax.transform.TopologicalSort", + "tvm.relax.transform.TopologicalSort", [](ffi::String order_str, ffi::String direction_str) -> Pass { TraversalOrder order = [&]() { if (order_str == "depth-first") { diff --git a/src/relax/transform/update_param_struct_info.cc b/src/relax/transform/update_param_struct_info.cc index 071e5bf4c991..1d25c3f2c0a2 100644 --- a/src/relax/transform/update_param_struct_info.cc +++ b/src/relax/transform/update_param_struct_info.cc @@ -107,7 +107,7 @@ Pass UpdateParamStructInfo(ffi::TypedFunction(Var)> si TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.transform.UpdateParamStructInfo", UpdateParamStructInfo); + refl::GlobalDef().def("tvm.relax.transform.UpdateParamStructInfo", UpdateParamStructInfo); } } // namespace transform diff --git a/src/relax/transform/update_vdevice.cc b/src/relax/transform/update_vdevice.cc index a6cbb83b8c73..a5c3543fd42c 100644 --- a/src/relax/transform/update_vdevice.cc +++ b/src/relax/transform/update_vdevice.cc @@ -109,7 +109,7 @@ Pass UpdateVDevice(VDevice new_vdevice, int64_t index) { } TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.transform.UpdateVDevice", UpdateVDevice); + refl::GlobalDef().def("tvm.relax.transform.UpdateVDevice", UpdateVDevice); } } // namespace transform diff --git a/src/relax/utils.cc b/src/relax/utils.cc index 37e53a614ff0..f80e9bb4fb16 100644 --- a/src/relax/utils.cc +++ b/src/relax/utils.cc @@ -249,7 +249,7 @@ Function CopyWithNewVars(Function func) { return FunctionCopier().Copy(func); } TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.CopyWithNewVars", CopyWithNewVars); + refl::GlobalDef().def("tvm.relax.CopyWithNewVars", CopyWithNewVars); } } // namespace relax diff --git a/src/runtime/contrib/amx/amx_config.cc b/src/runtime/contrib/amx/amx_config.cc index 4be9d57811b3..916605163266 100644 --- a/src/runtime/contrib/amx/amx_config.cc +++ b/src/runtime/contrib/amx/amx_config.cc @@ -78,23 +78,24 @@ void init_tile_config(__tilecfg_u* dst, uint16_t cols, uint8_t rows) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def_packed("runtime.amx_tileconfig", [](ffi::PackedArgs args, ffi::Any* rv) { - int rows = args[0].cast(); - int cols = args[1].cast(); - LOG(INFO) << "rows: " << rows << ", cols:" << cols; - // -----------Config for AMX tile resgister---------------------- - __tilecfg_u cfg; - init_tile_config(&cfg, cols, rows); - - *rv = 1; - return; - }); + refl::GlobalDef().def_packed("tvm.runtime.amx_tileconfig", + [](ffi::PackedArgs args, ffi::Any* rv) { + int rows = args[0].cast(); + int cols = args[1].cast(); + LOG(INFO) << "rows: " << rows << ", cols:" << cols; + // -----------Config for AMX tile resgister---------------------- + __tilecfg_u cfg; + init_tile_config(&cfg, cols, rows); + + *rv = 1; + return; + }); } // register a global packed function in c++,to init the system for AMX config TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def_packed("runtime.amx_init", [](ffi::PackedArgs args, ffi::Any* rv) { + refl::GlobalDef().def_packed("tvm.runtime.amx_init", [](ffi::PackedArgs args, ffi::Any* rv) { // -----------Detect and request for AMX control---------------------- uint64_t bitmask = 0; int64_t status = syscall(SYS_arch_prctl, ARCH_GET_XCOMP_PERM, &bitmask); diff --git a/src/runtime/contrib/arm_compute_lib/acl_runtime.cc b/src/runtime/contrib/arm_compute_lib/acl_runtime.cc index b090f0ccfbda..cd037f2e7f21 100644 --- a/src/runtime/contrib/arm_compute_lib/acl_runtime.cc +++ b/src/runtime/contrib/arm_compute_lib/acl_runtime.cc @@ -597,7 +597,7 @@ ffi::Module ACLRuntimeCreate(const ffi::String& symbol_name, const ffi::String& TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("runtime.arm_compute_lib_runtime_create", ACLRuntimeCreate) + .def("tvm.runtime.arm_compute_lib_runtime_create", ACLRuntimeCreate) .def("ffi.Module.load_from_bytes.arm_compute_lib", JSONRuntimeBase::LoadFromBytes); } diff --git a/src/runtime/contrib/bnns/bnns_json_runtime.cc b/src/runtime/contrib/bnns/bnns_json_runtime.cc index 499330cd0b5b..64b4ff1489c8 100644 --- a/src/runtime/contrib/bnns/bnns_json_runtime.cc +++ b/src/runtime/contrib/bnns/bnns_json_runtime.cc @@ -566,7 +566,7 @@ ffi::Module BNNSJSONRuntimeCreate(ffi::String symbol_name, ffi::String graph_jso TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("runtime.BNNSJSONRuntimeCreate", BNNSJSONRuntimeCreate) + .def("tvm.runtime.BNNSJSONRuntimeCreate", BNNSJSONRuntimeCreate) .def("ffi.Module.load_from_bytes.bnns_json", JSONRuntimeBase::LoadFromBytes); } diff --git a/src/runtime/contrib/clml/clml_runtime.cc b/src/runtime/contrib/clml/clml_runtime.cc index d1cf6b2808b0..654127fc2d3e 100644 --- a/src/runtime/contrib/clml/clml_runtime.cc +++ b/src/runtime/contrib/clml/clml_runtime.cc @@ -313,7 +313,7 @@ class CLMLRuntime : public JSONRuntimeBase { dump_tensors.Set(node_name, narr); } - const auto f = tvm::ffi::Function::GetGlobal("runtime.SaveParams"); + const auto f = tvm::ffi::Function::GetGlobal("tvm.runtime.SaveParams"); if (f.has_value()) { std::string dump_bytes = (*f)(dump_tensors).cast(); std::ostringstream oss; @@ -480,7 +480,7 @@ class CLMLRuntime : public JSONRuntimeBase { LOG_CLML << "Execution by Rec Queue"; if (cws->workspace->IsProfiling(cws->tentry->device)) { Timer t; - auto f = tvm::ffi::Function::GetGlobal(std::string("profiling.timer.opencl")); + auto f = tvm::ffi::Function::GetGlobal(std::string("tvm.profiling.timer.opencl")); t = f->operator()(cws->tentry->device).cast(); t->Start(); queue = CLML_QUEUE; @@ -501,7 +501,7 @@ class CLMLRuntime : public JSONRuntimeBase { LOG_CLML << "Run Layer:" << this->layer_.layer_names[i]; if (cws->workspace->IsProfiling(cws->tentry->device)) { Timer t; - auto f = tvm::ffi::Function::GetGlobal(std::string("profiling.timer.opencl")); + auto f = tvm::ffi::Function::GetGlobal(std::string("tvm.profiling.timer.opencl")); t = f->operator()(cws->tentry->device).cast(); t->Start(); queue = CLML_QUEUE; @@ -1835,7 +1835,7 @@ ffi::Module CLMLRuntimeCreate(const ffi::String& symbol_name, const ffi::String& TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("runtime.clml_runtime_create", CLMLRuntimeCreate) + .def("tvm.runtime.clml_runtime_create", CLMLRuntimeCreate) .def("ffi.Module.load_from_bytes.clml", JSONRuntimeBase::LoadFromBytes); } } // namespace contrib diff --git a/src/runtime/contrib/cublas/cublas_json_runtime.cc b/src/runtime/contrib/cublas/cublas_json_runtime.cc index 70521c1d7399..659cd8f721b1 100644 --- a/src/runtime/contrib/cublas/cublas_json_runtime.cc +++ b/src/runtime/contrib/cublas/cublas_json_runtime.cc @@ -162,7 +162,7 @@ ffi::Module CublasJSONRuntimeCreate(ffi::String symbol_name, ffi::String graph_j TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("runtime.CublasJSONRuntimeCreate", CublasJSONRuntimeCreate) + .def("tvm.runtime.CublasJSONRuntimeCreate", CublasJSONRuntimeCreate) .def("ffi.Module.load_from_bytes.cublas_json", JSONRuntimeBase::LoadFromBytes); } diff --git a/src/runtime/contrib/cudnn/cudnn_frontend/attention.h b/src/runtime/contrib/cudnn/cudnn_frontend/attention.h index 248d44d9d65f..647bd7039965 100644 --- a/src/runtime/contrib/cudnn/cudnn_frontend/attention.h +++ b/src/runtime/contrib/cudnn/cudnn_frontend/attention.h @@ -46,7 +46,7 @@ class CuDNNSDPARunnerNode : public tvm::runtime::Object { ~CuDNNSDPARunnerNode() {} - static constexpr const char* _type_key = "contrib.cudnn.SDPARunner"; + static constexpr const char* _type_key = "tvm.contrib.cudnn.SDPARunner"; void Init(int64_t batch, int64_t seq_len, int64_t num_heads, int64_t num_kv_heads, int64_t head_size, int64_t head_size_v, double scale, const DLDataType& data_type, diff --git a/src/runtime/contrib/cudnn/cudnn_json_runtime.cc b/src/runtime/contrib/cudnn/cudnn_json_runtime.cc index cefa2957b601..898905d8c39c 100644 --- a/src/runtime/contrib/cudnn/cudnn_json_runtime.cc +++ b/src/runtime/contrib/cudnn/cudnn_json_runtime.cc @@ -246,7 +246,7 @@ ffi::Module cuDNNJSONRuntimeCreate(ffi::String symbol_name, ffi::String graph_js TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("runtime.cuDNNJSONRuntimeCreate", cuDNNJSONRuntimeCreate) + .def("tvm.runtime.cuDNNJSONRuntimeCreate", cuDNNJSONRuntimeCreate) .def("ffi.Module.load_from_bytes.cudnn_json", JSONRuntimeBase::LoadFromBytes); } diff --git a/src/runtime/contrib/cudnn/cudnn_utils.cc b/src/runtime/contrib/cudnn/cudnn_utils.cc index b0e3af9efb59..c3496b17abcc 100644 --- a/src/runtime/contrib/cudnn/cudnn_utils.cc +++ b/src/runtime/contrib/cudnn/cudnn_utils.cc @@ -102,7 +102,7 @@ const void* CuDNNDataType::GetConst<1>(cudnnDataType_t type) { // CuDNNThreadEntry CuDNNThreadEntry::CuDNNThreadEntry() { - auto func = tvm::ffi::Function::GetGlobalRequired("device_api.cuda"); + auto func = tvm::ffi::Function::GetGlobalRequired("tvm.device_api.cuda"); void* ret = func().cast(); cuda_api = static_cast(ret); diff --git a/src/runtime/contrib/curand/curand.cc b/src/runtime/contrib/curand/curand.cc index 53505770f83a..3a8089353bd0 100644 --- a/src/runtime/contrib/curand/curand.cc +++ b/src/runtime/contrib/curand/curand.cc @@ -52,7 +52,7 @@ class CURandGenerator { }; DeviceAPI* GetCUDADeviceAPI() { - const auto get_cuda_api = tvm::ffi::Function::GetGlobalRequired("device_api.cuda"); + const auto get_cuda_api = tvm::ffi::Function::GetGlobalRequired("tvm.device_api.cuda"); void* ret = get_cuda_api(); runtime::DeviceAPI* cuda_api = static_cast(ret); return cuda_api; @@ -115,7 +115,7 @@ void RandomFill(DLTensor* tensor) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("runtime.contrib.curand.RandomFill", RandomFill); + refl::GlobalDef().def("tvm.runtime.contrib.curand.RandomFill", RandomFill); } } // namespace curand diff --git a/src/runtime/contrib/cutlass/fp16_group_gemm_sm100.cu b/src/runtime/contrib/cutlass/fp16_group_gemm_sm100.cu index 0c9fe0fff14d..8090f13edbaa 100644 --- a/src/runtime/contrib/cutlass/fp16_group_gemm_sm100.cu +++ b/src/runtime/contrib/cutlass/fp16_group_gemm_sm100.cu @@ -49,7 +49,7 @@ void tvm_cutlass_group_gemm_sm100(Tensor x, Tensor weight, Tensor indptr, Tensor TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("cutlass.group_gemm", tvm_cutlass_group_gemm_sm100); + refl::GlobalDef().def("tvm.cutlass.group_gemm", tvm_cutlass_group_gemm_sm100); } } // namespace runtime diff --git a/src/runtime/contrib/cutlass/fp16_group_gemm_sm90.cu b/src/runtime/contrib/cutlass/fp16_group_gemm_sm90.cu index e78fb06322e2..9c4ae8c9dc6f 100644 --- a/src/runtime/contrib/cutlass/fp16_group_gemm_sm90.cu +++ b/src/runtime/contrib/cutlass/fp16_group_gemm_sm90.cu @@ -48,7 +48,7 @@ void tvm_cutlass_group_gemm_sm90(Tensor x, Tensor weight, Tensor indptr, Tensor TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("cutlass.group_gemm", tvm_cutlass_group_gemm_sm90); + refl::GlobalDef().def("tvm.cutlass.group_gemm", tvm_cutlass_group_gemm_sm90); } #endif // CUTLASS_ARCH_MMA_MODIFIABLE_TMA_SM90_SUPPORTED diff --git a/src/runtime/contrib/cutlass/fp8_gemm.cu b/src/runtime/contrib/cutlass/fp8_gemm.cu index d41064efbaf0..eff9faf061a1 100644 --- a/src/runtime/contrib/cutlass/fp8_gemm.cu +++ b/src/runtime/contrib/cutlass/fp8_gemm.cu @@ -79,11 +79,11 @@ void tvm_cutlass_fp8_gemm(Tensor x, Tensor weight, Tensor workspace, Tensor alph TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("cutlass.gemm_e5m2_e5m2_fp16", + .def("tvm.cutlass.gemm_e5m2_e5m2_fp16", tvm_cutlass_fp8_gemm) - .def("cutlass.gemm_e5m2_e4m3_fp16", + .def("tvm.cutlass.gemm_e5m2_e4m3_fp16", tvm_cutlass_fp8_gemm) - .def("cutlass.gemm_e4m3_e4m3_fp16", + .def("tvm.cutlass.gemm_e4m3_e4m3_fp16", tvm_cutlass_fp8_gemm); } diff --git a/src/runtime/contrib/cutlass/fp8_group_gemm_sm90.cu b/src/runtime/contrib/cutlass/fp8_group_gemm_sm90.cu index b2e08b7570ab..8de893e3845d 100644 --- a/src/runtime/contrib/cutlass/fp8_group_gemm_sm90.cu +++ b/src/runtime/contrib/cutlass/fp8_group_gemm_sm90.cu @@ -71,12 +71,12 @@ TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() .def( - "cutlass.group_gemm_e5m2_e5m2_fp16", + "tvm.cutlass.group_gemm_e5m2_e5m2_fp16", tvm_cutlass_fp8_group_gemm) .def( - "cutlass.group_gemm_e5m2_e4m3_fp16", + "tvm.cutlass.group_gemm_e5m2_e4m3_fp16", tvm_cutlass_fp8_group_gemm) - .def("cutlass.group_gemm_e4m3_e4m3_fp16", + .def("tvm.cutlass.group_gemm_e4m3_e4m3_fp16", tvm_cutlass_fp8_group_gemm); } diff --git a/src/runtime/contrib/cutlass/fp8_groupwise_scaled_gemm_sm100.cu b/src/runtime/contrib/cutlass/fp8_groupwise_scaled_gemm_sm100.cu index e8035c172a3c..51332bfde12c 100644 --- a/src/runtime/contrib/cutlass/fp8_groupwise_scaled_gemm_sm100.cu +++ b/src/runtime/contrib/cutlass/fp8_groupwise_scaled_gemm_sm100.cu @@ -70,9 +70,9 @@ void tvm_cutlass_fp8_groupwise_scaled_bmm_sm100(Tensor a, Tensor b, Tensor scale TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("cutlass.groupwise_scaled_gemm_e4m3fn_e4m3fn", + .def("tvm.cutlass.groupwise_scaled_gemm_e4m3fn_e4m3fn", tvm_cutlass_fp8_groupwise_scaled_gemm_sm100) - .def("cutlass.groupwise_scaled_bmm_e4m3fn_e4m3fn", + .def("tvm.cutlass.groupwise_scaled_bmm_e4m3fn_e4m3fn", tvm_cutlass_fp8_groupwise_scaled_bmm_sm100); } diff --git a/src/runtime/contrib/cutlass/fp8_groupwise_scaled_gemm_sm90.cu b/src/runtime/contrib/cutlass/fp8_groupwise_scaled_gemm_sm90.cu index 3c326e314386..4102994e3d19 100644 --- a/src/runtime/contrib/cutlass/fp8_groupwise_scaled_gemm_sm90.cu +++ b/src/runtime/contrib/cutlass/fp8_groupwise_scaled_gemm_sm90.cu @@ -69,9 +69,10 @@ void tvm_cutlass_fp8_groupwise_scaled_bmm_sm90(Tensor a, Tensor b, Tensor scales TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("cutlass.groupwise_scaled_gemm_e4m3fn_e4m3fn", + .def("tvm.cutlass.groupwise_scaled_gemm_e4m3fn_e4m3fn", tvm_cutlass_fp8_groupwise_scaled_gemm_sm90) - .def("cutlass.groupwise_scaled_bmm_e4m3fn_e4m3fn", tvm_cutlass_fp8_groupwise_scaled_bmm_sm90); + .def("tvm.cutlass.groupwise_scaled_bmm_e4m3fn_e4m3fn", + tvm_cutlass_fp8_groupwise_scaled_bmm_sm90); } } // namespace runtime diff --git a/src/runtime/contrib/cutlass/fp8_groupwise_scaled_group_gemm_sm100.cu b/src/runtime/contrib/cutlass/fp8_groupwise_scaled_group_gemm_sm100.cu index 4f5dd1e1c706..b1e542984586 100644 --- a/src/runtime/contrib/cutlass/fp8_groupwise_scaled_group_gemm_sm100.cu +++ b/src/runtime/contrib/cutlass/fp8_groupwise_scaled_group_gemm_sm100.cu @@ -87,7 +87,7 @@ void tvm_fp8_groupwise_scaled_group_gemm_sm100(Tensor a, Tensor b, Tensor scales TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("cutlass.groupwise_scaled_group_gemm_e4m3fn_e4m3fn", + refl::GlobalDef().def("tvm.cutlass.groupwise_scaled_group_gemm_e4m3fn_e4m3fn", tvm_fp8_groupwise_scaled_group_gemm_sm100); } diff --git a/src/runtime/contrib/cutlass/weight_preprocess.cc b/src/runtime/contrib/cutlass/weight_preprocess.cc index 56e2b39b8094..3f6037a577bc 100644 --- a/src/runtime/contrib/cutlass/weight_preprocess.cc +++ b/src/runtime/contrib/cutlass/weight_preprocess.cc @@ -37,8 +37,8 @@ namespace runtime { // The preprocessing functions are defined in C++, so we need to copy the input weight to CPU. TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("cutlass.ft_preprocess_weight", [](Tensor packed_weight, int sm, - bool is_int4) { + refl::GlobalDef().def("tvm.cutlass.ft_preprocess_weight", [](Tensor packed_weight, int sm, + bool is_int4) { bool is_2d = packed_weight->ndim == 2; int num_experts = is_2d ? 1 : packed_weight->shape[0]; int rows = packed_weight->shape[is_2d ? 0 : 1]; diff --git a/src/runtime/contrib/dnnl/dnnl_json_runtime.cc b/src/runtime/contrib/dnnl/dnnl_json_runtime.cc index f0c47e5639d2..1bb51e3583f4 100644 --- a/src/runtime/contrib/dnnl/dnnl_json_runtime.cc +++ b/src/runtime/contrib/dnnl/dnnl_json_runtime.cc @@ -932,7 +932,7 @@ ffi::Module DNNLJSONRuntimeCreate(ffi::String symbol_name, ffi::String graph_jso TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("runtime.DNNLJSONRuntimeCreate", DNNLJSONRuntimeCreate) + .def("tvm.runtime.DNNLJSONRuntimeCreate", DNNLJSONRuntimeCreate) .def("ffi.Module.load_from_bytes.dnnl_json", JSONRuntimeBase::LoadFromBytes); } diff --git a/src/runtime/contrib/hipblas/hipblas_json_runtime.cc b/src/runtime/contrib/hipblas/hipblas_json_runtime.cc index 45bfabc277cc..1b6dafeb5b81 100644 --- a/src/runtime/contrib/hipblas/hipblas_json_runtime.cc +++ b/src/runtime/contrib/hipblas/hipblas_json_runtime.cc @@ -149,7 +149,7 @@ ffi::Module HipblasJSONRuntimeCreate(ffi::String symbol_name, ffi::String graph_ TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("runtime.HipblasJSONRuntimeCreate", HipblasJSONRuntimeCreate) + .def("tvm.runtime.HipblasJSONRuntimeCreate", HipblasJSONRuntimeCreate) .def("ffi.Module.load_from_bytes.hipblas_json", JSONRuntimeBase::LoadFromBytes); } diff --git a/src/runtime/contrib/miopen/miopen_utils.cc b/src/runtime/contrib/miopen/miopen_utils.cc index 617ea5aaf027..e57a0adcfe48 100644 --- a/src/runtime/contrib/miopen/miopen_utils.cc +++ b/src/runtime/contrib/miopen/miopen_utils.cc @@ -42,7 +42,7 @@ std::string miopenGetErrorString(int error_code) { // MiopenThreadEntry MIOpenThreadEntry::MIOpenThreadEntry() { - const auto get_rocm_api = tvm::ffi::Function::GetGlobalRequired("device_api.rocm"); + const auto get_rocm_api = tvm::ffi::Function::GetGlobalRequired("tvm.device_api.rocm"); void* ret = get_rocm_api(); rocm_api = static_cast(ret); MIOPEN_CALL(miopenCreate(&handle)); diff --git a/src/runtime/contrib/mps/mps_utils.mm b/src/runtime/contrib/mps/mps_utils.mm index f5dfbdd530f0..aed24a073645 100644 --- a/src/runtime/contrib/mps/mps_utils.mm +++ b/src/runtime/contrib/mps/mps_utils.mm @@ -72,7 +72,7 @@ } MetalThreadEntry::MetalThreadEntry() { - const auto get_metal_api = tvm::ffi::Function::GetGlobalRequired("device_api.metal"); + const auto get_metal_api = tvm::ffi::Function::GetGlobalRequired("tvm.device_api.metal"); void* ret = get_metal_api(); metal_api = static_cast(ret); } diff --git a/src/runtime/contrib/mrvl/mrvl_hw_runtime.cc b/src/runtime/contrib/mrvl/mrvl_hw_runtime.cc index bfa2e1889b2e..07c05e2d38e2 100644 --- a/src/runtime/contrib/mrvl/mrvl_hw_runtime.cc +++ b/src/runtime/contrib/mrvl/mrvl_hw_runtime.cc @@ -488,7 +488,7 @@ ml_dpdk_cb MarvellHardwareModuleNode::dpdk_cb_ = {}; TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("runtime.mrvl_hw_runtime_create", MarvellHardwareModuleRuntimeCreate) + .def("tvm.runtime.mrvl_hw_runtime_create", MarvellHardwareModuleRuntimeCreate) .def("ffi.Module.load_from_bytes.mrvl_hw", MarvellHardwareModuleNode::LoadFromBytes); } } // namespace contrib diff --git a/src/runtime/contrib/mrvl/mrvl_runtime.cc b/src/runtime/contrib/mrvl/mrvl_runtime.cc index 1a9ad8c47851..f54ca63456ae 100644 --- a/src/runtime/contrib/mrvl/mrvl_runtime.cc +++ b/src/runtime/contrib/mrvl/mrvl_runtime.cc @@ -160,7 +160,7 @@ ffi::Module MarvellSimulatorModuleRuntimeCreate(const ffi::String& symbol_name, TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("runtime.mrvl_runtime_create", MarvellSimulatorModuleRuntimeCreate) + .def("tvm.runtime.mrvl_runtime_create", MarvellSimulatorModuleRuntimeCreate) .def("ffi.Module.load_from_bytes.mrvl_sim", MarvellSimulatorModuleNode::LoadFromBytes); } } // namespace contrib diff --git a/src/runtime/contrib/msc/tensorrt_runtime.cc b/src/runtime/contrib/msc/tensorrt_runtime.cc index 91e291ce30c1..5c8ddfac5884 100644 --- a/src/runtime/contrib/msc/tensorrt_runtime.cc +++ b/src/runtime/contrib/msc/tensorrt_runtime.cc @@ -120,7 +120,7 @@ class MSCTensorRTRuntime : public JSONRuntimeBase { void Run() override { SetInputOutputBinds(); if (tool_tag_.size() > 0) { - const auto pf = tvm::ffi::Function::GetGlobal("msc_tool.callback_step"); + const auto pf = tvm::ffi::Function::GetGlobal("tvm.msc_tool.callback_step"); ICHECK(pf.has_value()) << "Cannot find msc_tool.callback_step func."; ffi::Map input_datas; int device_id = 0; @@ -153,7 +153,7 @@ class MSCTensorRTRuntime : public JSONRuntimeBase { } } if (tool_tag_.size() > 0) { - const auto pf = tvm::ffi::Function::GetGlobal("msc_tool.callback_step"); + const auto pf = tvm::ffi::Function::GetGlobal("tvm.msc_tool.callback_step"); ICHECK(pf.has_value()) << "Cannot find msc_tool.callback_step func."; ffi::Map output_datas; for (int bid = 0; bid < engine_->getNbBindings(); bid++) { @@ -354,7 +354,7 @@ ffi::Module MSCTensorRTRuntimeCreate(const ffi::String& symbol_name, const ffi:: TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("runtime.msc_tensorrt_runtime_create", MSCTensorRTRuntimeCreate) + .def("tvm.runtime.msc_tensorrt_runtime_create", MSCTensorRTRuntimeCreate) .def("ffi.Module.load_from_bytes.msc_tensorrt", JSONRuntimeBase::LoadFromBytes); } diff --git a/src/runtime/contrib/nnapi/nnapi_runtime.cc b/src/runtime/contrib/nnapi/nnapi_runtime.cc index 6d3c55513889..1719f0a81a1f 100644 --- a/src/runtime/contrib/nnapi/nnapi_runtime.cc +++ b/src/runtime/contrib/nnapi/nnapi_runtime.cc @@ -244,7 +244,7 @@ ffi::Module NNAPIRuntimeCreate(const ffi::String& symbol_name, const ffi::String TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("runtime.nnapi_runtime_create", NNAPIRuntimeCreate) + .def("tvm.runtime.nnapi_runtime_create", NNAPIRuntimeCreate) .def("ffi.Module.load_from_bytes.nnapi", JSONRuntimeBase::LoadFromBytes); } diff --git a/src/runtime/contrib/nvshmem/init.cc b/src/runtime/contrib/nvshmem/init.cc index 3471902bc311..601d0eab1320 100644 --- a/src/runtime/contrib/nvshmem/init.cc +++ b/src/runtime/contrib/nvshmem/init.cc @@ -124,10 +124,10 @@ void NVSHMEMXCumoduleInit(void* cuModule) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("runtime.disco.nvshmem.init_nvshmem_uid", InitNVSHMEMUID) - .def("runtime.disco.nvshmem.init_nvshmem", InitNVSHMEM) - .def("runtime.disco.nvshmem.init_nvshmem_wrapper", InitNVSHMEMWrapper) - .def("runtime.nvshmem.cumodule_init", NVSHMEMXCumoduleInit); + .def("tvm.runtime.disco.nvshmem.init_nvshmem_uid", InitNVSHMEMUID) + .def("tvm.runtime.disco.nvshmem.init_nvshmem", InitNVSHMEM) + .def("tvm.runtime.disco.nvshmem.init_nvshmem_wrapper", InitNVSHMEMWrapper) + .def("tvm.runtime.nvshmem.cumodule_init", NVSHMEMXCumoduleInit); } } // namespace runtime diff --git a/src/runtime/contrib/nvshmem/kv_transfer.cu b/src/runtime/contrib/nvshmem/kv_transfer.cu index 34916a614ae4..69e739d1489e 100644 --- a/src/runtime/contrib/nvshmem/kv_transfer.cu +++ b/src/runtime/contrib/nvshmem/kv_transfer.cu @@ -333,6 +333,6 @@ int _KVTransferPageToPage(DLTensor* remote_pages, DLTensor* local_pages, TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("nvshmem.KVTransfer", _KVTransfer) - .def("nvshmem.KVTransferPageToPage", _KVTransferPageToPage); + .def("tvm.nvshmem.KVTransfer", _KVTransfer) + .def("tvm.nvshmem.KVTransferPageToPage", _KVTransferPageToPage); } diff --git a/src/runtime/contrib/nvshmem/memory_allocator.cc b/src/runtime/contrib/nvshmem/memory_allocator.cc index 5893d04ac33a..123e19b26cde 100644 --- a/src/runtime/contrib/nvshmem/memory_allocator.cc +++ b/src/runtime/contrib/nvshmem/memory_allocator.cc @@ -92,7 +92,7 @@ Tensor NVSHMEMEmpty(ffi::Shape shape, DataType dtype, Device device) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("runtime.disco.nvshmem.empty", NVSHMEMEmpty); + refl::GlobalDef().def("tvm.runtime.disco.nvshmem.empty", NVSHMEMEmpty); } void NVSHMEMFinalize() { @@ -102,7 +102,7 @@ void NVSHMEMFinalize() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("runtime.disco.nvshmem.finalize_nvshmem", NVSHMEMFinalize); + refl::GlobalDef().def("tvm.runtime.disco.nvshmem.finalize_nvshmem", NVSHMEMFinalize); } } // namespace runtime diff --git a/src/runtime/contrib/papi/papi.cc b/src/runtime/contrib/papi/papi.cc index 91af80de3794..3b5cc01ef9d2 100644 --- a/src/runtime/contrib/papi/papi.cc +++ b/src/runtime/contrib/papi/papi.cc @@ -51,7 +51,7 @@ struct PAPIEventSetNode : public Object { explicit PAPIEventSetNode(std::vector start_values, Device dev) : start_values(start_values), dev(dev) {} - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("PAPIEventSetNode", PAPIEventSetNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.PAPIEventSetNode", PAPIEventSetNode, Object); }; /* Get the PAPI component id for the given device. @@ -267,7 +267,7 @@ struct PAPIMetricCollectorNode final : public MetricCollectorNode { /*! \brief Device-specific metric names. Order of names matches the order in the corresponding * `event_set`. */ std::unordered_map> papi_metric_names; - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("runtime.profiling.PAPIMetricCollector", + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.runtime.profiling.PAPIMetricCollector", PAPIMetricCollectorNode, MetricCollectorNode); }; @@ -288,7 +288,7 @@ MetricCollector CreatePAPIMetricCollector( TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("runtime.profiling.PAPIMetricCollector", + refl::GlobalDef().def("tvm.runtime.profiling.PAPIMetricCollector", [](ffi::Map> metrics) { return PAPIMetricCollector(metrics); }); diff --git a/src/runtime/contrib/random/random.cc b/src/runtime/contrib/random/random.cc index f444ab07409e..682ca0ef3d9e 100644 --- a/src/runtime/contrib/random/random.cc +++ b/src/runtime/contrib/random/random.cc @@ -131,7 +131,7 @@ TVM_FFI_STATIC_INIT_BLOCK() { .def_packed("tvm.contrib.random.random_fill_for_measure", [](ffi::PackedArgs args, ffi::Any* ret) -> void { const auto curand = - tvm::ffi::Function::GetGlobal("runtime.contrib.curand.RandomFill"); + tvm::ffi::Function::GetGlobal("tvm.runtime.contrib.curand.RandomFill"); auto out = args[0].cast(); if (curand.has_value() && out->device.device_type == DLDeviceType::kDLCUDA) { if (out->dtype.code == DLDataTypeCode::kDLFloat) { diff --git a/src/runtime/contrib/tensorrt/tensorrt_runtime.cc b/src/runtime/contrib/tensorrt/tensorrt_runtime.cc index f89f0abe2acb..221b2ef85e07 100644 --- a/src/runtime/contrib/tensorrt/tensorrt_runtime.cc +++ b/src/runtime/contrib/tensorrt/tensorrt_runtime.cc @@ -528,7 +528,7 @@ ffi::Module TensorRTRuntimeCreate(const ffi::String& symbol_name, const ffi::Str TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("runtime.tensorrt_runtime_create", TensorRTRuntimeCreate) + .def("tvm.runtime.tensorrt_runtime_create", TensorRTRuntimeCreate) .def("ffi.Module.load_from_bytes.tensorrt", JSONRuntimeBase::LoadFromBytes); } diff --git a/src/runtime/contrib/tflite/tflite_runtime.cc b/src/runtime/contrib/tflite/tflite_runtime.cc index 9029a62f8da0..eca992067679 100644 --- a/src/runtime/contrib/tflite/tflite_runtime.cc +++ b/src/runtime/contrib/tflite/tflite_runtime.cc @@ -192,7 +192,7 @@ TVM_FFI_STATIC_INIT_BLOCK() { [](ffi::PackedArgs args, ffi::Any* rv) { *rv = TFLiteRuntimeCreate(args[0].cast(), args[1].cast()); }) - .def("target.runtime.tflite", TFLiteRuntimeCreate); + .def("tvm.target.runtime.tflite", TFLiteRuntimeCreate); } } // namespace runtime } // namespace tvm diff --git a/src/runtime/cpu_device_api.cc b/src/runtime/cpu_device_api.cc index d9299832ddb3..9b5285ccca95 100644 --- a/src/runtime/cpu_device_api.cc +++ b/src/runtime/cpu_device_api.cc @@ -153,7 +153,7 @@ void CPUDeviceAPI::FreeWorkspace(Device dev, void* data) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def_packed("device_api.cpu", [](ffi::PackedArgs args, ffi::Any* rv) { + refl::GlobalDef().def_packed("tvm.device_api.cpu", [](ffi::PackedArgs args, ffi::Any* rv) { DeviceAPI* ptr = CPUDeviceAPI::Global(); *rv = static_cast(ptr); }); diff --git a/src/runtime/cuda/cuda_device_api.cc b/src/runtime/cuda/cuda_device_api.cc index bfd5f7cca98a..e25e370160ed 100644 --- a/src/runtime/cuda/cuda_device_api.cc +++ b/src/runtime/cuda/cuda_device_api.cc @@ -283,12 +283,12 @@ CUDAThreadEntry* CUDAThreadEntry::ThreadLocal() { return CUDAThreadStore::Get(); TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def_packed("device_api.cuda", + .def_packed("tvm.device_api.cuda", [](ffi::PackedArgs args, ffi::Any* rv) { DeviceAPI* ptr = CUDADeviceAPI::Global(); *rv = static_cast(ptr); }) - .def_packed("device_api.cuda_host", [](ffi::PackedArgs args, ffi::Any* rv) { + .def_packed("tvm.device_api.cuda_host", [](ffi::PackedArgs args, ffi::Any* rv) { DeviceAPI* ptr = CUDADeviceAPI::Global(); *rv = static_cast(ptr); }); @@ -323,7 +323,7 @@ class CUDATimerNode : public TimerNode { CUDA_CALL(cudaEventCreate(&start_)); CUDA_CALL(cudaEventCreate(&stop_)); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("runtime.cuda.CUDATimerNode", CUDATimerNode, TimerNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.runtime.cuda.CUDATimerNode", CUDATimerNode, TimerNode); private: cudaEvent_t start_; @@ -333,7 +333,7 @@ class CUDATimerNode : public TimerNode { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("profiling.timer.cuda", + refl::GlobalDef().def("tvm.profiling.timer.cuda", [](Device dev) { return Timer(ffi::make_object()); }); } @@ -349,8 +349,8 @@ TVM_DLL ffi::String GetCudaFreeMemory() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("runtime.GetCudaFreeMemory", GetCudaFreeMemory) - .def("runtime.get_cuda_stream", []() { + .def("tvm.runtime.GetCudaFreeMemory", GetCudaFreeMemory) + .def("tvm.runtime.get_cuda_stream", []() { // TODO(tvm-team): remove once confirms all dep such as flashinfer // migrated to TVMFFIEnvGetStream int device_id; @@ -367,7 +367,7 @@ TVM_DLL int GetCudaDeviceCount() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("runtime.GetCudaDeviceCount", GetCudaDeviceCount); + refl::GlobalDef().def("tvm.runtime.GetCudaDeviceCount", GetCudaDeviceCount); } #if (CUDA_VERSION >= 12000) @@ -396,8 +396,8 @@ TVM_FFI_STATIC_INIT_BLOCK() { */ TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def_packed("runtime.cuTensorMapEncodeTiled", [](ffi::PackedArgs args, - ffi::Any* rv) { + refl::GlobalDef().def_packed("tvm.runtime.cuTensorMapEncodeTiled", [](ffi::PackedArgs args, + ffi::Any* rv) { CHECK_GE(args.size(), 4) << "init_cuTensorMap expects at least 4 arguments"; size_t arg_cnt = 0; CUtensorMap* tensor_map = static_cast(args[arg_cnt++].cast()); diff --git a/src/runtime/cuda/cuda_module.cc b/src/runtime/cuda/cuda_module.cc index 3fee6b55f2e5..2498f12134fd 100644 --- a/src/runtime/cuda/cuda_module.cc +++ b/src/runtime/cuda/cuda_module.cc @@ -115,7 +115,7 @@ class CUDAModuleNode : public ffi::ModuleObj { // must recheck under the lock scope if (module_[device_id] == nullptr) { CUDA_DRIVER_CALL(cuModuleLoadData(&(module_[device_id]), data_.c_str())); - static auto nvshmem_init_hook = ffi::Function::GetGlobal("runtime.nvshmem.cumodule_init"); + static auto nvshmem_init_hook = ffi::Function::GetGlobal("tvm.runtime.nvshmem.cumodule_init"); if (nvshmem_init_hook.has_value()) { (*nvshmem_init_hook)(static_cast(module_[device_id])); } @@ -135,7 +135,7 @@ class CUDAModuleNode : public ffi::ModuleObj { // must recheck under the lock scope if (module_[device_id] == nullptr) { CUDA_DRIVER_CALL(cuModuleLoadData(&(module_[device_id]), data_.c_str())); - static auto nvshmem_init_hook = ffi::Function::GetGlobal("runtime.nvshmem.cumodule_init"); + static auto nvshmem_init_hook = ffi::Function::GetGlobal("tvm.runtime.nvshmem.cumodule_init"); if (nvshmem_init_hook.has_value()) { (*nvshmem_init_hook)(static_cast(module_[device_id])); } diff --git a/src/runtime/cuda/l2_cache_flush.cc b/src/runtime/cuda/l2_cache_flush.cc index b69ecc71882c..22ec5b0b18d2 100644 --- a/src/runtime/cuda/l2_cache_flush.cc +++ b/src/runtime/cuda/l2_cache_flush.cc @@ -36,7 +36,7 @@ L2Flush* L2Flush::ThreadLocal() { return L2FlushStore::Get(); } TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def_packed("l2_cache_flush_cuda", [](ffi::PackedArgs args, ffi::Any* rv) { + refl::GlobalDef().def_packed("tvm.l2_cache_flush_cuda", [](ffi::PackedArgs args, ffi::Any* rv) { ICHECK(L2Flush::ThreadLocal() != nullptr) << "L2Flush::ThreadLocal do not exist."; int device_id; CUDA_CALL(cudaGetDevice(&device_id)); diff --git a/src/runtime/device_api.cc b/src/runtime/device_api.cc index f8910f6e8800..2d743643d5d6 100644 --- a/src/runtime/device_api.cc +++ b/src/runtime/device_api.cc @@ -82,7 +82,7 @@ class DeviceAPIManager { } } DeviceAPI* GetAPI(const std::string name, bool allow_missing) { - std::string factory = "device_api." + name; + std::string factory = "tvm.device_api." + name; const auto f = tvm::ffi::Function::GetGlobal(factory); if (!f.has_value()) { ICHECK(allow_missing) << "Device API " << name << " is not enabled."; @@ -178,23 +178,23 @@ void DeviceAPI::SyncStreamFromTo(Device dev, TVMStreamHandle event_src, TVMStrea TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("runtime.Device_StreamCreate", + .def("tvm.runtime.Device_StreamCreate", [](DLDevice dev) { return reinterpret_cast(DeviceAPIManager::Get(dev)->CreateStream(dev)); }) - .def("runtime.Device_StreamFree", + .def("tvm.runtime.Device_StreamFree", [](DLDevice dev, int64_t stream) { DeviceAPIManager::Get(dev)->FreeStream(dev, reinterpret_cast(stream)); }) - .def("runtime.Device_SetStream", + .def("tvm.runtime.Device_SetStream", [](DLDevice dev, int64_t stream) { DeviceAPIManager::Get(dev)->SetStream(dev, reinterpret_cast(stream)); }) - .def("runtime.Device_StreamSync", + .def("tvm.runtime.Device_StreamSync", [](DLDevice dev, int64_t stream) { DeviceAPIManager::Get(dev)->StreamSync(dev, reinterpret_cast(stream)); }) - .def("runtime.Device_StreamSyncFromTo", [](DLDevice dev, int64_t src, int64_t dst) { + .def("tvm.runtime.Device_StreamSyncFromTo", [](DLDevice dev, int64_t src, int64_t dst) { DeviceAPIManager::Get(dev)->SyncStreamFromTo(dev, reinterpret_cast(src), reinterpret_cast(dst)); }); @@ -211,7 +211,7 @@ TVM_FFI_STATIC_INIT_BLOCK() { dev.device_id = args[1].cast(); DeviceAPIManager::Get(dev)->SetDevice(dev); }) - .def_packed("runtime.GetDeviceAttr", + .def_packed("tvm.runtime.GetDeviceAttr", [](tvm::ffi::PackedArgs args, tvm::ffi::Any* ret) { DLDevice dev; dev.device_type = static_cast(args[0].cast()); @@ -229,7 +229,7 @@ TVM_FFI_STATIC_INIT_BLOCK() { DeviceAPIManager::Get(dev)->GetAttr(dev, kind, ret); } }) - .def("runtime.TVMSetStream", [](int device_type, int device_id, void* stream) { + .def("tvm.runtime.TVMSetStream", [](int device_type, int device_id, void* stream) { Device dev; dev.device_type = static_cast(device_type); dev.device_id = device_id; diff --git a/src/runtime/disco/bcast_session.cc b/src/runtime/disco/bcast_session.cc index 2ea9ef575d05..cfb196b7045a 100644 --- a/src/runtime/disco/bcast_session.cc +++ b/src/runtime/disco/bcast_session.cc @@ -68,7 +68,7 @@ void BcastSessionObj::Shutdown() { } void BcastSessionObj::InitCCL(ffi::String ccl, ffi::Shape device_ids) { - const auto pf = tvm::ffi::Function::GetGlobal("runtime.disco." + ccl + ".init_ccl"); + const auto pf = tvm::ffi::Function::GetGlobal("tvm.runtime.disco." + ccl + ".init_ccl"); CHECK(pf.has_value()) << "ValueError: Cannot initialize CCL `" << ccl << "`, because cannot find function: runtime.disco." << ccl << ".init_ccl"; (*pf)(ffi::GetRef(this), device_ids); diff --git a/src/runtime/disco/builtin.cc b/src/runtime/disco/builtin.cc index 8584d15c5e04..6501d597152d 100644 --- a/src/runtime/disco/builtin.cc +++ b/src/runtime/disco/builtin.cc @@ -76,7 +76,7 @@ Tensor DiscoEmptyTensor(ffi::Shape shape, DataType dtype, ffi::Optional ffi::Function GetCCLFunc(const char* name) { std::string ccl = DiscoWorker::ThreadLocal()->ccl; - std::string pf_name = "runtime.disco." + ccl + "." + name; + std::string pf_name = "tvm.runtime.disco." + ccl + "." + name; const auto pf = tvm::ffi::Function::GetGlobal(pf_name); CHECK(pf.has_value()) << "ValueError: Cannot find the `" << name << "` function for `" << ccl << "` via `" << pf_name << "`"; @@ -128,8 +128,8 @@ void SyncWorker() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("runtime.disco.load_vm_module", LoadVMModule) - .def("runtime.disco.empty", + .def("tvm.runtime.disco.load_vm_module", LoadVMModule) + .def("tvm.runtime.disco.empty", [](ffi::Shape shape, DataType dtype, ffi::Optional device, bool worker0_only, bool in_group) -> ffi::Optional { int worker_id = WorkerId(); @@ -143,26 +143,26 @@ TVM_FFI_STATIC_INIT_BLOCK() { return DiscoEmptyTensor(shape, dtype, device); } }) - .def("runtime.disco.allreduce", + .def("tvm.runtime.disco.allreduce", [](Tensor send, ffi::Shape reduce_kind, bool in_group, Tensor recv) { int kind = IntegerFromShape(reduce_kind); CHECK(0 <= kind && kind <= 4) << "ValueError: Unknown ReduceKind: " << kind; AllReduce(send, static_cast(kind), in_group, recv); }) - .def("runtime.disco.allgather", AllGather) - .def("runtime.disco.broadcast_from_worker0", BroadcastFromWorker0) - .def("runtime.disco.scatter_from_worker0", ScatterFromWorker0) - .def("runtime.disco.gather_to_worker0", GatherToWorker0) - .def("runtime.disco.recv_from_worker0", RecvFromWorker0) - .def("runtime.disco.send_to_next_group", SendToNextGroup) - .def("runtime.disco.recv_from_prev_group", RecvFromPrevGroup) - .def("runtime.disco.send_to_worker", SendToWorker) - .def("runtime.disco.recv_from_worker", RecvFromWorker) - .def("runtime.disco.worker_id", []() -> ffi::Shape { return ffi::Shape({WorkerId()}); }) - .def("runtime.disco.worker_rank", []() -> int64_t { return WorkerId(); }) - .def("runtime.disco.device", + .def("tvm.runtime.disco.allgather", AllGather) + .def("tvm.runtime.disco.broadcast_from_worker0", BroadcastFromWorker0) + .def("tvm.runtime.disco.scatter_from_worker0", ScatterFromWorker0) + .def("tvm.runtime.disco.gather_to_worker0", GatherToWorker0) + .def("tvm.runtime.disco.recv_from_worker0", RecvFromWorker0) + .def("tvm.runtime.disco.send_to_next_group", SendToNextGroup) + .def("tvm.runtime.disco.recv_from_prev_group", RecvFromPrevGroup) + .def("tvm.runtime.disco.send_to_worker", SendToWorker) + .def("tvm.runtime.disco.recv_from_worker", RecvFromWorker) + .def("tvm.runtime.disco.worker_id", []() -> ffi::Shape { return ffi::Shape({WorkerId()}); }) + .def("tvm.runtime.disco.worker_rank", []() -> int64_t { return WorkerId(); }) + .def("tvm.runtime.disco.device", []() -> Device { return DiscoWorker::ThreadLocal()->default_device; }) - .def("runtime.disco.bind_worker_to_cpu_core", [](ffi::Shape cpu_ids) { + .def("tvm.runtime.disco.bind_worker_to_cpu_core", [](ffi::Shape cpu_ids) { int worker_id = WorkerId(); ICHECK_LT(worker_id, static_cast(cpu_ids.size())); const auto f_set_thread_affinity = tvm::ffi::Function::GetGlobalRequired( diff --git a/src/runtime/disco/cuda_ipc/cuda_ipc_memory.cc b/src/runtime/disco/cuda_ipc/cuda_ipc_memory.cc index 7dc55c0b4b7c..586c7a3ee430 100644 --- a/src/runtime/disco/cuda_ipc/cuda_ipc_memory.cc +++ b/src/runtime/disco/cuda_ipc/cuda_ipc_memory.cc @@ -216,8 +216,8 @@ memory::Storage IPCAllocStorage(ffi::Shape buffer_shape, DLDataType dtype_hint) TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("runtime.disco.cuda_ipc.alloc_storage", IPCAllocStorage) - .def("runtime.disco.cuda_ipc.cuda_ipc_memory_allocator_clear", + .def("tvm.runtime.disco.cuda_ipc.alloc_storage", IPCAllocStorage) + .def("tvm.runtime.disco.cuda_ipc.cuda_ipc_memory_allocator_clear", []() { CUDAIPCMemoryAllocator::Global()->Clear(); }); } diff --git a/src/runtime/disco/cuda_ipc/custom_allreduce.cc b/src/runtime/disco/cuda_ipc/custom_allreduce.cc index 060a098a9d63..075351dae627 100644 --- a/src/runtime/disco/cuda_ipc/custom_allreduce.cc +++ b/src/runtime/disco/cuda_ipc/custom_allreduce.cc @@ -115,7 +115,7 @@ void CustomAllReduce(DLTensor* send, int strategy, DLTensor* recv) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("runtime.disco.cuda_ipc.custom_allreduce", CustomAllReduce); + refl::GlobalDef().def("tvm.runtime.disco.cuda_ipc.custom_allreduce", CustomAllReduce); } } // namespace cuda_ipc diff --git a/src/runtime/disco/distributed/socket_session.cc b/src/runtime/disco/distributed/socket_session.cc index 99c54933bf3a..ef14a8e27ac2 100644 --- a/src/runtime/disco/distributed/socket_session.cc +++ b/src/runtime/disco/distributed/socket_session.cc @@ -59,12 +59,12 @@ class SocketSessionObj : public BcastSessionObj { const ffi::String& host, int port) : num_nodes_(num_nodes), num_workers_per_node_(num_workers_per_node) { const auto f_create_local_session = - tvm::ffi::Function::GetGlobal("runtime.disco.create_socket_session_local_workers"); + tvm::ffi::Function::GetGlobal("tvm.runtime.disco.create_socket_session_local_workers"); ICHECK(f_create_local_session.has_value()) << "Cannot find function runtime.disco.create_socket_session_local_workers"; local_session_ = ((*f_create_local_session)(num_workers_per_node)).cast(); DRef f_init_workers = - local_session_->GetGlobalFunc("runtime.disco.socket_session_init_workers"); + local_session_->GetGlobalFunc("tvm.runtime.disco.socket_session_init_workers"); local_session_->CallPacked(f_init_workers, num_nodes_, /*node_id=*/0, num_groups, num_workers_per_node_); @@ -196,7 +196,7 @@ class SocketSessionObj : public BcastSessionObj { } ~SocketSessionObj() { Shutdown(); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("runtime.disco.SocketSession", SocketSessionObj, + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.runtime.disco.SocketSession", SocketSessionObj, BcastSessionObj); int num_nodes_; int num_workers_per_node_; @@ -269,11 +269,11 @@ class RemoteSocketSession { private: void InitLocalSession() { const auto f_create_local_session = - tvm::ffi::Function::GetGlobal("runtime.disco.create_socket_session_local_workers"); + tvm::ffi::Function::GetGlobal("tvm.runtime.disco.create_socket_session_local_workers"); local_session_ = ((*f_create_local_session)(num_workers_per_node_)).cast(); DRef f_init_workers = - local_session_->GetGlobalFunc("runtime.disco.socket_session_init_workers"); + local_session_->GetGlobalFunc("tvm.runtime.disco.socket_session_init_workers"); local_session_->CallPacked(f_init_workers, num_nodes_, node_id_, num_groups_, num_workers_per_node_); } @@ -295,7 +295,7 @@ void RemoteSocketSessionEntryPoint(const ffi::String& server_host, int server_po TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("runtime.disco.RemoteSocketSession", RemoteSocketSessionEntryPoint); + refl::GlobalDef().def("tvm.runtime.disco.RemoteSocketSession", RemoteSocketSessionEntryPoint); } Session SocketSession(int num_nodes, int num_workers_per_node, int num_groups, @@ -309,8 +309,8 @@ TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::ObjectDef(); refl::GlobalDef() - .def("runtime.disco.SocketSession", SocketSession) - .def("runtime.disco.socket_session_init_workers", + .def("tvm.runtime.disco.SocketSession", SocketSession) + .def("tvm.runtime.disco.socket_session_init_workers", [](int num_nodes, int node_id, int num_groups, int num_workers_per_node) { LOG(INFO) << "Initializing worker group with " << num_nodes << " nodes, " << num_workers_per_node << " workers per node, and " << num_groups diff --git a/src/runtime/disco/loader.cc b/src/runtime/disco/loader.cc index 35fbf8abbb6f..9e63cb90f6f0 100644 --- a/src/runtime/disco/loader.cc +++ b/src/runtime/disco/loader.cc @@ -137,7 +137,7 @@ class ShardLoaderObj : public Object { /*! \brief Slice the given tensor at a specific dimension */ Tensor Shard(Tensor source, int dim, int num_slices) const; - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("runtime.disco.ShardLoader", ShardLoaderObj, Object); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.runtime.disco.ShardLoader", ShardLoaderObj, Object); public: /*! \brief Information of how each weight is stored and sharded */ @@ -405,36 +405,36 @@ ffi::Array ShardLoaderObj::LoadAllPresharded() const { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("runtime.disco.ShardLoader", ShardLoaderObj::Create) - .def("runtime.disco.ShardLoaderLoad", + .def("tvm.runtime.disco.ShardLoader", ShardLoaderObj::Create) + .def("tvm.runtime.disco.ShardLoaderLoad", [](ObjectRef loader_obj, ffi::Shape weight_index) { const auto* loader = loader_obj.as(); CHECK(loader != nullptr) << "TypeError: Expected ShardLoaderObj, but gets: " << loader_obj->GetTypeKey(); return loader->Load(IntegerFromShape(weight_index)); }) - .def("runtime.disco.ShardLoaderLoadPresharded", + .def("tvm.runtime.disco.ShardLoaderLoadPresharded", [](ObjectRef loader_obj, ffi::Shape weight_index) { const auto* loader = loader_obj.as(); CHECK(loader != nullptr) << "TypeError: Expected ShardLoaderObj, but gets: " << loader_obj->GetTypeKey(); return loader->LoadPresharded(IntegerFromShape(weight_index)); }) - .def("runtime.disco.ShardLoaderLoadAll", + .def("tvm.runtime.disco.ShardLoaderLoadAll", [](ObjectRef loader_obj) { const auto* loader = loader_obj.as(); CHECK(loader != nullptr) << "TypeError: Expected ShardLoaderObj, but gets: " << loader_obj->GetTypeKey(); return loader->LoadAll(); }) - .def("runtime.disco.ShardLoaderLoadAllPresharded", + .def("tvm.runtime.disco.ShardLoaderLoadAllPresharded", [](ObjectRef loader_obj) { const auto* loader = loader_obj.as(); CHECK(loader != nullptr) << "TypeError: Expected ShardLoaderObj, but gets: " << loader_obj->GetTypeKey(); return loader->LoadAllPresharded(); }) - .def("runtime.disco.ShardLoaderLoadParamOnWorker0", + .def("tvm.runtime.disco.ShardLoaderLoadParamOnWorker0", [](ObjectRef loader_obj, int param_index) { const auto* loader = loader_obj.as(); CHECK(loader != nullptr) diff --git a/src/runtime/disco/nccl/nccl.cc b/src/runtime/disco/nccl/nccl.cc index fd4ad06c3fa8..e3334f5292e5 100644 --- a/src/runtime/disco/nccl/nccl.cc +++ b/src/runtime/disco/nccl/nccl.cc @@ -55,7 +55,7 @@ inline ncclRedOp_t AsNCCLRedOp(ReduceKind kind) { } void InitCCL(Session sess, ffi::Shape device_ids) { - DRef func = sess->GetGlobalFunc("runtime.disco." TVM_DISCO_CCL_NAME ".init_ccl_per_worker"); + DRef func = sess->GetGlobalFunc("tvm.runtime.disco." TVM_DISCO_CCL_NAME ".init_ccl_per_worker"); DLOG(INFO) << "Initializing " TVM_DISCO_CCL_NAME " with devices: " << device_ids; ncclUniqueId id; NCCL_CALL(ncclGetUniqueId(&id)); @@ -330,26 +330,26 @@ void SyncWorker() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("runtime.disco.compiled_ccl", []() -> ffi::String { return TVM_DISCO_CCL_NAME; }) - .def("runtime.disco." TVM_DISCO_CCL_NAME ".init_ccl", InitCCL) - .def("runtime.disco." TVM_DISCO_CCL_NAME ".init_ccl_per_worker", InitCCLPerWorker) - .def("runtime.disco." TVM_DISCO_CCL_NAME ".allreduce", + .def("tvm.runtime.disco.compiled_ccl", []() -> ffi::String { return TVM_DISCO_CCL_NAME; }) + .def("tvm.runtime.disco." TVM_DISCO_CCL_NAME ".init_ccl", InitCCL) + .def("tvm.runtime.disco." TVM_DISCO_CCL_NAME ".init_ccl_per_worker", InitCCLPerWorker) + .def("tvm.runtime.disco." TVM_DISCO_CCL_NAME ".allreduce", [](Tensor send, int kind, bool in_group, Tensor recv) { CHECK(0 <= kind && kind <= 4) << "ValueError: Unknown ReduceKind: " << kind; nccl::AllReduce(send, static_cast(kind), in_group, recv); }) - .def("runtime.disco." TVM_DISCO_CCL_NAME ".allgather", + .def("tvm.runtime.disco." TVM_DISCO_CCL_NAME ".allgather", [](Tensor send, bool in_group, Tensor recv) { nccl::AllGather(send, in_group, recv); }) - .def("runtime.disco." TVM_DISCO_CCL_NAME ".broadcast_from_worker0", BroadcastFromWorker0) - .def("runtime.disco." TVM_DISCO_CCL_NAME ".scatter_from_worker0", ScatterFromWorker0) - .def("runtime.disco." TVM_DISCO_CCL_NAME ".gather_to_worker0", GatherToWorker0) - .def("runtime.disco." TVM_DISCO_CCL_NAME ".recv_from_worker0", RecvFromWorker0) - .def("runtime.disco." TVM_DISCO_CCL_NAME ".send_to_next_group", SendToNextGroup) - .def("runtime.disco." TVM_DISCO_CCL_NAME ".recv_from_prev_group", RecvFromPrevGroup) - .def("runtime.disco." TVM_DISCO_CCL_NAME ".send_to_worker", SendToWorker) - .def("runtime.disco." TVM_DISCO_CCL_NAME ".recv_from_worker", RecvFromWorker) - .def("runtime.disco." TVM_DISCO_CCL_NAME ".sync_worker", SyncWorker) - .def("runtime.disco." TVM_DISCO_CCL_NAME ".test_send_to_next_group_recv_from_prev_group", + .def("tvm.runtime.disco." TVM_DISCO_CCL_NAME ".broadcast_from_worker0", BroadcastFromWorker0) + .def("tvm.runtime.disco." TVM_DISCO_CCL_NAME ".scatter_from_worker0", ScatterFromWorker0) + .def("tvm.runtime.disco." TVM_DISCO_CCL_NAME ".gather_to_worker0", GatherToWorker0) + .def("tvm.runtime.disco." TVM_DISCO_CCL_NAME ".recv_from_worker0", RecvFromWorker0) + .def("tvm.runtime.disco." TVM_DISCO_CCL_NAME ".send_to_next_group", SendToNextGroup) + .def("tvm.runtime.disco." TVM_DISCO_CCL_NAME ".recv_from_prev_group", RecvFromPrevGroup) + .def("tvm.runtime.disco." TVM_DISCO_CCL_NAME ".send_to_worker", SendToWorker) + .def("tvm.runtime.disco." TVM_DISCO_CCL_NAME ".recv_from_worker", RecvFromWorker) + .def("tvm.runtime.disco." TVM_DISCO_CCL_NAME ".sync_worker", SyncWorker) + .def("tvm.runtime.disco." TVM_DISCO_CCL_NAME ".test_send_to_next_group_recv_from_prev_group", [](Tensor buffer) { CCLThreadLocalContext* ctx = CCLThreadLocalContext::Get(); CHECK_EQ(ctx->worker->num_workers, 4) << "The test requires the world size to be 4."; @@ -362,16 +362,17 @@ TVM_FFI_STATIC_INIT_BLOCK() { tvm::runtime::nccl::RecvFromPrevGroup(buffer); } }) - .def("runtime.disco." TVM_DISCO_CCL_NAME ".test_worker2_sends_to_worker0", [](Tensor buffer) { - CCLThreadLocalContext* ctx = CCLThreadLocalContext::Get(); - CHECK_EQ(ctx->worker->num_workers, 4) << "The test requires the world size to be 4."; - CHECK_EQ(ctx->worker->num_groups, 2) << "The test requires the group size to be 2."; - if (ctx->worker->worker_id == 2) { - tvm::runtime::nccl::SendToWorker(buffer, 0); - } else if (ctx->worker->worker_id == 0) { - tvm::runtime::nccl::RecvFromWorker(buffer, 2); - } - }); + .def("tvm.runtime.disco." TVM_DISCO_CCL_NAME ".test_worker2_sends_to_worker0", + [](Tensor buffer) { + CCLThreadLocalContext* ctx = CCLThreadLocalContext::Get(); + CHECK_EQ(ctx->worker->num_workers, 4) << "The test requires the world size to be 4."; + CHECK_EQ(ctx->worker->num_groups, 2) << "The test requires the group size to be 2."; + if (ctx->worker->worker_id == 2) { + tvm::runtime::nccl::SendToWorker(buffer, 0); + } else if (ctx->worker->worker_id == 0) { + tvm::runtime::nccl::RecvFromWorker(buffer, 2); + } + }); } } // namespace nccl diff --git a/src/runtime/disco/process_session.cc b/src/runtime/disco/process_session.cc index c13cd9e60e9d..e948075311fa 100644 --- a/src/runtime/disco/process_session.cc +++ b/src/runtime/disco/process_session.cc @@ -168,7 +168,8 @@ class ProcessSessionObj final : public BcastSessionObj { ffi::Function process_pool_; std::unique_ptr worker_0_; std::vector> workers_; - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("runtime.disco.ProcessSession", ProcessSessionObj, SessionObj); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.runtime.disco.ProcessSession", ProcessSessionObj, + SessionObj); }; Session Session::ProcessSession(int num_workers, int num_group, ffi::String process_pool_creator, @@ -196,8 +197,8 @@ TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::ObjectDef(); refl::GlobalDef() - .def("runtime.disco.SessionProcess", Session::ProcessSession) - .def("runtime.disco.WorkerProcess", WorkerProcess); + .def("tvm.runtime.disco.SessionProcess", Session::ProcessSession) + .def("tvm.runtime.disco.WorkerProcess", WorkerProcess); } } // namespace runtime diff --git a/src/runtime/disco/protocol.h b/src/runtime/disco/protocol.h index 067a4f0d4a67..3e3bd3b73234 100644 --- a/src/runtime/disco/protocol.h +++ b/src/runtime/disco/protocol.h @@ -116,7 +116,8 @@ struct DiscoDebugObject : public Object { inline uint64_t GetFFIAnyProtocolBytes() const { return sizeof(uint64_t) + this->SaveToStr().size(); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("runtime.disco.DiscoDebugObject", DiscoDebugObject, SessionObj); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.runtime.disco.DiscoDebugObject", DiscoDebugObject, + SessionObj); }; template @@ -230,7 +231,7 @@ inline std::string DiscoDebugObject::SaveToStr() const { return result; } else if (auto opt_obj = this->data.as()) { ObjectRef obj = opt_obj.value(); - const auto f = tvm::ffi::Function::GetGlobal("node.SaveJSON"); + const auto f = tvm::ffi::Function::GetGlobal("tvm.node.SaveJSON"); CHECK(f.has_value()) << "ValueError: Cannot serialize object in non-debugging mode: " << obj->GetTypeKey(); std::string result = (*f)(obj).cast(); @@ -247,7 +248,7 @@ inline ObjectPtr DiscoDebugObject::LoadFromStr(std::string jso json_str.pop_back(); ObjectPtr result = ffi::make_object(); if (control_bit == '0') { - const auto f = tvm::ffi::Function::GetGlobal("node.LoadJSON"); + const auto f = tvm::ffi::Function::GetGlobal("tvm.node.LoadJSON"); CHECK(f.has_value()) << "ValueError: Cannot deserialize object in non-debugging mode"; result->data = (*f)(json_str); } else if (control_bit == '1') { diff --git a/src/runtime/disco/session.cc b/src/runtime/disco/session.cc index 2bf132f362d5..e4abe6befc3f 100644 --- a/src/runtime/disco/session.cc +++ b/src/runtime/disco/session.cc @@ -35,21 +35,21 @@ TVM_FFI_STATIC_INIT_BLOCK() { refl::ObjectDef(); refl::ObjectDef(); refl::GlobalDef() - .def("runtime.disco.SessionThreaded", Session::ThreadedSession) - .def_method("runtime.disco.DRefDebugGetFromRemote", &DRefObj::DebugGetFromRemote) - .def_method("runtime.disco.DRefDebugCopyFrom", &DRefObj::DebugCopyFrom) - .def_method("runtime.disco.SessionGetNumWorkers", &SessionObj::GetNumWorkers) - .def_method("runtime.disco.SessionGetGlobalFunc", &SessionObj::GetGlobalFunc) - .def_method("runtime.disco.SessionCopyFromWorker0", &SessionObj::CopyFromWorker0) - .def_method("runtime.disco.SessionCopyToWorker0", &SessionObj::CopyToWorker0) - .def_method("runtime.disco.SessionSyncWorker", &SessionObj::SyncWorker) - .def_method("runtime.disco.SessionInitCCL", &SessionObj::InitCCL) - .def_packed("runtime.disco.SessionCallPacked", + .def("tvm.runtime.disco.SessionThreaded", Session::ThreadedSession) + .def_method("tvm.runtime.disco.DRefDebugGetFromRemote", &DRefObj::DebugGetFromRemote) + .def_method("tvm.runtime.disco.DRefDebugCopyFrom", &DRefObj::DebugCopyFrom) + .def_method("tvm.runtime.disco.SessionGetNumWorkers", &SessionObj::GetNumWorkers) + .def_method("tvm.runtime.disco.SessionGetGlobalFunc", &SessionObj::GetGlobalFunc) + .def_method("tvm.runtime.disco.SessionCopyFromWorker0", &SessionObj::CopyFromWorker0) + .def_method("tvm.runtime.disco.SessionCopyToWorker0", &SessionObj::CopyToWorker0) + .def_method("tvm.runtime.disco.SessionSyncWorker", &SessionObj::SyncWorker) + .def_method("tvm.runtime.disco.SessionInitCCL", &SessionObj::InitCCL) + .def_packed("tvm.runtime.disco.SessionCallPacked", [](ffi::PackedArgs args, ffi::Any* rv) { Session self = args[0].cast(); *rv = SessionObj::FFI::CallWithPacked(self, args.Slice(1)); }) - .def_method("runtime.disco.SessionShutdown", &SessionObj::Shutdown); + .def_method("tvm.runtime.disco.SessionShutdown", &SessionObj::Shutdown); } } // namespace runtime diff --git a/src/runtime/disco/threaded_session.cc b/src/runtime/disco/threaded_session.cc index 029038625faa..cf812c72b49b 100644 --- a/src/runtime/disco/threaded_session.cc +++ b/src/runtime/disco/threaded_session.cc @@ -181,7 +181,7 @@ class ThreadedSessionObj final : public BcastSessionObj { ffi::PackedArgs RecvReplyPacked(int worker_id) final { return this->workers_.at(worker_id).channel->RecvReply(); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("runtime.disco.ThreadedSession", ThreadedSessionObj, + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.runtime.disco.ThreadedSession", ThreadedSessionObj, SessionObj); std::vector workers_; diff --git a/src/runtime/file_utils.cc b/src/runtime/file_utils.cc index b3733ee6fdff..4900752d58a2 100644 --- a/src/runtime/file_utils.cc +++ b/src/runtime/file_utils.cc @@ -254,18 +254,19 @@ std::string SaveParams(const ffi::Map& params) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("runtime.SaveParams", + .def("tvm.runtime.SaveParams", [](const ffi::Map& params) { std::string s = ::tvm::runtime::SaveParams(params); return ffi::Bytes(std::move(s)); }) - .def("runtime.SaveParamsToFile", + .def("tvm.runtime.SaveParamsToFile", [](const ffi::Map& params, const ffi::String& path) { tvm::runtime::SimpleBinaryFileStream strm(path, "wb"); SaveParams(&strm, params); }) - .def("runtime.LoadParams", [](const ffi::Bytes& s) { return ::tvm::runtime::LoadParams(s); }) - .def("runtime.LoadParamsFromFile", [](const ffi::String& path) { + .def("tvm.runtime.LoadParams", + [](const ffi::Bytes& s) { return ::tvm::runtime::LoadParams(s); }) + .def("tvm.runtime.LoadParamsFromFile", [](const ffi::String& path) { tvm::runtime::SimpleBinaryFileStream strm(path, "rb"); return LoadParams(&strm); }); diff --git a/src/runtime/hexagon/hexagon_common.cc b/src/runtime/hexagon/hexagon_common.cc index 61c7e4972ba0..17bfbe9d2f6f 100644 --- a/src/runtime/hexagon/hexagon_common.cc +++ b/src/runtime/hexagon/hexagon_common.cc @@ -46,7 +46,7 @@ class HexagonTimerNode : public TimerNode { virtual void Stop() { end = HAP_perf_get_time_us(); } virtual int64_t SyncAndGetElapsedNanos() { return (end - start) * 1e3; } virtual ~HexagonTimerNode() {} - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("runtime.hexagon.HexagonTimerNode", HexagonTimerNode, + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.runtime.hexagon.HexagonTimerNode", HexagonTimerNode, TimerNode); private: @@ -55,7 +55,7 @@ class HexagonTimerNode : public TimerNode { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("profiling.timer.hexagon", + refl::GlobalDef().def("tvm.profiling.timer.hexagon", [](Device dev) { return Timer(ffi::make_object()); }); } } // namespace hexagon diff --git a/src/runtime/hexagon/hexagon_device_api.cc b/src/runtime/hexagon/hexagon_device_api.cc index 15ee1ed52a8b..759a3ee50786 100644 --- a/src/runtime/hexagon/hexagon_device_api.cc +++ b/src/runtime/hexagon/hexagon_device_api.cc @@ -194,7 +194,7 @@ void HexagonDeviceAPI::CopyDataFromTo(const void* from, size_t from_offset, void TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def_packed("device_api.hexagon.dma_copy_dltensor", + .def_packed("tvm.device_api.hexagon.dma_copy_dltensor", [](ffi::PackedArgs args, ffi::Any* rv) { auto dst = args[0].cast(); auto src = args[1].cast(); @@ -212,7 +212,7 @@ TVM_FFI_STATIC_INIT_BLOCK() { *rv = static_cast(0); }) - .def_packed("device_api.hexagon.dma_copy", + .def_packed("tvm.device_api.hexagon.dma_copy", [](ffi::PackedArgs args, ffi::Any* rv) { uint32_t queue_id = args[0].cast(); void* dst = args[1].cast(); @@ -229,7 +229,7 @@ TVM_FFI_STATIC_INIT_BLOCK() { CHECK(ret == DMA_SUCCESS); *rv = static_cast(ret); }) - .def_packed("device_api.hexagon.dma_wait", + .def_packed("tvm.device_api.hexagon.dma_wait", [](ffi::PackedArgs args, ffi::Any* rv) { uint32_t queue_id = args[0].cast(); int inflight = args[1].cast(); @@ -237,19 +237,19 @@ TVM_FFI_STATIC_INIT_BLOCK() { HexagonDeviceAPI::Global()->UserDMA()->Wait(queue_id, inflight); *rv = static_cast(0); }) - .def_packed("device_api.hexagon.dma_start_group", + .def_packed("tvm.device_api.hexagon.dma_start_group", [](ffi::PackedArgs args, ffi::Any* rv) { uint32_t queue_id = args[0].cast(); HexagonDeviceAPI::Global()->UserDMA()->StartGroup(queue_id); *rv = static_cast(0); }) - .def_packed("device_api.hexagon.dma_end_group", + .def_packed("tvm.device_api.hexagon.dma_end_group", [](ffi::PackedArgs args, ffi::Any* rv) { uint32_t queue_id = args[0].cast(); HexagonDeviceAPI::Global()->UserDMA()->EndGroup(queue_id); *rv = static_cast(0); }) - .def_packed("device_api.hexagon.alloc_nd", + .def_packed("tvm.device_api.hexagon.alloc_nd", [](ffi::PackedArgs args, ffi::Any* rv) { int32_t device_type = args[0].cast(); int32_t device_id = args[1].cast(); @@ -274,7 +274,7 @@ TVM_FFI_STATIC_INIT_BLOCK() { HexagonDeviceAPI* hexapi = HexagonDeviceAPI::Global(); *rv = hexapi->AllocDataSpace(dev, ndim, shape, type_hint, ffi::String(scope)); }) - .def_packed("device_api.hexagon.free_nd", + .def_packed("tvm.device_api.hexagon.free_nd", [](ffi::PackedArgs args, ffi::Any* rv) { int32_t device_type = args[0].cast(); int32_t device_id = args[1].cast(); @@ -290,22 +290,22 @@ TVM_FFI_STATIC_INIT_BLOCK() { hexapi->FreeDataSpace(dev, ptr); *rv = static_cast(0); }) - .def_packed("device_api.hexagon.acquire_resources", + .def_packed("tvm.device_api.hexagon.acquire_resources", [](ffi::PackedArgs args, ffi::Any* rv) { HexagonDeviceAPI* api = HexagonDeviceAPI::Global(); api->AcquireResources(); }) - .def_packed("device_api.hexagon.release_resources", + .def_packed("tvm.device_api.hexagon.release_resources", [](ffi::PackedArgs args, ffi::Any* rv) { HexagonDeviceAPI* api = HexagonDeviceAPI::Global(); api->ReleaseResources(); }) - .def_packed("device_api.hexagon.vtcm_device_bytes", + .def_packed("tvm.device_api.hexagon.vtcm_device_bytes", [](ffi::PackedArgs args, ffi::Any* rv) { HexagonDeviceAPI* api = HexagonDeviceAPI::Global(); *rv = static_cast(api->VtcmPool()->VtcmDeviceBytes()); }) - .def_packed("device_api.hexagon", [](ffi::PackedArgs args, ffi::Any* rv) { + .def_packed("tvm.device_api.hexagon", [](ffi::PackedArgs args, ffi::Any* rv) { DeviceAPI* ptr = HexagonDeviceAPI::Global(); *rv = static_cast(ptr); }); diff --git a/src/runtime/hexagon/rpc/hexagon/rpc_server.cc b/src/runtime/hexagon/rpc/hexagon/rpc_server.cc index d9c2e647aea2..7cdbe186fa34 100644 --- a/src/runtime/hexagon/rpc/hexagon/rpc_server.cc +++ b/src/runtime/hexagon/rpc/hexagon/rpc_server.cc @@ -250,9 +250,9 @@ const tvm::ffi::Function get_runtime_func(const std::string& name) { } void reset_device_api() { - const tvm::ffi::Function api = get_runtime_func("device_api.hexagon"); + const tvm::ffi::Function api = get_runtime_func("tvm.device_api.hexagon"); // Registering device_api.cpu as device_api.hexagon since we use hexagon as sub-target of LLVM. - tvm::ffi::Function::SetGlobal("device_api.cpu", api, true); + tvm::ffi::Function::SetGlobal("tvm.device_api.cpu", api, true); } int __QAIC_HEADER(hexagon_rpc_open)(const char* uri, remote_handle64* handle) { diff --git a/src/runtime/hexagon/rpc/simulator/rpc_server.cc b/src/runtime/hexagon/rpc/simulator/rpc_server.cc index c3cec3039221..480b08a1450b 100644 --- a/src/runtime/hexagon/rpc/simulator/rpc_server.cc +++ b/src/runtime/hexagon/rpc/simulator/rpc_server.cc @@ -301,9 +301,9 @@ int main(int argc, char* argv[]) { void* self = dlopen(argv[0], RTLD_GLOBAL); ICHECK(self != nullptr); - const auto api = tvm::ffi::Function::GetGlobal("device_api.hexagon"); + const auto api = tvm::ffi::Function::GetGlobal("tvm.device_api.hexagon"); ICHECK(api.has_value()); - tvm::ffi::Function::SetGlobal("device_api.cpu", *api, true); + tvm::ffi::Function::SetGlobal("tvm.device_api.cpu", *api, true); tvm::runtime::hexagon::SimulatorRPCServer server; diff --git a/src/runtime/memory/memory_manager.cc b/src/runtime/memory/memory_manager.cc index db4d33be3789..a83f9e7542db 100644 --- a/src/runtime/memory/memory_manager.cc +++ b/src/runtime/memory/memory_manager.cc @@ -267,7 +267,7 @@ void Allocator::Clear() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("vm.builtin.memory_manager.clear", MemoryManager::Clear); + refl::GlobalDef().def("tvm.vm.builtin.memory_manager.clear", MemoryManager::Clear); } } // namespace memory diff --git a/src/runtime/metal/metal_device_api.mm b/src/runtime/metal/metal_device_api.mm index 2a3cd558f2a5..6a6f12efac33 100644 --- a/src/runtime/metal/metal_device_api.mm +++ b/src/runtime/metal/metal_device_api.mm @@ -355,12 +355,12 @@ int GetWarpSize(id dev) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def_packed("device_api.metal", + .def_packed("tvm.device_api.metal", [](ffi::PackedArgs args, ffi::Any* rv) { DeviceAPI* ptr = MetalWorkspace::Global(); *rv = static_cast(ptr); }) - .def("metal.ResetGlobalState", + .def("tvm.metal.ResetGlobalState", []() { MetalWorkspace::Global()->ReinitializeDefaultStreams(); }); } @@ -380,7 +380,7 @@ virtual void Stop() { [mtl_dev_ sampleTimestamps:&stop_cpu_time_ gpuTimestamp:&stop_gpu_time_]; } virtual int64_t SyncAndGetElapsedNanos() { return stop_gpu_time_ - start_gpu_time_; } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("runtime.metal.MetalTimerNode", MetalTimerNode, TimerNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.runtime.metal.MetalTimerNode", MetalTimerNode, TimerNode); private: Device dev_; @@ -394,7 +394,7 @@ virtual void Stop() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("profiling.timer.metal", + refl::GlobalDef().def("tvm.profiling.timer.metal", [](Device dev) { return Timer(ffi::make_object(dev)); }); } diff --git a/src/runtime/metal/metal_module.mm b/src/runtime/metal/metal_module.mm index 9c0aa96257d4..d05ea82ccbab 100644 --- a/src/runtime/metal/metal_module.mm +++ b/src/runtime/metal/metal_module.mm @@ -292,7 +292,7 @@ void operator()(ffi::PackedArgs args, ffi::Any* rv, const ArgUnion64* pack_args) TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("runtime.module.create_metal_module", + refl::GlobalDef().def("tvm.runtime.module.create_metal_module", [](ffi::Map smap, std::string fmap_json, std::string fmt, std::string source) { std::istringstream stream(fmap_json); diff --git a/src/runtime/minrpc/minrpc_server.h b/src/runtime/minrpc/minrpc_server.h index ccfd3d079280..4e9f27b4a465 100644 --- a/src/runtime/minrpc/minrpc_server.h +++ b/src/runtime/minrpc/minrpc_server.h @@ -68,7 +68,7 @@ class MinRPCServer { auto fsend = ffi::Function::FromTyped([this](TVMFFIByteArray* bytes) { return io_->PosixWrite(reinterpret_cast(bytes->data), bytes->size); }); - auto fcreate = tvm::ffi::Function::GetGlobalRequired("rpc.CreateEventDrivenServer"); + auto fcreate = tvm::ffi::Function::GetGlobalRequired("tvm.rpc.CreateEventDrivenServer"); ffi::Any value = fcreate(fsend, "MinRPCServer", ""); fserver_handler_ = value.cast(); } diff --git a/src/runtime/module.cc b/src/runtime/module.cc index c782cb96c09f..0194b2d51b79 100644 --- a/src/runtime/module.cc +++ b/src/runtime/module.cc @@ -41,25 +41,25 @@ bool RuntimeEnabled(const ffi::String& target_str) { if (target == "cpu") { return true; } else if (target == "cuda" || target == "gpu") { - f_name = "device_api.cuda"; + f_name = "tvm.device_api.cuda"; } else if (target == "cl" || target == "opencl") { - f_name = "device_api.opencl"; + f_name = "tvm.device_api.opencl"; } else if (target == "mtl" || target == "metal") { - f_name = "device_api.metal"; + f_name = "tvm.device_api.metal"; } else if (target == "tflite") { - f_name = "target.runtime.tflite"; + f_name = "tvm.target.runtime.tflite"; } else if (target == "vulkan") { - f_name = "device_api.vulkan"; + f_name = "tvm.device_api.vulkan"; } else if (target == "rpc") { - f_name = "device_api.rpc"; + f_name = "tvm.device_api.rpc"; } else if (target == "hexagon") { - f_name = "device_api.hexagon"; + f_name = "tvm.device_api.hexagon"; } else if (target.length() >= 5 && target.substr(0, 5) == "nvptx") { - f_name = "device_api.cuda"; + f_name = "tvm.device_api.cuda"; } else if (target.length() >= 4 && target.substr(0, 4) == "rocm") { - f_name = "device_api.rocm"; + f_name = "tvm.device_api.rocm"; } else if (target.length() >= 4 && target.substr(0, 4) == "llvm") { - const auto pf = tvm::ffi::Function::GetGlobal("codegen.llvm_target_enabled"); + const auto pf = tvm::ffi::Function::GetGlobal("tvm.codegen.llvm_target_enabled"); if (!pf.has_value()) return false; return (*pf)(target).cast(); } else { @@ -84,7 +84,7 @@ TVM_FFI_STATIC_INIT_BLOCK() { TVM_INIT_CONTEXT_FUNC(TVMBackendParallelLaunch); TVM_INIT_CONTEXT_FUNC(TVMBackendParallelBarrier); - refl::GlobalDef().def("runtime.RuntimeEnabled", RuntimeEnabled); + refl::GlobalDef().def("tvm.runtime.RuntimeEnabled", RuntimeEnabled); } #undef TVM_INIT_CONTEXT_FUNC diff --git a/src/runtime/opencl/opencl_common.h b/src/runtime/opencl/opencl_common.h index 933cd0b7a7cf..b8ce810897b5 100644 --- a/src/runtime/opencl/opencl_common.h +++ b/src/runtime/opencl/opencl_common.h @@ -592,7 +592,8 @@ class OpenCLTimerNode : public TimerNode { static size_t count_timer_execs; static std::vector event_start_idxs; - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("runtime.opencl.OpenCLTimerNode", OpenCLTimerNode, TimerNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.runtime.opencl.OpenCLTimerNode", OpenCLTimerNode, + TimerNode); private: int64_t duration; diff --git a/src/runtime/opencl/opencl_device_api.cc b/src/runtime/opencl/opencl_device_api.cc index 63e0890f70c2..970a07a7940c 100644 --- a/src/runtime/opencl/opencl_device_api.cc +++ b/src/runtime/opencl/opencl_device_api.cc @@ -764,7 +764,7 @@ void OpenCLWorkspace::Init(const std::string& type_key, const std::string& devic TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def_packed("device_api.opencl.alloc_nd", + .def_packed("tvm.device_api.opencl.alloc_nd", [](ffi::PackedArgs args, ffi::Any* rv) { int32_t device_type = args[0].cast(); int32_t device_id = args[1].cast(); @@ -791,7 +791,7 @@ TVM_FFI_STATIC_INIT_BLOCK() { dev, static_cast(width), static_cast(height), type_hint, ffi::String("global.texture")); }) - .def_packed("device_api.opencl.free_nd", + .def_packed("tvm.device_api.opencl.free_nd", [](ffi::PackedArgs args, ffi::Any* rv) { int32_t device_type = args[0].cast(); int32_t device_id = args[1].cast(); @@ -805,7 +805,7 @@ TVM_FFI_STATIC_INIT_BLOCK() { ptr->FreeDataSpace(dev, data); *rv = static_cast(0); }) - .def_packed("device_api.opencl", [](ffi::PackedArgs args, ffi::Any* rv) { + .def_packed("tvm.device_api.opencl", [](ffi::PackedArgs args, ffi::Any* rv) { DeviceAPI* ptr = OpenCLWorkspace::Global(); *rv = static_cast(ptr); }); @@ -813,7 +813,7 @@ TVM_FFI_STATIC_INIT_BLOCK() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("profiling.timer.opencl", + refl::GlobalDef().def("tvm.profiling.timer.opencl", [](Device dev) { return Timer(ffi::make_object(dev)); }); } @@ -899,10 +899,11 @@ class OpenCLPooledAllocator final : public memory::PooledAllocator { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def_packed("DeviceAllocator.opencl", [](ffi::PackedArgs args, ffi::Any* rv) { - Allocator* alloc = new OpenCLPooledAllocator(); - *rv = static_cast(alloc); - }); + refl::GlobalDef().def_packed("tvm.DeviceAllocator.opencl", + [](ffi::PackedArgs args, ffi::Any* rv) { + Allocator* alloc = new OpenCLPooledAllocator(); + *rv = static_cast(alloc); + }); } } // namespace cl diff --git a/src/runtime/profiling.cc b/src/runtime/profiling.cc index 21c5681176c3..25841f8505f0 100644 --- a/src/runtime/profiling.cc +++ b/src/runtime/profiling.cc @@ -55,7 +55,7 @@ class DefaultTimerNode : public TimerNode { virtual ~DefaultTimerNode() {} explicit DefaultTimerNode(Device dev) : device_(dev) {} - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("runtime.DefaultTimerNode", DefaultTimerNode, TimerNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.runtime.DefaultTimerNode", DefaultTimerNode, TimerNode); private: std::chrono::high_resolution_clock::time_point start_; @@ -71,7 +71,7 @@ class CPUTimerNode : public TimerNode { virtual void Stop() { duration_ = std::chrono::high_resolution_clock::now() - start_; } virtual int64_t SyncAndGetElapsedNanos() { return duration_.count(); } virtual ~CPUTimerNode() {} - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("runtime.CPUTimerNode", CPUTimerNode, TimerNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.runtime.CPUTimerNode", CPUTimerNode, TimerNode); private: std::chrono::high_resolution_clock::time_point start_; @@ -80,7 +80,7 @@ class CPUTimerNode : public TimerNode { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("profiling.timer.cpu", + refl::GlobalDef().def("tvm.profiling.timer.cpu", [](Device dev) { return Timer(ffi::make_object()); }); } @@ -113,7 +113,7 @@ Timer Timer::Start(Device dev) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("profiling.start_timer", Timer::Start); + refl::GlobalDef().def("tvm.profiling.start_timer", Timer::Start); } namespace profiling { @@ -789,10 +789,10 @@ TVM_FFI_STATIC_INIT_BLOCK() { refl::GlobalDef() .def_method("runtime.profiling.AsTable", &ReportNode::AsTable) - .def("runtime.profiling.AsCSV", [](Report n) { return n->AsCSV(); }) - .def("runtime.profiling.AsJSON", [](Report n) { return n->AsJSON(); }) - .def("runtime.profiling.FromJSON", Report::FromJSON) - .def("runtime.profiling.DeviceWrapper", [](Device dev) { return DeviceWrapper(dev); }); + .def("tvm.runtime.profiling.AsCSV", [](Report n) { return n->AsCSV(); }) + .def("tvm.runtime.profiling.AsJSON", [](Report n) { return n->AsJSON(); }) + .def("tvm.runtime.profiling.FromJSON", Report::FromJSON) + .def("tvm.runtime.profiling.DeviceWrapper", [](Device dev) { return DeviceWrapper(dev); }); } ffi::Function ProfileFunction(ffi::Module mod, std::string func_name, int device_type, @@ -846,7 +846,7 @@ ffi::Function ProfileFunction(ffi::Module mod, std::string func_name, int device TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef().def( - "runtime.profiling.ProfileFunction", + "tvm.runtime.profiling.ProfileFunction", [](ffi::Module mod, ffi::String func_name, int device_type, int device_id, int warmup_iters, ffi::Array collectors) { if (mod->kind() == std::string("rpc")) { @@ -928,19 +928,19 @@ ffi::Function WrapTimeEvaluator(ffi::Function pf, Device dev, int number, int re TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("runtime.profiling.Report", + .def("tvm.runtime.profiling.Report", [](ffi::Array> calls, ffi::Map> device_metrics, ffi::Map configuration) { return Report(calls, device_metrics, configuration); }) - .def("runtime.profiling.Count", + .def("tvm.runtime.profiling.Count", [](int64_t count) { return ObjectRef(ffi::make_object(count)); }) - .def("runtime.profiling.Percent", + .def("tvm.runtime.profiling.Percent", [](double percent) { return ObjectRef(ffi::make_object(percent)); }) - .def("runtime.profiling.Duration", + .def("tvm.runtime.profiling.Duration", [](double duration) { return ObjectRef(ffi::make_object(duration)); }) - .def("runtime.profiling.Ratio", + .def("tvm.runtime.profiling.Ratio", [](double ratio) { return ObjectRef(ffi::make_object(ratio)); }); } diff --git a/src/runtime/rocm/rocm_device_api.cc b/src/runtime/rocm/rocm_device_api.cc index 016169653552..202e68d904b6 100644 --- a/src/runtime/rocm/rocm_device_api.cc +++ b/src/runtime/rocm/rocm_device_api.cc @@ -248,12 +248,12 @@ ROCMThreadEntry* ROCMThreadEntry::ThreadLocal() { return ROCMThreadStore::Get(); TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def_packed("device_api.rocm", + .def_packed("tvm.device_api.rocm", [](ffi::PackedArgs args, ffi::Any* rv) { DeviceAPI* ptr = ROCMDeviceAPI::Global(); *rv = static_cast(ptr); }) - .def_packed("device_api.rocm_host", [](ffi::PackedArgs args, ffi::Any* rv) { + .def_packed("tvm.device_api.rocm_host", [](ffi::PackedArgs args, ffi::Any* rv) { DeviceAPI* ptr = ROCMDeviceAPI::Global(); *rv = static_cast(ptr); }); @@ -286,7 +286,7 @@ class ROCMTimerNode : public TimerNode { ROCM_CALL(hipEventCreate(&start_)); ROCM_CALL(hipEventCreate(&stop_)); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("runtime.rocm.ROCMTimerNode", ROCMTimerNode, TimerNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.runtime.rocm.ROCMTimerNode", ROCMTimerNode, TimerNode); private: hipEvent_t start_; @@ -297,9 +297,9 @@ class ROCMTimerNode : public TimerNode { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("profiling.timer.rocm", + .def("tvm.profiling.timer.rocm", [](Device dev) { return Timer(ffi::make_object()); }) - .def("runtime.get_rocm_stream", []() { + .def("tvm.runtime.get_rocm_stream", []() { int device_id; ROCM_CALL(hipGetDevice(&device_id)); return static_cast(TVMFFIEnvGetStream(kDLROCM, device_id)); diff --git a/src/runtime/rpc/rpc_device_api.cc b/src/runtime/rpc/rpc_device_api.cc index 88e01255d82a..dc7a4a1a3a0c 100644 --- a/src/runtime/rpc/rpc_device_api.cc +++ b/src/runtime/rpc/rpc_device_api.cc @@ -153,7 +153,7 @@ class RPCDeviceAPI final : public DeviceAPI { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def_packed("device_api.rpc", [](ffi::PackedArgs args, ffi::Any* rv) { + refl::GlobalDef().def_packed("tvm.device_api.rpc", [](ffi::PackedArgs args, ffi::Any* rv) { static RPCDeviceAPI inst; DeviceAPI* ptr = &inst; *rv = static_cast(ptr); diff --git a/src/runtime/rpc/rpc_endpoint.cc b/src/runtime/rpc/rpc_endpoint.cc index 0778b5539474..3d21b279cd6d 100644 --- a/src/runtime/rpc/rpc_endpoint.cc +++ b/src/runtime/rpc/rpc_endpoint.cc @@ -608,7 +608,7 @@ class RPCEndpoint::EventHandler : public dmlc::Stream { ffi::PackedArgs constructor_args = ffi::PackedArgs(nullptr, 0); if (args.size() == 0) { - constructor_name = "rpc.LocalSession"; + constructor_name = "tvm.rpc.LocalSession"; serving_session_ = std::make_shared(); } else { constructor_name = args[0].cast(); diff --git a/src/runtime/rpc/rpc_event_impl.cc b/src/runtime/rpc/rpc_event_impl.cc index 4eefb2b2b978..3757a69634d1 100644 --- a/src/runtime/rpc/rpc_event_impl.cc +++ b/src/runtime/rpc/rpc_event_impl.cc @@ -47,7 +47,7 @@ ffi::Function CreateEventDrivenServer(ffi::Function fsend, std::string name, TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("rpc.CreateEventDrivenServer", CreateEventDrivenServer); + refl::GlobalDef().def("tvm.rpc.CreateEventDrivenServer", CreateEventDrivenServer); } } // namespace runtime } // namespace tvm diff --git a/src/runtime/rpc/rpc_local_session.cc b/src/runtime/rpc/rpc_local_session.cc index 2cfeacfcd71f..1c7c6fd1b6c8 100644 --- a/src/runtime/rpc/rpc_local_session.cc +++ b/src/runtime/rpc/rpc_local_session.cc @@ -151,7 +151,7 @@ DeviceAPI* LocalSession::GetDeviceAPI(Device dev, bool allow_missing) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("rpc.LocalSession", + refl::GlobalDef().def("tvm.rpc.LocalSession", []() { return CreateRPCSessionModule(std::make_shared()); }); } diff --git a/src/runtime/rpc/rpc_module.cc b/src/runtime/rpc/rpc_module.cc index a90c69c63c8b..76e2ef4c1c83 100644 --- a/src/runtime/rpc/rpc_module.cc +++ b/src/runtime/rpc/rpc_module.cc @@ -207,7 +207,7 @@ class RPCModuleNode final : public ffi::ModuleObj { int min_repeat_ms, int limit_zero_time_iterations, int cooldown_interval_ms, int repeats_to_cooldown, int cache_flush_bytes, const std::string& f_preproc_name) { - InitRemoteFunc(&remote_get_time_evaluator_, "runtime.RPCTimeEvaluator"); + InitRemoteFunc(&remote_get_time_evaluator_, "tvm.runtime.RPCTimeEvaluator"); // Remove session mask because we pass dev by parts. ICHECK_EQ(GetRPCSessionIndex(dev), sess_->table_index()) << "ValueError: Need to pass the matched remote device to RPCModule.GetTimeEvaluator"; @@ -396,7 +396,7 @@ inline void CPUCacheFlush(int begin_index, const ffi::PackedArgs& args) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("runtime.RPCTimeEvaluator", + .def("tvm.runtime.RPCTimeEvaluator", [](ffi::Optional opt_mod, std::string name, int device_type, int device_id, int number, int repeat, int min_repeat_ms, int limit_zero_time_iterations, int cooldown_interval_ms, int repeats_to_cooldown, int cache_flush_bytes, @@ -441,7 +441,7 @@ TVM_FFI_STATIC_INIT_BLOCK() { cooldown_interval_ms, repeats_to_cooldown, cache_flush_bytes, f_preproc); } }) - .def_packed("cache_flush_cpu_non_first_arg", + .def_packed("tvm.cache_flush_cpu_non_first_arg", [](ffi::PackedArgs args, ffi::Any* rv) { CPUCacheFlush(1, args); }); } @@ -461,19 +461,19 @@ TVM_FFI_STATIC_INIT_BLOCK() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("rpc.LoadRemoteModule", + .def("tvm.rpc.LoadRemoteModule", [](ffi::Module sess, std::string name) { std::string tkey = sess->kind(); ICHECK_EQ(tkey, "rpc"); return static_cast(sess.operator->())->LoadModule(name); }) - .def("rpc.ImportRemoteModule", + .def("tvm.rpc.ImportRemoteModule", [](ffi::Module parent, ffi::Module child) { std::string tkey = parent->kind(); ICHECK_EQ(tkey, "rpc"); static_cast(parent.operator->())->ImportModule(child); }) - .def_packed("rpc.SessTableIndex", + .def_packed("tvm.rpc.SessTableIndex", [](ffi::PackedArgs args, ffi::Any* rv) { ffi::Module m = args[0].cast(); std::string tkey = m->kind(); diff --git a/src/runtime/rpc/rpc_pipe_impl.cc b/src/runtime/rpc/rpc_pipe_impl.cc index 0bc608ccc253..cc235fa7dd4c 100644 --- a/src/runtime/rpc/rpc_pipe_impl.cc +++ b/src/runtime/rpc/rpc_pipe_impl.cc @@ -115,7 +115,7 @@ ffi::Module CreatePipeClient(std::vector cmd) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def_packed("rpc.CreatePipeClient", [](ffi::PackedArgs args, ffi::Any* rv) { + refl::GlobalDef().def_packed("tvm.rpc.CreatePipeClient", [](ffi::PackedArgs args, ffi::Any* rv) { std::vector cmd; for (int i = 0; i < args.size(); ++i) { cmd.push_back(args[i].cast()); diff --git a/src/runtime/rpc/rpc_session.h b/src/runtime/rpc/rpc_session.h index d7f629a0254f..e8e7ab827e96 100644 --- a/src/runtime/rpc/rpc_session.h +++ b/src/runtime/rpc/rpc_session.h @@ -316,7 +316,7 @@ class RPCObjectRefObj : public Object { static constexpr const uint32_t _type_index = TypeIndex::kRuntimeRPCObjectRef; static const constexpr bool _type_final = true; - TVM_FFI_DECLARE_OBJECT_INFO_STATIC("runtime.RPCObjectRef", RPCObjectRefObj, Object); + TVM_FFI_DECLARE_OBJECT_INFO_STATIC("tvm.runtime.RPCObjectRef", RPCObjectRefObj, Object); private: // The object handle diff --git a/src/runtime/rpc/rpc_socket_impl.cc b/src/runtime/rpc/rpc_socket_impl.cc index c19b91801e77..2e33779dcd25 100644 --- a/src/runtime/rpc/rpc_socket_impl.cc +++ b/src/runtime/rpc/rpc_socket_impl.cc @@ -125,7 +125,7 @@ void RPCServerLoop(ffi::Function fsend, ffi::Function frecv) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def_packed("rpc.Connect", + .def_packed("tvm.rpc.Connect", [](ffi::PackedArgs args, ffi::Any* rv) { auto url = args[0].cast(); int port = args[1].cast(); @@ -133,7 +133,7 @@ TVM_FFI_STATIC_INIT_BLOCK() { bool enable_logging = args[3].cast(); *rv = RPCClientConnect(url, port, key, enable_logging, args.Slice(4)); }) - .def_packed("rpc.ServerLoop", [](ffi::PackedArgs args, ffi::Any* rv) { + .def_packed("tvm.rpc.ServerLoop", [](ffi::PackedArgs args, ffi::Any* rv) { if (auto opt_int = args[0].as()) { RPCServerLoop(opt_int.value()); } else { @@ -169,7 +169,7 @@ class SimpleSockHandler : public dmlc::Stream { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("rpc.ReturnException", [](int sockfd, ffi::String msg) { + refl::GlobalDef().def("tvm.rpc.ReturnException", [](int sockfd, ffi::String msg) { auto handler = SimpleSockHandler(sockfd); RPCReference::ReturnException(msg.c_str(), &handler); return; diff --git a/src/runtime/static_library.cc b/src/runtime/static_library.cc index 2cf7d3394599..0400c47bf399 100644 --- a/src/runtime/static_library.cc +++ b/src/runtime/static_library.cc @@ -135,7 +135,7 @@ ffi::Module LoadStaticLibrary(const std::string& filename, ffi::Array(args[0].cast()); @@ -398,7 +398,7 @@ TVM_FFI_STATIC_INIT_BLOCK() { } threading::Configure(mode, nthreads, cpus); }) - .def("runtime.NumThreads", []() -> int32_t { return threading::NumThreads(); }); + .def("tvm.runtime.NumThreads", []() -> int32_t { return threading::NumThreads(); }); } namespace threading { diff --git a/src/runtime/vm/builtin.cc b/src/runtime/vm/builtin.cc index dce687b436d1..809ef4fd742e 100644 --- a/src/runtime/vm/builtin.cc +++ b/src/runtime/vm/builtin.cc @@ -68,7 +68,7 @@ Tensor AllocShapeHeap(void* ctx_ptr, int64_t size) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("vm.builtin.alloc_shape_heap", AllocShapeHeap); + refl::GlobalDef().def("tvm.vm.builtin.alloc_shape_heap", AllocShapeHeap); } /*! @@ -111,7 +111,7 @@ void MatchPrimValue(int64_t input_value, DLTensor* heap, int code_value, int64_t TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("vm.builtin.match_prim_value", MatchPrimValue); + refl::GlobalDef().def("tvm.vm.builtin.match_prim_value", MatchPrimValue); } /*! @@ -168,7 +168,7 @@ void MatchShape(ffi::PackedArgs args, ffi::Any* rv) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def_packed("vm.builtin.match_shape", MatchShape); + refl::GlobalDef().def_packed("tvm.vm.builtin.match_shape", MatchShape); } /*! @@ -195,7 +195,7 @@ int64_t MakePrimValue(DLTensor* heap, int shape_code, int64_t reg) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("vm.builtin.make_prim_value", MakePrimValue); + refl::GlobalDef().def("tvm.vm.builtin.make_prim_value", MakePrimValue); } /*! @@ -229,7 +229,7 @@ void MakeShape(ffi::PackedArgs args, ffi::Any* rv) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def_packed("vm.builtin.make_shape", MakeShape); + refl::GlobalDef().def_packed("tvm.vm.builtin.make_shape", MakeShape); } /*! @@ -272,7 +272,7 @@ void CheckTensorInfo(ffi::PackedArgs args, ffi::Any* rv) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def_packed("vm.builtin.check_tensor_info", CheckTensorInfo); + refl::GlobalDef().def_packed("tvm.vm.builtin.check_tensor_info", CheckTensorInfo); } /*! @@ -295,7 +295,7 @@ void CheckShapeInfo(ObjectRef arg, int ndim, ffi::Optional err_ctx) TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("vm.builtin.check_shape_info", CheckShapeInfo); + refl::GlobalDef().def("tvm.vm.builtin.check_shape_info", CheckShapeInfo); } /*! @@ -325,7 +325,7 @@ void CheckPrimValueInfo(ffi::AnyView arg, DataType dtype, ffi::Optional err_ TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("vm.builtin.check_tuple_info", CheckTupleInfo); + refl::GlobalDef().def("tvm.vm.builtin.check_tuple_info", CheckTupleInfo); } /*! @@ -363,7 +363,7 @@ void CheckFuncInfo(ObjectRef arg, ffi::Optional err_ctx) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("vm.builtin.check_func_info", CheckFuncInfo); + refl::GlobalDef().def("tvm.vm.builtin.check_func_info", CheckFuncInfo); } //------------------------------------------------- @@ -392,8 +392,8 @@ Storage VMAllocStorage(void* ctx_ptr, ffi::Shape buffer_shape, Index device_inde TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("vm.builtin.alloc_storage", VMAllocStorage) - .def_method("vm.builtin.alloc_tensor", &StorageObj::AllocTensor); + .def("tvm.vm.builtin.alloc_storage", VMAllocStorage) + .def_method("tvm.vm.builtin.alloc_tensor", &StorageObj::AllocTensor); } //------------------------------------------------- @@ -402,7 +402,7 @@ TVM_FFI_STATIC_INIT_BLOCK() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def_packed("vm.builtin.make_closure", + .def_packed("tvm.vm.builtin.make_closure", [](ffi::PackedArgs args, ffi::Any* rv) { VMClosure clo = args[0].cast(); std::vector saved_args; @@ -413,14 +413,14 @@ TVM_FFI_STATIC_INIT_BLOCK() { auto impl = VMClosure::BindLastArgs(clo->impl, saved_args); *rv = VMClosure(clo->func_name, impl); }) - .def_packed("vm.builtin.invoke_closure", + .def_packed("tvm.vm.builtin.invoke_closure", [](ffi::PackedArgs args, ffi::Any* rv) { // args[0]: vm; args[1]: closure; args[2, 3, ...]: function arguments VirtualMachine* vm = VirtualMachine::GetContextPtr(args[0]); ObjectRef vm_closure = args[1].cast(); vm->InvokeClosurePacked(vm_closure, args.Slice(2), rv); }) - .def_packed("vm.builtin.call_tir_dyn", [](ffi::PackedArgs args, ffi::Any* rv) { + .def_packed("tvm.vm.builtin.call_tir_dyn", [](ffi::PackedArgs args, ffi::Any* rv) { ffi::Function func = args[0].cast(); ffi::Shape to_unpack = args[args.size() - 1].cast(); size_t num_tensor_args = args.size() - 2; @@ -501,10 +501,10 @@ void CallPyFunc(ffi::PackedArgs args, ffi::Any* rv) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def_packed("vm.builtin.call_py_func", CallPyFunc) - .def("vm.builtin.register_py_func", RegisterPyFunc) - .def("vm.builtin.get_py_func", GetPyFunc) - .def("vm.builtin.clear_py_func_registry", ClearPyFuncRegistry); + .def_packed("tvm.vm.builtin.call_py_func", CallPyFunc) + .def("tvm.vm.builtin.register_py_func", RegisterPyFunc) + .def("tvm.vm.builtin.get_py_func", GetPyFunc) + .def("tvm.vm.builtin.clear_py_func_registry", ClearPyFuncRegistry); } //------------------------------------- @@ -513,13 +513,13 @@ TVM_FFI_STATIC_INIT_BLOCK() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def_method("vm.builtin.shape_of", [](Tensor data) -> ffi::Shape { return data.Shape(); }) - .def("vm.builtin.copy", [](ffi::Any a) -> ffi::Any { return a; }) + .def_method("tvm.vm.builtin.shape_of", [](Tensor data) -> ffi::Shape { return data.Shape(); }) + .def("tvm.vm.builtin.copy", [](ffi::Any a) -> ffi::Any { return a; }) .def( - "vm.builtin.reshape", + "tvm.vm.builtin.reshape", [](Tensor data, ffi::Shape new_shape) { return data.CreateView(new_shape, data->dtype); }) - .def("vm.builtin.null_value", []() -> std::nullptr_t { return nullptr; }) - .def("vm.builtin.to_device", [](Tensor data, int dev_type, int dev_id) { + .def("tvm.vm.builtin.null_value", []() -> std::nullptr_t { return nullptr; }) + .def("tvm.vm.builtin.to_device", [](Tensor data, int dev_type, int dev_id) { Device dst_device = {(DLDeviceType)dev_type, dev_id}; return data.CopyTo(dst_device); }); @@ -570,7 +570,7 @@ bool ReadIfCond(ffi::AnyView cond) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("vm.builtin.read_if_cond", ReadIfCond); + refl::GlobalDef().def("tvm.vm.builtin.read_if_cond", ReadIfCond); } //------------------------------------- @@ -580,7 +580,7 @@ TVM_FFI_STATIC_INIT_BLOCK() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef().def_packed( - "vm.builtin.invoke_debug_func", [](ffi::PackedArgs args, ffi::Any* rv) -> void { + "tvm.vm.builtin.invoke_debug_func", [](ffi::PackedArgs args, ffi::Any* rv) -> void { ICHECK_GE(args.size(), 3); int num_args = args.size() - 3; ObjectRef io_effect = args[0].cast(); @@ -609,13 +609,13 @@ TVM_FFI_STATIC_INIT_BLOCK() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("vm.builtin.tuple_getitem", + .def("tvm.vm.builtin.tuple_getitem", [](ffi::Array arr, int64_t index) { return arr[index]; }) - .def("vm.builtin.tuple_reset_item", + .def("tvm.vm.builtin.tuple_reset_item", [](const ffi::ArrayObj* arr, int64_t index) { const_cast(arr)->SetItem(index, nullptr); }) - .def_packed("vm.builtin.make_tuple", + .def_packed("tvm.vm.builtin.make_tuple", [](ffi::PackedArgs args, ffi::Any* rv) { ffi::Array arr; for (int i = 0; i < args.size(); ++i) { @@ -623,7 +623,7 @@ TVM_FFI_STATIC_INIT_BLOCK() { } *rv = arr; }) - .def("vm.builtin.tensor_to_shape", + .def("tvm.vm.builtin.tensor_to_shape", [](Tensor data) { Tensor arr = data; if (data->device.device_type != kDLCPU) { @@ -657,7 +657,7 @@ TVM_FFI_STATIC_INIT_BLOCK() { } return ffi::Shape(out_shape); }) - .def("vm.builtin.ensure_zero_offset", [](Tensor data) { + .def("tvm.vm.builtin.ensure_zero_offset", [](Tensor data) { if (data->byte_offset == 0) { return data; } diff --git a/src/runtime/vm/cuda/cuda_graph_builtin.cc b/src/runtime/vm/cuda/cuda_graph_builtin.cc index 9523fd3f4b30..4ebf0d72e9ff 100644 --- a/src/runtime/vm/cuda/cuda_graph_builtin.cc +++ b/src/runtime/vm/cuda/cuda_graph_builtin.cc @@ -251,7 +251,7 @@ class CUDAGraphExtension : public VMExtension { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def_packed("vm.builtin.cuda_graph.run_or_capture", + .def_packed("tvm.vm.builtin.cuda_graph.run_or_capture", [](ffi::PackedArgs args, ffi::Any* rv) { ICHECK(args.size() == 5 || args.size() == 4); VirtualMachine* vm = VirtualMachine::GetContextPtr(args[0]); @@ -266,14 +266,15 @@ TVM_FFI_STATIC_INIT_BLOCK() { *rv = extension->RunOrCapture(vm, capture_func, func_args, entry_index, shape_expr); }) - .def_packed("vm.builtin.cuda_graph.get_cached_alloc", [](ffi::PackedArgs args, ffi::Any* rv) { - ICHECK_EQ(args.size(), 3); - VirtualMachine* vm = VirtualMachine::GetContextPtr(args[0]); - auto extension = vm->GetOrCreateExtension(); - auto alloc_func = args[1].cast(); - int64_t entry_index = args[2].cast(); - *rv = extension->GetCachedAllocation(vm, alloc_func, entry_index); - }); + .def_packed("tvm.vm.builtin.cuda_graph.get_cached_alloc", + [](ffi::PackedArgs args, ffi::Any* rv) { + ICHECK_EQ(args.size(), 3); + VirtualMachine* vm = VirtualMachine::GetContextPtr(args[0]); + auto extension = vm->GetOrCreateExtension(); + auto alloc_func = args[1].cast(); + int64_t entry_index = args[2].cast(); + *rv = extension->GetCachedAllocation(vm, alloc_func, entry_index); + }); } } // namespace vm diff --git a/src/runtime/vm/executable.cc b/src/runtime/vm/executable.cc index 40edbc14c433..bd40f066121c 100644 --- a/src/runtime/vm/executable.cc +++ b/src/runtime/vm/executable.cc @@ -554,7 +554,7 @@ ffi::String VMExecutable::AsPython() const { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("relax.ExecutableLoadFromFile", VMExecutable::LoadFromFile); + refl::GlobalDef().def("tvm.relax.ExecutableLoadFromFile", VMExecutable::LoadFromFile); } } // namespace vm diff --git a/src/runtime/vm/hexagon/builtin.cc b/src/runtime/vm/hexagon/builtin.cc index 72929dd3d8f2..30e6591de80c 100644 --- a/src/runtime/vm/hexagon/builtin.cc +++ b/src/runtime/vm/hexagon/builtin.cc @@ -36,7 +36,7 @@ namespace vm { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("vm.builtin.hexagon.dma_copy", + .def("tvm.vm.builtin.hexagon.dma_copy", [](ffi::AnyView vm_ptr, Tensor src_arr, Tensor dst_arr, int queue_id, bool bypass_cache) { const DLTensor* dptr = dst_arr.operator->(); @@ -57,7 +57,9 @@ TVM_FFI_STATIC_INIT_BLOCK() { } while (ret == DMA_RETRY); CHECK(ret == DMA_SUCCESS); }) - .def("vm.builtin.hexagon.dma_wait", [](ffi::AnyView vm_ptr, int queue_id, int inflight_dma, +.def( + "tvm.vm.builtin.hexagon.dma_wait", + [](ffi::AnyView vm_ptr, int queue_id, int inflight_dma, bool bypass_cache, [[maybe_unused]] Tensor src_arr, [[maybe_unused]] Tensor dst_arr) { ICHECK(inflight_dma >= 0); diff --git a/src/runtime/vm/kv_state.cc b/src/runtime/vm/kv_state.cc index 5d04139a32c8..4bc2c8e0ce59 100644 --- a/src/runtime/vm/kv_state.cc +++ b/src/runtime/vm/kv_state.cc @@ -33,12 +33,12 @@ namespace vm { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def_method("vm.builtin.kv_state_clear", &KVStateObj::Clear) - .def_method("vm.builtin.kv_state_add_sequence", &KVStateObj::AddSequence) - .def_method("vm.builtin.kv_state_remove_sequence", &KVStateObj::RemoveSequence) - .def_method("vm.builtin.kv_state_fork_sequence", &KVStateObj::ForkSequence) - .def_method("vm.builtin.kv_state_popn", &KVStateObj::PopN) - .def_packed("vm.builtin.kv_state_begin_forward", + .def_method("tvm.vm.builtin.kv_state_clear", &KVStateObj::Clear) + .def_method("tvm.vm.builtin.kv_state_add_sequence", &KVStateObj::AddSequence) + .def_method("tvm.vm.builtin.kv_state_remove_sequence", &KVStateObj::RemoveSequence) + .def_method("tvm.vm.builtin.kv_state_fork_sequence", &KVStateObj::ForkSequence) + .def_method("tvm.vm.builtin.kv_state_popn", &KVStateObj::PopN) + .def_packed("tvm.vm.builtin.kv_state_begin_forward", [](ffi::PackedArgs args, ffi::Any* rv) { CHECK(args.size() == 3 || args.size() == 4) << "KVState BeginForward only accepts 3 or 4 arguments"; @@ -51,55 +51,56 @@ TVM_FFI_STATIC_INIT_BLOCK() { } kv_state->BeginForward(seq_ids, append_lengths, token_tree_parent_ptr); }) - .def_method("vm.builtin.kv_state_end_forward", &KVStateObj::EndForward); + .def_method("tvm.vm.builtin.kv_state_end_forward", &KVStateObj::EndForward); } // Attention KV Cache methods TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def_method("vm.builtin.kv_cache_disagg_prepare_recv", + .def_method("tvm.vm.builtin.kv_cache_disagg_prepare_recv", &AttentionKVCacheObj::DisaggPrepareRecv) - .def_method("vm.builtin.kv_cache_disagg_mark_send", &AttentionKVCacheObj::DisaggMarkSend) - .def_method("vm.builtin.attention_kv_cache_enable_sliding_window_for_seq", + .def_method("tvm.vm.builtin.kv_cache_disagg_mark_send", &AttentionKVCacheObj::DisaggMarkSend) + .def_method("tvm.vm.builtin.attention_kv_cache_enable_sliding_window_for_seq", &AttentionKVCacheObj::EnableSlidingWindowForSeq) - .def_method("vm.builtin.attention_kv_cache_commit_accepted_token_tree_nodes", + .def_method("tvm.vm.builtin.attention_kv_cache_commit_accepted_token_tree_nodes", &AttentionKVCacheObj::CommitAcceptedTokenTreeNodes) - .def_method("vm.builtin.attention_kv_cache_empty", &AttentionKVCacheObj::Empty) - .def_method("vm.builtin.attention_kv_cache_get_num_available_pages", + .def_method("tvm.vm.builtin.attention_kv_cache_empty", &AttentionKVCacheObj::Empty) + .def_method("tvm.vm.builtin.attention_kv_cache_get_num_available_pages", &AttentionKVCacheObj::GetNumAvailablePages) - .def_method("vm.builtin.attention_kv_cache_get_total_sequence_length", + .def_method("tvm.vm.builtin.attention_kv_cache_get_total_sequence_length", &AttentionKVCacheObj::GetTotalSequenceLength) - .def_method("vm.builtin.attention_kv_cache_get_query_positions", + .def_method("tvm.vm.builtin.attention_kv_cache_get_query_positions", &AttentionKVCacheObj::GetQueryPositions) - .def_method("vm.builtin.attention_kv_cache_debug_get_kv", &AttentionKVCacheObj::DebugGetKV) - .def_method("vm.builtin.attention_kv_cache_debug_get_kv_mla", + .def_method("tvm.vm.builtin.attention_kv_cache_debug_get_kv", + &AttentionKVCacheObj::DebugGetKV) + .def_method("tvm.vm.builtin.attention_kv_cache_debug_get_kv_mla", &AttentionKVCacheObj::DebugGetKVMLA) - .def("vm.builtin.attention_kv_cache_attention_with_fused_qkv", + .def("tvm.vm.builtin.attention_kv_cache_attention_with_fused_qkv", [](AttentionKVCache kv_cache, int64_t layer_id, double sm_scale, Tensor qkv_data, Tensor o_data) { kv_cache->AttentionWithFusedQKV(layer_id, std::move(qkv_data), std::nullopt, std::move(o_data), sm_scale); }) - .def("vm.builtin.attention_kv_cache_self_attention", + .def("tvm.vm.builtin.attention_kv_cache_self_attention", [](AttentionKVCache kv_cache, int64_t layer_id, double sm_scale, Tensor q_data, Tensor k_data, Tensor v_data, Tensor o_data, Tensor lse_data) { kv_cache->SelfAttention(layer_id, std::move(q_data), std::move(k_data), std::move(v_data), std::move(o_data), std::move(lse_data), sm_scale); }) - .def("vm.builtin.attention_kv_cache_cross_attention", + .def("tvm.vm.builtin.attention_kv_cache_cross_attention", [](AttentionKVCache kv_cache, int64_t layer_id, double sm_scale, Tensor q_data, Tensor o_data, Tensor lse_data) { kv_cache->CrossAttention(layer_id, std::move(q_data), std::move(o_data), std::move(lse_data), sm_scale); }) - .def("vm.builtin.attention_kv_cache_append_mla_kv", + .def("tvm.vm.builtin.attention_kv_cache_append_mla_kv", [](AttentionKVCache kv_cache, int64_t layer_id, Tensor kv_data) { kv_cache->AppendMLAKV(layer_id, std::move(kv_data)); return kv_cache; }) - .def("vm.builtin.attention_kv_cache_merge_attn_output_inplace", + .def("tvm.vm.builtin.attention_kv_cache_merge_attn_output_inplace", [](AttentionKVCache kv_cache, Tensor o_self_attn, Tensor lse_self_attn, Tensor o_cross_attn, Tensor lse_cross_attn) { return kv_cache->MergeAttnOutputInplace( @@ -112,13 +113,13 @@ TVM_FFI_STATIC_INIT_BLOCK() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def_method("vm.builtin.rnn_state_get", &RNNStateObj::Get) - .def("vm.builtin.rnn_state_set", + .def_method("tvm.vm.builtin.rnn_state_get", &RNNStateObj::Get) + .def("tvm.vm.builtin.rnn_state_set", [](RNNState state, int64_t layer_id, int64_t state_id, Tensor data) { state->Set(layer_id, state_id, data); return state; }) - .def_method("vm.builtin.rnn_state_debug_get", &RNNStateObj::DebugGet); + .def_method("tvm.vm.builtin.rnn_state_debug_get", &RNNStateObj::DebugGet); } } // namespace vm diff --git a/src/runtime/vm/kv_state.h b/src/runtime/vm/kv_state.h index 33c669f18ab2..96f3d91427aa 100644 --- a/src/runtime/vm/kv_state.h +++ b/src/runtime/vm/kv_state.h @@ -106,7 +106,7 @@ class KVStateObj : public Object { virtual void EndForward() = 0; static constexpr const bool _type_mutable = true; - TVM_FFI_DECLARE_OBJECT_INFO("relax.vm.KVState", KVStateObj, Object); + TVM_FFI_DECLARE_OBJECT_INFO("tvm.relax.vm.KVState", KVStateObj, Object); }; class KVState : public ObjectRef { @@ -295,7 +295,7 @@ class AttentionKVCacheObj : public KVStateObj { virtual void DebugSetKV(int64_t seq_id, int64_t start_pos, Tensor k_data, Tensor v_data) = 0; static constexpr const bool _type_mutable = true; - TVM_FFI_DECLARE_OBJECT_INFO("relax.vm.AttentionKVCache", AttentionKVCacheObj, KVStateObj); + TVM_FFI_DECLARE_OBJECT_INFO("tvm.relax.vm.AttentionKVCache", AttentionKVCacheObj, KVStateObj); }; class AttentionKVCache : public KVState { @@ -338,7 +338,7 @@ class RNNStateObj : public KVStateObj { virtual Tensor DebugGet(int64_t layer_id, int64_t state_id, int64_t seq_id) = 0; static constexpr const bool _type_mutable = true; - TVM_FFI_DECLARE_OBJECT_INFO("relax.vm.RNNState", RNNStateObj, KVStateObj); + TVM_FFI_DECLARE_OBJECT_INFO("tvm.relax.vm.RNNState", RNNStateObj, KVStateObj); }; class RNNState : public KVState { diff --git a/src/runtime/vm/lm_support.cc b/src/runtime/vm/lm_support.cc index e4bdb7e86607..4fe22631ca6a 100644 --- a/src/runtime/vm/lm_support.cc +++ b/src/runtime/vm/lm_support.cc @@ -261,7 +261,7 @@ class AttentionKVCacheLegacy : public ObjectRef { //------------------------------------------------- TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("vm.builtin.attention_kv_cache_create", AttentionKVCacheLegacy::Create); + refl::GlobalDef().def("tvm.vm.builtin.attention_kv_cache_create", AttentionKVCacheLegacy::Create); } AttentionKVCacheLegacy AttentionKVCacheUpdate(AttentionKVCacheLegacy cache, Tensor value) { @@ -271,7 +271,7 @@ AttentionKVCacheLegacy AttentionKVCacheUpdate(AttentionKVCacheLegacy cache, Tens TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("vm.builtin.attention_kv_cache_update", AttentionKVCacheUpdate); + refl::GlobalDef().def("tvm.vm.builtin.attention_kv_cache_update", AttentionKVCacheUpdate); } AttentionKVCacheLegacy AttentionKVCacheAppend(AttentionKVCacheLegacy cache, Tensor value) { @@ -281,7 +281,7 @@ AttentionKVCacheLegacy AttentionKVCacheAppend(AttentionKVCacheLegacy cache, Tens TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("vm.builtin.attention_kv_cache_append", AttentionKVCacheAppend); + refl::GlobalDef().def("tvm.vm.builtin.attention_kv_cache_append", AttentionKVCacheAppend); } AttentionKVCacheLegacy AttentionKVCacheWindowOverride(AttentionKVCacheLegacy cache, Tensor value, @@ -292,7 +292,7 @@ AttentionKVCacheLegacy AttentionKVCacheWindowOverride(AttentionKVCacheLegacy cac TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("vm.builtin.attention_kv_cache_window_override", + refl::GlobalDef().def("tvm.vm.builtin.attention_kv_cache_window_override", AttentionKVCacheWindowOverride); } @@ -305,7 +305,7 @@ AttentionKVCacheLegacy AttentionKVCacheWindowOverrideWithSinks(AttentionKVCacheL TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("vm.builtin.attention_kv_cache_window_override_with_sinks", + refl::GlobalDef().def("tvm.vm.builtin.attention_kv_cache_window_override_with_sinks", AttentionKVCacheWindowOverrideWithSinks); } @@ -316,7 +316,7 @@ Tensor AttentionKVCacheView(AttentionKVCacheLegacy cache, ffi::Shape shape) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef().def_packed( - "vm.builtin.attention_kv_cache_view", [](ffi::PackedArgs args, ffi::Any* rv) { + "tvm.vm.builtin.attention_kv_cache_view", [](ffi::PackedArgs args, ffi::Any* rv) { CHECK(args.size() == 1 || args.size() == 2) << "ValueError: `vm.builtin.attention_kv_cache_view` expects 1 or 2 arguments, but got " << args.size() << "."; @@ -343,7 +343,7 @@ void AttentionKVCacheArrayPopN(ffi::Array caches, int64_ TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("vm.builtin.attention_kv_cache_array_popn", AttentionKVCacheArrayPopN); + refl::GlobalDef().def("tvm.vm.builtin.attention_kv_cache_array_popn", AttentionKVCacheArrayPopN); } void AttentionKVCacheArrayClear(ffi::Array caches) { @@ -354,7 +354,8 @@ void AttentionKVCacheArrayClear(ffi::Array caches) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("vm.builtin.attention_kv_cache_array_clear", AttentionKVCacheArrayClear); + refl::GlobalDef().def("tvm.vm.builtin.attention_kv_cache_array_clear", + AttentionKVCacheArrayClear); } // NOTE this is a built-in highly related to LM so we put it here. @@ -421,7 +422,7 @@ int SampleTopPFromLogits(Tensor logits, double temperature, double top_p, double TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("vm.builtin.sample_top_p_from_logits", SampleTopPFromLogits); + refl::GlobalDef().def("tvm.vm.builtin.sample_top_p_from_logits", SampleTopPFromLogits); } int SampleTopPFromProb(Tensor prob, double top_p, double uniform_sample) { @@ -519,7 +520,7 @@ int SampleTopPFromProb(Tensor prob, double top_p, double uniform_sample) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("vm.builtin.sample_top_p_from_prob", SampleTopPFromProb); + refl::GlobalDef().def("tvm.vm.builtin.sample_top_p_from_prob", SampleTopPFromProb); } Tensor MultinomialFromUniform(Tensor prob, Tensor uniform_sample) { @@ -559,7 +560,7 @@ Tensor MultinomialFromUniform(Tensor prob, Tensor uniform_sample) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("vm.builtin.multinomial_from_uniform", MultinomialFromUniform); + refl::GlobalDef().def("tvm.vm.builtin.multinomial_from_uniform", MultinomialFromUniform); } // This is an inplace operation. @@ -585,7 +586,7 @@ void ApplyRepetitionPenalty(Tensor logits, Tensor token_ids, double penalty) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("vm.builtin.apply_repetition_penalty", ApplyRepetitionPenalty); + refl::GlobalDef().def("tvm.vm.builtin.apply_repetition_penalty", ApplyRepetitionPenalty); } /*! @@ -623,7 +624,7 @@ void ApplyPresenceAndFrequencyPenalty(Tensor logits, Tensor token_ids, Tensor to TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("vm.builtin.apply_presence_and_frequency_penalty", + refl::GlobalDef().def("tvm.vm.builtin.apply_presence_and_frequency_penalty", ApplyPresenceAndFrequencyPenalty); } @@ -651,7 +652,8 @@ void ApplySoftmaxWithTemperature(Tensor logits, double temperature) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("vm.builtin.apply_softmax_with_temperature", ApplySoftmaxWithTemperature); + refl::GlobalDef().def("tvm.vm.builtin.apply_softmax_with_temperature", + ApplySoftmaxWithTemperature); } } // namespace vm diff --git a/src/runtime/vm/paged_kv_cache.cc b/src/runtime/vm/paged_kv_cache.cc index 4fb3cd69d60f..68ed92ba4391 100644 --- a/src/runtime/vm/paged_kv_cache.cc +++ b/src/runtime/vm/paged_kv_cache.cc @@ -351,10 +351,10 @@ class PagedAttentionKVCacheObj : public AttentionKVCacheObj { CHECK(attn_kind == AttnKind::kMHA); } const auto f_nvshmem_init = - tvm::ffi::Function::GetGlobal("runtime.disco.nvshmem.init_nvshmem"); + tvm::ffi::Function::GetGlobal("tvm.runtime.disco.nvshmem.init_nvshmem"); CHECK(f_nvshmem_init.has_value()) << "NVSHMEM is not enabled. Please make sure NVSHMEM is enabled when compiling TVM."; - const auto f_nvshmem_empty = tvm::ffi::Function::GetGlobal("runtime.disco.nvshmem.empty"); + const auto f_nvshmem_empty = tvm::ffi::Function::GetGlobal("tvm.runtime.disco.nvshmem.empty"); ICHECK(f_nvshmem_empty.has_value()); nvshmem_pages_ = (*f_nvshmem_empty)( @@ -368,9 +368,9 @@ class PagedAttentionKVCacheObj : public AttentionKVCacheObj { nvshmem_pages_.DataType().bytes())); } - const auto f_transfer_kv_ptr = tvm::ffi::Function::GetGlobal("nvshmem.KVTransfer"); + const auto f_transfer_kv_ptr = tvm::ffi::Function::GetGlobal("tvm.nvshmem.KVTransfer"); const auto f_transfer_kv_page_to_page_ptr = - tvm::ffi::Function::GetGlobal("nvshmem.KVTransferPageToPage"); + tvm::ffi::Function::GetGlobal("tvm.nvshmem.KVTransferPageToPage"); ICHECK(f_transfer_kv_ptr.has_value()); ICHECK(f_transfer_kv_page_to_page_ptr.has_value()); f_transfer_kv_ = *f_transfer_kv_ptr; @@ -1691,7 +1691,7 @@ class PagedAttentionKVCacheObj : public AttentionKVCacheObj { void DebugSetKV(int64_t seq_id, int64_t start_pos, Tensor k_data, Tensor v_data) final { ICHECK(false) << "DebugSetKV for PageAttentionKVCache not implemented yet."; } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.vm.PagedAttentionKVCache", PagedAttentionKVCacheObj, + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.vm.PagedAttentionKVCache", PagedAttentionKVCacheObj, AttentionKVCacheObj); private: @@ -2436,7 +2436,7 @@ class PagedAttentionKVCacheObj : public AttentionKVCacheObj { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef().def_packed( - "vm.builtin.paged_attention_kv_cache_create", [](ffi::PackedArgs args, ffi::Any* rv) { + "tvm.vm.builtin.paged_attention_kv_cache_create", [](ffi::PackedArgs args, ffi::Any* rv) { // Todo: cuda graph arg CHECK(args.size() == 28 || args.size() == 29) << "Invalid number of KV cache constructor args: " << args.size(); diff --git a/src/runtime/vm/rnn_state.cc b/src/runtime/vm/rnn_state.cc index 61194b5dade2..4f75a7d23e56 100644 --- a/src/runtime/vm/rnn_state.cc +++ b/src/runtime/vm/rnn_state.cc @@ -458,7 +458,7 @@ class RNNStateImpObj : public RNNStateObj { } public: - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.vm.RNNStateImp", RNNStateImpObj, RNNStateObj); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.relax.vm.RNNStateImp", RNNStateImpObj, RNNStateObj); }; //------------------------------------------------- @@ -467,12 +467,12 @@ class RNNStateImpObj : public RNNStateObj { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("vm.builtin.rnn_state_create", [](int64_t num_layers, // - int64_t reserved_num_seqs, // - int64_t max_history, // - ffi::Array f_gets, // - ffi::Array f_sets, // - ffi::Array init_layer_value) { + refl::GlobalDef().def("tvm.vm.builtin.rnn_state_create", [](int64_t num_layers, // + int64_t reserved_num_seqs, // + int64_t max_history, // + ffi::Array f_gets, // + ffi::Array f_sets, // + ffi::Array init_layer_value) { CHECK_GT(num_layers, 0) << "The number of layers should be greater than 0."; CHECK_GT(reserved_num_seqs, 0) << "The number of reserved sequences should be greater than 0."; CHECK_GE(max_history, 0) << "The maximum history length should be greater or equal than 0."; diff --git a/src/runtime/vm/tensor_cache_support.cc b/src/runtime/vm/tensor_cache_support.cc index 1f727241cd25..f26572ddbfee 100644 --- a/src/runtime/vm/tensor_cache_support.cc +++ b/src/runtime/vm/tensor_cache_support.cc @@ -270,8 +270,8 @@ class TensorCache { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("vm.builtin.tensor_cache.get", TensorCache::Get) - .def_packed("vm.builtin.tensor_cache.update", + .def("tvm.vm.builtin.tensor_cache.get", TensorCache::Get) + .def_packed("tvm.vm.builtin.tensor_cache.update", [](ffi::PackedArgs args, ffi::Any* rv) { CHECK(args.size() == 2 || args.size() == 3); ffi::String name = args[0].cast(); @@ -295,9 +295,9 @@ TVM_FFI_STATIC_INIT_BLOCK() { TensorCache::Update(name, arr, is_override); }) - .def("vm.builtin.tensor_cache.remove", TensorCache::Remove) - .def("vm.builtin.tensor_cache.clear", TensorCache::Clear) - .def("vm.builtin.tensor_cache.load", TensorCache::Load); + .def("tvm.vm.builtin.tensor_cache.remove", TensorCache::Remove) + .def("tvm.vm.builtin.tensor_cache.clear", TensorCache::Clear) + .def("tvm.vm.builtin.tensor_cache.load", TensorCache::Load); } // This param module node can be useful to get param dict in RPC mode @@ -362,11 +362,11 @@ class ParamModuleNode : public ffi::ModuleObj { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("vm.builtin.param_module_from_cache", ParamModuleNode::Create) - .def("vm.builtin.param_module_from_cache_by_name", ParamModuleNode::CreateByName) - .def("vm.builtin.param_array_from_cache", ParamModuleNode::GetParams) - .def("vm.builtin.param_array_from_cache_by_name", ParamModuleNode::GetParamByName) - .def_packed("vm.builtin.param_array_from_cache_by_name_unpacked", + .def("tvm.vm.builtin.param_module_from_cache", ParamModuleNode::Create) + .def("tvm.vm.builtin.param_module_from_cache_by_name", ParamModuleNode::CreateByName) + .def("tvm.vm.builtin.param_array_from_cache", ParamModuleNode::GetParams) + .def("tvm.vm.builtin.param_array_from_cache_by_name", ParamModuleNode::GetParamByName) + .def_packed("tvm.vm.builtin.param_array_from_cache_by_name_unpacked", [](ffi::PackedArgs args, ffi::Any* rv) { ffi::Array names; names.reserve(args.size()); diff --git a/src/runtime/vulkan/vulkan_device_api.cc b/src/runtime/vulkan/vulkan_device_api.cc index a2ff8bb7ce0e..1d0137546b03 100644 --- a/src/runtime/vulkan/vulkan_device_api.cc +++ b/src/runtime/vulkan/vulkan_device_api.cc @@ -454,16 +454,17 @@ VulkanDevice& VulkanDeviceAPI::device(size_t device_id) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def_packed("device_api.vulkan", + .def_packed("tvm.device_api.vulkan", [](ffi::PackedArgs args, ffi::Any* rv) { DeviceAPI* ptr = VulkanDeviceAPI::Global(); *rv = static_cast(ptr); }) - .def("device_api.vulkan.get_target_property", [](Device dev, const std::string& property) { - ffi::Any rv; - VulkanDeviceAPI::Global()->GetTargetProperty(dev, property, &rv); - return rv; - }); + .def("tvm.device_api.vulkan.get_target_property", + [](Device dev, const std::string& property) { + ffi::Any rv; + VulkanDeviceAPI::Global()->GetTargetProperty(dev, property, &rv); + return rv; + }); } } // namespace vulkan diff --git a/src/script/ir_builder/base.cc b/src/script/ir_builder/base.cc index 658e76be466c..7cb2d4c1f248 100644 --- a/src/script/ir_builder/base.cc +++ b/src/script/ir_builder/base.cc @@ -108,16 +108,17 @@ void Namer::Name(ObjectRef node, ffi::String name) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def_method("script.ir_builder.IRBuilderFrameEnter", &IRBuilderFrameNode::EnterWithScope) - .def_method("script.ir_builder.IRBuilderFrameExit", &IRBuilderFrameNode::ExitWithScope) - .def_method("script.ir_builder.IRBuilderFrameAddCallback", &IRBuilderFrameNode::AddCallback) - .def("script.ir_builder.IRBuilder", []() { return IRBuilder(); }) - .def_method("script.ir_builder.IRBuilderEnter", &IRBuilder::EnterWithScope) - .def_method("script.ir_builder.IRBuilderExit", &IRBuilder::ExitWithScope) - .def("script.ir_builder.IRBuilderCurrent", IRBuilder::Current) - .def("script.ir_builder.IRBuilderIsInScope", IRBuilder::IsInScope) - .def_method("script.ir_builder.IRBuilderGet", &IRBuilderNode::Get) - .def("script.ir_builder.IRBuilderName", IRBuilder::Name); + .def_method("tvm.script.ir_builder.IRBuilderFrameEnter", &IRBuilderFrameNode::EnterWithScope) + .def_method("tvm.script.ir_builder.IRBuilderFrameExit", &IRBuilderFrameNode::ExitWithScope) + .def_method("tvm.script.ir_builder.IRBuilderFrameAddCallback", + &IRBuilderFrameNode::AddCallback) + .def("tvm.script.ir_builder.IRBuilder", []() { return IRBuilder(); }) + .def_method("tvm.script.ir_builder.IRBuilderEnter", &IRBuilder::EnterWithScope) + .def_method("tvm.script.ir_builder.IRBuilderExit", &IRBuilder::ExitWithScope) + .def("tvm.script.ir_builder.IRBuilderCurrent", IRBuilder::Current) + .def("tvm.script.ir_builder.IRBuilderIsInScope", IRBuilder::IsInScope) + .def_method("tvm.script.ir_builder.IRBuilderGet", &IRBuilderNode::Get) + .def("tvm.script.ir_builder.IRBuilderName", IRBuilder::Name); } } // namespace ir_builder diff --git a/src/script/ir_builder/ir/ir.cc b/src/script/ir_builder/ir/ir.cc index e609f1b8efd2..36ddc10eec5b 100644 --- a/src/script/ir_builder/ir/ir.cc +++ b/src/script/ir_builder/ir/ir.cc @@ -164,14 +164,14 @@ VDevice LookupVDevice(ffi::String target_kind, int device_index) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("script.ir_builder.ir.IRModule", IRModule) - .def("script.ir_builder.ir.DeclFunction", DeclFunction) - .def("script.ir_builder.ir.DefFunction", DefFunction) - .def("script.ir_builder.ir.ModuleAttrs", ModuleAttrs) - .def("script.ir_builder.ir.ModuleGetAttr", ModuleGetAttr) - .def("script.ir_builder.ir.ModuleSetAttr", ModuleSetAttr) - .def("script.ir_builder.ir.ModuleGlobalInfos", ModuleGlobalInfos) - .def("script.ir_builder.ir.LookupVDevice", LookupVDevice); + .def("tvm.script.ir_builder.ir.IRModule", IRModule) + .def("tvm.script.ir_builder.ir.DeclFunction", DeclFunction) + .def("tvm.script.ir_builder.ir.DefFunction", DefFunction) + .def("tvm.script.ir_builder.ir.ModuleAttrs", ModuleAttrs) + .def("tvm.script.ir_builder.ir.ModuleGetAttr", ModuleGetAttr) + .def("tvm.script.ir_builder.ir.ModuleSetAttr", ModuleSetAttr) + .def("tvm.script.ir_builder.ir.ModuleGlobalInfos", ModuleGlobalInfos) + .def("tvm.script.ir_builder.ir.LookupVDevice", LookupVDevice); } } // namespace ir diff --git a/src/script/ir_builder/relax/distributed.cc b/src/script/ir_builder/relax/distributed.cc index 3efb38d44bf5..1b10df454797 100644 --- a/src/script/ir_builder/relax/distributed.cc +++ b/src/script/ir_builder/relax/distributed.cc @@ -58,7 +58,7 @@ Expr MakeCallTIRDist(Expr func, Tuple args, TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("script.ir_builder.relax.distributed.call_tir_dist", MakeCallTIRDist); + refl::GlobalDef().def("tvm.script.ir_builder.relax.distributed.call_tir_dist", MakeCallTIRDist); } } // namespace relax diff --git a/src/script/ir_builder/relax/ir.cc b/src/script/ir_builder/relax/ir.cc index db77d4db5b26..92d42698383c 100644 --- a/src/script/ir_builder/relax/ir.cc +++ b/src/script/ir_builder/relax/ir.cc @@ -149,12 +149,12 @@ void FuncRetValue(const tvm::relax::Expr& value) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("script.ir_builder.relax.Function", Function) - .def("script.ir_builder.relax.Arg", Arg) - .def("script.ir_builder.relax.FuncName", FuncName) - .def("script.ir_builder.relax.FuncAttrs", FuncAttrs) - .def("script.ir_builder.relax.FuncRetStructInfo", FuncRetStructInfo) - .def("script.ir_builder.relax.FuncRetValue", FuncRetValue); + .def("tvm.script.ir_builder.relax.Function", Function) + .def("tvm.script.ir_builder.relax.Arg", Arg) + .def("tvm.script.ir_builder.relax.FuncName", FuncName) + .def("tvm.script.ir_builder.relax.FuncAttrs", FuncAttrs) + .def("tvm.script.ir_builder.relax.FuncRetStructInfo", FuncRetStructInfo) + .def("tvm.script.ir_builder.relax.FuncRetValue", FuncRetValue); } ///////////////////////////// BindingBlock ////////////////////////////// @@ -200,9 +200,9 @@ void DataflowBlockOutput(const ffi::Array& vars) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("script.ir_builder.relax.Dataflow", Dataflow) - .def("script.ir_builder.relax.BindingBlock", BindingBlock) - .def("script.ir_builder.relax.DataflowBlockOutput", DataflowBlockOutput); + .def("tvm.script.ir_builder.relax.Dataflow", Dataflow) + .def("tvm.script.ir_builder.relax.BindingBlock", BindingBlock) + .def("tvm.script.ir_builder.relax.DataflowBlockOutput", DataflowBlockOutput); } /////////////////////////////// Bindings /////////////////////////////// @@ -248,9 +248,9 @@ tvm::relax::Var EmitVarBinding(const tvm::relax::VarBinding& binding) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("script.ir_builder.relax.Emit", Emit) - .def("script.ir_builder.relax.EmitMatchCast", EmitMatchCast) - .def("script.ir_builder.relax.EmitVarBinding", EmitVarBinding); + .def("tvm.script.ir_builder.relax.Emit", Emit) + .def("tvm.script.ir_builder.relax.EmitMatchCast", EmitMatchCast) + .def("tvm.script.ir_builder.relax.EmitVarBinding", EmitVarBinding); } /////////////////////////////// SeqExpr /////////////////////////////// @@ -262,7 +262,7 @@ SeqExprFrame SeqExpr() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("script.ir_builder.relax.SeqExpr", SeqExpr); + refl::GlobalDef().def("tvm.script.ir_builder.relax.SeqExpr", SeqExpr); } ///////////////////////////// If Then Else ///////////////////////////// @@ -288,9 +288,9 @@ ElseFrame Else() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("script.ir_builder.relax.If", If) - .def("script.ir_builder.relax.Then", Then) - .def("script.ir_builder.relax.Else", Else); + .def("tvm.script.ir_builder.relax.If", If) + .def("tvm.script.ir_builder.relax.Then", Then) + .def("tvm.script.ir_builder.relax.Else", Else); } } // namespace relax diff --git a/src/script/ir_builder/tir/ir.cc b/src/script/ir_builder/tir/ir.cc index 00f9c28475b4..adf27bb7e17c 100644 --- a/src/script/ir_builder/tir/ir.cc +++ b/src/script/ir_builder/tir/ir.cc @@ -707,9 +707,9 @@ TVM_STATIC_IR_FUNCTOR(Namer, vtable) TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("script.ir_builder.tir.Buffer", BufferDecl) - .def("script.ir_builder.tir.PrimFunc", PrimFunc) - .def("script.ir_builder.tir.Arg", + .def("tvm.script.ir_builder.tir.Buffer", BufferDecl) + .def("tvm.script.ir_builder.tir.PrimFunc", PrimFunc) + .def("tvm.script.ir_builder.tir.Arg", [](ffi::String name, ObjectRef obj) -> ObjectRef { using namespace tvm::tir; if (auto var = obj.as()) { @@ -721,41 +721,41 @@ TVM_FFI_STATIC_INIT_BLOCK() { LOG(FATAL) << "ValueError: Unexpected type for TIR Arg: " << obj->GetTypeKey(); throw; }) - .def("script.ir_builder.tir.FuncName", FuncName) - .def("script.ir_builder.tir.FuncAttrs", FuncAttrs) - .def("script.ir_builder.tir.FuncRet", FuncRet) - .def("script.ir_builder.tir.MatchBuffer", MatchBuffer) - .def("script.ir_builder.tir.Block", Block) - .def("script.ir_builder.tir.Init", Init) - .def("script.ir_builder.tir.Where", Where) - .def("script.ir_builder.tir.Reads", Reads) - .def("script.ir_builder.tir.Writes", Writes) - .def("script.ir_builder.tir.BlockAttrs", BlockAttrs) - .def("script.ir_builder.tir.AllocBuffer", AllocBuffer) - .def("script.ir_builder.tir.AxisSpatial", axis::Spatial) - .def("script.ir_builder.tir.AxisReduce", axis::Reduce) - .def("script.ir_builder.tir.AxisScan", axis::Scan) - .def("script.ir_builder.tir.AxisOpaque", axis::Opaque) - .def("script.ir_builder.tir.AxisRemap", axis::Remap) - .def("script.ir_builder.tir.Serial", Serial) - .def("script.ir_builder.tir.Parallel", Parallel) - .def("script.ir_builder.tir.Vectorized", Vectorized) - .def("script.ir_builder.tir.Unroll", Unroll) - .def("script.ir_builder.tir.ThreadBinding", ThreadBinding) - .def("script.ir_builder.tir.Grid", Grid) - .def("script.ir_builder.tir.Assert", Assert) - .def("script.ir_builder.tir.LetStmt", LetStmt) - .def("script.ir_builder.tir.LegacyLetStmt", LegacyLetStmt) - .def("script.ir_builder.tir.Allocate", Allocate) - .def("script.ir_builder.tir.AllocateConst", AllocateConst) - .def("script.ir_builder.tir.Realize", Realize) - .def("script.ir_builder.tir.Attr", Attr) - .def("script.ir_builder.tir.While", While) - .def("script.ir_builder.tir.If", If) - .def("script.ir_builder.tir.Then", Then) - .def("script.ir_builder.tir.Else", Else) - .def("script.ir_builder.tir.DeclBuffer", DeclBuffer) - .def("script.ir_builder.tir.LaunchThread", + .def("tvm.script.ir_builder.tir.FuncName", FuncName) + .def("tvm.script.ir_builder.tir.FuncAttrs", FuncAttrs) + .def("tvm.script.ir_builder.tir.FuncRet", FuncRet) + .def("tvm.script.ir_builder.tir.MatchBuffer", MatchBuffer) + .def("tvm.script.ir_builder.tir.Block", Block) + .def("tvm.script.ir_builder.tir.Init", Init) + .def("tvm.script.ir_builder.tir.Where", Where) + .def("tvm.script.ir_builder.tir.Reads", Reads) + .def("tvm.script.ir_builder.tir.Writes", Writes) + .def("tvm.script.ir_builder.tir.BlockAttrs", BlockAttrs) + .def("tvm.script.ir_builder.tir.AllocBuffer", AllocBuffer) + .def("tvm.script.ir_builder.tir.AxisSpatial", axis::Spatial) + .def("tvm.script.ir_builder.tir.AxisReduce", axis::Reduce) + .def("tvm.script.ir_builder.tir.AxisScan", axis::Scan) + .def("tvm.script.ir_builder.tir.AxisOpaque", axis::Opaque) + .def("tvm.script.ir_builder.tir.AxisRemap", axis::Remap) + .def("tvm.script.ir_builder.tir.Serial", Serial) + .def("tvm.script.ir_builder.tir.Parallel", Parallel) + .def("tvm.script.ir_builder.tir.Vectorized", Vectorized) + .def("tvm.script.ir_builder.tir.Unroll", Unroll) + .def("tvm.script.ir_builder.tir.ThreadBinding", ThreadBinding) + .def("tvm.script.ir_builder.tir.Grid", Grid) + .def("tvm.script.ir_builder.tir.Assert", Assert) + .def("tvm.script.ir_builder.tir.LetStmt", LetStmt) + .def("tvm.script.ir_builder.tir.LegacyLetStmt", LegacyLetStmt) + .def("tvm.script.ir_builder.tir.Allocate", Allocate) + .def("tvm.script.ir_builder.tir.AllocateConst", AllocateConst) + .def("tvm.script.ir_builder.tir.Realize", Realize) + .def("tvm.script.ir_builder.tir.Attr", Attr) + .def("tvm.script.ir_builder.tir.While", While) + .def("tvm.script.ir_builder.tir.If", If) + .def("tvm.script.ir_builder.tir.Then", Then) + .def("tvm.script.ir_builder.tir.Else", Else) + .def("tvm.script.ir_builder.tir.DeclBuffer", DeclBuffer) + .def("tvm.script.ir_builder.tir.LaunchThread", [](ffi::Variant thread_tag_or_var, PrimExpr extent) { if (auto var = thread_tag_or_var.as()) { return LaunchThread(var.value(), extent); @@ -767,10 +767,10 @@ TVM_FFI_STATIC_INIT_BLOCK() { throw; } }) - .def("script.ir_builder.tir.EnvThread", EnvThread) - .def("script.ir_builder.tir.BufferStore", BufferStore) - .def("script.ir_builder.tir.Evaluate", Evaluate) - .def("script.ir_builder.tir.Ptr", Ptr); + .def("tvm.script.ir_builder.tir.EnvThread", EnvThread) + .def("tvm.script.ir_builder.tir.BufferStore", BufferStore) + .def("tvm.script.ir_builder.tir.Evaluate", Evaluate) + .def("tvm.script.ir_builder.tir.Ptr", Ptr); } #define TVM_TMP_STR(x) #x @@ -797,106 +797,107 @@ TVM_FFI_STATIC_INIT_BLOCK() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("script.ir_builder.tir.BFloat16", BFloat16) - .TVM_FFI_REFL_DEF_GLOBAL_SIZE("script.ir_builder.tir.Float", Float) - .TVM_FFI_REFL_DEF_GLOBAL_SIZE("script.ir_builder.tir.UInt", UInt) - .TVM_FFI_REFL_DEF_GLOBAL_SIZE("script.ir_builder.tir.Int", Int) - .TVM_FFI_REFL_DEF_GLOBAL_SIZES_LANES("script.ir_builder.tir.Float", Float) - .TVM_FFI_REFL_DEF_GLOBAL_SIZES_LANES("script.ir_builder.tir.UInt", UInt) - .TVM_FFI_REFL_DEF_GLOBAL_SIZES_LANES("script.ir_builder.tir.Int", Int) - .TVM_FFI_REFL_DEF_GLOBAL_LANES("script.ir_builder.tir.BFloat16", BFloat16); + .def("tvm.script.ir_builder.tir.BFloat16", BFloat16) + .TVM_FFI_REFL_DEF_GLOBAL_SIZE("tvm.script.ir_builder.tir.Float", Float) + .TVM_FFI_REFL_DEF_GLOBAL_SIZE("tvm.script.ir_builder.tir.UInt", UInt) + .TVM_FFI_REFL_DEF_GLOBAL_SIZE("tvm.script.ir_builder.tir.Int", Int) + .TVM_FFI_REFL_DEF_GLOBAL_SIZES_LANES("tvm.script.ir_builder.tir.Float", Float) + .TVM_FFI_REFL_DEF_GLOBAL_SIZES_LANES("tvm.script.ir_builder.tir.UInt", UInt) + .TVM_FFI_REFL_DEF_GLOBAL_SIZES_LANES("tvm.script.ir_builder.tir.Int", Int) + .TVM_FFI_REFL_DEF_GLOBAL_LANES("tvm.script.ir_builder.tir.BFloat16", BFloat16); } // Float8 variants TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("script.ir_builder.tir.Float8E3M4", Float8E3M4) - .TVM_FFI_REFL_DEF_GLOBAL_LANES("script.ir_builder.tir.Float8E3M4", Float8E3M4); + .def("tvm.script.ir_builder.tir.Float8E3M4", Float8E3M4) + .TVM_FFI_REFL_DEF_GLOBAL_LANES("tvm.script.ir_builder.tir.Float8E3M4", Float8E3M4); } TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("script.ir_builder.tir.Float8E4M3", Float8E4M3) - .TVM_FFI_REFL_DEF_GLOBAL_LANES("script.ir_builder.tir.Float8E4M3", Float8E4M3); + .def("tvm.script.ir_builder.tir.Float8E4M3", Float8E4M3) + .TVM_FFI_REFL_DEF_GLOBAL_LANES("tvm.script.ir_builder.tir.Float8E4M3", Float8E4M3); } TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("script.ir_builder.tir.Float8E4M3B11FNUZ", Float8E4M3B11FNUZ) - .TVM_FFI_REFL_DEF_GLOBAL_LANES("script.ir_builder.tir.Float8E4M3B11FNUZ", Float8E4M3B11FNUZ); + .def("tvm.script.ir_builder.tir.Float8E4M3B11FNUZ", Float8E4M3B11FNUZ) + .TVM_FFI_REFL_DEF_GLOBAL_LANES("tvm.script.ir_builder.tir.Float8E4M3B11FNUZ", + Float8E4M3B11FNUZ); } TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("script.ir_builder.tir.Float8E4M3FN", Float8E4M3FN) - .TVM_FFI_REFL_DEF_GLOBAL_LANES("script.ir_builder.tir.Float8E4M3FN", Float8E4M3FN); + .def("tvm.script.ir_builder.tir.Float8E4M3FN", Float8E4M3FN) + .TVM_FFI_REFL_DEF_GLOBAL_LANES("tvm.script.ir_builder.tir.Float8E4M3FN", Float8E4M3FN); } TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("script.ir_builder.tir.Float8E4M3FNUZ", Float8E4M3FNUZ) - .TVM_FFI_REFL_DEF_GLOBAL_LANES("script.ir_builder.tir.Float8E4M3FNUZ", Float8E4M3FNUZ); + .def("tvm.script.ir_builder.tir.Float8E4M3FNUZ", Float8E4M3FNUZ) + .TVM_FFI_REFL_DEF_GLOBAL_LANES("tvm.script.ir_builder.tir.Float8E4M3FNUZ", Float8E4M3FNUZ); } TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("script.ir_builder.tir.Float8E5M2", Float8E5M2) - .TVM_FFI_REFL_DEF_GLOBAL_LANES("script.ir_builder.tir.Float8E5M2", Float8E5M2); + .def("tvm.script.ir_builder.tir.Float8E5M2", Float8E5M2) + .TVM_FFI_REFL_DEF_GLOBAL_LANES("tvm.script.ir_builder.tir.Float8E5M2", Float8E5M2); } TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("script.ir_builder.tir.Float8E5M2FNUZ", Float8E5M2FNUZ) - .TVM_FFI_REFL_DEF_GLOBAL_LANES("script.ir_builder.tir.Float8E5M2FNUZ", Float8E5M2FNUZ); + .def("tvm.script.ir_builder.tir.Float8E5M2FNUZ", Float8E5M2FNUZ) + .TVM_FFI_REFL_DEF_GLOBAL_LANES("tvm.script.ir_builder.tir.Float8E5M2FNUZ", Float8E5M2FNUZ); } TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("script.ir_builder.tir.Float8E8M0FNU", Float8E8M0FNU) - .TVM_FFI_REFL_DEF_GLOBAL_LANES("script.ir_builder.tir.Float8E8M0FNU", Float8E8M0FNU); + .def("tvm.script.ir_builder.tir.Float8E8M0FNU", Float8E8M0FNU) + .TVM_FFI_REFL_DEF_GLOBAL_LANES("tvm.script.ir_builder.tir.Float8E8M0FNU", Float8E8M0FNU); } // Float6 variants TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("script.ir_builder.tir.Float6E2M3FN", Float6E2M3FN) - .TVM_FFI_REFL_DEF_GLOBAL_LANES("script.ir_builder.tir.Float6E2M3FN", Float6E2M3FN); + .def("tvm.script.ir_builder.tir.Float6E2M3FN", Float6E2M3FN) + .TVM_FFI_REFL_DEF_GLOBAL_LANES("tvm.script.ir_builder.tir.Float6E2M3FN", Float6E2M3FN); } TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("script.ir_builder.tir.Float6E3M2FN", Float6E3M2FN) - .TVM_FFI_REFL_DEF_GLOBAL_LANES("script.ir_builder.tir.Float6E3M2FN", Float6E3M2FN); + .def("tvm.script.ir_builder.tir.Float6E3M2FN", Float6E3M2FN) + .TVM_FFI_REFL_DEF_GLOBAL_LANES("tvm.script.ir_builder.tir.Float6E3M2FN", Float6E3M2FN); } // Float4 variant TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("script.ir_builder.tir.Float4E2M1FN", Float4E2M1FN) - .TVM_FFI_REFL_DEF_GLOBAL_LANES("script.ir_builder.tir.Float4E2M1FN", Float4E2M1FN); + .def("tvm.script.ir_builder.tir.Float4E2M1FN", Float4E2M1FN) + .TVM_FFI_REFL_DEF_GLOBAL_LANES("tvm.script.ir_builder.tir.Float4E2M1FN", Float4E2M1FN); } TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("script.ir_builder.tir.Boolean", Boolean) - .def("script.ir_builder.tir.Handle", Handle) - .def("script.ir_builder.tir.TensormapHandle", TensormapHandle) - .def("script.ir_builder.tir.Void", Void) - .def("script.ir_builder.tir.min", + .def("tvm.script.ir_builder.tir.Boolean", Boolean) + .def("tvm.script.ir_builder.tir.Handle", Handle) + .def("tvm.script.ir_builder.tir.TensormapHandle", TensormapHandle) + .def("tvm.script.ir_builder.tir.Void", Void) + .def("tvm.script.ir_builder.tir.min", [](PrimExpr a, PrimExpr b) -> PrimExpr { return tvm::min(a, b); }) - .def("script.ir_builder.tir.max", + .def("tvm.script.ir_builder.tir.max", [](PrimExpr a, PrimExpr b) -> PrimExpr { return tvm::max(a, b); }); } } // namespace tir diff --git a/src/script/printer/doc.cc b/src/script/printer/doc.cc index e5d72c002da0..120019ca8b9a 100644 --- a/src/script/printer/doc.cc +++ b/src/script/printer/doc.cc @@ -271,16 +271,16 @@ DocStringDoc::DocStringDoc(ffi::String docs) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef().def( - "script.printer.DocSetSourcePaths", + "tvm.script.printer.DocSetSourcePaths", [](Doc doc, ffi::Array source_paths) { doc->source_paths = source_paths; }); } TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def_method("script.printer.ExprDocAttr", &ExprDocNode::Attr) - .def_method("script.printer.ExprDocIndex", &ExprDocNode::operator[]) - .def_method("script.printer.ExprDocCall", + .def_method("tvm.script.printer.ExprDocAttr", &ExprDocNode::Attr) + .def_method("tvm.script.printer.ExprDocIndex", &ExprDocNode::operator[]) + .def_method("tvm.script.printer.ExprDocCall", [](ExprDoc doc, ffi::Array args, ffi::Array kwargs_keys, ffi::Array kwargs_values) { return doc->Call(args, kwargs_keys, kwargs_values); @@ -290,57 +290,57 @@ TVM_FFI_STATIC_INIT_BLOCK() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef().def( - "script.printer.StmtDocSetComment", + "tvm.script.printer.StmtDocSetComment", [](StmtDoc doc, ffi::Optional comment) { doc->comment = comment; }); } TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("script.printer.StmtBlockDoc", + refl::GlobalDef().def("tvm.script.printer.StmtBlockDoc", [](ffi::Array stmts) { return StmtBlockDoc(stmts); }); } TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("script.printer.LiteralDocNone", LiteralDoc::None) - .def("script.printer.LiteralDocInt", LiteralDoc::Int) - .def("script.printer.LiteralDocBoolean", LiteralDoc::Boolean) - .def("script.printer.LiteralDocFloat", LiteralDoc::Float) - .def("script.printer.LiteralDocStr", LiteralDoc::Str); + .def("tvm.script.printer.LiteralDocNone", LiteralDoc::None) + .def("tvm.script.printer.LiteralDocInt", LiteralDoc::Int) + .def("tvm.script.printer.LiteralDocBoolean", LiteralDoc::Boolean) + .def("tvm.script.printer.LiteralDocFloat", LiteralDoc::Float) + .def("tvm.script.printer.LiteralDocStr", LiteralDoc::Str); } TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("script.printer.IdDoc", [](ffi::String name) { return IdDoc(name); }); + refl::GlobalDef().def("tvm.script.printer.IdDoc", [](ffi::String name) { return IdDoc(name); }); } TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("script.printer.AttrAccessDoc", + refl::GlobalDef().def("tvm.script.printer.AttrAccessDoc", [](ExprDoc value, ffi::String attr) { return AttrAccessDoc(value, attr); }); } TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("script.printer.IndexDoc", [](ExprDoc value, ffi::Array indices) { + refl::GlobalDef().def("tvm.script.printer.IndexDoc", [](ExprDoc value, ffi::Array indices) { return IndexDoc(value, indices); }); } TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("script.printer.CallDoc", [](ExprDoc callee, // - ffi::Array args, // - ffi::Array kwargs_keys, // - ffi::Array kwargs_values) { + refl::GlobalDef().def("tvm.script.printer.CallDoc", [](ExprDoc callee, // + ffi::Array args, // + ffi::Array kwargs_keys, // + ffi::Array kwargs_values) { return CallDoc(callee, args, kwargs_keys, kwargs_values); }); } TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("script.printer.OperationDoc", + refl::GlobalDef().def("tvm.script.printer.OperationDoc", [](int32_t kind, ffi::Array operands) { return OperationDoc(OperationDocNode::Kind(kind), operands); }); @@ -348,40 +348,40 @@ TVM_FFI_STATIC_INIT_BLOCK() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("script.printer.LambdaDoc", + refl::GlobalDef().def("tvm.script.printer.LambdaDoc", [](ffi::Array args, ExprDoc body) { return LambdaDoc(args, body); }); } TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("script.printer.TupleDoc", + refl::GlobalDef().def("tvm.script.printer.TupleDoc", [](ffi::Array elements) { return TupleDoc(elements); }); } TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("script.printer.ListDoc", + refl::GlobalDef().def("tvm.script.printer.ListDoc", [](ffi::Array elements) { return ListDoc(elements); }); } TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef().def( - "script.printer.DictDoc", + "tvm.script.printer.DictDoc", [](ffi::Array keys, ffi::Array values) { return DictDoc(keys, values); }); } TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("script.printer.SliceDoc", + refl::GlobalDef().def("tvm.script.printer.SliceDoc", [](ffi::Optional start, ffi::Optional stop, ffi::Optional step) { return SliceDoc(start, stop, step); }); } TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("script.printer.AssignDoc", [](ExprDoc lhs, ffi::Optional rhs, - ffi::Optional annotation) { + refl::GlobalDef().def("tvm.script.printer.AssignDoc", [](ExprDoc lhs, ffi::Optional rhs, + ffi::Optional annotation) { return AssignDoc(lhs, rhs, annotation); }); } @@ -389,7 +389,7 @@ TVM_FFI_STATIC_INIT_BLOCK() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef().def( - "script.printer.IfDoc", + "tvm.script.printer.IfDoc", [](ExprDoc predicate, ffi::Array then_branch, ffi::Array else_branch) { return IfDoc(predicate, then_branch, else_branch); }); @@ -397,21 +397,21 @@ TVM_FFI_STATIC_INIT_BLOCK() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("script.printer.WhileDoc", [](ExprDoc predicate, ffi::Array body) { - return WhileDoc(predicate, body); - }); + refl::GlobalDef().def( + "tvm.script.printer.WhileDoc", + [](ExprDoc predicate, ffi::Array body) { return WhileDoc(predicate, body); }); } TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef().def( - "script.printer.ForDoc", + "tvm.script.printer.ForDoc", [](ExprDoc lhs, ExprDoc rhs, ffi::Array body) { return ForDoc(lhs, rhs, body); }); } TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("script.printer.ScopeDoc", + refl::GlobalDef().def("tvm.script.printer.ScopeDoc", [](ffi::Optional lhs, ExprDoc rhs, ffi::Array body) { return ScopeDoc(lhs, rhs, body); }); @@ -419,25 +419,26 @@ TVM_FFI_STATIC_INIT_BLOCK() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("script.printer.ExprStmtDoc", + refl::GlobalDef().def("tvm.script.printer.ExprStmtDoc", [](ExprDoc expr) { return ExprStmtDoc(expr); }); } TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef().def( - "script.printer.AssertDoc", + "tvm.script.printer.AssertDoc", [](ExprDoc test, ffi::Optional msg = std::nullopt) { return AssertDoc(test, msg); }); } TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("script.printer.ReturnDoc", [](ExprDoc value) { return ReturnDoc(value); }); + refl::GlobalDef().def("tvm.script.printer.ReturnDoc", + [](ExprDoc value) { return ReturnDoc(value); }); } TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("script.printer.FunctionDoc", + refl::GlobalDef().def("tvm.script.printer.FunctionDoc", [](IdDoc name, ffi::Array args, ffi::Array decorators, ffi::Optional return_type, ffi::Array body) { return FunctionDoc(name, args, decorators, return_type, body); @@ -446,7 +447,7 @@ TVM_FFI_STATIC_INIT_BLOCK() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("script.printer.ClassDoc", + refl::GlobalDef().def("tvm.script.printer.ClassDoc", [](IdDoc name, ffi::Array decorators, ffi::Array body) { return ClassDoc(name, decorators, body); }); @@ -454,13 +455,13 @@ TVM_FFI_STATIC_INIT_BLOCK() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("script.printer.CommentDoc", + refl::GlobalDef().def("tvm.script.printer.CommentDoc", [](ffi::String comment) { return CommentDoc(comment); }); } TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("script.printer.DocStringDoc", + refl::GlobalDef().def("tvm.script.printer.DocStringDoc", [](ffi::String docs) { return DocStringDoc(docs); }); } diff --git a/src/script/printer/doc_printer/python_doc_printer.cc b/src/script/printer/doc_printer/python_doc_printer.cc index 1a79806d1621..73fafa5de1a6 100644 --- a/src/script/printer/doc_printer/python_doc_printer.cc +++ b/src/script/printer/doc_printer/python_doc_printer.cc @@ -730,7 +730,7 @@ ffi::String DocToPythonScript(Doc doc, const PrinterConfig& cfg) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("script.printer.DocToPythonScript", DocToPythonScript); + refl::GlobalDef().def("tvm.script.printer.DocToPythonScript", DocToPythonScript); } } // namespace printer diff --git a/src/script/printer/ir/ir.cc b/src/script/printer/ir/ir.cc index aac5656f9146..fe36365b03f8 100644 --- a/src/script/printer/ir/ir.cc +++ b/src/script/printer/ir/ir.cc @@ -35,11 +35,11 @@ struct SortableFunction { : priority(0), gv(obj.first), func(obj.second) { if (gv->name_hint == "main") { priority = 1000; - } else if (obj.second->GetTypeKey() == "tir.PrimFunc") { + } else if (obj.second->GetTypeKey() == "tvm.tir.PrimFunc") { priority = 1; - } else if (obj.second->GetTypeKey() == "relax.expr.ExternFunc") { + } else if (obj.second->GetTypeKey() == "tvm.relax.expr.ExternFunc") { priority = 2; - } else if (obj.second->GetTypeKey() == "relax.expr.Function") { + } else if (obj.second->GetTypeKey() == "tvm.relax.expr.Function") { priority = 3; } else { LOG(FATAL) << "TypeError: TVMScript cannot print functions of type: " diff --git a/src/script/printer/ir/utils.h b/src/script/printer/ir/utils.h index 588e6066d9c0..b1533e84e568 100644 --- a/src/script/printer/ir/utils.h +++ b/src/script/printer/ir/utils.h @@ -43,7 +43,7 @@ class IRFrameNode : public FrameNode { namespace refl = tvm::ffi::reflection; // global infos is not exposed } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.IRFrame", IRFrameNode, FrameNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.script.printer.IRFrame", IRFrameNode, FrameNode); }; class IRFrame : public Frame { diff --git a/src/script/printer/relax/function.cc b/src/script/printer/relax/function.cc index 978c4a8243da..b85a67c86f2d 100644 --- a/src/script/printer/relax/function.cc +++ b/src/script/printer/relax/function.cc @@ -100,7 +100,7 @@ TVM_STATIC_IR_FUNCTOR(IRDocsifier, vtable) } } // Step 5. Prepare the decorator (include purity if it's impure) - ExprDoc decorator = Relax(d, "function"); + ExprDoc decorator = Relax(d, "tvm.function"); ffi::Array pos_args = {}; ffi::Array dec_keys; ffi::Array dec_values; diff --git a/src/script/printer/relax/type.cc b/src/script/printer/relax/type.cc index 032205244347..c2fbccea4866 100644 --- a/src/script/printer/relax/type.cc +++ b/src/script/printer/relax/type.cc @@ -86,7 +86,7 @@ TVM_SCRIPT_REPR(relax::TensorTypeNode, ReprPrintRelax); TVM_SCRIPT_REPR(relax::PackedFuncTypeNode, ReprPrintRelax); TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("script.printer.ReprPrintRelax", ReprPrintRelax); + refl::GlobalDef().def("tvm.script.printer.ReprPrintRelax", ReprPrintRelax); } } // namespace printer diff --git a/src/script/printer/relax/utils.h b/src/script/printer/relax/utils.h index 7dddfaecbbe7..3d5461a2ddaa 100644 --- a/src/script/printer/relax/utils.h +++ b/src/script/printer/relax/utils.h @@ -50,7 +50,7 @@ class RelaxFrameNode : public FrameNode { .def_ro("is_func", &RelaxFrameNode::is_func) .def_ro("module_alias_printed", &RelaxFrameNode::module_alias_printed); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.RelaxFrame", RelaxFrameNode, FrameNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.script.printer.RelaxFrame", RelaxFrameNode, FrameNode); }; class RelaxFrame : public Frame { diff --git a/src/script/printer/tir/expr.cc b/src/script/printer/tir/expr.cc index da525aa35fc2..4e6541eb6918 100644 --- a/src/script/printer/tir/expr.cc +++ b/src/script/printer/tir/expr.cc @@ -260,7 +260,7 @@ TVM_STATIC_IR_FUNCTOR(IRDocsifier, vtable) int n_args = call->args.size(); int64_t id = call->args[0].as()->value; auto f_llvm_lookup_intrinsic_name = - tvm::ffi::Function::GetGlobal("target.llvm_get_intrinsic_name"); + tvm::ffi::Function::GetGlobal("tvm.target.llvm_get_intrinsic_name"); ffi::Array args; args.reserve(n_args + 1); diff --git a/src/script/printer/tir/utils.h b/src/script/printer/tir/utils.h index 8cb5636d1516..46438936f57b 100644 --- a/src/script/printer/tir/utils.h +++ b/src/script/printer/tir/utils.h @@ -55,7 +55,7 @@ class TIRFrameNode : public FrameNode { .def_ro("tir", &TIRFrameNode::tir) .def_ro("allow_concise_scoping", &TIRFrameNode::allow_concise_scoping); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.TIRFrame", TIRFrameNode, FrameNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.script.printer.TIRFrame", TIRFrameNode, FrameNode); }; /*! \brief Managed reference to TIRFrameNode */ diff --git a/src/support/ffi_testing.cc b/src/support/ffi_testing.cc index 8875046874e4..981c991a4f64 100644 --- a/src/support/ffi_testing.cc +++ b/src/support/ffi_testing.cc @@ -51,7 +51,7 @@ struct TestAttrs : public AttrsNodeReflAdapter { .def_ro("func", &TestAttrs::func, "some random env function", refl::DefaultValue(TypedEnvFunc(nullptr))); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("attrs.TestAttrs", TestAttrs, BaseAttrsNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.attrs.TestAttrs", TestAttrs, BaseAttrsNode); }; TVM_FFI_STATIC_INIT_BLOCK() { TestAttrs::RegisterReflection(); } @@ -59,19 +59,19 @@ TVM_FFI_STATIC_INIT_BLOCK() { TestAttrs::RegisterReflection(); } TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("testing.GetShapeSize", + .def("tvm.testing.GetShapeSize", [](ffi::Shape shape) { return static_cast(shape.size()); }) - .def("testing.GetShapeElem", + .def("tvm.testing.GetShapeElem", [](ffi::Shape shape, int idx) { ICHECK_LT(idx, shape.size()); return shape[idx]; }) - .def_packed("testing.test_wrap_callback", + .def_packed("tvm.testing.test_wrap_callback", [](ffi::PackedArgs args, ffi::Any* ret) { ffi::Function pf = args[0].cast(); *ret = ffi::TypedFunction([pf]() { pf(); }); }) - .def_packed("testing.test_wrap_callback_suppress_err", + .def_packed("tvm.testing.test_wrap_callback_suppress_err", [](ffi::PackedArgs args, ffi::Any* ret) { ffi::Function pf = args[0].cast(); auto result = ffi::TypedFunction([pf]() { @@ -82,13 +82,13 @@ TVM_FFI_STATIC_INIT_BLOCK() { }); *ret = result; }) - .def_packed("testing.test_check_eq_callback", + .def_packed("tvm.testing.test_check_eq_callback", [](ffi::PackedArgs args, ffi::Any* ret) { auto msg = args[0].cast(); *ret = ffi::TypedFunction( [msg](int x, int y) { CHECK_EQ(x, y) << msg; }); }) - .def_packed("testing.device_test", + .def_packed("tvm.testing.device_test", [](ffi::PackedArgs args, ffi::Any* ret) { auto dev = args[0].cast(); int dtype = args[1].cast(); @@ -97,8 +97,8 @@ TVM_FFI_STATIC_INIT_BLOCK() { CHECK_EQ(static_cast(dev.device_id), did); *ret = dev; }) - .def_packed("testing.identity_cpp", [](ffi::PackedArgs args, ffi::Any* ret) { - const auto identity_func = tvm::ffi::Function::GetGlobal("testing.identity_py"); + .def_packed("tvm.testing.identity_cpp", [](ffi::PackedArgs args, ffi::Any* ret) { + const auto identity_func = tvm::ffi::Function::GetGlobal("tvm.testing.identity_py"); ICHECK(identity_func.has_value()) << "AttributeError: \"testing.identity_py\" is not registered. Please check " "if the python module is properly loaded"; @@ -118,7 +118,7 @@ void ErrorTest(int x, int y) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("testing.ErrorTest", ErrorTest); + refl::GlobalDef().def("tvm.testing.ErrorTest", ErrorTest); } class FrontendTestModuleNode : public ffi::ModuleObj { @@ -162,14 +162,14 @@ ffi::Module NewFrontendTestModule() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("testing.FrontendTestModule", NewFrontendTestModule) + .def("tvm.testing.FrontendTestModule", NewFrontendTestModule) .def( - "testing.sleep_in_ffi", + "tvm.testing.sleep_in_ffi", [](double timeout) { std::chrono::duration duration(static_cast(timeout * 1e9)); std::this_thread::sleep_for(duration); }) - .def("testing.ReturnsVariant", + .def("tvm.testing.ReturnsVariant", [](int x) -> ffi::Variant { if (x % 2 == 0) { return IntImm(DataType::Int(64), x / 2); @@ -177,7 +177,7 @@ TVM_FFI_STATIC_INIT_BLOCK() { return ffi::String("argument was odd"); } }) - .def("testing.AcceptsVariant", + .def("tvm.testing.AcceptsVariant", [](ffi::Variant arg) -> ffi::String { if (auto opt_str = arg.as()) { return ffi::StaticTypeKey::kTVMFFIStr; @@ -185,14 +185,15 @@ TVM_FFI_STATIC_INIT_BLOCK() { return arg.get().GetTypeKey(); } }) - .def("testing.AcceptsBool", [](bool arg) -> bool { return arg; }) - .def("testing.AcceptsInt", [](int arg) -> int { return arg; }) - .def("testing.AcceptsObjectRefArray", [](ffi::Array arg) -> Any { return arg[0]; }) - .def("testing.AcceptsMapReturnsValue", + .def("tvm.testing.AcceptsBool", [](bool arg) -> bool { return arg; }) + .def("tvm.testing.AcceptsInt", [](int arg) -> int { return arg; }) + .def("tvm.testing.AcceptsObjectRefArray", [](ffi::Array arg) -> Any { return arg[0]; }) + .def("tvm.testing.AcceptsMapReturnsValue", [](ffi::Map map, Any key) -> Any { return map[key]; }) - .def("testing.AcceptsMapReturnsMap", [](ffi::Map map) -> ObjectRef { return map; }) - .def("testing.AcceptsPrimExpr", [](PrimExpr expr) -> ObjectRef { return expr; }) - .def("testing.AcceptsArrayOfPrimExpr", + .def("tvm.testing.AcceptsMapReturnsMap", + [](ffi::Map map) -> ObjectRef { return map; }) + .def("tvm.testing.AcceptsPrimExpr", [](PrimExpr expr) -> ObjectRef { return expr; }) + .def("tvm.testing.AcceptsArrayOfPrimExpr", [](ffi::Array arr) -> ObjectRef { for (ObjectRef item : arr) { CHECK(item->IsInstance()) << "Array contained " << item->GetTypeKey() @@ -200,7 +201,7 @@ TVM_FFI_STATIC_INIT_BLOCK() { } return arr; }) - .def("testing.AcceptsArrayOfVariant", + .def("tvm.testing.AcceptsArrayOfVariant", [](ffi::Array> arr) -> ObjectRef { for (auto item : arr) { CHECK(item.as() || item.as()) @@ -208,7 +209,7 @@ TVM_FFI_STATIC_INIT_BLOCK() { } return arr; }) - .def("testing.AcceptsMapOfPrimExpr", [](ffi::Map map) -> ObjectRef { + .def("tvm.testing.AcceptsMapOfPrimExpr", [](ffi::Map map) -> ObjectRef { for (const auto& kv : map) { ObjectRef value = kv.second; CHECK(value->IsInstance()) @@ -260,7 +261,7 @@ class TestingEventLogger { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def_packed("testing.record_event", + .def_packed("tvm.testing.record_event", [](ffi::PackedArgs args, ffi::Any* rv) { if (args.size() != 0 && args[0].try_cast()) { TestingEventLogger::ThreadLocal()->Record(args[0].cast()); @@ -269,8 +270,8 @@ TVM_FFI_STATIC_INIT_BLOCK() { } }) .def_packed( - "testing.reset_events", + "tvm.testing.reset_events", [](ffi::PackedArgs args, ffi::Any* rv) { TestingEventLogger::ThreadLocal()->Reset(); }) - .def("testing.dump_events", []() { TestingEventLogger::ThreadLocal()->Dump(); }); + .def("tvm.testing.dump_events", []() { TestingEventLogger::ThreadLocal()->Dump(); }); } } // namespace tvm diff --git a/src/support/libinfo.cc b/src/support/libinfo.cc index d0646ee8b06f..ccc30c64fd5e 100644 --- a/src/support/libinfo.cc +++ b/src/support/libinfo.cc @@ -368,7 +368,7 @@ TVM_DLL ffi::Map GetLibInfo() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("support.GetLibInfo", GetLibInfo); + refl::GlobalDef().def("tvm.support.GetLibInfo", GetLibInfo); } } // namespace tvm diff --git a/src/target/codegen.cc b/src/target/codegen.cc index 30238318ffed..66a90aea80a5 100644 --- a/src/target/codegen.cc +++ b/src/target/codegen.cc @@ -49,7 +49,7 @@ ffi::Module Build(IRModule mod, Target target) { } // the build function. - std::string build_f_name = "target.build." + target->kind->name; + std::string build_f_name = "tvm.target.build." + target->kind->name; const auto bf = tvm::ffi::Function::GetGlobal(build_f_name); ICHECK(bf.has_value()) << build_f_name << " is not enabled"; return (*bf)(mod, target).cast(); @@ -69,7 +69,7 @@ class ModuleSerializer { // we prioritize export dso when a module is both serializable and exportable if (export_dso) { if (group[0]->GetPropertyMask() & ffi::Module::kCompilationExportable) { - std::string mod_type_key = "_lib"; + std::string mod_type_key = "tvm._lib"; stream->Write(mod_type_key); } else if (group[0]->GetPropertyMask() & ffi::Module::kBinarySerializable) { ICHECK_EQ(group.size(), 1U) << "Non DSO module is never merged"; @@ -236,9 +236,9 @@ ffi::Module DeserializeModuleFromBytes(std::string blob) { for (uint64_t i = 0; i < size; ++i) { std::string tkey; ICHECK(stream->Read(&tkey)); - // "_lib" serves as a placeholder in the module import tree to indicate where + // "tvm._lib" serves as a placeholder in the module import tree to indicate where // to place the DSOModule - ICHECK(tkey != "_lib") << "Should not contain any placeholder for DSOModule."; + ICHECK(tkey != "tvm._lib") << "Should not contain any placeholder for DSOModule."; if (tkey == "_import_tree") { ICHECK(stream->Read(&import_tree_row_ptr)); ICHECK(stream->Read(&import_tree_child_indices)); @@ -333,7 +333,7 @@ ffi::Module PackImportsToLLVM(const ffi::Module& mod, bool system_lib, std::string blob = PackImportsToBytes(mod); // Call codegen_blob to generate LLVM module - std::string codegen_f_name = "codegen.codegen_blob"; + std::string codegen_f_name = "tvm.codegen.codegen_blob"; // the codegen function. const auto codegen_f = tvm::ffi::Function::GetGlobal(codegen_f_name); ICHECK(codegen_f.has_value()) << "codegen.codegen_blob is not presented."; @@ -343,16 +343,16 @@ ffi::Module PackImportsToLLVM(const ffi::Module& mod, bool system_lib, TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("target.Build", Build); + refl::GlobalDef().def("tvm.target.Build", Build); } // Export a few auxiliary function to the runtime namespace. TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("runtime.ModuleImportsBlobName", + .def("tvm.runtime.ModuleImportsBlobName", []() -> std::string { return ffi::symbol::tvm_ffi_library_bin; }) - .def("runtime.ModulePackImportsToTensor", + .def("tvm.runtime.ModulePackImportsToTensor", [](const ffi::Module& mod) { std::string buffer = PackImportsToBytes(mod); ffi::Shape::index_type size = buffer.size(); @@ -367,8 +367,8 @@ TVM_FFI_STATIC_INIT_BLOCK() { array.CopyFromBytes(buffer.data(), size); return array; }) - .def("runtime.ModulePackImportsToC", PackImportsToC) - .def("runtime.ModulePackImportsToLLVM", PackImportsToLLVM); + .def("tvm.runtime.ModulePackImportsToC", PackImportsToC) + .def("tvm.runtime.ModulePackImportsToLLVM", PackImportsToLLVM); } } // namespace codegen diff --git a/src/target/datatype/registry.cc b/src/target/datatype/registry.cc index 9f534e8d69b4..f02ab23f08b1 100644 --- a/src/target/datatype/registry.cc +++ b/src/target/datatype/registry.cc @@ -31,22 +31,23 @@ using ffi::PackedArgs; TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def_packed("dtype.register_custom_type", + .def_packed("tvm.dtype.register_custom_type", [](ffi::PackedArgs args, ffi::Any* ret) { datatype::Registry::Global()->Register( args[0].cast(), static_cast(args[1].cast())); }) - .def_packed("dtype.get_custom_type_code", + .def_packed("tvm.dtype.get_custom_type_code", [](ffi::PackedArgs args, ffi::Any* ret) { *ret = datatype::Registry::Global()->GetTypeCode(args[0].cast()); }) - .def_packed("dtype.get_custom_type_name", + .def_packed("tvm.dtype.get_custom_type_name", [](ffi::PackedArgs args, ffi::Any* ret) { *ret = Registry::Global()->GetTypeName(args[0].cast()); }) - .def_packed("runtime._datatype_get_type_registered", [](ffi::PackedArgs args, ffi::Any* ret) { - *ret = Registry::Global()->GetTypeRegistered(args[0].cast()); - }); + .def_packed("tvm.runtime._datatype_get_type_registered", + [](ffi::PackedArgs args, ffi::Any* ret) { + *ret = Registry::Global()->GetTypeRegistered(args[0].cast()); + }); } Registry* Registry::Global() { diff --git a/src/target/intrin_rule.cc b/src/target/intrin_rule.cc index 3103e6f5b9c3..5a55b24896a3 100644 --- a/src/target/intrin_rule.cc +++ b/src/target/intrin_rule.cc @@ -55,7 +55,7 @@ TVM_REGISTER_OP("tir.tanh") TVM_REGISTER_OP("tir.tan").set_attr("default.FLowerIntrinsic", DispatchPureExtern); -TVM_REGISTER_OP("tir.trunc") +TVM_REGISTER_OP("tvm.tir.trunc") .set_attr("default.FLowerIntrinsic", DispatchPureExtern); TVM_REGISTER_OP("tir.atan") @@ -106,16 +106,16 @@ TVM_REGISTER_OP("tir.ldexp") TVM_REGISTER_OP("tir.sqrt") .set_attr("default.FLowerIntrinsic", DispatchPureExtern); -TVM_REGISTER_OP("tir.floor") +TVM_REGISTER_OP("tvm.tir.floor") .set_attr("default.FLowerIntrinsic", DispatchPureExtern); -TVM_REGISTER_OP("tir.ceil") +TVM_REGISTER_OP("tvm.tir.ceil") .set_attr("default.FLowerIntrinsic", DispatchPureExtern); -TVM_REGISTER_OP("tir.round") +TVM_REGISTER_OP("tvm.tir.round") .set_attr("default.FLowerIntrinsic", DispatchPureExtern); -TVM_REGISTER_OP("tir.nearbyint") +TVM_REGISTER_OP("tvm.tir.nearbyint") .set_attr("default.FLowerIntrinsic", DispatchPureExtern); TVM_REGISTER_OP("tir.pow").set_attr("default.FLowerIntrinsic", @@ -177,14 +177,14 @@ TVM_REGISTER_OP("tir.sigmoid") return one / (one + exp(-call->args[0])); }); -TVM_REGISTER_OP("tir.isfinite") +TVM_REGISTER_OP("tvm.tir.isfinite") .set_attr("default.FLegalize", [](const PrimExpr& e) -> PrimExpr { const CallNode* call = e.as(); ICHECK(call != nullptr); return isfinite(call->args[0]); }); -TVM_REGISTER_OP("tir.isinf") +TVM_REGISTER_OP("tvm.tir.isinf") .set_attr("default.FLegalize", [](const PrimExpr& e) -> PrimExpr { const CallNode* call = e.as(); ICHECK(call != nullptr); diff --git a/src/target/llvm/codegen_amdgpu.cc b/src/target/llvm/codegen_amdgpu.cc index 034b982f64b3..c2cee7fd4e2d 100644 --- a/src/target/llvm/codegen_amdgpu.cc +++ b/src/target/llvm/codegen_amdgpu.cc @@ -279,7 +279,7 @@ ffi::Module BuildAMDGPU(IRModule mod, Target target) { cg->AddFunctionsOrdered(mod->functions.begin(), mod->functions.end()); llvm::TargetMachine* tm = llvm_target->GetOrCreateTargetMachine(); - auto fbitcode = tvm::ffi::Function::GetGlobalRequired("tvm_callback_rocm_bitcode_path"); + auto fbitcode = tvm::ffi::Function::GetGlobalRequired("tvm.tvm_callback_rocm_bitcode_path"); auto bitcode_files = fbitcode().cast>(); for (auto& bitcode_path : bitcode_files) { @@ -348,7 +348,7 @@ ffi::Module BuildAMDGPU(IRModule mod, Target target) { passAsm.run(*mAsm); std::string assembly(dataAsm.begin(), dataAsm.end()); - auto flink = tvm::ffi::Function::GetGlobal("tvm_callback_rocm_link"); + auto flink = tvm::ffi::Function::GetGlobal("tvm.tvm_callback_rocm_link"); ICHECK(flink.has_value()) << "Require tvm_callback_rocm_link to exist, do import tvm.contrib.rocm"; @@ -364,7 +364,7 @@ ffi::Module BuildAMDGPU(IRModule mod, Target target) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("target.build.rocm", BuildAMDGPU) + .def("tvm.target.build.rocm", BuildAMDGPU) .def_packed("tvm.codegen.llvm.target_rocm", [](const ffi::PackedArgs& targs, ffi::Any* rv) { *rv = static_cast(new CodeGenAMDGPU()); }); diff --git a/src/target/llvm/codegen_hexagon.cc b/src/target/llvm/codegen_hexagon.cc index 773e2a2e1d91..54101d86c852 100644 --- a/src/target/llvm/codegen_hexagon.cc +++ b/src/target/llvm/codegen_hexagon.cc @@ -595,7 +595,7 @@ ffi::Module BuildHexagon(IRModule mod, Target target) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("target.build.hexagon", BuildHexagon) + .def("tvm.target.build.hexagon", BuildHexagon) .def_packed("tvm.codegen.llvm.target_hexagon", [](const ffi::PackedArgs& targs, ffi::Any* rv) { *rv = static_cast(new CodeGenHexagon()); diff --git a/src/target/llvm/codegen_nvptx.cc b/src/target/llvm/codegen_nvptx.cc index 17a90477d2fc..f6be651c87c5 100644 --- a/src/target/llvm/codegen_nvptx.cc +++ b/src/target/llvm/codegen_nvptx.cc @@ -334,7 +334,7 @@ ffi::Module BuildNVPTX(IRModule mod, Target target) { cg->AddFunctionsOrdered(mod->functions.begin(), mod->functions.end()); llvm::TargetMachine* tm = llvm_target->GetOrCreateTargetMachine(); - const auto flibdevice_path = tvm::ffi::Function::GetGlobal("tvm_callback_libdevice_path"); + const auto flibdevice_path = tvm::ffi::Function::GetGlobal("tvm.tvm_callback_libdevice_path"); if (flibdevice_path.has_value()) { std::string path = (*flibdevice_path)(compute_ver).cast(); if (path.length() != 0) { @@ -380,7 +380,7 @@ ffi::Module BuildNVPTX(IRModule mod, Target target) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("target.build.nvptx", BuildNVPTX) + .def("tvm.target.build.nvptx", BuildNVPTX) .def_packed("tvm.codegen.llvm.target_nvptx", [](const ffi::PackedArgs& targs, ffi::Any* rv) { *rv = static_cast(new CodeGenNVPTX()); }); diff --git a/src/target/llvm/intrin_rule_hexagon.cc b/src/target/llvm/intrin_rule_hexagon.cc index bb78af0a8434..050982835bed 100644 --- a/src/target/llvm/intrin_rule_hexagon.cc +++ b/src/target/llvm/intrin_rule_hexagon.cc @@ -54,7 +54,7 @@ inline PrimExpr DispatchTVMQHLWrapperFp16(const PrimExpr& e) { ffi::Array new_args; #if ENABLE_QHL // Check target for qfloat enablement - const auto f = tvm::ffi::Function::GetGlobal("target.TargetCurrent"); + const auto f = tvm::ffi::Function::GetGlobal("tvm.target.TargetCurrent"); ICHECK(f.has_value()) << "target.TargetCurrent is not registered"; const auto ret = (*f)(true); bool useqhl = true; @@ -81,7 +81,7 @@ TVM_REGISTER_OP("tir.fma").set_attr( TVM_REGISTER_OP("tir.log").set_attr( "hexagon.FLowerIntrinsic", DispatchLLVMPureIntrin<::llvm::Intrinsic::log, 1>); -TVM_REGISTER_OP("tir.trunc") +TVM_REGISTER_OP("tvm.tir.trunc") .set_attr("hexagon.FLowerIntrinsic", DispatchLLVMPureIntrin<::llvm::Intrinsic::trunc, 1>); @@ -89,7 +89,7 @@ TVM_REGISTER_OP("tir.fabs") .set_attr("hexagon.FLowerIntrinsic", DispatchLLVMPureIntrin<::llvm::Intrinsic::fabs, 1>); -TVM_REGISTER_OP("tir.round") +TVM_REGISTER_OP("tvm.tir.round") .set_attr("hexagon.FLowerIntrinsic", DispatchLLVMPureIntrin<::llvm::Intrinsic::round, 1>); @@ -104,7 +104,7 @@ TVM_REGISTER_OP("tir.tanh") #if ENABLE_QHL // Check target for qfloat enablement - const auto f = tvm::ffi::Function::GetGlobal("target.TargetCurrent"); + const auto f = tvm::ffi::Function::GetGlobal("tvm.target.TargetCurrent"); ICHECK(f.has_value()) << "target.TargetCurrent is not registered"; const auto ret = (*f)(true); bool useqhl = true; @@ -139,7 +139,7 @@ TVM_REGISTER_OP("tir.tan").set_attr( const PrimExpr& x = call->args[0]; #if ENABLE_QHL // Check target for qfloat enablement - const auto f = tvm::ffi::Function::GetGlobal("target.TargetCurrent"); + const auto f = tvm::ffi::Function::GetGlobal("tvm.target.TargetCurrent"); ICHECK(f.has_value()) << "target.TargetCurrent is not registered"; const auto ret = (*f)(true); bool useqhl = true; @@ -158,7 +158,7 @@ TVM_REGISTER_OP("tir.tan").set_attr( return tan_x; }); -TVM_REGISTER_OP("tir.nearbyint") +TVM_REGISTER_OP("tvm.tir.nearbyint") .set_attr("hexagon.FLowerIntrinsic", DispatchLLVMPureIntrin<::llvm::Intrinsic::nearbyint, 1>); @@ -169,7 +169,7 @@ TVM_REGISTER_OP("tir.sigmoid") const PrimExpr& x = call->args[0]; #if ENABLE_QHL // Check target for qfloat enablement - const auto f = tvm::ffi::Function::GetGlobal("target.TargetCurrent"); + const auto f = tvm::ffi::Function::GetGlobal("tvm.target.TargetCurrent"); ICHECK(f.has_value()) << "target.TargetCurrent is not registered"; const auto ret = (*f)(true); bool useqhl = true; diff --git a/src/target/llvm/intrin_rule_llvm.cc b/src/target/llvm/intrin_rule_llvm.cc index a8a3d911ca8e..34d76b2ef45d 100644 --- a/src/target/llvm/intrin_rule_llvm.cc +++ b/src/target/llvm/intrin_rule_llvm.cc @@ -69,15 +69,15 @@ TVM_REGISTER_OP("tir.sqrt") .set_attr("llvm.FLowerIntrinsic", DispatchLLVMPureIntrin<::llvm::Intrinsic::sqrt, 1>); -TVM_REGISTER_OP("tir.floor") +TVM_REGISTER_OP("tvm.tir.floor") .set_attr("llvm.FLowerIntrinsic", DispatchLLVMPureIntrin<::llvm::Intrinsic::floor, 1>); -TVM_REGISTER_OP("tir.ceil") +TVM_REGISTER_OP("tvm.tir.ceil") .set_attr("llvm.FLowerIntrinsic", DispatchLLVMPureIntrin<::llvm::Intrinsic::ceil, 1>); -TVM_REGISTER_OP("tir.trunc") +TVM_REGISTER_OP("tvm.tir.trunc") .set_attr("llvm.FLowerIntrinsic", DispatchLLVMPureIntrin<::llvm::Intrinsic::trunc, 1>); @@ -85,11 +85,11 @@ TVM_REGISTER_OP("tir.fabs") .set_attr("llvm.FLowerIntrinsic", DispatchLLVMPureIntrin<::llvm::Intrinsic::fabs, 1>); -TVM_REGISTER_OP("tir.round") +TVM_REGISTER_OP("tvm.tir.round") .set_attr("llvm.FLowerIntrinsic", DispatchLLVMPureIntrin<::llvm::Intrinsic::round, 1>); -TVM_REGISTER_OP("tir.nearbyint") +TVM_REGISTER_OP("tvm.tir.nearbyint") .set_attr("llvm.FLowerIntrinsic", DispatchLLVMPureIntrin<::llvm::Intrinsic::nearbyint, 1>); diff --git a/src/target/llvm/intrin_rule_nvptx.cc b/src/target/llvm/intrin_rule_nvptx.cc index a5fef4f5d411..1510bb00cc6e 100644 --- a/src/target/llvm/intrin_rule_nvptx.cc +++ b/src/target/llvm/intrin_rule_nvptx.cc @@ -59,19 +59,19 @@ inline PrimExpr DispatchPureExternLibDevice(const PrimExpr& e) { namespace llvm { using tir::FLowerIntrinsic; -TVM_REGISTER_OP("tir.floor") +TVM_REGISTER_OP("tvm.tir.floor") .set_attr("nvptx.FLowerIntrinsic", DispatchPureExternLibDevice); -TVM_REGISTER_OP("tir.ceil") +TVM_REGISTER_OP("tvm.tir.ceil") .set_attr("nvptx.FLowerIntrinsic", DispatchPureExternLibDevice); -TVM_REGISTER_OP("tir.round") +TVM_REGISTER_OP("tvm.tir.round") .set_attr("nvptx.FLowerIntrinsic", DispatchPureExternLibDevice); -TVM_REGISTER_OP("tir.nearbyint") +TVM_REGISTER_OP("tvm.tir.nearbyint") .set_attr("nvptx.FLowerIntrinsic", DispatchPureExternLibDevice); -TVM_REGISTER_OP("tir.trunc") +TVM_REGISTER_OP("tvm.tir.trunc") .set_attr("nvptx.FLowerIntrinsic", DispatchPureExternLibDevice); TVM_REGISTER_OP("tir.fabs") diff --git a/src/target/llvm/intrin_rule_rocm.cc b/src/target/llvm/intrin_rule_rocm.cc index d4c92a38d1ba..f2ccb7593651 100644 --- a/src/target/llvm/intrin_rule_rocm.cc +++ b/src/target/llvm/intrin_rule_rocm.cc @@ -122,23 +122,23 @@ TVM_REGISTER_OP("tir.tvm_warp_shuffle_up") TVM_REGISTER_OP("tir.tvm_warp_shuffle_down") .set_attr("rocm.FLowerIntrinsic", DispatchShuffle); -TVM_REGISTER_OP("tir.floor") +TVM_REGISTER_OP("tvm.tir.floor") .set_attr("rocm.FLowerIntrinsic", DispatchLLVMPureIntrin<::llvm::Intrinsic::floor, 1>); -TVM_REGISTER_OP("tir.ceil") +TVM_REGISTER_OP("tvm.tir.ceil") .set_attr("rocm.FLowerIntrinsic", DispatchLLVMPureIntrin<::llvm::Intrinsic::ceil, 1>); -TVM_REGISTER_OP("tir.round") +TVM_REGISTER_OP("tvm.tir.round") .set_attr("rocm.FLowerIntrinsic", DispatchLLVMPureIntrin<::llvm::Intrinsic::round, 1>); -TVM_REGISTER_OP("tir.nearbyint") +TVM_REGISTER_OP("tvm.tir.nearbyint") .set_attr("rocm.FLowerIntrinsic", DispatchLLVMPureIntrin<::llvm::Intrinsic::nearbyint, 1>); -TVM_REGISTER_OP("tir.trunc") +TVM_REGISTER_OP("tvm.tir.trunc") .set_attr("rocm.FLowerIntrinsic", DispatchLLVMPureIntrin<::llvm::Intrinsic::trunc, 1>); diff --git a/src/target/llvm/llvm_module.cc b/src/target/llvm/llvm_module.cc index 5f7494558eaa..2268dd1067e3 100644 --- a/src/target/llvm/llvm_module.cc +++ b/src/target/llvm/llvm_module.cc @@ -658,13 +658,13 @@ void* LLVMModuleNode::GetFunctionAddr(const std::string& name, static void LLVMReflectionRegister() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("target.build.llvm", + .def("tvm.target.build.llvm", [](IRModule mod, Target target) -> ffi::Module { auto n = ffi::make_object(); n->Init(mod, target); return ffi::Module(n); }) - .def("codegen.LLVMModuleCreate", + .def("tvm.codegen.LLVMModuleCreate", [](std::string target_str, std::string module_name) -> ffi::Module { auto llvm_instance = std::make_unique(); With llvm_target(*llvm_instance, target_str); @@ -682,7 +682,7 @@ static void LLVMReflectionRegister() { n->SetJITEngine(llvm_target->GetJITEngine()); return ffi::Module(n); }) - .def("target.llvm_lookup_intrinsic_id", + .def("tvm.target.llvm_lookup_intrinsic_id", [](std::string name) -> int64_t { #if TVM_LLVM_VERSION >= 200 return static_cast(llvm::Intrinsic::lookupIntrinsicID(name)); @@ -690,9 +690,9 @@ static void LLVMReflectionRegister() { return static_cast(llvm::Function::lookupIntrinsicID(name)); #endif }) - .def("target.llvm_get_intrinsic_name", + .def("tvm.target.llvm_get_intrinsic_name", [](int64_t id) -> ffi::String { return llvmGetIntrinName(id); }) - .def("target.llvm_get_system_x86_vendor", + .def("tvm.target.llvm_get_system_x86_vendor", []() -> ffi::String { #if TVM_LLVM_VERSION >= 120 #if defined(__i386__) || defined(_M_IX86) || defined(__x86_64__) || defined(_M_X64) @@ -708,7 +708,7 @@ static void LLVMReflectionRegister() { #endif return "unimplemented"; }) - .def("target.llvm_get_vector_width", + .def("tvm.target.llvm_get_vector_width", [](const Target& target) -> int { auto use_target = target.defined() ? target : Target::Current(false); // ignore non "llvm" target @@ -721,17 +721,17 @@ static void LLVMReflectionRegister() { LLVMTargetInfo llvm_backend(*llvm_instance, use_target); return llvm_backend.GetVectorWidth(); }) - .def("target.llvm_get_system_triple", + .def("tvm.target.llvm_get_system_triple", []() -> ffi::String { return llvm::sys::getDefaultTargetTriple(); }) - .def("target.llvm_get_system_cpu", + .def("tvm.target.llvm_get_system_cpu", []() -> ffi::String { return llvm::sys::getHostCPUName().str(); }) - .def("target.llvm_get_targets", + .def("tvm.target.llvm_get_targets", []() -> ffi::Array { auto llvm_instance = std::make_unique(); LLVMTargetInfo llvm_backend(*llvm_instance, "llvm"); return llvm_backend.GetAllLLVMTargets(); }) - .def("target.llvm_get_cpu_archlist", + .def("tvm.target.llvm_get_cpu_archlist", [](const Target& target) -> ffi::Array { auto use_target = target.defined() ? target : Target::Current(false); // ignore non "llvm" target @@ -744,7 +744,7 @@ static void LLVMReflectionRegister() { LLVMTargetInfo llvm_backend(*llvm_instance, use_target); return llvm_backend.GetAllLLVMTargetArches(); }) - .def("target.llvm_get_cpu_features", + .def("tvm.target.llvm_get_cpu_features", [](const Target& target) -> ffi::Map { auto use_target = target.defined() ? target : Target::Current(false); // ignore non "llvm" target @@ -757,7 +757,7 @@ static void LLVMReflectionRegister() { LLVMTargetInfo llvm_backend(*llvm_instance, use_target); return llvm_backend.GetAllLLVMCpuFeatures(); }) - .def("target.llvm_cpu_has_feature", + .def("tvm.target.llvm_cpu_has_feature", [](const ffi::String feature, const Target& target) -> bool { auto use_target = target.defined() ? target : Target::Current(false); // ignore non "llvm" target @@ -772,7 +772,7 @@ static void LLVMReflectionRegister() { bool has_feature = cpu_features.find(feature) != cpu_features.end(); return has_feature; }) - .def("target.target_has_feature", + .def("tvm.target.target_has_feature", [](const ffi::String feature, const Target& target) -> bool { auto use_target = target.defined() ? target : Target::Current(false); // ignore non "llvm" target @@ -785,7 +785,7 @@ static void LLVMReflectionRegister() { LLVMTargetInfo llvm_target(*llvm_instance, use_target); return llvm_target.TargetHasCPUFeature(feature); }) - .def("target.llvm_version_major", []() -> int { return TVM_LLVM_VERSION / 10; }) + .def("tvm.target.llvm_version_major", []() -> int { return TVM_LLVM_VERSION / 10; }) .def("ffi.Module.load_from_file.ll", [](std::string filename, std::string fmt) -> ffi::Module { auto n = ffi::make_object(); @@ -793,14 +793,14 @@ static void LLVMReflectionRegister() { n->LoadIR(filename); return ffi::Module(n); }) - .def("codegen.llvm_target_enabled", + .def("tvm.codegen.llvm_target_enabled", [](std::string target_str) -> bool { LLVMInstance llvm_instance; auto* tm = With(llvm_instance, target_str) ->GetOrCreateTargetMachine(/*allow_missing=*/true); return tm != nullptr; }) - .def("codegen.codegen_blob", + .def("tvm.codegen.codegen_blob", [](std::string data, bool system_lib, std::string llvm_target_string, std::string c_symbol_prefix) -> ffi::Module { auto n = ffi::make_object(); diff --git a/src/target/opt/build_cuda_on.cc b/src/target/opt/build_cuda_on.cc index 8d2589aaec13..fa4fd52520e3 100644 --- a/src/target/opt/build_cuda_on.cc +++ b/src/target/opt/build_cuda_on.cc @@ -158,9 +158,9 @@ ffi::Module BuildCUDA(IRModule mod, Target target) { } std::string fmt = "ptx"; std::string ptx; - auto f_enter = ffi::Function::GetGlobal("target.TargetEnterScope"); + auto f_enter = ffi::Function::GetGlobal("tvm.target.TargetEnterScope"); (*f_enter)(target); - if (auto f = ffi::Function::GetGlobal("tvm_callback_cuda_compile")) { + if (auto f = ffi::Function::GetGlobal("tvm.tvm_callback_cuda_compile")) { ptx = (*f)(code, target).cast(); // Dirty matching to check PTX vs cubin. // TODO(tqchen) more reliable checks @@ -168,14 +168,14 @@ ffi::Module BuildCUDA(IRModule mod, Target target) { } else { ptx = NVRTCCompile(code, cg.need_include_path()); } - auto f_exit = ffi::Function::GetGlobal("target.TargetExitScope"); + auto f_exit = ffi::Function::GetGlobal("tvm.target.TargetExitScope"); (*f_exit)(target); return CUDAModuleCreate(ptx, fmt, ExtractFuncInfo(mod), code); } TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("target.build.cuda", BuildCUDA); + refl::GlobalDef().def("tvm.target.build.cuda", BuildCUDA); } TVM_REGISTER_PASS_CONFIG_OPTION("cuda.kernels_output_dir", ffi::String); } // namespace codegen diff --git a/src/target/parsers/cpu.cc b/src/target/parsers/cpu.cc index ac187a03bbdc..69daa81f1576 100644 --- a/src/target/parsers/cpu.cc +++ b/src/target/parsers/cpu.cc @@ -30,7 +30,7 @@ namespace cpu { ffi::Optional DetectSystemTriple() { #ifdef TVM_LLVM_VERSION - auto pf = tvm::ffi::Function::GetGlobal("target.llvm_get_system_triple"); + auto pf = tvm::ffi::Function::GetGlobal("tvm.target.llvm_get_system_triple"); ICHECK(pf.has_value()) << "The target llvm_get_system_triple was not found, " "please compile with USE_LLVM = ON"; return (*pf)().cast(); diff --git a/src/target/source/codegen_c_host.cc b/src/target/source/codegen_c_host.cc index 12a8d66bba9b..f47dfe633048 100644 --- a/src/target/source/codegen_c_host.cc +++ b/src/target/source/codegen_c_host.cc @@ -411,7 +411,7 @@ ffi::Module BuildCHost(IRModule mod, Target target) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("target.build.c", BuildCHost); + refl::GlobalDef().def("tvm.target.build.c", BuildCHost); } } // namespace codegen } // namespace tvm diff --git a/src/target/source/codegen_cuda.cc b/src/target/source/codegen_cuda.cc index a9cfad9ab6f5..9e6897d5a6ae 100644 --- a/src/target/source/codegen_cuda.cc +++ b/src/target/source/codegen_cuda.cc @@ -1109,7 +1109,7 @@ void CodeGenCUDA::VisitExpr_(const CallNode* op, std::ostream& os) { // to determine the output location for each 8 element. const auto index_map_func = - tvm::ffi::Function::GetGlobal("tir.index_map.shared_16x16_to_ldmatrix_32x8_layout"); + tvm::ffi::Function::GetGlobal("tvm.tir.index_map.shared_16x16_to_ldmatrix_32x8_layout"); ICHECK(index_map_func.has_value()); arith::Analyzer analyzer; diff --git a/src/target/source/codegen_metal.cc b/src/target/source/codegen_metal.cc index 01042776c971..4abacb670404 100644 --- a/src/target/source/codegen_metal.cc +++ b/src/target/source/codegen_metal.cc @@ -438,7 +438,7 @@ ffi::Module BuildMetal(IRModule mod, Target target) { std::ostringstream source_maker; std::unordered_map smap; - const auto fmetal_compile = tvm::ffi::Function::GetGlobal("tvm_callback_metal_compile"); + const auto fmetal_compile = tvm::ffi::Function::GetGlobal("tvm.tvm_callback_metal_compile"); std::string fmt = fmetal_compile ? "metallib" : "metal"; for (auto kv : mod->functions) { @@ -470,7 +470,7 @@ ffi::Module BuildMetal(IRModule mod, Target target) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("target.build.metal", BuildMetal); + refl::GlobalDef().def("tvm.target.build.metal", BuildMetal); } } // namespace codegen } // namespace tvm diff --git a/src/target/source/codegen_opencl.cc b/src/target/source/codegen_opencl.cc index 8ea55b8ff5d8..34b93ac2002e 100644 --- a/src/target/source/codegen_opencl.cc +++ b/src/target/source/codegen_opencl.cc @@ -682,7 +682,7 @@ ffi::Module BuildOpenCL(IRModule mod, Target target) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("target.build.opencl", BuildOpenCL); + refl::GlobalDef().def("tvm.target.build.opencl", BuildOpenCL); } ffi::String DeviceScopeCompatibilityFromTarget(Target target, ffi::String memory_scope) { @@ -697,7 +697,7 @@ ffi::String DeviceScopeCompatibilityFromTarget(Target target, ffi::String memory TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("DeviceScopeCompatibility.opencl", DeviceScopeCompatibilityFromTarget); + refl::GlobalDef().def("tvm.DeviceScopeCompatibility.opencl", DeviceScopeCompatibilityFromTarget); } } // namespace codegen diff --git a/src/target/source/codegen_webgpu.cc b/src/target/source/codegen_webgpu.cc index cf8176001a8a..146622242840 100644 --- a/src/target/source/codegen_webgpu.cc +++ b/src/target/source/codegen_webgpu.cc @@ -794,7 +794,7 @@ ffi::Module BuildWebGPU(IRModule mod, Target target) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("target.build.webgpu", + refl::GlobalDef().def("tvm.target.build.webgpu", [](IRModule mod, Target target) { return BuildWebGPU(mod, target); }); } diff --git a/src/target/source/intrin_rule_cuda.cc b/src/target/source/intrin_rule_cuda.cc index 56b575cc6c38..ee1af1af7c04 100644 --- a/src/target/source/intrin_rule_cuda.cc +++ b/src/target/source/intrin_rule_cuda.cc @@ -151,22 +151,22 @@ static PrimExpr DispatchCUDAShuffle(const PrimExpr& e) { TVM_REGISTER_OP("tir.clz").set_attr( "cuda.FLowerIntrinsic", DispatchPureExtern); -TVM_REGISTER_OP("tir.floor") +TVM_REGISTER_OP("tvm.tir.floor") .set_attr("cuda.FLowerIntrinsic", DispatchPureExtern); -TVM_REGISTER_OP("tir.ceil") +TVM_REGISTER_OP("tvm.tir.ceil") .set_attr("cuda.FLowerIntrinsic", DispatchPureExtern); -TVM_REGISTER_OP("tir.trunc") +TVM_REGISTER_OP("tvm.tir.trunc") .set_attr("cuda.FLowerIntrinsic", DispatchPureExtern); TVM_REGISTER_OP("tir.fabs") .set_attr("cuda.FLowerIntrinsic", DispatchPureExtern); -TVM_REGISTER_OP("tir.round") +TVM_REGISTER_OP("tvm.tir.round") .set_attr("cuda.FLowerIntrinsic", DispatchPureExtern); -TVM_REGISTER_OP("tir.nearbyint") +TVM_REGISTER_OP("tvm.tir.nearbyint") .set_attr("cuda.FLowerIntrinsic", DispatchPureExtern); TVM_REGISTER_OP("tir.exp").set_attr("cuda.FLowerIntrinsic", diff --git a/src/target/source/intrin_rule_metal.cc b/src/target/source/intrin_rule_metal.cc index e74c63a79ba3..2ac7f1138b26 100644 --- a/src/target/source/intrin_rule_metal.cc +++ b/src/target/source/intrin_rule_metal.cc @@ -55,22 +55,22 @@ static PrimExpr DispatchMetalShuffle(const PrimExpr& e) { TVM_REGISTER_OP("tir.clz").set_attr("metal.FLowerIntrinsic", DispatchPureExtern); -TVM_REGISTER_OP("tir.floor") +TVM_REGISTER_OP("tvm.tir.floor") .set_attr("metal.FLowerIntrinsic", DispatchPureExtern); -TVM_REGISTER_OP("tir.ceil") +TVM_REGISTER_OP("tvm.tir.ceil") .set_attr("metal.FLowerIntrinsic", DispatchPureExtern); -TVM_REGISTER_OP("tir.trunc") +TVM_REGISTER_OP("tvm.tir.trunc") .set_attr("metal.FLowerIntrinsic", DispatchPureExtern); TVM_REGISTER_OP("tir.fabs") .set_attr("metal.FLowerIntrinsic", DispatchPureExtern); -TVM_REGISTER_OP("tir.round") +TVM_REGISTER_OP("tvm.tir.round") .set_attr("metal.FLowerIntrinsic", DispatchPureExtern); -TVM_REGISTER_OP("tir.nearbyint") +TVM_REGISTER_OP("tvm.tir.nearbyint") .set_attr("metal.FLowerIntrinsic", DispatchPureExtern); TVM_REGISTER_OP("tir.exp").set_attr("metal.FLowerIntrinsic", diff --git a/src/target/source/intrin_rule_opencl.cc b/src/target/source/intrin_rule_opencl.cc index ea3a1c58bc3f..8cbfa723165e 100644 --- a/src/target/source/intrin_rule_opencl.cc +++ b/src/target/source/intrin_rule_opencl.cc @@ -34,22 +34,22 @@ using tir::FLowerIntrinsic; TVM_REGISTER_OP("tir.clz").set_attr("opencl.FLowerIntrinsic", DispatchPureExtern); -TVM_REGISTER_OP("tir.floor") +TVM_REGISTER_OP("tvm.tir.floor") .set_attr("opencl.FLowerIntrinsic", DispatchPureExtern); -TVM_REGISTER_OP("tir.ceil") +TVM_REGISTER_OP("tvm.tir.ceil") .set_attr("opencl.FLowerIntrinsic", DispatchPureExtern); -TVM_REGISTER_OP("tir.trunc") +TVM_REGISTER_OP("tvm.tir.trunc") .set_attr("opencl.FLowerIntrinsic", DispatchPureExtern); TVM_REGISTER_OP("tir.fabs") .set_attr("opencl.FLowerIntrinsic", DispatchPureExtern); -TVM_REGISTER_OP("tir.round") +TVM_REGISTER_OP("tvm.tir.round") .set_attr("opencl.FLowerIntrinsic", DispatchPureExtern); -TVM_REGISTER_OP("tir.nearbyint") +TVM_REGISTER_OP("tvm.tir.nearbyint") .set_attr("opencl.FLowerIntrinsic", DispatchPureExtern); TVM_REGISTER_OP("tir.exp").set_attr("opencl.FLowerIntrinsic", diff --git a/src/target/source/intrin_rule_webgpu.cc b/src/target/source/intrin_rule_webgpu.cc index f3e561f71477..b55e99842970 100644 --- a/src/target/source/intrin_rule_webgpu.cc +++ b/src/target/source/intrin_rule_webgpu.cc @@ -59,7 +59,7 @@ TVM_REGISTER_OP("tir.atan") TVM_REGISTER_OP("tir.atan2") .set_attr("webgpu.FLowerIntrinsic", DispatchPureExtern); -TVM_REGISTER_OP("tir.ceil") +TVM_REGISTER_OP("tvm.tir.ceil") .set_attr("webgpu.FLowerIntrinsic", DispatchPureExtern); TVM_REGISTER_OP("tir.cos").set_attr("webgpu.FLowerIntrinsic", @@ -74,7 +74,7 @@ TVM_REGISTER_OP("tir.exp").set_attr("webgpu.FLowerIntrinsic", TVM_REGISTER_OP("tir.exp2") .set_attr("webgpu.FLowerIntrinsic", DispatchPureExtern); -TVM_REGISTER_OP("tir.floor") +TVM_REGISTER_OP("tvm.tir.floor") .set_attr("webgpu.FLowerIntrinsic", DispatchPureExtern); TVM_REGISTER_OP("tir.fma").set_attr("webgpu.FLowerIntrinsic", @@ -89,7 +89,7 @@ TVM_REGISTER_OP("tir.log2") TVM_REGISTER_OP("tir.pow").set_attr("webgpu.FLowerIntrinsic", DispatchPureExtern); -TVM_REGISTER_OP("tir.round") +TVM_REGISTER_OP("tvm.tir.round") .set_attr("webgpu.FLowerIntrinsic", DispatchPureExtern); TVM_REGISTER_OP("tir.sin").set_attr("webgpu.FLowerIntrinsic", @@ -107,7 +107,7 @@ TVM_REGISTER_OP("tir.tan").set_attr("webgpu.FLowerIntrinsic", TVM_REGISTER_OP("tir.tanh") .set_attr("webgpu.FLowerIntrinsic", DispatchNumericalStableTanh); -TVM_REGISTER_OP("tir.trunc") +TVM_REGISTER_OP("tvm.tir.trunc") .set_attr("webgpu.FLowerIntrinsic", DispatchPureExtern); // extra dispatch diff --git a/src/target/source/source_module.cc b/src/target/source/source_module.cc index 0112ad961de4..94b2e2a4cca3 100644 --- a/src/target/source/source_module.cc +++ b/src/target/source/source_module.cc @@ -266,12 +266,13 @@ ffi::Module DeviceSourceModuleCreate(std::string data, std::string fmt, TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("runtime.SourceModuleCreate", SourceModuleCreate) - .def("runtime.CSourceModuleCreate", [](ffi::String code, ffi::String fmt, - ffi::Optional> func_names, - ffi::Optional> const_vars) { - return CSourceModuleCreate(code, fmt, func_names.value_or({}), const_vars.value_or({})); - }); + .def("tvm.runtime.SourceModuleCreate", SourceModuleCreate) + .def("tvm.runtime.CSourceModuleCreate", + [](ffi::String code, ffi::String fmt, ffi::Optional> func_names, + ffi::Optional> const_vars) { + return CSourceModuleCreate(code, fmt, func_names.value_or({}), + const_vars.value_or({})); + }); } } // namespace codegen diff --git a/src/target/spirv/build_vulkan.cc b/src/target/spirv/build_vulkan.cc index f71b7ef8d6fa..11ee84350814 100644 --- a/src/target/spirv/build_vulkan.cc +++ b/src/target/spirv/build_vulkan.cc @@ -39,7 +39,7 @@ ffi::Module BuildSPIRV(IRModule mod, Target target) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("target.build.vulkan", + refl::GlobalDef().def("tvm.target.build.vulkan", [](IRModule mod, Target target) { return BuildSPIRV(mod, target); }); } diff --git a/src/target/spirv/intrin_rule_spirv.cc b/src/target/spirv/intrin_rule_spirv.cc index a689a550c4aa..8665dbbaa4d7 100644 --- a/src/target/spirv/intrin_rule_spirv.cc +++ b/src/target/spirv/intrin_rule_spirv.cc @@ -61,19 +61,19 @@ inline PrimExpr DispatchGLSLPureIntrin(const PrimExpr& e) { namespace intrin { using tir::FLowerIntrinsic; -TVM_REGISTER_OP("tir.floor") +TVM_REGISTER_OP("tvm.tir.floor") .set_attr("vulkan.FLowerIntrinsic", DispatchGLSLPureIntrin); -TVM_REGISTER_OP("tir.ceil") +TVM_REGISTER_OP("tvm.tir.ceil") .set_attr("vulkan.FLowerIntrinsic", DispatchGLSLPureIntrin); -TVM_REGISTER_OP("tir.round") +TVM_REGISTER_OP("tvm.tir.round") .set_attr("vulkan.FLowerIntrinsic", DispatchGLSLPureIntrin); -TVM_REGISTER_OP("tir.nearbyint") +TVM_REGISTER_OP("tvm.tir.nearbyint") .set_attr("vulkan.FLowerIntrinsic", DispatchGLSLPureIntrin); -TVM_REGISTER_OP("tir.trunc") +TVM_REGISTER_OP("tvm.tir.trunc") .set_attr("vulkan.FLowerIntrinsic", DispatchGLSLPureIntrin); TVM_REGISTER_OP("tir.fabs") diff --git a/src/target/tag.cc b/src/target/tag.cc index dfe179f7ac16..b4615c1cbfe5 100644 --- a/src/target/tag.cc +++ b/src/target/tag.cc @@ -37,8 +37,8 @@ TVM_FFI_STATIC_INIT_BLOCK() { TargetTagNode::RegisterReflection(); } TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("target.TargetTagListTags", TargetTag::ListTags) - .def("target.TargetTagAddTag", TargetTag::AddTag); + .def("tvm.target.TargetTagListTags", TargetTag::ListTags) + .def("tvm.target.TargetTagAddTag", TargetTag::AddTag); } /********** Registry-related code **********/ diff --git a/src/target/target.cc b/src/target/target.cc index 23ee76fc898d..69b57f2946ef 100644 --- a/src/target/target.cc +++ b/src/target/target.cc @@ -1002,15 +1002,15 @@ std::unordered_map TargetInternal::QueryDevice(int device TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def_packed("target.Target", TargetInternal::ConstructorDispatcher) - .def("target.TargetEnterScope", TargetInternal::EnterScope) - .def("target.TargetExitScope", TargetInternal::ExitScope) - .def("target.TargetCurrent", Target::Current) - .def("target.TargetExport", TargetInternal::Export) - .def("target.WithHost", TargetInternal::WithHost) - .def("target.TargetGetDeviceType", + .def_packed("tvm.target.Target", TargetInternal::ConstructorDispatcher) + .def("tvm.target.TargetEnterScope", TargetInternal::EnterScope) + .def("tvm.target.TargetExitScope", TargetInternal::ExitScope) + .def("tvm.target.TargetCurrent", Target::Current) + .def("tvm.target.TargetExport", TargetInternal::Export) + .def("tvm.target.WithHost", TargetInternal::WithHost) + .def("tvm.target.TargetGetDeviceType", [](const Target& target) { return target->GetTargetDeviceType(); }) - .def("target.TargetGetFeature", + .def("tvm.target.TargetGetFeature", [](const Target& target, const ffi::String& feature_key) -> Any { if (auto opt_any = target->GetFeature(feature_key)) { return opt_any.value(); diff --git a/src/target/target_kind.cc b/src/target/target_kind.cc index d44173a2ae3c..aa2f09513735 100644 --- a/src/target/target_kind.cc +++ b/src/target/target_kind.cc @@ -40,12 +40,12 @@ TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; TargetKindNode::RegisterReflection(); refl::TypeAttrDef() - .def("__data_to_json__", + .def("tvm.__data_to_json__", [](const TargetKindNode* node) { // simply save as the string return node->name; }) - .def("__data_from_json__", [](const ffi::String& name) { + .def("tvm.__data_from_json__", [](const ffi::String& name) { auto kind = TargetKind::Get(name); ICHECK(kind.has_value()) << "Cannot find target kind \'" << name << '\''; return kind.value(); @@ -225,7 +225,8 @@ TargetJSON UpdateROCmAttrs(TargetJSON target) { ICHECK(!arch.empty()) << "ValueError: ROCm target gets an invalid GFX version: -mcpu=" << mcpu; } else { ffi::Any val; - if (const auto f_get_rocm_arch = tvm::ffi::Function::GetGlobal("tvm_callback_rocm_get_arch")) { + if (const auto f_get_rocm_arch = + tvm::ffi::Function::GetGlobal("tvm.tvm_callback_rocm_get_arch")) { arch = (*f_get_rocm_arch)().cast(); } target.Set("mcpu", ffi::String(arch)); @@ -449,7 +450,7 @@ TVM_REGISTER_TARGET_KIND("test", kDLCPU) // line break TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("target.TargetKindGetAttr", + .def("tvm.target.TargetKindGetAttr", [](TargetKind kind, ffi::String attr_name) -> ffi::Any { auto target_attr_map = TargetKind::GetAttrMap(attr_name); ffi::Any rv; @@ -458,9 +459,9 @@ TVM_FFI_STATIC_INIT_BLOCK() { } return rv; }) - .def("target.ListTargetKinds", TargetKindRegEntry::ListTargetKinds) - .def("target.ListTargetKindOptions", TargetKindRegEntry::ListTargetKindOptions) - .def("target.ListTargetKindOptionsFromName", [](ffi::String target_kind_name) { + .def("tvm.target.ListTargetKinds", TargetKindRegEntry::ListTargetKinds) + .def("tvm.target.ListTargetKindOptions", TargetKindRegEntry::ListTargetKindOptions) + .def("tvm.target.ListTargetKindOptionsFromName", [](ffi::String target_kind_name) { TargetKind kind = TargetKind::Get(target_kind_name).value(); return TargetKindRegEntry::ListTargetKindOptions(kind); }); diff --git a/src/target/virtual_device.cc b/src/target/virtual_device.cc index 54529acb409c..032d48592676 100644 --- a/src/target/virtual_device.cc +++ b/src/target/virtual_device.cc @@ -194,7 +194,7 @@ VirtualDevice VirtualDeviceCache::Unique(const VirtualDevice& virtual_device) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("target.VirtualDevice_ForDeviceTargetAndMemoryScope", + refl::GlobalDef().def("tvm.target.VirtualDevice_ForDeviceTargetAndMemoryScope", VirtualDevice::ForDeviceTargetAndMemoryScope); } diff --git a/src/te/operation/compute_op.cc b/src/te/operation/compute_op.cc index fa7424a7cda0..abb8cf21d3d9 100644 --- a/src/te/operation/compute_op.cc +++ b/src/te/operation/compute_op.cc @@ -155,11 +155,12 @@ ComputeOp::ComputeOp(std::string name, std::string tag, ffi::Map> attrs, - ffi::Array axis, ffi::Array body) { - return ComputeOp(name, tag, attrs.value_or({}), axis, body); - }); + refl::GlobalDef().def( + "tvm.te.ComputeOp", + [](std::string name, std::string tag, ffi::Optional> attrs, + ffi::Array axis, ffi::Array body) { + return ComputeOp(name, tag, attrs.value_or({}), axis, body); + }); } // The schedule related logics diff --git a/src/te/operation/create_primfunc.cc b/src/te/operation/create_primfunc.cc index fa84ab3863fb..7278118f4a4b 100644 --- a/src/te/operation/create_primfunc.cc +++ b/src/te/operation/create_primfunc.cc @@ -643,7 +643,7 @@ Stmt GenerateStmtFromExternOp(const te::ExternOp& extern_op, CreateFuncInfo* inf } // The access region does not need to be collected here, as it will - // be generated with the later application of "script.Complete" in + // be generated with the later application of "tvm.script.Complete" in // GenerateAndCompletePrimFunc. Waiting until later also handles // the case where there is only a single BlockNode, which then // becomes the root Block of the function, and should not have @@ -747,7 +747,7 @@ PrimFunc GenerateAndCompletePrimFunc(const ffi::Array& arg_list, /*ret_type=*/VoidType(), /*buffer_map=*/std::move(buffer_map)), {{"global_symbol", ffi::String("main")}, {"tir.noalias", true}}); - const auto fcomplete = tvm::ffi::Function::GetGlobal("script.Complete"); + const auto fcomplete = tvm::ffi::Function::GetGlobal("tvm.script.Complete"); ICHECK(fcomplete.has_value()); func = (*fcomplete)(std::move(func), info->root_alloc).cast(); return func; @@ -791,7 +791,7 @@ PrimFunc CreatePrimFunc(const ffi::Array& arg_list, TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def_packed("te.CreatePrimFunc", [](ffi::PackedArgs args, ffi::Any* ret) { + refl::GlobalDef().def_packed("tvm.te.CreatePrimFunc", [](ffi::PackedArgs args, ffi::Any* ret) { ffi::Array arg_list = args[0].cast>(); std::optional index_dtype_override{std::nullopt}; // Add conversion to make std::optional compatible with FFI. @@ -824,7 +824,7 @@ PrimFunc GenerateAndCompletePrimFunc(const ffi::Array& arg_tir_var_li /*ret_type=*/VoidType(), /*buffer_map=*/std::move(buffer_map)), {{"global_symbol", ffi::String("main")}, {"tir.noalias", true}}); - const auto fcomplete = tvm::ffi::Function::GetGlobal("script.Complete"); + const auto fcomplete = tvm::ffi::Function::GetGlobal("tvm.script.Complete"); ICHECK(fcomplete.has_value()); func = (*fcomplete)(std::move(func), info->root_alloc).cast(); return func; diff --git a/src/te/operation/extern_op.cc b/src/te/operation/extern_op.cc index def64595412d..cdeba29c6810 100644 --- a/src/te/operation/extern_op.cc +++ b/src/te/operation/extern_op.cc @@ -77,7 +77,7 @@ ExternOp::ExternOp(std::string name, std::string tag, ffi::Map> attrs, ffi::Array inputs, ffi::Array input_placeholders, ffi::Array output_placeholders, Stmt body) { diff --git a/src/te/operation/graph.cc b/src/te/operation/graph.cc index bddea5f7f2d4..b67838040b45 100644 --- a/src/te/operation/graph.cc +++ b/src/te/operation/graph.cc @@ -84,8 +84,8 @@ ffi::Array PostDFSOrder(const ffi::Array& roots, const Rea TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("schedule.CreateReadGraph", CreateReadGraph) - .def("schedule.PostDFSOrder", [](const ffi::Array& roots, const ReadGraph& g) { + .def("tvm.schedule.CreateReadGraph", CreateReadGraph) + .def("tvm.schedule.PostDFSOrder", [](const ffi::Array& roots, const ReadGraph& g) { return PostDFSOrder(roots, g); }); } diff --git a/src/te/operation/placeholder_op.cc b/src/te/operation/placeholder_op.cc index 6c7d60841c0f..e967fab05a30 100644 --- a/src/te/operation/placeholder_op.cc +++ b/src/te/operation/placeholder_op.cc @@ -64,19 +64,20 @@ Tensor placeholder(ffi::Array shape, DataType dtype, std::string name) TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("te.Placeholder", [](ffi::Variant> shape_arg, - DataType dtype, std::string name) { - auto shape = [&]() -> ffi::Array { - if (auto arg_expr = shape_arg.as()) { - return {arg_expr.value()}; - } else if (auto arg_array = shape_arg.as>()) { - return arg_array.value(); - } else { - LOG(FATAL) << "Variant did not contain either allowed type"; - } - }(); - return placeholder(shape, dtype, name); - }); + refl::GlobalDef().def( + "tvm.te.Placeholder", + [](ffi::Variant> shape_arg, DataType dtype, std::string name) { + auto shape = [&]() -> ffi::Array { + if (auto arg_expr = shape_arg.as()) { + return {arg_expr.value()}; + } else if (auto arg_array = shape_arg.as>()) { + return arg_array.value(); + } else { + LOG(FATAL) << "Variant did not contain either allowed type"; + } + }(); + return placeholder(shape, dtype, name); + }); } ffi::Array PlaceholderOpNode::InputTensors() const { return {}; } diff --git a/src/te/operation/scan_op.cc b/src/te/operation/scan_op.cc index fbc65e8a61fb..cdd23b75b185 100644 --- a/src/te/operation/scan_op.cc +++ b/src/te/operation/scan_op.cc @@ -103,7 +103,7 @@ ScanOp::ScanOp(std::string name, std::string tag, TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef().def( - "te.ScanOp", + "tvm.te.ScanOp", [](std::string name, std::string tag, ffi::Optional> attrs, IterVar axis, ffi::Array init, ffi::Array update, ffi::Array state_placeholder, ffi::Array inputs) { diff --git a/src/te/tensor.cc b/src/te/tensor.cc index 8035564b27f4..413d8419b3ea 100644 --- a/src/te/tensor.cc +++ b/src/te/tensor.cc @@ -115,10 +115,9 @@ Tensor::Tensor(ffi::Array shape, DataType dtype, Operation op, int val TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def( - "te.Tensor", [](ffi::Array shape, DataType dtype, Operation op, int value_index) { - return Tensor(shape, dtype, op, value_index); - }); + refl::GlobalDef().def("tvm.te.Tensor", + [](ffi::Array shape, DataType dtype, Operation op, + int value_index) { return Tensor(shape, dtype, op, value_index); }); } TVM_STATIC_IR_FUNCTOR(ReprPrinter, vtable) @@ -131,15 +130,15 @@ TVM_STATIC_IR_FUNCTOR(ReprPrinter, vtable) TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def_method("te.TensorEqual", &Tensor::operator==) - .def("te.TensorHash", + .def_method("tvm.te.TensorEqual", &Tensor::operator==) + .def("tvm.te.TensorHash", [](Tensor tensor) -> int64_t { return static_cast(std::hash()(tensor)); }) - .def("te.OpGetOutput", + .def("tvm.te.OpGetOutput", [](Operation op, int64_t output) { return op.output(static_cast(output)); }) - .def_method("te.OpNumOutputs", &OperationNode::num_outputs) - .def_method("te.OpInputTensors", &OperationNode::InputTensors); + .def_method("tvm.te.OpNumOutputs", &OperationNode::num_outputs) + .def_method("tvm.te.OpInputTensors", &OperationNode::InputTensors); } } // namespace te diff --git a/src/tir/analysis/block_access_region_detector.cc b/src/tir/analysis/block_access_region_detector.cc index aca06ad595bc..1c34e3903c61 100644 --- a/src/tir/analysis/block_access_region_detector.cc +++ b/src/tir/analysis/block_access_region_detector.cc @@ -414,8 +414,8 @@ ffi::Array> GetBlockReadWriteRegion( TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("tir.analysis.GetBlockAccessRegion", GetBlockAccessRegion) - .def("tir.analysis.GetBlockReadWriteRegion", GetBlockReadWriteRegion); + .def("tvm.tir.analysis.GetBlockAccessRegion", GetBlockAccessRegion) + .def("tvm.tir.analysis.GetBlockReadWriteRegion", GetBlockReadWriteRegion); } } // namespace tir diff --git a/src/tir/analysis/buffer_access_lca_detector.cc b/src/tir/analysis/buffer_access_lca_detector.cc index 67e8bda6f670..da756fa02319 100644 --- a/src/tir/analysis/buffer_access_lca_detector.cc +++ b/src/tir/analysis/buffer_access_lca_detector.cc @@ -349,7 +349,7 @@ ffi::Map> DetectBufferAccessLCA(const PrimFunc& func TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.analysis.detect_buffer_access_lca", DetectBufferAccessLCA); + refl::GlobalDef().def("tvm.tir.analysis.detect_buffer_access_lca", DetectBufferAccessLCA); } } // namespace tir } // namespace tvm diff --git a/src/tir/analysis/calculate_allocated_memory.cc b/src/tir/analysis/calculate_allocated_memory.cc index 557f42c5ba10..fb156b3acc90 100644 --- a/src/tir/analysis/calculate_allocated_memory.cc +++ b/src/tir/analysis/calculate_allocated_memory.cc @@ -102,7 +102,7 @@ tvm::ffi::Map > CalculateAlloca TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef().def( - "tir.analysis.calculate_allocated_bytes", + "tvm.tir.analysis.calculate_allocated_bytes", [](ObjectRef obj) -> tvm::ffi::Map > { if (auto func = obj.as()) { return CalculateAllocatedBytes(func.value()); @@ -164,7 +164,7 @@ ffi::Array GetVTCMCompactionPasses() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.analysis.get_vtcm_compaction_passes", + refl::GlobalDef().def("tvm.tir.analysis.get_vtcm_compaction_passes", []() { return GetVTCMCompactionPasses(); }); } @@ -202,7 +202,7 @@ Pass VerifyVTCMLimit(ffi::Optional default_target) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.transform.VerifyVTCMLimit", VerifyVTCMLimit); + refl::GlobalDef().def("tvm.tir.transform.VerifyVTCMLimit", VerifyVTCMLimit); } } // namespace transform diff --git a/src/tir/analysis/deep_equal.cc b/src/tir/analysis/deep_equal.cc index 60a3e0d448d2..324ed8a934a5 100644 --- a/src/tir/analysis/deep_equal.cc +++ b/src/tir/analysis/deep_equal.cc @@ -199,7 +199,7 @@ bool ExprDeepEqual::operator()(const PrimExpr& lhs, const PrimExpr& rhs) const { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef().def( - "tir.analysis.expr_deep_equal", + "tvm.tir.analysis.expr_deep_equal", [](const PrimExpr& lhs, const PrimExpr& rhs) { return ExprDeepEqual()(lhs, rhs); }); } diff --git a/src/tir/analysis/estimate_flops.cc b/src/tir/analysis/estimate_flops.cc index 3fe33cdf2af2..6adb964a102c 100644 --- a/src/tir/analysis/estimate_flops.cc +++ b/src/tir/analysis/estimate_flops.cc @@ -259,7 +259,7 @@ double EstimateTIRFlops(const IRModule& mod) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.analysis.EstimateTIRFlops", [](ObjectRef obj) -> double { + refl::GlobalDef().def("tvm.tir.analysis.EstimateTIRFlops", [](ObjectRef obj) -> double { if (auto mod = obj.as()) { return EstimateTIRFlops(mod.value()); } else if (auto stmt = obj.as()) { diff --git a/src/tir/analysis/identify_memcpy.cc b/src/tir/analysis/identify_memcpy.cc index 71f92900d892..d9470fb3d3e6 100644 --- a/src/tir/analysis/identify_memcpy.cc +++ b/src/tir/analysis/identify_memcpy.cc @@ -285,7 +285,7 @@ std::optional IdentifyMemCpy(const For& loop, arith::Analyzer* an // Expose the IdentifyMemCpy functionality to Python API for purpose of unit testing. TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.analysis._identify_memcpy", [](const Stmt& stmt) { + refl::GlobalDef().def("tvm.tir.analysis._identify_memcpy", [](const Stmt& stmt) { ffi::Array output; struct Visitor : arith::IRVisitorWithAnalyzer { diff --git a/src/tir/analysis/is_pure_function.cc b/src/tir/analysis/is_pure_function.cc index a6a3fc4bc7f3..8ddb4f849980 100644 --- a/src/tir/analysis/is_pure_function.cc +++ b/src/tir/analysis/is_pure_function.cc @@ -96,7 +96,7 @@ bool IsPureFunction(const PrimFunc& func, bool assert_on_error) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.analysis.is_pure_function", IsPureFunction); + refl::GlobalDef().def("tvm.tir.analysis.is_pure_function", IsPureFunction); } } // namespace tir diff --git a/src/tir/analysis/oob_checker.cc b/src/tir/analysis/oob_checker.cc index 06deb7934ad0..f0d162e92572 100644 --- a/src/tir/analysis/oob_checker.cc +++ b/src/tir/analysis/oob_checker.cc @@ -121,12 +121,12 @@ transform::Pass OOBChecker() { } return func; }; - return transform::CreatePrimFuncPass(pass_func, 0, "tir.analysis.OOBChecker", {}); + return transform::CreatePrimFuncPass(pass_func, 0, "tvm.tir.analysis.OOBChecker", {}); } TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.analysis.OOBChecker", OOBChecker); + refl::GlobalDef().def("tvm.tir.analysis.OOBChecker", OOBChecker); } } // namespace transform } // namespace tir diff --git a/src/tir/analysis/stmt_finding.cc b/src/tir/analysis/stmt_finding.cc index 9f6f4da7eaf3..ef9eb85ecfd6 100644 --- a/src/tir/analysis/stmt_finding.cc +++ b/src/tir/analysis/stmt_finding.cc @@ -142,7 +142,7 @@ const BlockNode* FindAnchorBlock(const IRModule& mod) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.analysis.find_anchor_block", [](const IRModule& mod) { + refl::GlobalDef().def("tvm.tir.analysis.find_anchor_block", [](const IRModule& mod) { auto ret = FindAnchorBlock(mod); if (ret) { return ffi::Optional(ffi::GetRef(ret)); diff --git a/src/tir/analysis/var_use_def_analysis.cc b/src/tir/analysis/var_use_def_analysis.cc index becae607fb39..fa7c2c1b2ebc 100644 --- a/src/tir/analysis/var_use_def_analysis.cc +++ b/src/tir/analysis/var_use_def_analysis.cc @@ -204,7 +204,7 @@ ffi::Array UndefinedVars(const PrimExpr& expr, const ffi::Array& args) TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef().def_packed( - "tir.analysis.UndefinedVars", [](ffi::PackedArgs args, ffi::Any* rv) { + "tvm.tir.analysis.UndefinedVars", [](ffi::PackedArgs args, ffi::Any* rv) { if (auto opt_stmt = args[0].as()) { *rv = UndefinedVars(opt_stmt.value(), args[1].cast>()); } else if (auto opt_expr = args[0].as()) { diff --git a/src/tir/analysis/verify_gpu_code.cc b/src/tir/analysis/verify_gpu_code.cc index e0273069cc46..ea3f36b00ab1 100644 --- a/src/tir/analysis/verify_gpu_code.cc +++ b/src/tir/analysis/verify_gpu_code.cc @@ -326,7 +326,7 @@ bool VerifyGPUCode(const PrimFunc& func, ffi::Map constra TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.analysis.verify_gpu_code", VerifyGPUCode); + refl::GlobalDef().def("tvm.tir.analysis.verify_gpu_code", VerifyGPUCode); } namespace transform { @@ -354,7 +354,7 @@ Pass VerifyGPUCode(ffi::Map constraints) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.transform.VerifyGPUCode", VerifyGPUCode); + refl::GlobalDef().def("tvm.tir.transform.VerifyGPUCode", VerifyGPUCode); } } // namespace transform diff --git a/src/tir/analysis/verify_memory.cc b/src/tir/analysis/verify_memory.cc index a82de34716c8..25d8ad2e87cf 100644 --- a/src/tir/analysis/verify_memory.cc +++ b/src/tir/analysis/verify_memory.cc @@ -189,7 +189,7 @@ bool VerifyMemory(const PrimFunc& func) { return VerifyMemory_(func).size() == 0 TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.analysis.verify_memory", VerifyMemory); + refl::GlobalDef().def("tvm.tir.analysis.verify_memory", VerifyMemory); } namespace transform { @@ -217,7 +217,7 @@ Pass VerifyMemory() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.transform.VerifyMemory", VerifyMemory); + refl::GlobalDef().def("tvm.tir.transform.VerifyMemory", VerifyMemory); } } // namespace transform diff --git a/src/tir/analysis/verify_ssa.cc b/src/tir/analysis/verify_ssa.cc index eafe28bd63a9..66adddcd2f67 100644 --- a/src/tir/analysis/verify_ssa.cc +++ b/src/tir/analysis/verify_ssa.cc @@ -142,7 +142,7 @@ bool VerifySSA(const PrimFunc& func) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.analysis.verify_ssa", VerifySSA); + refl::GlobalDef().def("tvm.tir.analysis.verify_ssa", VerifySSA); } namespace transform { @@ -161,7 +161,7 @@ Pass VerifySSA() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.transform.VerifySSA", VerifySSA); + refl::GlobalDef().def("tvm.tir.transform.VerifySSA", VerifySSA); } } // namespace transform diff --git a/src/tir/analysis/verify_well_formed.cc b/src/tir/analysis/verify_well_formed.cc index c10931d1bd10..d3600d92d0bd 100644 --- a/src/tir/analysis/verify_well_formed.cc +++ b/src/tir/analysis/verify_well_formed.cc @@ -378,8 +378,8 @@ bool VerifyWellFormed(const IRModule& mod, bool assert_mode) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.analysis.VerifyWellFormed", [](const ObjectRef& obj, - bool assert_mode) { + refl::GlobalDef().def("tvm.tir.analysis.VerifyWellFormed", [](const ObjectRef& obj, + bool assert_mode) { if (auto opt = obj.as()) { return VerifyWellFormed(opt.value(), assert_mode); } else if (auto opt = obj.as()) { diff --git a/src/tir/ir/block_dependence_info.cc b/src/tir/ir/block_dependence_info.cc index 3cda278d0a71..b42f78ebd992 100644 --- a/src/tir/ir/block_dependence_info.cc +++ b/src/tir/ir/block_dependence_info.cc @@ -90,10 +90,10 @@ BlockDependenceInfo::BlockDependenceInfo(IRModule mod) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("tir.BlockDependenceInfo", + .def("tvm.tir.BlockDependenceInfo", [](IRModule mod) -> BlockDependenceInfo { return BlockDependenceInfo(mod); }) .def_method("tir.BlockDependenceInfoGetBlockScope", &BlockDependenceInfoNode::GetBlockScope) - .def("tir.BlockDependenceInfoGetSRef", + .def("tvm.tir.BlockDependenceInfoGetSRef", [](BlockDependenceInfo self, Stmt stmt) -> ffi::Optional { auto it = self->stmt2ref.find(stmt.get()); return it != self->stmt2ref.end() ? it->second : ffi::Optional(std::nullopt); diff --git a/src/tir/ir/block_scope.cc b/src/tir/ir/block_scope.cc index 676f162076ce..0b761303462c 100644 --- a/src/tir/ir/block_scope.cc +++ b/src/tir/ir/block_scope.cc @@ -196,16 +196,16 @@ void SRefTreeCreator::VisitStmt_(const SeqStmtNode* seq_stmt) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("tir.StmtSRefStmt", + .def("tvm.tir.StmtSRefStmt", [](StmtSRef sref) -> ffi::Optional { return ffi::GetRef>(sref->stmt); }) - .def("tir.StmtSRefParent", + .def("tvm.tir.StmtSRefParent", [](StmtSRef sref) -> ffi::Optional { return ffi::GetRef>(sref->parent); }) - .def("tir.StmtSRefRootMark", StmtSRef::RootMark) - .def("tir.StmtSRefInlineMark", StmtSRef::InlineMark) + .def("tvm.tir.StmtSRefRootMark", StmtSRef::RootMark) + .def("tvm.tir.StmtSRefInlineMark", StmtSRef::InlineMark) .def_method("tir.BlockScopeGetDepsBySrc", &BlockScopeNode::GetDepsBySrc) .def_method("tir.BlockScopeGetDepsByDst", &BlockScopeNode::GetDepsByDst); } diff --git a/src/tir/ir/buffer.cc b/src/tir/ir/buffer.cc index 87b9a2628cc7..6ae57399a7d5 100644 --- a/src/tir/ir/buffer.cc +++ b/src/tir/ir/buffer.cc @@ -647,7 +647,7 @@ tir::Buffer BufferWithOffsetAlignment(ffi::Array shape, DataType dtype TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def_packed("tir.Buffer", + .def_packed("tvm.tir.Buffer", [](ffi::PackedArgs args, ffi::Any* ret) { ICHECK_EQ(args.size(), 11); auto buffer_type = args[8].cast(); diff --git a/src/tir/ir/data_layout.cc b/src/tir/ir/data_layout.cc index 75f9bb50d15e..dd1ab72413c0 100644 --- a/src/tir/ir/data_layout.cc +++ b/src/tir/ir/data_layout.cc @@ -433,22 +433,22 @@ TVM_STATIC_IR_FUNCTOR(ReprPrinter, vtable) TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("tir.Layout", [](std::string name, DataType dtype) { return Layout(name, dtype); }) - .def("tir.LayoutIndexOf", + .def("tvm.tir.Layout", [](std::string name, DataType dtype) { return Layout(name, dtype); }) + .def("tvm.tir.LayoutIndexOf", [](Layout layout, std::string axis) -> int { return layout.IndexOf(LayoutAxis::Get(axis)); }) - .def("tir.LayoutFactorOf", + .def("tvm.tir.LayoutFactorOf", [](Layout layout, std::string axis) -> int { return layout.FactorOf(LayoutAxis::Get(axis)); }) - .def("tir.LayoutNdim", [](Layout layout) -> int { return layout.ndim(); }) - .def("tir.LayoutGetItem", + .def("tvm.tir.LayoutNdim", [](Layout layout) -> int { return layout.ndim(); }) + .def("tvm.tir.LayoutGetItem", [](Layout layout, int idx) -> std::string { const LayoutAxis& axis = layout[idx]; return axis.name(); }) - .def("tir.BijectiveLayout", + .def("tvm.tir.BijectiveLayout", [](Layout src_layout, Layout dst_layout) -> BijectiveLayout { return BijectiveLayout(src_layout, dst_layout); }) diff --git a/src/tir/ir/expr.cc b/src/tir/ir/expr.cc index 5eee4ffd8bd5..356cb1c8c964 100644 --- a/src/tir/ir/expr.cc +++ b/src/tir/ir/expr.cc @@ -82,7 +82,7 @@ TVM_FFI_STATIC_INIT_BLOCK() { */ TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.convert", + refl::GlobalDef().def("tvm.tir.convert", [](ffi::Variant> expr) { return expr; }); } @@ -168,7 +168,7 @@ Var Var::copy_with_dtype(DataType dtype) const { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.Var", [](ffi::String name_hint, ffi::AnyView type, Span span) { + refl::GlobalDef().def("tvm.tir.Var", [](ffi::String name_hint, ffi::AnyView type, Span span) { if (type.as()) { return Var(name_hint, type.cast(), span); } else { @@ -198,7 +198,7 @@ SizeVar::SizeVar(ffi::String name_hint, Type type_annotation, Span span) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.SizeVar", + refl::GlobalDef().def("tvm.tir.SizeVar", [](ffi::String s, DataType t, Span span) { return SizeVar(s, t, span); }); } @@ -225,7 +225,7 @@ IterVar::IterVar(Range dom, Var var, IterVarType t, ffi::String thread_tag, Span TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef().def( - "tir.IterVar", [](Range dom, Var var, int iter_type, ffi::String thread_tag, Span span) { + "tvm.tir.IterVar", [](Range dom, Var var, int iter_type, ffi::String thread_tag, Span span) { return IterVar(dom, var, static_cast(iter_type), thread_tag, span); }); } @@ -241,7 +241,7 @@ StringImm::StringImm(ffi::String value, Span span) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.StringImm", + refl::GlobalDef().def("tvm.tir.StringImm", [](ffi::String value, Span span) { return StringImm(value, span); }); } @@ -259,7 +259,7 @@ Cast::Cast(DataType t, PrimExpr value, Span span) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.Cast", [](DataType dtype, PrimExpr value, Span span) { + refl::GlobalDef().def("tvm.tir.Cast", [](DataType dtype, PrimExpr value, Span span) { return Cast(dtype, value, span); }); } @@ -269,7 +269,7 @@ TVM_DEFINE_BINOP_CONSTRUCTOR(Add); TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.Add", + refl::GlobalDef().def("tvm.tir.Add", [](PrimExpr a, PrimExpr b, Span span) { return Add(a, b, span); }); } @@ -278,7 +278,7 @@ TVM_DEFINE_BINOP_CONSTRUCTOR(Sub); TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.Sub", + refl::GlobalDef().def("tvm.tir.Sub", [](PrimExpr a, PrimExpr b, Span span) { return Sub(a, b, span); }); } @@ -287,7 +287,7 @@ TVM_DEFINE_BINOP_CONSTRUCTOR(Mul); TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.Mul", + refl::GlobalDef().def("tvm.tir.Mul", [](PrimExpr a, PrimExpr b, Span span) { return Mul(a, b, span); }); } @@ -296,7 +296,7 @@ TVM_DEFINE_BINOP_CONSTRUCTOR(Div); TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.Div", + refl::GlobalDef().def("tvm.tir.Div", [](PrimExpr a, PrimExpr b, Span span) { return Div(a, b, span); }); } @@ -305,7 +305,7 @@ TVM_DEFINE_BINOP_CONSTRUCTOR(Mod); TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.Mod", + refl::GlobalDef().def("tvm.tir.Mod", [](PrimExpr a, PrimExpr b, Span span) { return Mod(a, b, span); }); } @@ -314,7 +314,7 @@ TVM_DEFINE_BINOP_CONSTRUCTOR(FloorDiv); TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.FloorDiv", + refl::GlobalDef().def("tvm.tir.FloorDiv", [](PrimExpr a, PrimExpr b, Span span) { return FloorDiv(a, b, span); }); } @@ -323,7 +323,7 @@ TVM_DEFINE_BINOP_CONSTRUCTOR(FloorMod); TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.FloorMod", + refl::GlobalDef().def("tvm.tir.FloorMod", [](PrimExpr a, PrimExpr b, Span span) { return FloorMod(a, b, span); }); } @@ -332,7 +332,7 @@ TVM_DEFINE_BINOP_CONSTRUCTOR(Min); TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.Min", + refl::GlobalDef().def("tvm.tir.Min", [](PrimExpr a, PrimExpr b, Span span) { return Min(a, b, span); }); } @@ -341,7 +341,7 @@ TVM_DEFINE_BINOP_CONSTRUCTOR(Max); TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.Max", + refl::GlobalDef().def("tvm.tir.Max", [](PrimExpr a, PrimExpr b, Span span) { return Max(a, b, span); }); } @@ -350,7 +350,8 @@ TVM_DEFINE_CMPOP_CONSTRUCTOR(EQ); TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.EQ", [](PrimExpr a, PrimExpr b, Span span) { return EQ(a, b, span); }); + refl::GlobalDef().def("tvm.tir.EQ", + [](PrimExpr a, PrimExpr b, Span span) { return EQ(a, b, span); }); } // NE @@ -358,7 +359,8 @@ TVM_DEFINE_CMPOP_CONSTRUCTOR(NE); TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.NE", [](PrimExpr a, PrimExpr b, Span span) { return NE(a, b, span); }); + refl::GlobalDef().def("tvm.tir.NE", + [](PrimExpr a, PrimExpr b, Span span) { return NE(a, b, span); }); } // LT @@ -366,7 +368,8 @@ TVM_DEFINE_CMPOP_CONSTRUCTOR(LT); TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.LT", [](PrimExpr a, PrimExpr b, Span span) { return LT(a, b, span); }); + refl::GlobalDef().def("tvm.tir.LT", + [](PrimExpr a, PrimExpr b, Span span) { return LT(a, b, span); }); } // LE @@ -374,7 +377,8 @@ TVM_DEFINE_CMPOP_CONSTRUCTOR(LE); TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.LE", [](PrimExpr a, PrimExpr b, Span span) { return LE(a, b, span); }); + refl::GlobalDef().def("tvm.tir.LE", + [](PrimExpr a, PrimExpr b, Span span) { return LE(a, b, span); }); } // GT @@ -382,7 +386,8 @@ TVM_DEFINE_CMPOP_CONSTRUCTOR(GT); TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.GT", [](PrimExpr a, PrimExpr b, Span span) { return GT(a, b, span); }); + refl::GlobalDef().def("tvm.tir.GT", + [](PrimExpr a, PrimExpr b, Span span) { return GT(a, b, span); }); } // GE @@ -390,7 +395,8 @@ TVM_DEFINE_CMPOP_CONSTRUCTOR(GE); TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.GE", [](PrimExpr a, PrimExpr b, Span span) { return GE(a, b, span); }); + refl::GlobalDef().def("tvm.tir.GE", + [](PrimExpr a, PrimExpr b, Span span) { return GE(a, b, span); }); } // And @@ -412,7 +418,7 @@ And::And(PrimExpr a, PrimExpr b, Span span) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.And", + refl::GlobalDef().def("tvm.tir.And", [](PrimExpr a, PrimExpr b, Span span) { return And(a, b, span); }); } @@ -435,7 +441,8 @@ Or::Or(PrimExpr a, PrimExpr b, Span span) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.Or", [](PrimExpr a, PrimExpr b, Span span) { return Or(a, b, span); }); + refl::GlobalDef().def("tvm.tir.Or", + [](PrimExpr a, PrimExpr b, Span span) { return Or(a, b, span); }); } // Not @@ -453,7 +460,7 @@ Not::Not(PrimExpr a, Span span) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.Not", [](PrimExpr a, Span span) { return Not(a, span); }); + refl::GlobalDef().def("tvm.tir.Not", [](PrimExpr a, Span span) { return Not(a, span); }); } // Select @@ -480,10 +487,9 @@ Select::Select(PrimExpr condition, PrimExpr true_value, PrimExpr false_value, Sp TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def( - "tir.Select", [](PrimExpr condition, PrimExpr true_value, PrimExpr false_value, Span span) { - return Select(condition, true_value, false_value, span); - }); + refl::GlobalDef().def("tvm.tir.Select", + [](PrimExpr condition, PrimExpr true_value, PrimExpr false_value, + Span span) { return Select(condition, true_value, false_value, span); }); } // Ramp @@ -520,9 +526,8 @@ Ramp::Ramp(PrimExpr base, PrimExpr stride, PrimExpr lanes, Span span) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.Ramp", [](PrimExpr base, PrimExpr stride, PrimExpr lanes, Span span) { - return Ramp(base, stride, lanes, span); - }); + refl::GlobalDef().def("tvm.tir.Ramp", [](PrimExpr base, PrimExpr stride, PrimExpr lanes, + Span span) { return Ramp(base, stride, lanes, span); }); } // Broadcast @@ -553,7 +558,7 @@ Broadcast::Broadcast(PrimExpr value, PrimExpr lanes, Span span) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.Broadcast", [](PrimExpr value, PrimExpr lanes, Span span) { + refl::GlobalDef().def("tvm.tir.Broadcast", [](PrimExpr value, PrimExpr lanes, Span span) { return Broadcast(value, lanes, span); }); } @@ -575,7 +580,7 @@ Let::Let(Var var, PrimExpr value, PrimExpr body, Span span) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.Let", [](Var var, PrimExpr value, PrimExpr body, Span span) { + refl::GlobalDef().def("tvm.tir.Let", [](Var var, PrimExpr value, PrimExpr body, Span span) { return Let(var, value, body, span); }); } @@ -597,7 +602,7 @@ Call::Call(DataType dtype, RelaxExpr op, ffi::Array args, Span span) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef().def( - "tir.Call", + "tvm.tir.Call", [](ffi::Optional dtype, RelaxExpr op, ffi::Array> args, Span span) { @@ -673,7 +678,7 @@ PrimExpr Shuffle::ExtractElement(PrimExpr vector, int index, Span span) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.Shuffle", + refl::GlobalDef().def("tvm.tir.Shuffle", [](ffi::Array vectors, ffi::Array indices, Span span) { return Shuffle(vectors, indices, span); }); @@ -736,7 +741,7 @@ ffi::Array CommReducerNode::operator()(ffi::Array a, TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("tir.CommReducer", + .def("tvm.tir.CommReducer", [](ffi::Array lhs, ffi::Array rhs, ffi::Array result, ffi::Array identity_element, Span span) { return CommReducer(lhs, rhs, result, identity_element, span); }) @@ -781,10 +786,10 @@ Reduce::Reduce(CommReducer combiner, ffi::Array source, ffi::Array source, ffi::Array axis, - PrimExpr condition, int value_index, ffi::Array init, Span span) { - return Reduce(combiner, source, axis, condition, value_index, init, span); - }); + "tvm.tir.Reduce", + [](CommReducer combiner, ffi::Array source, ffi::Array axis, + PrimExpr condition, int value_index, ffi::Array init, + Span span) { return Reduce(combiner, source, axis, condition, value_index, init, span); }); } // BufferLoad @@ -856,8 +861,8 @@ BufferLoad::BufferLoad(Buffer buffer, ffi::Array indices, TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.BufferLoad", [](Buffer buffer, ffi::Array indices, - ffi::Optional predicate, Span span) { + refl::GlobalDef().def("tvm.tir.BufferLoad", [](Buffer buffer, ffi::Array indices, + ffi::Optional predicate, Span span) { return BufferLoad(buffer, indices, predicate, span); }); } @@ -874,7 +879,7 @@ ProducerLoad::ProducerLoad(DataProducer producer, ffi::Array indices, TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.ProducerLoad", + refl::GlobalDef().def("tvm.tir.ProducerLoad", [](DataProducer producer, ffi::Array indices, Span span) { return ProducerLoad(producer, indices, span); }); diff --git a/src/tir/ir/function.cc b/src/tir/ir/function.cc index 9daf09695086..058b18688ea2 100644 --- a/src/tir/ir/function.cc +++ b/src/tir/ir/function.cc @@ -160,16 +160,16 @@ ffi::Optional TensorIntrin::Get(ffi::String name, bool allow_missi TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("tir.PrimFunc", + .def("tvm.tir.PrimFunc", [](ffi::Array params, Stmt body, Type ret_type, ffi::Map buffer_map, DictAttrs attrs, Span span) { return PrimFunc(params, body, ret_type, buffer_map, attrs, span); }) - .def("tir.TensorIntrin", + .def("tvm.tir.TensorIntrin", [](PrimFunc desc_func, PrimFunc intrin_func) { return TensorIntrin(desc_func, intrin_func); }) - .def("tir.TensorIntrinRegister", TensorIntrin::Register) - .def("tir.TensorIntrinGet", TensorIntrin::Get); + .def("tvm.tir.TensorIntrinRegister", TensorIntrin::Register) + .def("tvm.tir.TensorIntrinGet", TensorIntrin::Get); } } // namespace tir diff --git a/src/tir/ir/index_map.cc b/src/tir/ir/index_map.cc index cdd1d8ad56d8..07e35ced185b 100644 --- a/src/tir/ir/index_map.cc +++ b/src/tir/ir/index_map.cc @@ -426,29 +426,29 @@ IndexMap Substitute(const IndexMap& index_map, TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("tir.IndexMap", + .def("tvm.tir.IndexMap", [](ffi::Array initial_indices, ffi::Array final_indices, ffi::Optional inverse_index_map) { return IndexMap(initial_indices, final_indices, inverse_index_map); }) - .def("tir.IndexMapMapIndices", + .def("tvm.tir.IndexMapMapIndices", [](IndexMap map, ffi::Array indices) { arith::Analyzer analyzer; return map->MapIndices(indices, &analyzer); }) - .def("tir.IndexMapMapShape", + .def("tvm.tir.IndexMapMapShape", [](IndexMap map, ffi::Array shape) { arith::Analyzer analyzer; return map->MapShape(shape, &analyzer); }) - .def("tir.IndexMapInverse", + .def("tvm.tir.IndexMapInverse", [](IndexMap map, ffi::Array initial_ranges) { arith::Analyzer analyzer; return map.Inverse(initial_ranges, &analyzer); }) - .def("tir.IndexMapMapTensor", + .def("tvm.tir.IndexMapMapTensor", [](IndexMap map, runtime::Tensor arr) { return map->MapTensor(arr); }) - .def("tir.IndexMapNonSurjectiveInverse", + .def("tvm.tir.IndexMapNonSurjectiveInverse", [](IndexMap forward, ffi::Array initial_ranges) { arith::Analyzer analyzer; auto result = forward.NonSurjectiveInverse(initial_ranges, &analyzer); diff --git a/src/tir/ir/py_functor.cc b/src/tir/ir/py_functor.cc index 61bdfb15e70e..69acbd0bcbdb 100644 --- a/src/tir/ir/py_functor.cc +++ b/src/tir/ir/py_functor.cc @@ -220,7 +220,7 @@ class PyStmtExprVisitorNode : public Object, public StmtExprVisitor { } static constexpr const bool _type_mutable = true; - TVM_FFI_DECLARE_OBJECT_INFO("tir.PyStmtExprVisitor", PyStmtExprVisitorNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO("tvm.tir.PyStmtExprVisitor", PyStmtExprVisitorNode, Object); private: // Statement functions @@ -587,7 +587,7 @@ class PyStmtExprMutatorNode : public Object, public StmtExprMutator { } static constexpr const bool _type_mutable = true; - TVM_FFI_DECLARE_OBJECT_INFO("tir.PyStmtExprMutator", PyStmtExprMutatorNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO("tvm.tir.PyStmtExprMutator", PyStmtExprMutatorNode, Object); private: // Statement functions @@ -836,21 +836,21 @@ TVM_FFI_STATIC_INIT_BLOCK() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("tir.MakePyStmtExprVisitor", PyStmtExprVisitor::MakePyStmtExprVisitor) - .def("tir.MakePyStmtExprMutator", PyStmtExprMutator::MakePyStmtExprMutator); + .def("tvm.tir.MakePyStmtExprVisitor", PyStmtExprVisitor::MakePyStmtExprVisitor) + .def("tvm.tir.MakePyStmtExprMutator", PyStmtExprMutator::MakePyStmtExprMutator); } // StmtExprVisitor TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("tir.PyStmtExprVisitorDefaultVisitExpr", + .def("tvm.tir.PyStmtExprVisitorDefaultVisitExpr", [](PyStmtExprVisitor visitor, const PrimExpr& expr) { visitor->DefaultVisitExpr(expr); }) - .def("tir.PyStmtExprVisitorDefaultVisitStmt", + .def("tvm.tir.PyStmtExprVisitorDefaultVisitStmt", [](PyStmtExprVisitor visitor, const Stmt& stmt) { visitor->DefaultVisitStmt(stmt); }) - .def("tir.PyStmtExprVisitorVisitStmt", + .def("tvm.tir.PyStmtExprVisitorVisitStmt", [](PyStmtExprVisitor visitor, const Stmt& stmt) { visitor->VisitStmt(stmt); }) - .def("tir.PyStmtExprVisitorVisitExpr", + .def("tvm.tir.PyStmtExprVisitorVisitExpr", [](PyStmtExprVisitor visitor, const PrimExpr& expr) { visitor->VisitExpr(expr); }); } @@ -858,17 +858,17 @@ TVM_FFI_STATIC_INIT_BLOCK() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("tir.PyStmtExprMutatorDefaultVisitExpr", + .def("tvm.tir.PyStmtExprMutatorDefaultVisitExpr", [](PyStmtExprMutator mutator, const PrimExpr& expr) { return mutator->DefaultVisitExpr(expr); }) - .def("tir.PyStmtExprMutatorDefaultVisitStmt", + .def("tvm.tir.PyStmtExprMutatorDefaultVisitStmt", [](PyStmtExprMutator mutator, const Stmt& stmt) { return mutator->DefaultVisitStmt(stmt); }) - .def("tir.PyStmtExprMutatorVisitExpr", + .def("tvm.tir.PyStmtExprMutatorVisitExpr", [](PyStmtExprMutator mutator, const PrimExpr& expr) { return mutator->VisitExpr(expr); }) - .def("tir.PyStmtExprMutatorVisitStmt", + .def("tvm.tir.PyStmtExprMutatorVisitStmt", [](PyStmtExprMutator mutator, const Stmt& stmt) { return mutator->VisitStmt(stmt); }); } diff --git a/src/tir/ir/script/script_complete.cc b/src/tir/ir/script/script_complete.cc index bf2b333f2501..89dad0a56a2e 100644 --- a/src/tir/ir/script/script_complete.cc +++ b/src/tir/ir/script/script_complete.cc @@ -164,7 +164,7 @@ PrimFunc ScriptComplete(PrimFunc func, const ffi::Array& root_allocates) TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("script.Complete", ScriptComplete); + refl::GlobalDef().def("tvm.script.Complete", ScriptComplete); } } // namespace tir diff --git a/src/tir/ir/specialize.cc b/src/tir/ir/specialize.cc index 083dd8dedf31..2aea57be2ae0 100644 --- a/src/tir/ir/specialize.cc +++ b/src/tir/ir/specialize.cc @@ -436,7 +436,7 @@ PrimFunc Specialize(PrimFunc func, const ffi::Map thread_binding, - ffi::Optional> annotations, - ffi::Optional step, Span span) { + refl::GlobalDef().def("tvm.tir.For", [](Var loop_var, PrimExpr min, PrimExpr extent, int kind, + Stmt body, ffi::Optional thread_binding, + ffi::Optional> annotations, + ffi::Optional step, Span span) { return For(loop_var, min, extent, static_cast(kind), body, thread_binding, annotations.value_or(ffi::Map()), step, span); }); @@ -237,7 +237,7 @@ While::While(PrimExpr condition, Stmt body, Span span) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.While", [](PrimExpr condition, Stmt body, Span span) { + refl::GlobalDef().def("tvm.tir.While", [](PrimExpr condition, Stmt body, Span span) { return While(condition, body, span); }); } @@ -289,7 +289,7 @@ int64_t AllocateNode::ConstantAllocationSize(const ffi::Array& extents TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef().def( - "tir.Allocate", + "tvm.tir.Allocate", [](Var buffer_var, DataType type, ffi::Array extents, PrimExpr condition, Stmt body, ffi::Map annotations, Span span) { return Allocate(buffer_var, type, extents, condition, body, annotations, span); @@ -352,7 +352,7 @@ int64_t AllocateConstNode::ConstantAllocationSize(const ffi::Array& ex TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef().def( - "tir.AllocateConst", + "tvm.tir.AllocateConst", [](Var buffer_var, DataType dtype, ffi::Array extents, ObjectRef data_or_idx, Stmt body, ffi::Optional> annotations, Span span) { return AllocateConst(buffer_var, dtype, extents, data_or_idx, body, @@ -371,7 +371,7 @@ DeclBuffer::DeclBuffer(Buffer buffer, Stmt body, Span span) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.DeclBuffer", [](Buffer buffer, Stmt body, Span span) { + refl::GlobalDef().def("tvm.tir.DeclBuffer", [](Buffer buffer, Stmt body, Span span) { return DeclBuffer(buffer, body, span); }); } @@ -405,8 +405,9 @@ SeqStmt::SeqStmt(ffi::Array seq, Span span) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def( - "tir.SeqStmt", [](ffi::Array seq, Span span) { return SeqStmt(std::move(seq), span); }); + refl::GlobalDef().def("tvm.tir.SeqStmt", [](ffi::Array seq, Span span) { + return SeqStmt(std::move(seq), span); + }); } // IfThenElse @@ -425,7 +426,7 @@ IfThenElse::IfThenElse(PrimExpr condition, Stmt then_case, ffi::Optional e TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.IfThenElse", + refl::GlobalDef().def("tvm.tir.IfThenElse", [](PrimExpr condition, Stmt then_case, Stmt else_case, Span span) { return IfThenElse(condition, then_case, else_case, span); }); @@ -443,7 +444,7 @@ Evaluate::Evaluate(PrimExpr value, Span span) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.Evaluate", + refl::GlobalDef().def("tvm.tir.Evaluate", [](PrimExpr value, Span span) { return Evaluate(value, span); }); } @@ -525,7 +526,7 @@ BufferStore::BufferStore(Buffer buffer, PrimExpr value, ffi::Array ind TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.BufferStore", + refl::GlobalDef().def("tvm.tir.BufferStore", [](Buffer buffer, PrimExpr value, ffi::Array indices, ffi::Optional predicate, Span span) { return BufferStore(buffer, value, indices, predicate, span); @@ -540,8 +541,8 @@ BufferRealize::BufferRealize(Buffer buffer, ffi::Array bounds, PrimExpr c TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.BufferRealize", [](Buffer buffer, ffi::Array bounds, - PrimExpr condition, Stmt body, Span span) { + refl::GlobalDef().def("tvm.tir.BufferRealize", [](Buffer buffer, ffi::Array bounds, + PrimExpr condition, Stmt body, Span span) { return BufferRealize(buffer, bounds, condition, body, span); }); } @@ -596,7 +597,7 @@ BufferRegion BufferRegion::FromPoint(Buffer buffer, ffi::Array indices TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.BufferRegion", [](Buffer buffer, ffi::Array region) { + refl::GlobalDef().def("tvm.tir.BufferRegion", [](Buffer buffer, ffi::Array region) { return BufferRegion(buffer, region); }); } @@ -654,7 +655,7 @@ MatchBufferRegion::MatchBufferRegion(Buffer buffer, BufferRegion source) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.MatchBufferRegion", [](Buffer buffer, BufferRegion source) { + refl::GlobalDef().def("tvm.tir.MatchBufferRegion", [](Buffer buffer, BufferRegion source) { return MatchBufferRegion(buffer, source); }); } @@ -681,7 +682,7 @@ Block::Block(ffi::Array iter_vars, ffi::Array reads, TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.Block", + refl::GlobalDef().def("tvm.tir.Block", [](ffi::Array iter_vars, ffi::Array reads, ffi::Array writes, ffi::String name_hint, Stmt body, ffi::Optional init, ffi::Array alloc_buffers, @@ -709,8 +710,8 @@ BlockRealize::BlockRealize(ffi::Array values, PrimExpr predicate, Bloc TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.BlockRealize", [](ffi::Array iter_values, PrimExpr predicate, - Block block, Span span) { + refl::GlobalDef().def("tvm.tir.BlockRealize", [](ffi::Array iter_values, + PrimExpr predicate, Block block, Span span) { return BlockRealize(iter_values, predicate, block, span); }); } diff --git a/src/tir/ir/stmt_functor.cc b/src/tir/ir/stmt_functor.cc index e6666cc63816..ae04bcd931e0 100644 --- a/src/tir/ir/stmt_functor.cc +++ b/src/tir/ir/stmt_functor.cc @@ -847,16 +847,16 @@ PrimExpr SubstituteWithDataTypeLegalization( TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("tir.IRTransform", IRTransform) - .def("tir.PostOrderVisit", + .def("tvm.tir.IRTransform", IRTransform) + .def("tvm.tir.PostOrderVisit", [](ObjectRef node, ffi::Function f) { tir::PostOrderVisit(node, [f](const ObjectRef& n) { f(n); }); }) - .def("tir.PreOrderVisit", + .def("tvm.tir.PreOrderVisit", [](ObjectRef node, ffi::Function f) { tir::PreOrderVisit(node, [f](const ObjectRef& n) { return f(n).cast(); }); }) - .def("tir.Substitute", [](ObjectRef node, ffi::Map vmap) -> ObjectRef { + .def("tvm.tir.Substitute", [](ObjectRef node, ffi::Map vmap) -> ObjectRef { if (node->IsInstance()) { return Substitute(Downcast(node), vmap); } else { diff --git a/src/tir/ir/transform.cc b/src/tir/ir/transform.cc index 68b494d41144..f1d9700255e9 100644 --- a/src/tir/ir/transform.cc +++ b/src/tir/ir/transform.cc @@ -82,7 +82,7 @@ class PrimFuncPassNode : public PassNode { * \brief Get the pass information/meta data. */ PassInfo Info() const override { return pass_info; } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tir.PrimFuncPass", PrimFuncPassNode, PassNode); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.tir.PrimFuncPass", PrimFuncPassNode, PassNode); }; class PrimFuncPass : public Pass { @@ -150,7 +150,7 @@ TVM_FFI_STATIC_INIT_BLOCK() { PrimFuncPassNode::RegisterReflection(); } TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef().def( - "tir.transform.CreatePrimFuncPass", + "tvm.tir.transform.CreatePrimFuncPass", [](ffi::TypedFunction, IRModule, PassContext)> pass_func, PassInfo pass_info) { auto wrapped_pass_func = [pass_func](PrimFunc func, IRModule mod, PassContext ctx) { diff --git a/src/tir/op/op.cc b/src/tir/op/op.cc index 51c0b64ed295..a3593f5e5a54 100644 --- a/src/tir/op/op.cc +++ b/src/tir/op/op.cc @@ -267,10 +267,10 @@ PrimExpr break_loop(Span span) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("tir.ret", ret) - .def("tir.thread_return", thread_return) - .def("tir.continue_loop", continue_loop) - .def("tir.break_loop", break_loop); + .def("tvm.tir.ret", ret) + .def("tvm.tir.thread_return", thread_return) + .def("tvm.tir.continue_loop", continue_loop) + .def("tvm.tir.break_loop", break_loop); }; // maximum and min limits @@ -839,7 +839,7 @@ PrimExpr bitwise_neg(PrimExpr a, Span span) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.bitwise_not", + refl::GlobalDef().def("tvm.tir.bitwise_not", [](PrimExpr a, Span span) { return bitwise_neg(a, span); }); } @@ -918,7 +918,7 @@ PrimExpr isnan(PrimExpr x, Span span) { if (fx) { return make_const(t, std::isnan(fx->value), fx->span); } - static auto op = Op::Get("tir.isnan"); + static auto op = Op::Get("tvm.tir.isnan"); if (x.dtype().bits() == 16) { return tir::Call(t, op, {cast(DataType::Float(32, t.lanes()), std::move(x), span)}, span); } else { @@ -1013,7 +1013,7 @@ PrimExpr floor(PrimExpr x, Span span) { using tir::FloatImmNode; const FloatImmNode* fx = x.as(); if (fx) return FloatImm(x.dtype(), std::floor(fx->value), fx->span); - static auto op = Op::Get("tir.floor"); + static auto op = Op::Get("tvm.tir.floor"); return tir::Call(x.dtype(), op, {x}, span); } @@ -1027,7 +1027,7 @@ PrimExpr ceil(PrimExpr x, Span span) { using tir::FloatImmNode; const FloatImmNode* fx = x.as(); if (fx) return FloatImm(x.dtype(), std::ceil(fx->value), fx->span); - static auto op = Op::Get("tir.ceil"); + static auto op = Op::Get("tvm.tir.ceil"); return tir::Call(x.dtype(), op, {x}, span); } @@ -1041,7 +1041,7 @@ PrimExpr round(PrimExpr x, Span span) { using tir::FloatImmNode; const FloatImmNode* fx = x.as(); if (fx) return FloatImm(x.dtype(), std::nearbyint(fx->value), fx->span); - static auto op = Op::Get("tir.round"); + static auto op = Op::Get("tvm.tir.round"); return tir::Call(x.dtype(), op, {x}, span); } @@ -1055,7 +1055,7 @@ PrimExpr nearbyint(PrimExpr x, Span span) { using tir::FloatImmNode; const FloatImmNode* fx = x.as(); if (fx) return FloatImm(x.dtype(), std::nearbyint(fx->value), fx->span); - static auto op = Op::Get("tir.nearbyint"); + static auto op = Op::Get("tvm.tir.nearbyint"); return tir::Call(x.dtype(), op, {x}, span); } @@ -1072,7 +1072,7 @@ PrimExpr trunc(PrimExpr x, Span span) { return FloatImm(x.dtype(), (fx->value < 0 ? std::ceil(fx->value) : std::floor(fx->value)), fx->span); } - static auto op = Op::Get("tir.trunc"); + static auto op = Op::Get("tvm.tir.trunc"); return tir::Call(x.dtype(), op, {x}, span); } @@ -1152,7 +1152,7 @@ TVM_TIR_REGISTER_OP("TVMBackendFreeWorkspace") TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def_packed("node._const", + .def_packed("tvm.node._const", [](ffi::PackedArgs args, ffi::Any* ret) { if (auto opt = args[0].try_cast()) { *ret = tir::make_const(args[1].cast(), *opt, args[2].cast()); @@ -1164,22 +1164,22 @@ TVM_FFI_STATIC_INIT_BLOCK() { << args[0].GetTypeKey(); } }) - .def("node.LargeUIntImm", LargeUIntImm) - .def("tir.min_value", min_value) - .def("tir.max_value", max_value) - .def("tir.infinity", infinity) - .def("tir.abs", tvm::abs) - .def("tir.likely", tvm::likely) - .def("tir.isnan", tvm::isnan) - .def("tir.isfinite", tvm::isfinite) - .def("tir.isinf", tvm::isinf) - .def("tir.floor", tvm::floor) - .def("tir.ceil", tvm::ceil) - .def("tir.round", tvm::round) - .def("tir.nearbyint", tvm::nearbyint) - .def("tir.trunc", tvm::trunc) - .def("tir._cast", tvm::cast) - .def("tir.reinterpret", tvm::reinterpret); + .def("tvm.node.LargeUIntImm", LargeUIntImm) + .def("tvm.tir.min_value", min_value) + .def("tvm.tir.max_value", max_value) + .def("tvm.tir.infinity", infinity) + .def("tvm.tir.abs", tvm::abs) + .def("tvm.tir.likely", tvm::likely) + .def("tvm.tir.isnan", tvm::isnan) + .def("tvm.tir.isfinite", tvm::isfinite) + .def("tvm.tir.isinf", tvm::isinf) + .def("tvm.tir.floor", tvm::floor) + .def("tvm.tir.ceil", tvm::ceil) + .def("tvm.tir.round", tvm::round) + .def("tvm.tir.nearbyint", tvm::nearbyint) + .def("tvm.tir.trunc", tvm::trunc) + .def("tvm.tir._cast", tvm::cast) + .def("tvm.tir.reinterpret", tvm::reinterpret); } // operator overloading, smarter than make @@ -1202,11 +1202,11 @@ TVM_FFI_STATIC_INIT_BLOCK() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("tir._OpIfThenElse", + .def("tvm.tir._OpIfThenElse", [](PrimExpr cond, PrimExpr true_value, PrimExpr false_value, Span span) { return if_then_else(cond, true_value, false_value, span); }) - .def("tir.const_true", [](DataType t, Span span) { return const_true(t.lanes(), span); }) + .def("tvm.tir.const_true", [](DataType t, Span span) { return const_true(t.lanes(), span); }) .DEF_MAKE_BINARY_OP(_OpAdd, add) .DEF_MAKE_BINARY_OP(_OpSub, sub) .DEF_MAKE_BINARY_OP(_OpMul, mul) diff --git a/src/tir/schedule/analysis.h b/src/tir/schedule/analysis.h index 1285c2c5f0ab..eb37ebb312df 100644 --- a/src/tir/schedule/analysis.h +++ b/src/tir/schedule/analysis.h @@ -754,7 +754,7 @@ class TensorizeInfoNode : public Object { .def_ro("desc_loop_indexer", &TensorizeInfoNode::desc_loop_indexer) .def_ro("block_iter_paddings", &TensorizeInfoNode::block_iter_paddings); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tir.schedule.TensorizeInfo", TensorizeInfoNode, Object); + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.tir.schedule.TensorizeInfo", TensorizeInfoNode, Object); }; class TensorizeInfo : public ObjectRef { @@ -804,7 +804,7 @@ class AutoTensorizeMappingInfoNode : public Object { .def_ro("lhs_iters", &AutoTensorizeMappingInfoNode::lhs_iters) .def_ro("rhs_iters", &AutoTensorizeMappingInfoNode::rhs_iters); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tir.schedule.AutoTensorizeMappingInfo", + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.tir.schedule.AutoTensorizeMappingInfo", AutoTensorizeMappingInfoNode, Object); }; diff --git a/src/tir/schedule/analysis/analysis.cc b/src/tir/schedule/analysis/analysis.cc index 75cbd5f3e4c1..c4a13dddb3f2 100644 --- a/src/tir/schedule/analysis/analysis.cc +++ b/src/tir/schedule/analysis/analysis.cc @@ -254,14 +254,16 @@ static const char* kReductionBlockDefinition = R"(Definition of a reduction bloc static const char* kLocalCompleteBlockDefinition = R"(Definition of a local complete block: 1) All block vars are data parallel -2) Local Dominant: the block is the only writer of its output, dominating the reader of its output buffers under a given subtree +2) Local Dominant: the block is the only writer of its output, dominating the reader of its output +buffers under a given subtree 3) No overlap between the buffers the block reads and writes)"; static const char* kLocalReductionBlockDefinition = R"(Definition of a reduction block: 1) The block has the `init` statement 2) All the block bindings are quasi-affine expressions 3) All block vars are either data parallel block vars or reduction block vars -4) Local Dominant: the block is the only writer of its output, dominating the reader of its output buffers under a given subtree +4) Local Dominant: the block is the only writer of its output, dominating the reader of its output +buffers under a given subtree 5) The reduction block vars are not used to index the output buffers)"; bool IsCompleteBlock(const ScheduleState& self, const StmtSRef& block_sref, @@ -337,10 +339,10 @@ bool IsReductionBlock(const ScheduleState& self, const StmtSRef& block_sref, TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def( - "tir.schedule.IsReductionBlock", [](Schedule sch, BlockRV block_rv, BlockRV scope_block_rv) { - return IsReductionBlock(sch->state(), sch->GetSRef(block_rv), sch->GetSRef(scope_block_rv)); - }); + refl::GlobalDef().def("tvm.tir.schedule.IsReductionBlock", [](Schedule sch, BlockRV block_rv, + BlockRV scope_block_rv) { + return IsReductionBlock(sch->state(), sch->GetSRef(block_rv), sch->GetSRef(scope_block_rv)); + }); } void CheckReductionBlock(const ScheduleState& self, const StmtSRef& block_sref, @@ -879,7 +881,7 @@ BlockRealize GetBlockRealize(const ScheduleState& self, const StmtSRef& block_sr TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.schedule.GetBlockRealize", [](Schedule sch, BlockRV block_rv) { + refl::GlobalDef().def("tvm.tir.schedule.GetBlockRealize", [](Schedule sch, BlockRV block_rv) { return GetBlockRealize(sch->state(), sch->GetSRef(block_rv)); }); } @@ -1502,7 +1504,7 @@ bool IsTrivialBinding(const ScheduleState& self, const StmtSRef& block_sref) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.schedule.IsTrivialBinding", [](Schedule sch, BlockRV block_rv) { + refl::GlobalDef().def("tvm.tir.schedule.IsTrivialBinding", [](Schedule sch, BlockRV block_rv) { return IsTrivialBinding(sch->state(), sch->GetSRef(block_rv)); }); } @@ -1911,9 +1913,9 @@ ffi::Optional GetTensorizeLoopMapping(const tir::ScheduleState& s TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("tir.schedule.IsSpatialPrimFunc", IsSpatialPrimFunc) - .def("tir.schedule.GetTensorizeLoopMapping", [](Schedule sch, BlockRV block, - PrimFunc desc_func, bool allow_padding) { + .def("tvm.tir.schedule.IsSpatialPrimFunc", IsSpatialPrimFunc) + .def("tvm.tir.schedule.GetTensorizeLoopMapping", [](Schedule sch, BlockRV block, + PrimFunc desc_func, bool allow_padding) { return GetTensorizeLoopMapping(sch->state(), sch->GetSRef(block), desc_func, allow_padding); }); } @@ -2144,18 +2146,18 @@ ffi::Optional GetAutoTensorizeMappingInfo( TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("tir.schedule.GetAutoTensorizeMappingInfo", + .def("tvm.tir.schedule.GetAutoTensorizeMappingInfo", [](Schedule sch, BlockRV block, PrimFunc desc_func) { return GetAutoTensorizeMappingInfo(sch->state(), sch->GetSRef(block), desc_func); }) - .def("tir.schedule.HasBlock", HasBlock) - .def("tir.schedule.IsOutputBlock", + .def("tvm.tir.schedule.HasBlock", HasBlock) + .def("tvm.tir.schedule.IsOutputBlock", [](Schedule sch, BlockRV block) { auto state = sch->state(); auto block_sref = sch->GetSRef(block); return IsOutputBlock(state, block_sref, GetScopeRoot(state, block_sref, false)); }) - .def("tir.schedule.GetLoopIterType", + .def("tvm.tir.schedule.GetLoopIterType", [](Schedule sch, LoopRV loop) -> ffi::String { IterVarType kind = GetLoopIterType(sch->GetSRef(loop)); if (kind == kDataPar) { @@ -2166,7 +2168,7 @@ TVM_FFI_STATIC_INIT_BLOCK() { return "O"; } }) - .def("tir.schedule.HasIfThenElse", + .def("tvm.tir.schedule.HasIfThenElse", [](const Stmt& stmt) -> bool { return HasIfThenElse(stmt); }); } diff --git a/src/tir/schedule/analysis/layout.cc b/src/tir/schedule/analysis/layout.cc index ddc15ab5e592..851a3cb380cf 100644 --- a/src/tir/schedule/analysis/layout.cc +++ b/src/tir/schedule/analysis/layout.cc @@ -243,7 +243,7 @@ ffi::Optional SuggestIndexMap(const Buffer& buffer, const ffi::Array

indices, ffi::Array loops, PrimExpr predicate) { arith::Analyzer analyzer; return SuggestIndexMap(buffer, indices, loops, predicate, &analyzer); diff --git a/src/tir/schedule/instruction.cc b/src/tir/schedule/instruction.cc index 02c866e0b605..77adf1603534 100644 --- a/src/tir/schedule/instruction.cc +++ b/src/tir/schedule/instruction.cc @@ -107,8 +107,8 @@ TVM_STATIC_IR_FUNCTOR(ReprPrinter, vtable) TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("tir.schedule.InstructionKindGet", InstructionKind::Get) - .def("tir.schedule.Instruction", + .def("tvm.tir.schedule.InstructionKindGet", InstructionKind::Get) + .def("tvm.tir.schedule.Instruction", [](InstructionKind kind, ffi::Array inputs, ffi::Array attrs, ffi::Array outputs) -> Instruction { return Instruction(kind, inputs, attrs, outputs); diff --git a/src/tir/schedule/primitive/decompose_padding.cc b/src/tir/schedule/primitive/decompose_padding.cc index 7e61fd4eb20a..cd55dfeea646 100644 --- a/src/tir/schedule/primitive/decompose_padding.cc +++ b/src/tir/schedule/primitive/decompose_padding.cc @@ -536,7 +536,7 @@ bool CanDecomposePadding(ScheduleState self, const StmtSRef& block_sref, TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef().def( - "tir.schedule.CanDecomposePadding", [](Schedule self, BlockRV block_rv, LoopRV loop_rv) { + "tvm.tir.schedule.CanDecomposePadding", [](Schedule self, BlockRV block_rv, LoopRV loop_rv) { return CanDecomposePadding(self->state(), self->GetSRef(block_rv), self->GetSRef(loop_rv)); }); } diff --git a/src/tir/schedule/primitive/reduction.cc b/src/tir/schedule/primitive/reduction.cc index 0629757a13d8..b162e57356eb 100644 --- a/src/tir/schedule/primitive/reduction.cc +++ b/src/tir/schedule/primitive/reduction.cc @@ -1353,7 +1353,7 @@ TVM_REGISTER_INST_KIND_TRAITS(DecomposeReductionTraits); TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef().def( - "tir.schedule.RegisterReducer", + "tvm.tir.schedule.RegisterReducer", [](int n_buffers, ffi::Function combiner_getter, ffi::Function identity_getter) { ReducerRegistry::RegisterReducer(n_buffers, std::move(combiner_getter), std::move(identity_getter)); diff --git a/src/tir/schedule/schedule.cc b/src/tir/schedule/schedule.cc index 35b221561978..df1983b3bb90 100644 --- a/src/tir/schedule/schedule.cc +++ b/src/tir/schedule/schedule.cc @@ -51,14 +51,14 @@ StmtSRef ScheduleNode::GetSRef(const StmtNode* stmt) const { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def_method("tir.schedule.ScheduleGetMod", &ScheduleNode::mod) - .def_method("tir.schedule.ScheduleGetState", &ScheduleNode::state) - .def_method("tir.schedule.ScheduleGetTrace", &ScheduleNode::trace) - .def_method("tir.schedule.ScheduleGetFuncWorkingOn", &ScheduleNode::func_working_on) - .def_method("tir.schedule.ScheduleCopy", &ScheduleNode::Copy) - .def_method("tir.schedule.ScheduleSeed", &ScheduleNode::Seed) - .def_method("tir.schedule.ScheduleForkSeed", &ScheduleNode::ForkSeed) - .def_method("tir.schedule.ScheduleWorkOn", &ScheduleNode::WorkOn); + .def_method("tvm.tir.schedule.ScheduleGetMod", &ScheduleNode::mod) + .def_method("tvm.tir.schedule.ScheduleGetState", &ScheduleNode::state) + .def_method("tvm.tir.schedule.ScheduleGetTrace", &ScheduleNode::trace) + .def_method("tvm.tir.schedule.ScheduleGetFuncWorkingOn", &ScheduleNode::func_working_on) + .def_method("tvm.tir.schedule.ScheduleCopy", &ScheduleNode::Copy) + .def_method("tvm.tir.schedule.ScheduleSeed", &ScheduleNode::Seed) + .def_method("tvm.tir.schedule.ScheduleForkSeed", &ScheduleNode::ForkSeed) + .def_method("tvm.tir.schedule.ScheduleWorkOn", &ScheduleNode::WorkOn); } /**************** (FFI) Constructor ****************/ @@ -66,16 +66,16 @@ TVM_FFI_STATIC_INIT_BLOCK() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("tir.schedule.BlockRV", []() { return BlockRV(); }) - .def("tir.schedule.LoopRV", []() { return LoopRV(); }) - .def("tir.schedule.ConcreteSchedule", + .def("tvm.tir.schedule.BlockRV", []() { return BlockRV(); }) + .def("tvm.tir.schedule.LoopRV", []() { return LoopRV(); }) + .def("tvm.tir.schedule.ConcreteSchedule", [](IRModule mod, support::LinearCongruentialEngine::TRandState seed, int debug_mask, int error_render_level, bool enable_check) -> Schedule { return Schedule::Concrete(mod, debug_mask, seed, static_cast(error_render_level), enable_check); }) - .def("tir.schedule.TracedSchedule", + .def("tvm.tir.schedule.TracedSchedule", [](IRModule mod, support::LinearCongruentialEngine::TRandState seed, int debug_mask, int error_render_level, bool enable_check) -> Schedule { return Schedule::Traced(mod, seed, debug_mask, @@ -89,7 +89,7 @@ TVM_FFI_STATIC_INIT_BLOCK() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("tir.schedule.ScheduleGet", + .def("tvm.tir.schedule.ScheduleGet", [](Schedule self, ObjectRef obj) -> ObjectRef { if (auto loop_rv = obj.as()) { return self->Get(loop_rv.value()); @@ -104,7 +104,7 @@ TVM_FFI_STATIC_INIT_BLOCK() { << obj->GetTypeKey() << ". Its value is: " << obj; throw; }) - .def("tir.schedule.ScheduleGetSRef", + .def("tvm.tir.schedule.ScheduleGetSRef", [](Schedule self, ObjectRef obj) -> ffi::Optional { if (auto loop_rv = obj.as()) { return self->GetSRef(loop_rv.value()); @@ -118,7 +118,7 @@ TVM_FFI_STATIC_INIT_BLOCK() { LOG(FATAL) << "TypeError: Invalid type: " << obj->GetTypeKey(); throw; }) - .def("tir.schedule.ScheduleRemoveRV", [](Schedule self, ObjectRef obj) -> void { + .def("tvm.tir.schedule.ScheduleRemoveRV", [](Schedule self, ObjectRef obj) -> void { if (auto loop_rv = obj.as()) { return self->RemoveRV(loop_rv.value()); } @@ -137,20 +137,20 @@ TVM_FFI_STATIC_INIT_BLOCK() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def_method("tir.schedule.ScheduleSampleCategorical", &ScheduleNode::SampleCategorical) - .def_method("tir.schedule.ScheduleSamplePerfectTile", &ScheduleNode::SamplePerfectTile) - .def_method("tir.schedule.ScheduleSamplePartitionedTile", + .def_method("tvm.tir.schedule.ScheduleSampleCategorical", &ScheduleNode::SampleCategorical) + .def_method("tvm.tir.schedule.ScheduleSamplePerfectTile", &ScheduleNode::SamplePerfectTile) + .def_method("tvm.tir.schedule.ScheduleSamplePartitionedTile", &ScheduleNode::SamplePartitionedTile) - .def_method("tir.schedule.ScheduleSampleComputeLocation", + .def_method("tvm.tir.schedule.ScheduleSampleComputeLocation", &ScheduleNode::SampleComputeLocation); } /******** (FFI) Get blocks & loops ********/ TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def_method("tir.schedule.ScheduleGetBlock", &ScheduleNode::GetBlock) - .def_method("tir.schedule.ScheduleGetLoops", &ScheduleNode::GetLoops) - .def("tir.schedule.ScheduleGetChildBlocks", + .def_method("tvm.tir.schedule.ScheduleGetBlock", &ScheduleNode::GetBlock) + .def_method("tvm.tir.schedule.ScheduleGetLoops", &ScheduleNode::GetLoops) + .def("tvm.tir.schedule.ScheduleGetChildBlocks", [](Schedule self, ObjectRef rv) { if (auto block_rv = rv.as()) { return self->GetChildBlocks(block_rv.value()); @@ -162,21 +162,22 @@ TVM_FFI_STATIC_INIT_BLOCK() { << rv->GetTypeKey() << ". Its value is: " << rv; throw; }) - .def_method("tir.schedule.ScheduleGetProducers", &ScheduleNode::GetProducers) - .def_method("tir.schedule.ScheduleGetConsumers", &ScheduleNode::GetConsumers) - .def_method("tir.schedule.ScheduleGetOutputBlocks", &ScheduleNode::GetOutputBlocks); + .def_method("tvm.tir.schedule.ScheduleGetProducers", &ScheduleNode::GetProducers) + .def_method("tvm.tir.schedule.ScheduleGetConsumers", &ScheduleNode::GetConsumers) + .def_method("tvm.tir.schedule.ScheduleGetOutputBlocks", &ScheduleNode::GetOutputBlocks); } /******** (FFI) Transform loops ********/ TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def_method("tir.schedule.ScheduleMerge", &ScheduleNode::Merge) - .def_method("tir.schedule.ScheduleFuse", &ScheduleNode::Fuse) - .def_method("tir.schedule.ScheduleSplit", &ScheduleNode::Split) - .def_method("tir.schedule.ScheduleLoopPartition", &ScheduleNode::LoopPartition) - .def_method("tir.schedule.ScheduleReorder", &ScheduleNode::Reorder) - .def_method("tir.schedule.ScheduleReorderBlockIterVar", &ScheduleNode::ReorderBlockIterVar) - .def("tir.schedule.ScheduleAddUnitLoop", [](Schedule self, ObjectRef rv) -> LoopRV { + .def_method("tvm.tir.schedule.ScheduleMerge", &ScheduleNode::Merge) + .def_method("tvm.tir.schedule.ScheduleFuse", &ScheduleNode::Fuse) + .def_method("tvm.tir.schedule.ScheduleSplit", &ScheduleNode::Split) + .def_method("tvm.tir.schedule.ScheduleLoopPartition", &ScheduleNode::LoopPartition) + .def_method("tvm.tir.schedule.ScheduleReorder", &ScheduleNode::Reorder) + .def_method("tvm.tir.schedule.ScheduleReorderBlockIterVar", + &ScheduleNode::ReorderBlockIterVar) + .def("tvm.tir.schedule.ScheduleAddUnitLoop", [](Schedule self, ObjectRef rv) -> LoopRV { if (auto loop_rv = rv.as()) { return self->AddUnitLoop(loop_rv.value()); } else if (auto block_rv = rv.as()) { @@ -192,22 +193,22 @@ TVM_FFI_STATIC_INIT_BLOCK() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def_method("tir.schedule.ScheduleParallel", &ScheduleNode::Parallel) - .def_method("tir.schedule.ScheduleVectorize", &ScheduleNode::Vectorize) - .def_method("tir.schedule.ScheduleBind", &ScheduleNode::Bind) - .def_method("tir.schedule.ScheduleUnroll", &ScheduleNode::Unroll); + .def_method("tvm.tir.schedule.ScheduleParallel", &ScheduleNode::Parallel) + .def_method("tvm.tir.schedule.ScheduleVectorize", &ScheduleNode::Vectorize) + .def_method("tvm.tir.schedule.ScheduleBind", &ScheduleNode::Bind) + .def_method("tvm.tir.schedule.ScheduleUnroll", &ScheduleNode::Unroll); } /******** (FFI) Insert cache stages ********/ TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def_method("tir.schedule.ScheduleCacheRead", &ScheduleNode::CacheRead) - .def_method("tir.schedule.ScheduleCacheWrite", &ScheduleNode::CacheWrite) - .def_method("tir.schedule.ScheduleReindexCacheRead", &ScheduleNode::ReindexCacheRead) - .def_method("tir.schedule.ScheduleReindexCacheWrite", &ScheduleNode::ReindexCacheWrite) - .def_method("tir.schedule.ScheduleCacheInplace", &ScheduleNode::CacheInplace) - .def_method("tir.schedule.ScheduleCacheIndex", &ScheduleNode::CacheIndex) - .def("tir.schedule.ScheduleReIndex", + .def_method("tvm.tir.schedule.ScheduleCacheRead", &ScheduleNode::CacheRead) + .def_method("tvm.tir.schedule.ScheduleCacheWrite", &ScheduleNode::CacheWrite) + .def_method("tvm.tir.schedule.ScheduleReindexCacheRead", &ScheduleNode::ReindexCacheRead) + .def_method("tvm.tir.schedule.ScheduleReindexCacheWrite", &ScheduleNode::ReindexCacheWrite) + .def_method("tvm.tir.schedule.ScheduleCacheInplace", &ScheduleNode::CacheInplace) + .def_method("tvm.tir.schedule.ScheduleCacheIndex", &ScheduleNode::CacheIndex) + .def("tvm.tir.schedule.ScheduleReIndex", [](Schedule self, const BlockRV& block_rv, int buffer_index, int buffer_index_type) { return self->ReIndex(block_rv, buffer_index, static_cast(buffer_index_type)); @@ -217,40 +218,41 @@ TVM_FFI_STATIC_INIT_BLOCK() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def_method("tir.schedule.ScheduleReadAt", &ScheduleNode::ReadAt) - .def_method("tir.schedule.ScheduleWriteAt", &ScheduleNode::WriteAt); + .def_method("tvm.tir.schedule.ScheduleReadAt", &ScheduleNode::ReadAt) + .def_method("tvm.tir.schedule.ScheduleWriteAt", &ScheduleNode::WriteAt); } /******** (FFI) Compute location ********/ TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def_method("tir.schedule.ScheduleComputeAt", &ScheduleNode::ComputeAt) - .def_method("tir.schedule.ScheduleReverseComputeAt", &ScheduleNode::ReverseComputeAt) - .def_method("tir.schedule.ScheduleComputeInline", &ScheduleNode::ComputeInline) - .def_method("tir.schedule.ScheduleReverseComputeInline", &ScheduleNode::ReverseComputeInline) - .def_method("tir.schedule.ScheduleFuseReductionEpilogue", + .def_method("tvm.tir.schedule.ScheduleComputeAt", &ScheduleNode::ComputeAt) + .def_method("tvm.tir.schedule.ScheduleReverseComputeAt", &ScheduleNode::ReverseComputeAt) + .def_method("tvm.tir.schedule.ScheduleComputeInline", &ScheduleNode::ComputeInline) + .def_method("tvm.tir.schedule.ScheduleReverseComputeInline", + &ScheduleNode::ReverseComputeInline) + .def_method("tvm.tir.schedule.ScheduleFuseReductionEpilogue", &ScheduleNode::FuseReductionEpilogue); } /******** (FFI) Reduction ********/ TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def_method("tir.schedule.ScheduleDecomposeReduction", &ScheduleNode::DecomposeReduction) - .def_method("tir.schedule.ScheduleRFactor", &ScheduleNode::RFactor); + .def_method("tvm.tir.schedule.ScheduleDecomposeReduction", &ScheduleNode::DecomposeReduction) + .def_method("tvm.tir.schedule.ScheduleRFactor", &ScheduleNode::RFactor); } /******** (FFI) Block annotation ********/ TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def_method("tir.schedule.ScheduleStorageAlign", &ScheduleNode::StorageAlign) - .def_method("tir.schedule.ScheduleSetScope", &ScheduleNode::SetScope) - .def_method("tir.schedule.ScheduleUnsafeSetDType", &ScheduleNode::UnsafeSetDType); + .def_method("tvm.tir.schedule.ScheduleStorageAlign", &ScheduleNode::StorageAlign) + .def_method("tvm.tir.schedule.ScheduleSetScope", &ScheduleNode::SetScope) + .def_method("tvm.tir.schedule.ScheduleUnsafeSetDType", &ScheduleNode::UnsafeSetDType); } /******** (FFI) Blockize & Tensorize ********/ TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("tir.schedule.ScheduleBlockize", + .def("tvm.tir.schedule.ScheduleBlockize", [](Schedule self, ObjectRef target, bool preserve_unit_iters) { if (auto loop_rv = target.as()) { return self->Blockize(loop_rv.value(), preserve_unit_iters); @@ -259,7 +261,7 @@ TVM_FFI_STATIC_INIT_BLOCK() { } LOG(FATAL) << "Unsupported target type: " << target->GetTypeKey(); }) - .def("tir.schedule.ScheduleTensorize", + .def("tvm.tir.schedule.ScheduleTensorize", [](Schedule self, ObjectRef rv, ffi::String intrin, bool preserve_unit_iters) { if (auto block_rv = rv.as()) { self->Tensorize(block_rv.value(), intrin, preserve_unit_iters); @@ -276,7 +278,7 @@ TVM_FFI_STATIC_INIT_BLOCK() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("tir.schedule.ScheduleAnnotate", + .def("tvm.tir.schedule.ScheduleAnnotate", [](Schedule self, ObjectRef rv, const ffi::String& ann_key, const Any& ann_val) { if (auto block_rv = rv.as()) { return self->Annotate(block_rv.value(), ann_key, ann_val); @@ -288,8 +290,8 @@ TVM_FFI_STATIC_INIT_BLOCK() { << rv->GetTypeKey() << ". Its value is: " << rv; throw; }) - .def("tir.schedule.ScheduleUnannotate", [](Schedule self, ObjectRef rv, - const ffi::String& ann_key) { + .def("tvm.tir.schedule.ScheduleUnannotate", [](Schedule self, ObjectRef rv, + const ffi::String& ann_key) { if (auto block_rv = rv.as()) { return self->Unannotate(block_rv.value(), ann_key); } @@ -306,7 +308,7 @@ TVM_FFI_STATIC_INIT_BLOCK() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("tir.schedule.ScheduleTransformLayout", + .def("tvm.tir.schedule.ScheduleTransformLayout", [](Schedule self, const BlockRV& block_rv, int buffer_index, int buffer_index_type, const IndexMap& index_map, const ffi::Optional& pad_value, bool assume_injective_transform) { @@ -314,8 +316,9 @@ TVM_FFI_STATIC_INIT_BLOCK() { static_cast(buffer_index_type), index_map, pad_value, assume_injective_transform); }) - .def_method("tir.schedule.ScheduleTransformBlockLayout", &ScheduleNode::TransformBlockLayout) - .def("tir.schedule.ScheduleSetAxisSeparator", + .def_method("tvm.tir.schedule.ScheduleTransformBlockLayout", + &ScheduleNode::TransformBlockLayout) + .def("tvm.tir.schedule.ScheduleSetAxisSeparator", [](Schedule self, const BlockRV& block_rv, int buffer_index, int buffer_index_type, const ffi::Array& axis_separators) { return self->SetAxisSeparator(block_rv, buffer_index, @@ -328,26 +331,27 @@ TVM_FFI_STATIC_INIT_BLOCK() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def_method("tir.schedule.ScheduleDecomposePadding", &ScheduleNode::DecomposePadding) - .def_method("tir.schedule.SchedulePadEinsum", &ScheduleNode::PadEinsum); + .def_method("tvm.tir.schedule.ScheduleDecomposePadding", &ScheduleNode::DecomposePadding) + .def_method("tvm.tir.schedule.SchedulePadEinsum", &ScheduleNode::PadEinsum); } /******** (FFI) Buffer transformation ********/ TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def_method("tir.schedule.ScheduleRollingBuffer", &ScheduleNode::RollingBuffer); + refl::GlobalDef().def_method("tvm.tir.schedule.ScheduleRollingBuffer", + &ScheduleNode::RollingBuffer); } /******** (FFI) Misc ********/ TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def_method("tir.schedule.ScheduleEnterPostproc", &ScheduleNode::EnterPostproc) - .def_method("tir.schedule.ScheduleUnsafeHideBufferAccess", + .def_method("tvm.tir.schedule.ScheduleEnterPostproc", &ScheduleNode::EnterPostproc) + .def_method("tvm.tir.schedule.ScheduleUnsafeHideBufferAccess", &ScheduleNode::UnsafeHideBufferAccess); } /******** (FFI) Annotate buffer access ********/ TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.schedule.ScheduleAnnotateBufferAccess", + refl::GlobalDef().def("tvm.tir.schedule.ScheduleAnnotateBufferAccess", [](Schedule self, const BlockRV& block_rv, int buffer_index, int buffer_index_type, const IndexMap& index_map) { return self->AnnotateBufferAccess( diff --git a/src/tir/schedule/state.cc b/src/tir/schedule/state.cc index c299f52fde55..ad0f0ac45880 100644 --- a/src/tir/schedule/state.cc +++ b/src/tir/schedule/state.cc @@ -1019,18 +1019,18 @@ TVM_DLL ffi::Array GetCachedFlags(const ScheduleState& self, const StmtSRe TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("tir.schedule.ScheduleState", + .def("tvm.tir.schedule.ScheduleState", [](IRModule mod, int debug_mask, bool enable_check) -> ScheduleState { return ScheduleState(mod, debug_mask, enable_check); }) - .def_method("tir.schedule.ScheduleStateGetBlockScope", &ScheduleStateNode::GetBlockScope) - .def_method("tir.schedule.ScheduleStateReplace", &ScheduleStateNode::Replace) - .def("tir.schedule.ScheduleStateGetSRef", + .def_method("tvm.tir.schedule.ScheduleStateGetBlockScope", &ScheduleStateNode::GetBlockScope) + .def_method("tvm.tir.schedule.ScheduleStateReplace", &ScheduleStateNode::Replace) + .def("tvm.tir.schedule.ScheduleStateGetSRef", [](ScheduleState self, Stmt stmt) -> ffi::Optional { auto it = self->stmt2ref.find(stmt.get()); return it != self->stmt2ref.end() ? it->second : ffi::Optional(std::nullopt); }) - .def("tir.schedule.ScheduleStateGetCachedFlags", GetCachedFlags); + .def("tvm.tir.schedule.ScheduleStateGetCachedFlags", GetCachedFlags); } } // namespace tir diff --git a/src/tir/schedule/trace.cc b/src/tir/schedule/trace.cc index 371aa0cb092d..12a038714bda 100644 --- a/src/tir/schedule/trace.cc +++ b/src/tir/schedule/trace.cc @@ -571,13 +571,13 @@ TVM_REGISTER_INST_KIND_TRAITS(EnterPostprocTraits); TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("tir.schedule.Trace", + .def("tvm.tir.schedule.Trace", [](ffi::Optional> insts, ffi::Optional> decisions) { return Trace(insts.value_or(ffi::Array()), decisions.value_or({})); }) - .def_method("tir.schedule.TraceGetDecision", &TraceNode::GetDecision) - .def("tir.schedule.TraceAppend", + .def_method("tvm.tir.schedule.TraceGetDecision", &TraceNode::GetDecision) + .def("tvm.tir.schedule.TraceAppend", [](Trace self, Instruction inst, ffi::Optional decision) { if (decision.defined()) { return self->Append(inst, decision.value()); @@ -585,13 +585,13 @@ TVM_FFI_STATIC_INIT_BLOCK() { return self->Append(inst); } }) - .def_method("tir.schedule.TracePop", &TraceNode::Pop) - .def_method("tir.schedule.TraceApplyToSchedule", &TraceNode::ApplyToSchedule) - .def_method("tir.schedule.TraceAsJSON", &TraceNode::AsJSON) - .def_method("tir.schedule.TraceAsPython", &TraceNode::AsPython) - .def_method("tir.schedule.TraceWithDecision", &TraceNode::WithDecision) - .def_method("tir.schedule.TraceSimplified", &TraceNode::Simplified) - .def("tir.schedule.TraceApplyJSONToSchedule", Trace::ApplyJSONToSchedule); + .def_method("tvm.tir.schedule.TracePop", &TraceNode::Pop) + .def_method("tvm.tir.schedule.TraceApplyToSchedule", &TraceNode::ApplyToSchedule) + .def_method("tvm.tir.schedule.TraceAsJSON", &TraceNode::AsJSON) + .def_method("tvm.tir.schedule.TraceAsPython", &TraceNode::AsPython) + .def_method("tvm.tir.schedule.TraceWithDecision", &TraceNode::WithDecision) + .def_method("tvm.tir.schedule.TraceSimplified", &TraceNode::Simplified) + .def("tvm.tir.schedule.TraceApplyJSONToSchedule", Trace::ApplyJSONToSchedule); } } // namespace tir diff --git a/src/tir/schedule/transform.cc b/src/tir/schedule/transform.cc index 9c3da9f32bea..8266c13e5434 100644 --- a/src/tir/schedule/transform.cc +++ b/src/tir/schedule/transform.cc @@ -448,7 +448,7 @@ ffi::Optional TileWithTensorIntrin(const tir::Schedule& sch, const tir:: TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.schedule.TileWithTensorIntrin", TileWithTensorIntrin); + refl::GlobalDef().def("tvm.tir.schedule.TileWithTensorIntrin", TileWithTensorIntrin); } /******** BlockBufferAccessSimplifier ********/ @@ -570,7 +570,7 @@ ffi::Optional NormalizePrimFunc(Schedule sch) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.schedule.NormalizePrimFunc", NormalizePrimFunc); + refl::GlobalDef().def("tvm.tir.schedule.NormalizePrimFunc", NormalizePrimFunc); } } // namespace tir diff --git a/src/tir/transforms/annotate_device_regions.cc b/src/tir/transforms/annotate_device_regions.cc index 47b3df5fdaa3..33188ce548aa 100644 --- a/src/tir/transforms/annotate_device_regions.cc +++ b/src/tir/transforms/annotate_device_regions.cc @@ -77,7 +77,7 @@ Pass AnnotateDeviceRegions() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.transform.AnnotateDeviceRegions", AnnotateDeviceRegions); + refl::GlobalDef().def("tvm.tir.transform.AnnotateDeviceRegions", AnnotateDeviceRegions); } } // namespace transform diff --git a/src/tir/transforms/annotate_irregular_loop.cc b/src/tir/transforms/annotate_irregular_loop.cc index c715922d60b3..560465afe2bc 100644 --- a/src/tir/transforms/annotate_irregular_loop.cc +++ b/src/tir/transforms/annotate_irregular_loop.cc @@ -86,7 +86,7 @@ Pass AnnotateIrregularLoop() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.transform.AnnotateIrregularLoop", AnnotateIrregularLoop); + refl::GlobalDef().def("tvm.tir.transform.AnnotateIrregularLoop", AnnotateIrregularLoop); } } // namespace transform diff --git a/src/tir/transforms/bind_target.cc b/src/tir/transforms/bind_target.cc index 9ec0a506a314..5629572e1519 100644 --- a/src/tir/transforms/bind_target.cc +++ b/src/tir/transforms/bind_target.cc @@ -375,7 +375,7 @@ transform::Pass BindTarget(Target target) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.transform.BindTarget", BindTarget); + refl::GlobalDef().def("tvm.tir.transform.BindTarget", BindTarget); } } // namespace transform diff --git a/src/tir/transforms/bound_checker.cc b/src/tir/transforms/bound_checker.cc index 99d990ece627..71e64ec0877d 100644 --- a/src/tir/transforms/bound_checker.cc +++ b/src/tir/transforms/bound_checker.cc @@ -259,7 +259,7 @@ Pass InstrumentBoundCheckers() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.transform.InstrumentBoundCheckers", InstrumentBoundCheckers); + refl::GlobalDef().def("tvm.tir.transform.InstrumentBoundCheckers", InstrumentBoundCheckers); } } // namespace transform diff --git a/src/tir/transforms/canonicalize_loop.cc b/src/tir/transforms/canonicalize_loop.cc index 93511bf84bb2..19799b66b76f 100644 --- a/src/tir/transforms/canonicalize_loop.cc +++ b/src/tir/transforms/canonicalize_loop.cc @@ -93,7 +93,7 @@ Pass CanonicalizeLoop() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.transform.CanonicalizeLoop", CanonicalizeLoop); + refl::GlobalDef().def("tvm.tir.transform.CanonicalizeLoop", CanonicalizeLoop); } } // namespace transform diff --git a/src/tir/transforms/combine_context_call.cc b/src/tir/transforms/combine_context_call.cc index bd9d67352659..653145c94446 100644 --- a/src/tir/transforms/combine_context_call.cc +++ b/src/tir/transforms/combine_context_call.cc @@ -115,7 +115,7 @@ Pass CombineContextCall() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.transform.CombineContextCall", CombineContextCall); + refl::GlobalDef().def("tvm.tir.transform.CombineContextCall", CombineContextCall); } } // namespace transform diff --git a/src/tir/transforms/common_subexpr_elim.cc b/src/tir/transforms/common_subexpr_elim.cc index 9b9619fae937..210222a97374 100644 --- a/src/tir/transforms/common_subexpr_elim.cc +++ b/src/tir/transforms/common_subexpr_elim.cc @@ -640,7 +640,7 @@ Pass CommonSubexprElimTIR(bool enable_cse_tir, bool identify_equiv_terms) { // The pass can now be invoked via the pass infrastructure, but we also add a Python binding for it TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.transform.CommonSubexprElimTIR", CommonSubexprElimTIR); + refl::GlobalDef().def("tvm.tir.transform.CommonSubexprElimTIR", CommonSubexprElimTIR); } } // namespace transform diff --git a/src/tir/transforms/compact_buffer_region.cc b/src/tir/transforms/compact_buffer_region.cc index 0ba4e75c3004..c961659e6f23 100644 --- a/src/tir/transforms/compact_buffer_region.cc +++ b/src/tir/transforms/compact_buffer_region.cc @@ -759,7 +759,7 @@ Pass CompactBufferAllocation(bool is_strict) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.transform.CompactBufferAllocation", CompactBufferAllocation); + refl::GlobalDef().def("tvm.tir.transform.CompactBufferAllocation", CompactBufferAllocation); } } // namespace transform diff --git a/src/tir/transforms/convert_blocks_to_opaque.cc b/src/tir/transforms/convert_blocks_to_opaque.cc index f187252b2e31..6bcbd848ec0b 100644 --- a/src/tir/transforms/convert_blocks_to_opaque.cc +++ b/src/tir/transforms/convert_blocks_to_opaque.cc @@ -125,7 +125,7 @@ Pass ConvertBlocksToOpaque() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.transform.ConvertBlocksToOpaque", ConvertBlocksToOpaque); + refl::GlobalDef().def("tvm.tir.transform.ConvertBlocksToOpaque", ConvertBlocksToOpaque); } } // namespace transform diff --git a/src/tir/transforms/convert_for_loops_serial.cc b/src/tir/transforms/convert_for_loops_serial.cc index 691d8b885c59..ffd28d447039 100644 --- a/src/tir/transforms/convert_for_loops_serial.cc +++ b/src/tir/transforms/convert_for_loops_serial.cc @@ -69,7 +69,7 @@ Pass ConvertForLoopsToSerial() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.transform.ConvertForLoopsToSerial", ConvertForLoopsToSerial); + refl::GlobalDef().def("tvm.tir.transform.ConvertForLoopsToSerial", ConvertForLoopsToSerial); } } // namespace transform diff --git a/src/tir/transforms/decorate_device_scope.cc b/src/tir/transforms/decorate_device_scope.cc index ab0078a50ae0..bc05cff75d28 100644 --- a/src/tir/transforms/decorate_device_scope.cc +++ b/src/tir/transforms/decorate_device_scope.cc @@ -47,7 +47,7 @@ Pass DecorateDeviceScope() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.transform.DecorateDeviceScope", DecorateDeviceScope); + refl::GlobalDef().def("tvm.tir.transform.DecorateDeviceScope", DecorateDeviceScope); } } // namespace transform diff --git a/src/tir/transforms/default_gpu_schedule.cc b/src/tir/transforms/default_gpu_schedule.cc index 74c299456a4b..b854463a1f61 100644 --- a/src/tir/transforms/default_gpu_schedule.cc +++ b/src/tir/transforms/default_gpu_schedule.cc @@ -166,7 +166,7 @@ Pass DefaultGPUSchedule() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.transform.DefaultGPUSchedule", DefaultGPUSchedule); + refl::GlobalDef().def("tvm.tir.transform.DefaultGPUSchedule", DefaultGPUSchedule); } } // namespace transform diff --git a/src/tir/transforms/extract_constants.cc b/src/tir/transforms/extract_constants.cc index be5da45d9f6f..5e3d4c207b84 100644 --- a/src/tir/transforms/extract_constants.cc +++ b/src/tir/transforms/extract_constants.cc @@ -106,7 +106,7 @@ tvm::transform::Pass ExtractPrimFuncConstants() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.transform.ExtractPrimFuncConstants", ExtractPrimFuncConstants); + refl::GlobalDef().def("tvm.tir.transform.ExtractPrimFuncConstants", ExtractPrimFuncConstants); } } // namespace transform diff --git a/src/tir/transforms/flatten_buffer.cc b/src/tir/transforms/flatten_buffer.cc index 1a9ba390703f..a8d706018a63 100644 --- a/src/tir/transforms/flatten_buffer.cc +++ b/src/tir/transforms/flatten_buffer.cc @@ -283,7 +283,7 @@ Pass FlattenBuffer() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.transform.FlattenBuffer", FlattenBuffer); + refl::GlobalDef().def("tvm.tir.transform.FlattenBuffer", FlattenBuffer); } } // namespace transform diff --git a/src/tir/transforms/force_narrow_index_to_i32.cc b/src/tir/transforms/force_narrow_index_to_i32.cc index 711c2a739f59..68884b87fb0a 100644 --- a/src/tir/transforms/force_narrow_index_to_i32.cc +++ b/src/tir/transforms/force_narrow_index_to_i32.cc @@ -89,7 +89,7 @@ Pass ForceNarrowIndexToInt32() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.transform.ForceNarrowIndexToInt32", ForceNarrowIndexToInt32); + refl::GlobalDef().def("tvm.tir.transform.ForceNarrowIndexToInt32", ForceNarrowIndexToInt32); } } // namespace transform diff --git a/src/tir/transforms/hoist_expression.cc b/src/tir/transforms/hoist_expression.cc index ebd90583c93d..cd308a47fb01 100644 --- a/src/tir/transforms/hoist_expression.cc +++ b/src/tir/transforms/hoist_expression.cc @@ -81,7 +81,7 @@ struct HoistExpressionConfigNode : public AttrsNodeReflAdapter(flag) & hoisted_let_bindings; } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tir.transform.HoistExpressionConfig", + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.tir.transform.HoistExpressionConfig", HoistExpressionConfigNode, Object); }; @@ -110,7 +110,7 @@ struct HoistIfThenElseConfigNode : public AttrsNodeReflAdapter fcond) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("tir.transform.AnnotateEntryFunc", AnnotateEntryFunc) - .def("tir.transform.Filter", Filter); + .def("tvm.tir.transform.AnnotateEntryFunc", AnnotateEntryFunc) + .def("tvm.tir.transform.Filter", Filter); } } // namespace transform diff --git a/src/tir/transforms/profile_instrumentation.cc b/src/tir/transforms/profile_instrumentation.cc index 513f0d730e8c..589fc47e877e 100644 --- a/src/tir/transforms/profile_instrumentation.cc +++ b/src/tir/transforms/profile_instrumentation.cc @@ -286,7 +286,8 @@ Pass InstrumentProfileIntrinsics() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.transform.InstrumentProfileIntrinsics", InstrumentProfileIntrinsics); + refl::GlobalDef().def("tvm.tir.transform.InstrumentProfileIntrinsics", + InstrumentProfileIntrinsics); } } // namespace transform diff --git a/src/tir/transforms/reduce_branching_through_overcompute.cc b/src/tir/transforms/reduce_branching_through_overcompute.cc index 9a03b143d0f9..3bc8a414910b 100644 --- a/src/tir/transforms/reduce_branching_through_overcompute.cc +++ b/src/tir/transforms/reduce_branching_through_overcompute.cc @@ -51,7 +51,7 @@ struct ReduceBranchingThroughOvercomputeConfigNode "to statically prove that overcompute is valid.", refl::DefaultValue(false)); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tir.transform.ReduceBranchingThroughOvercomputeConfig", + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.tir.transform.ReduceBranchingThroughOvercomputeConfig", ReduceBranchingThroughOvercomputeConfigNode, BaseAttrsNode); }; @@ -177,7 +177,7 @@ Pass ReduceBranchingThroughOvercompute() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.transform.ReduceBranchingThroughOvercompute", + refl::GlobalDef().def("tvm.tir.transform.ReduceBranchingThroughOvercompute", ReduceBranchingThroughOvercompute); } diff --git a/src/tir/transforms/remap_thread_axis.cc b/src/tir/transforms/remap_thread_axis.cc index c7184e07a036..f642a151fd43 100644 --- a/src/tir/transforms/remap_thread_axis.cc +++ b/src/tir/transforms/remap_thread_axis.cc @@ -106,7 +106,7 @@ Pass RemapThreadAxis(ffi::Map thread_map) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.transform.RemapThreadAxis", RemapThreadAxis); + refl::GlobalDef().def("tvm.tir.transform.RemapThreadAxis", RemapThreadAxis); } } // namespace transform diff --git a/src/tir/transforms/remove_assume.cc b/src/tir/transforms/remove_assume.cc index 6475befa1cf8..80ae12a68b85 100644 --- a/src/tir/transforms/remove_assume.cc +++ b/src/tir/transforms/remove_assume.cc @@ -64,7 +64,7 @@ Pass RemoveAssume() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.transform.RemoveAssume", RemoveAssume); + refl::GlobalDef().def("tvm.tir.transform.RemoveAssume", RemoveAssume); } } // namespace transform diff --git a/src/tir/transforms/remove_no_op.cc b/src/tir/transforms/remove_no_op.cc index 6cc80535085f..70e926e08b60 100644 --- a/src/tir/transforms/remove_no_op.cc +++ b/src/tir/transforms/remove_no_op.cc @@ -59,7 +59,7 @@ struct RemoveNoOpConfigNode : public AttrsNodeReflAdapter "For use in debug and testing purposes.", refl::DefaultValue(0)); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tir.transform.RemoveNoOpConfig", RemoveNoOpConfigNode, + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.tir.transform.RemoveNoOpConfig", RemoveNoOpConfigNode, BaseAttrsNode); }; @@ -334,7 +334,7 @@ Pass RemoveNoOp() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.transform.RemoveNoOp", RemoveNoOp); + refl::GlobalDef().def("tvm.tir.transform.RemoveNoOp", RemoveNoOp); } } // namespace transform diff --git a/src/tir/transforms/remove_store_undef.cc b/src/tir/transforms/remove_store_undef.cc index 93cdd4ed145a..8b8414ebfb1e 100644 --- a/src/tir/transforms/remove_store_undef.cc +++ b/src/tir/transforms/remove_store_undef.cc @@ -174,7 +174,7 @@ Pass RemoveStoreUndef() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.transform.RemoveStoreUndef", RemoveStoreUndef); + refl::GlobalDef().def("tvm.tir.transform.RemoveStoreUndef", RemoveStoreUndef); } } // namespace transform diff --git a/src/tir/transforms/remove_weight_layout_rewrite_block.cc b/src/tir/transforms/remove_weight_layout_rewrite_block.cc index 5b2b5704c5c9..6e44c4aabe1c 100644 --- a/src/tir/transforms/remove_weight_layout_rewrite_block.cc +++ b/src/tir/transforms/remove_weight_layout_rewrite_block.cc @@ -289,7 +289,7 @@ Pass RemoveWeightLayoutRewriteBlock(bool skip_tensor_rewrite) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.transform.RemoveWeightLayoutRewriteBlock", + refl::GlobalDef().def("tvm.tir.transform.RemoveWeightLayoutRewriteBlock", RemoveWeightLayoutRewriteBlock); } diff --git a/src/tir/transforms/renew_defs.cc b/src/tir/transforms/renew_defs.cc index 69002a9e1d78..d57c77e4cc62 100644 --- a/src/tir/transforms/renew_defs.cc +++ b/src/tir/transforms/renew_defs.cc @@ -293,7 +293,7 @@ PrimFunc RenewDefs(const PrimFunc& func) { return RenewDefMutator::Transform(fun TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.RenewDefs", RenewDefs); + refl::GlobalDef().def("tvm.tir.RenewDefs", RenewDefs); } } // namespace tir diff --git a/src/tir/transforms/renormalize_split_pattern.cc b/src/tir/transforms/renormalize_split_pattern.cc index 04dbcca510e1..e2d4b750b2f1 100644 --- a/src/tir/transforms/renormalize_split_pattern.cc +++ b/src/tir/transforms/renormalize_split_pattern.cc @@ -208,7 +208,7 @@ Pass RenormalizeSplitPattern() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.transform.RenormalizeSplitPattern", RenormalizeSplitPattern); + refl::GlobalDef().def("tvm.tir.transform.RenormalizeSplitPattern", RenormalizeSplitPattern); } } // namespace transform diff --git a/src/tir/transforms/rewrite_unsafe_select.cc b/src/tir/transforms/rewrite_unsafe_select.cc index 3dfbcb9967d5..47be01183ca8 100644 --- a/src/tir/transforms/rewrite_unsafe_select.cc +++ b/src/tir/transforms/rewrite_unsafe_select.cc @@ -142,7 +142,7 @@ Pass RewriteUnsafeSelect() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.transform.RewriteUnsafeSelect", RewriteUnsafeSelect); + refl::GlobalDef().def("tvm.tir.transform.RewriteUnsafeSelect", RewriteUnsafeSelect); } } // namespace transform diff --git a/src/tir/transforms/simplify.cc b/src/tir/transforms/simplify.cc index a3365db9b700..6af3726bdf31 100644 --- a/src/tir/transforms/simplify.cc +++ b/src/tir/transforms/simplify.cc @@ -77,7 +77,7 @@ struct SimplifyConfigNode : public AttrsNodeReflAdapter { "branch", refl::DefaultValue(false)); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tir.transform.SimplifyConfig", SimplifyConfigNode, + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.tir.transform.SimplifyConfig", SimplifyConfigNode, BaseAttrsNode); RewriteSimplifier::Extension GetEnabledExtensions() const { @@ -364,7 +364,7 @@ Pass Simplify() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.transform.Simplify", Simplify); + refl::GlobalDef().def("tvm.tir.transform.Simplify", Simplify); } } // namespace transform diff --git a/src/tir/transforms/skip_assert.cc b/src/tir/transforms/skip_assert.cc index b2c473c97c96..b8d5ec6405b5 100644 --- a/src/tir/transforms/skip_assert.cc +++ b/src/tir/transforms/skip_assert.cc @@ -50,7 +50,7 @@ Pass SkipAssert() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.transform.SkipAssert", SkipAssert); + refl::GlobalDef().def("tvm.tir.transform.SkipAssert", SkipAssert); } } // namespace transform diff --git a/src/tir/transforms/split_host_device.cc b/src/tir/transforms/split_host_device.cc index 130cc177f0b1..879f12bf94a8 100644 --- a/src/tir/transforms/split_host_device.cc +++ b/src/tir/transforms/split_host_device.cc @@ -168,7 +168,7 @@ Pass SplitHostDevice() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.transform.SplitHostDevice", SplitHostDevice); + refl::GlobalDef().def("tvm.tir.transform.SplitHostDevice", SplitHostDevice); } } // namespace transform diff --git a/src/tir/transforms/storage_rewrite.cc b/src/tir/transforms/storage_rewrite.cc index 830364788c5e..af9ef959738e 100644 --- a/src/tir/transforms/storage_rewrite.cc +++ b/src/tir/transforms/storage_rewrite.cc @@ -1766,7 +1766,7 @@ Pass StorageRewrite() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.transform.StorageRewrite", StorageRewrite); + refl::GlobalDef().def("tvm.tir.transform.StorageRewrite", StorageRewrite); } Pass PointerValueTypeRewrite() { @@ -1778,7 +1778,7 @@ Pass PointerValueTypeRewrite() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.transform.PointerValueTypeRewrite", PointerValueTypeRewrite); + refl::GlobalDef().def("tvm.tir.transform.PointerValueTypeRewrite", PointerValueTypeRewrite); } } // namespace transform diff --git a/src/tir/transforms/tensorcore_infer_fragment.cc b/src/tir/transforms/tensorcore_infer_fragment.cc index 7c1b5b05d093..8918b8bb4fb5 100644 --- a/src/tir/transforms/tensorcore_infer_fragment.cc +++ b/src/tir/transforms/tensorcore_infer_fragment.cc @@ -220,7 +220,7 @@ Pass InferFragment() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.transform.InferFragment", InferFragment); + refl::GlobalDef().def("tvm.tir.transform.InferFragment", InferFragment); } } // namespace transform diff --git a/src/tir/transforms/thread_storage_sync.cc b/src/tir/transforms/thread_storage_sync.cc index d41d474a0864..04cb9a7006ec 100644 --- a/src/tir/transforms/thread_storage_sync.cc +++ b/src/tir/transforms/thread_storage_sync.cc @@ -474,7 +474,7 @@ Pass ThreadSync(ffi::String storage_scope) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.transform.ThreadSync", ThreadSync); + refl::GlobalDef().def("tvm.tir.transform.ThreadSync", ThreadSync); } } // namespace transform diff --git a/src/tir/transforms/transform_mma_buffer_layout.cc b/src/tir/transforms/transform_mma_buffer_layout.cc index 60b6ffda3219..982866e6bad3 100644 --- a/src/tir/transforms/transform_mma_buffer_layout.cc +++ b/src/tir/transforms/transform_mma_buffer_layout.cc @@ -130,7 +130,8 @@ class MmaBufferLayoutTransformer : public StmtExprMutator { if (buffer_map_.count(store->buffer)) { auto* n = store.CopyOnWrite(); if (store->buffer.scope() == "m16n8k8.matrixC") { - const auto index_map_func = tvm::ffi::Function::GetGlobal("tir.index_map_m16n8k8.matrixC"); + const auto index_map_func = + tvm::ffi::Function::GetGlobal("tvm.tir.index_map_m16n8k8.matrixC"); ICHECK(index_map_func.has_value()); auto index_map = IndexMap::FromFunc(2, *index_map_func); auto new_indices = index_map->MapIndices(store->indices, &analyzer); @@ -149,7 +150,8 @@ class MmaBufferLayoutTransformer : public StmtExprMutator { if (buffer_map_.count(load->buffer)) { auto* n = load.CopyOnWrite(); if (load->buffer.scope() == "m16n8k8.matrixC") { - const auto index_map_func = tvm::ffi::Function::GetGlobal("tir.index_map_m16n8k8.matrixC"); + const auto index_map_func = + tvm::ffi::Function::GetGlobal("tvm.tir.index_map_m16n8k8.matrixC"); ICHECK(index_map_func.has_value()); auto index_map = IndexMap::FromFunc(2, *index_map_func); auto new_indices = index_map->MapIndices(load->indices, &analyzer); @@ -189,7 +191,7 @@ Pass TransformMmaBufferLayout() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.transform.TransformMmaBufferLayout", TransformMmaBufferLayout); + refl::GlobalDef().def("tvm.tir.transform.TransformMmaBufferLayout", TransformMmaBufferLayout); } } // namespace transform diff --git a/src/tir/transforms/unify_thread_binding.cc b/src/tir/transforms/unify_thread_binding.cc index 502acd5a467e..a34648c5ec8d 100644 --- a/src/tir/transforms/unify_thread_binding.cc +++ b/src/tir/transforms/unify_thread_binding.cc @@ -205,7 +205,7 @@ Pass UnifyThreadBinding() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.transform.UnifyThreadBinding", UnifyThreadBinding); + refl::GlobalDef().def("tvm.tir.transform.UnifyThreadBinding", UnifyThreadBinding); } } // namespace transform diff --git a/src/tir/transforms/unroll_loop.cc b/src/tir/transforms/unroll_loop.cc index 7b92bad12d34..85427e55496e 100644 --- a/src/tir/transforms/unroll_loop.cc +++ b/src/tir/transforms/unroll_loop.cc @@ -62,7 +62,7 @@ struct UnrollLoopConfigNode : public AttrsNodeReflAdapter .def_ro("unroll_local_access", &UnrollLoopConfigNode::unroll_local_access, "Whether to always unroll local access", refl::DefaultValue(false)); } - TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tir.transform.UnrollLoopConfig", UnrollLoopConfigNode, + TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tvm.tir.transform.UnrollLoopConfig", UnrollLoopConfigNode, BaseAttrsNode); }; @@ -293,7 +293,7 @@ Pass UnrollLoop() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.transform.UnrollLoop", UnrollLoop); + refl::GlobalDef().def("tvm.tir.transform.UnrollLoop", UnrollLoop); } } // namespace transform diff --git a/src/tir/transforms/unsupported_dtype_legalize.cc b/src/tir/transforms/unsupported_dtype_legalize.cc index 74a69dfbc3e6..bd2caf89f73a 100644 --- a/src/tir/transforms/unsupported_dtype_legalize.cc +++ b/src/tir/transforms/unsupported_dtype_legalize.cc @@ -761,7 +761,7 @@ Pass BF16ComputeLegalize() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.transform.BF16ComputeLegalize", BF16ComputeLegalize); + refl::GlobalDef().def("tvm.tir.transform.BF16ComputeLegalize", BF16ComputeLegalize); } Pass BF16StorageLegalize() { @@ -777,7 +777,7 @@ Pass BF16StorageLegalize() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.transform.BF16StorageLegalize", BF16StorageLegalize); + refl::GlobalDef().def("tvm.tir.transform.BF16StorageLegalize", BF16StorageLegalize); } Pass FP8ComputeLegalize(ffi::String promote_dtype) { @@ -793,7 +793,7 @@ Pass FP8ComputeLegalize(ffi::String promote_dtype) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.transform.FP8ComputeLegalize", FP8ComputeLegalize); + refl::GlobalDef().def("tvm.tir.transform.FP8ComputeLegalize", FP8ComputeLegalize); } Pass FP8StorageLegalize() { @@ -809,7 +809,7 @@ Pass FP8StorageLegalize() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.transform.FP8StorageLegalize", FP8StorageLegalize); + refl::GlobalDef().def("tvm.tir.transform.FP8StorageLegalize", FP8StorageLegalize); } } // namespace transform diff --git a/src/tir/transforms/using_assume_to_reduce_branches.cc b/src/tir/transforms/using_assume_to_reduce_branches.cc index 21f3dc43ba28..5de1547587a8 100644 --- a/src/tir/transforms/using_assume_to_reduce_branches.cc +++ b/src/tir/transforms/using_assume_to_reduce_branches.cc @@ -384,7 +384,7 @@ Pass UseAssumeToReduceBranches() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.transform.UseAssumeToReduceBranches", UseAssumeToReduceBranches); + refl::GlobalDef().def("tvm.tir.transform.UseAssumeToReduceBranches", UseAssumeToReduceBranches); } } // namespace transform diff --git a/src/tir/transforms/vectorize_loop.cc b/src/tir/transforms/vectorize_loop.cc index 068903baa814..c75702ccd6e2 100644 --- a/src/tir/transforms/vectorize_loop.cc +++ b/src/tir/transforms/vectorize_loop.cc @@ -1025,7 +1025,7 @@ Pass VectorizeLoop(bool enable_vectorize) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("tir.transform.VectorizeLoop", VectorizeLoop); + refl::GlobalDef().def("tvm.tir.transform.VectorizeLoop", VectorizeLoop); } } // namespace transform diff --git a/src/topi/broadcast.cc b/src/topi/broadcast.cc index c90b20877101..ac2d81999af8 100644 --- a/src/topi/broadcast.cc +++ b/src/topi/broadcast.cc @@ -50,36 +50,36 @@ using namespace tvm::runtime; TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def_packed("topi.broadcast_to", + .def_packed("tvm.topi.broadcast_to", [](ffi::PackedArgs args, ffi::Any* rv) { *rv = broadcast_to(args[0].cast(), args[1].cast>()); }) - .TOPI_DEF_BCAST_OP("topi.add", topi::add) - .TOPI_DEF_BCAST_OP("topi.subtract", topi::subtract) - .TOPI_DEF_BCAST_OP("topi.multiply", topi::multiply) - .TOPI_DEF_BCAST_OP("topi.divide", topi::divide) - .TOPI_DEF_BCAST_OP("topi.floor_divide", topi::floor_divide) - .TOPI_DEF_BCAST_OP("topi.log_add_exp", topi::log_add_exp) - .TOPI_DEF_BCAST_OP("topi.mod", topi::mod) - .TOPI_DEF_BCAST_OP("topi.floor_mod", topi::floor_mod) - .TOPI_DEF_BCAST_OP("topi.maximum", topi::maximum) - .TOPI_DEF_BCAST_OP("topi.minimum", topi::minimum) - .TOPI_DEF_BCAST_OP("topi.power", topi::power) - .TOPI_DEF_BCAST_OP("topi.left_shift", topi::left_shift) - .TOPI_DEF_BCAST_OP("topi.logical_and", topi::logical_and) - .TOPI_DEF_BCAST_OP("topi.logical_or", topi::logical_or) - .TOPI_DEF_BCAST_OP("topi.logical_xor", topi::logical_xor) - .TOPI_DEF_BCAST_OP("topi.bitwise_and", topi::bitwise_and) - .TOPI_DEF_BCAST_OP("topi.bitwise_or", topi::bitwise_or) - .TOPI_DEF_BCAST_OP("topi.bitwise_xor", topi::bitwise_xor) - .TOPI_DEF_BCAST_OP("topi.right_shift", topi::right_shift) - .TOPI_DEF_BCAST_OP("topi.greater", topi::greater) - .TOPI_DEF_BCAST_OP("topi.less", topi::less) - .TOPI_DEF_BCAST_OP("topi.equal", topi::equal) - .TOPI_DEF_BCAST_OP("topi.not_equal", topi::not_equal) - .TOPI_DEF_BCAST_OP("topi.greater_equal", topi::greater_equal) - .TOPI_DEF_BCAST_OP("topi.less_equal", topi::less_equal); + .TOPI_DEF_BCAST_OP("tvm.topi.add", topi::add) + .TOPI_DEF_BCAST_OP("tvm.topi.subtract", topi::subtract) + .TOPI_DEF_BCAST_OP("tvm.topi.multiply", topi::multiply) + .TOPI_DEF_BCAST_OP("tvm.topi.divide", topi::divide) + .TOPI_DEF_BCAST_OP("tvm.topi.floor_divide", topi::floor_divide) + .TOPI_DEF_BCAST_OP("tvm.topi.log_add_exp", topi::log_add_exp) + .TOPI_DEF_BCAST_OP("tvm.topi.mod", topi::mod) + .TOPI_DEF_BCAST_OP("tvm.topi.floor_mod", topi::floor_mod) + .TOPI_DEF_BCAST_OP("tvm.topi.maximum", topi::maximum) + .TOPI_DEF_BCAST_OP("tvm.topi.minimum", topi::minimum) + .TOPI_DEF_BCAST_OP("tvm.topi.power", topi::power) + .TOPI_DEF_BCAST_OP("tvm.topi.left_shift", topi::left_shift) + .TOPI_DEF_BCAST_OP("tvm.topi.logical_and", topi::logical_and) + .TOPI_DEF_BCAST_OP("tvm.topi.logical_or", topi::logical_or) + .TOPI_DEF_BCAST_OP("tvm.topi.logical_xor", topi::logical_xor) + .TOPI_DEF_BCAST_OP("tvm.topi.bitwise_and", topi::bitwise_and) + .TOPI_DEF_BCAST_OP("tvm.topi.bitwise_or", topi::bitwise_or) + .TOPI_DEF_BCAST_OP("tvm.topi.bitwise_xor", topi::bitwise_xor) + .TOPI_DEF_BCAST_OP("tvm.topi.right_shift", topi::right_shift) + .TOPI_DEF_BCAST_OP("tvm.topi.greater", topi::greater) + .TOPI_DEF_BCAST_OP("tvm.topi.less", topi::less) + .TOPI_DEF_BCAST_OP("tvm.topi.equal", topi::equal) + .TOPI_DEF_BCAST_OP("tvm.topi.not_equal", topi::not_equal) + .TOPI_DEF_BCAST_OP("tvm.topi.greater_equal", topi::greater_equal) + .TOPI_DEF_BCAST_OP("tvm.topi.less_equal", topi::less_equal); } } // namespace topi diff --git a/src/topi/einsum.cc b/src/topi/einsum.cc index 42c8c768d275..a3886d5fc0a7 100644 --- a/src/topi/einsum.cc +++ b/src/topi/einsum.cc @@ -364,7 +364,7 @@ ffi::Array InferEinsumShape(const std::string& subscripts, TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def_packed("topi.einsum", [](ffi::PackedArgs args, ffi::Any* rv) { + refl::GlobalDef().def_packed("tvm.topi.einsum", [](ffi::PackedArgs args, ffi::Any* rv) { *rv = einsum(args[0].cast(), args[1].cast>()); }); } diff --git a/src/topi/elemwise.cc b/src/topi/elemwise.cc index 922c40619908..b8161fbcc004 100644 --- a/src/topi/elemwise.cc +++ b/src/topi/elemwise.cc @@ -34,89 +34,94 @@ using namespace tvm::runtime; TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def_packed("topi.acos", [](ffi::PackedArgs args, - ffi::Any* rv) { *rv = acos(args[0].cast()); }) - .def_packed("topi.acosh", [](ffi::PackedArgs args, - ffi::Any* rv) { *rv = acosh(args[0].cast()); }) - .def_packed("topi.asin", [](ffi::PackedArgs args, - ffi::Any* rv) { *rv = asin(args[0].cast()); }) - .def_packed("topi.asinh", [](ffi::PackedArgs args, - ffi::Any* rv) { *rv = asinh(args[0].cast()); }) - .def_packed("topi.atanh", [](ffi::PackedArgs args, - ffi::Any* rv) { *rv = atanh(args[0].cast()); }) - .def_packed("topi.exp", + .def_packed("tvm.topi.acos", [](ffi::PackedArgs args, + ffi::Any* rv) { *rv = acos(args[0].cast()); }) + .def_packed("tvm.topi.acosh", [](ffi::PackedArgs args, + ffi::Any* rv) { *rv = acosh(args[0].cast()); }) + .def_packed("tvm.topi.asin", [](ffi::PackedArgs args, + ffi::Any* rv) { *rv = asin(args[0].cast()); }) + .def_packed("tvm.topi.asinh", [](ffi::PackedArgs args, + ffi::Any* rv) { *rv = asinh(args[0].cast()); }) + .def_packed("tvm.topi.atanh", [](ffi::PackedArgs args, + ffi::Any* rv) { *rv = atanh(args[0].cast()); }) + .def_packed("tvm.topi.exp", [](ffi::PackedArgs args, ffi::Any* rv) { *rv = exp(args[0].cast()); }) - .def_packed("topi.fast_exp", [](ffi::PackedArgs args, - ffi::Any* rv) { *rv = fast_exp(args[0].cast()); }) - .def_packed("topi.erf", + .def_packed( + "tvm.topi.fast_exp", + [](ffi::PackedArgs args, ffi::Any* rv) { *rv = fast_exp(args[0].cast()); }) + .def_packed("tvm.topi.erf", [](ffi::PackedArgs args, ffi::Any* rv) { *rv = erf(args[0].cast()); }) - .def_packed("topi.fast_erf", [](ffi::PackedArgs args, - ffi::Any* rv) { *rv = fast_erf(args[0].cast()); }) - .def_packed("topi.tan", + .def_packed( + "tvm.topi.fast_erf", + [](ffi::PackedArgs args, ffi::Any* rv) { *rv = fast_erf(args[0].cast()); }) + .def_packed("tvm.topi.tan", [](ffi::PackedArgs args, ffi::Any* rv) { *rv = tan(args[0].cast()); }) - .def_packed("topi.cos", + .def_packed("tvm.topi.cos", [](ffi::PackedArgs args, ffi::Any* rv) { *rv = cos(args[0].cast()); }) - .def_packed("topi.cosh", [](ffi::PackedArgs args, - ffi::Any* rv) { *rv = cosh(args[0].cast()); }) - .def_packed("topi.sin", + .def_packed("tvm.topi.cosh", [](ffi::PackedArgs args, + ffi::Any* rv) { *rv = cosh(args[0].cast()); }) + .def_packed("tvm.topi.sin", [](ffi::PackedArgs args, ffi::Any* rv) { *rv = sin(args[0].cast()); }) - .def_packed("topi.sinh", [](ffi::PackedArgs args, - ffi::Any* rv) { *rv = sinh(args[0].cast()); }) - .def_packed("topi.tanh", [](ffi::PackedArgs args, - ffi::Any* rv) { *rv = tanh(args[0].cast()); }) + .def_packed("tvm.topi.sinh", [](ffi::PackedArgs args, + ffi::Any* rv) { *rv = sinh(args[0].cast()); }) + .def_packed("tvm.topi.tanh", [](ffi::PackedArgs args, + ffi::Any* rv) { *rv = tanh(args[0].cast()); }) .def_packed( - "topi.fast_tanh", + "tvm.topi.fast_tanh", [](ffi::PackedArgs args, ffi::Any* rv) { *rv = fast_tanh(args[0].cast()); }) - .def_packed("topi.atan", [](ffi::PackedArgs args, - ffi::Any* rv) { *rv = atan(args[0].cast()); }) - .def_packed("topi.sigmoid", [](ffi::PackedArgs args, - ffi::Any* rv) { *rv = sigmoid(args[0].cast()); }) - .def_packed("topi.sqrt", [](ffi::PackedArgs args, - ffi::Any* rv) { *rv = sqrt(args[0].cast()); }) - .def_packed("topi.rsqrt", [](ffi::PackedArgs args, - ffi::Any* rv) { *rv = rsqrt(args[0].cast()); }) - .def_packed("topi.log", + .def_packed("tvm.topi.atan", [](ffi::PackedArgs args, + ffi::Any* rv) { *rv = atan(args[0].cast()); }) + .def_packed( + "tvm.topi.sigmoid", + [](ffi::PackedArgs args, ffi::Any* rv) { *rv = sigmoid(args[0].cast()); }) + .def_packed("tvm.topi.sqrt", [](ffi::PackedArgs args, + ffi::Any* rv) { *rv = sqrt(args[0].cast()); }) + .def_packed("tvm.topi.rsqrt", [](ffi::PackedArgs args, + ffi::Any* rv) { *rv = rsqrt(args[0].cast()); }) + .def_packed("tvm.topi.log", [](ffi::PackedArgs args, ffi::Any* rv) { *rv = log(args[0].cast()); }) - .def_packed("topi.log2", [](ffi::PackedArgs args, - ffi::Any* rv) { *rv = log2(args[0].cast()); }) - .def_packed("topi.log10", [](ffi::PackedArgs args, - ffi::Any* rv) { *rv = log10(args[0].cast()); }) - .def_packed("topi.identity", [](ffi::PackedArgs args, - ffi::Any* rv) { *rv = identity(args[0].cast()); }) - .def_packed("topi.negative", [](ffi::PackedArgs args, - ffi::Any* rv) { *rv = negative(args[0].cast()); }) - .def_packed("topi.clip", + .def_packed("tvm.topi.log2", [](ffi::PackedArgs args, + ffi::Any* rv) { *rv = log2(args[0].cast()); }) + .def_packed("tvm.topi.log10", [](ffi::PackedArgs args, + ffi::Any* rv) { *rv = log10(args[0].cast()); }) + .def_packed( + "tvm.topi.identity", + [](ffi::PackedArgs args, ffi::Any* rv) { *rv = identity(args[0].cast()); }) + .def_packed( + "tvm.topi.negative", + [](ffi::PackedArgs args, ffi::Any* rv) { *rv = negative(args[0].cast()); }) + .def_packed("tvm.topi.clip", [](ffi::PackedArgs args, ffi::Any* rv) { *rv = clip(args[0].cast(), args[1].cast(), args[2].cast()); }) - .def_packed("topi.cast", + .def_packed("tvm.topi.cast", [](ffi::PackedArgs args, ffi::Any* rv) { *rv = cast(args[0].cast(), args[1].cast()); }) - .def_packed("topi.reinterpret", + .def_packed("tvm.topi.reinterpret", [](ffi::PackedArgs args, ffi::Any* rv) { *rv = reinterpret(args[0].cast(), args[1].cast()); }) - .def_packed("topi.elemwise_sum", + .def_packed("tvm.topi.elemwise_sum", [](ffi::PackedArgs args, ffi::Any* rv) { *rv = elemwise_sum(args[0].cast>()); }) - .def_packed("topi.sign", [](ffi::PackedArgs args, - ffi::Any* rv) { *rv = sign(args[0].cast()); }) - .def_packed("topi.full", + .def_packed("tvm.topi.sign", [](ffi::PackedArgs args, + ffi::Any* rv) { *rv = sign(args[0].cast()); }) + .def_packed("tvm.topi.full", [](ffi::PackedArgs args, ffi::Any* rv) { *rv = full(args[0].cast>(), args[1].cast(), args[2].cast()); }) - .def_packed("topi.full_like", + .def_packed("tvm.topi.full_like", [](ffi::PackedArgs args, ffi::Any* rv) { *rv = full_like(args[0].cast(), args[1].cast()); }) .def_packed( - "topi.logical_not", + "tvm.topi.logical_not", [](ffi::PackedArgs args, ffi::Any* rv) { *rv = logical_not(args[0].cast()); }) - .def_packed("topi.bitwise_not", [](ffi::PackedArgs args, ffi::Any* rv) { + .def_packed("tvm.topi.bitwise_not", [](ffi::PackedArgs args, ffi::Any* rv) { *rv = bitwise_not(args[0].cast()); }); } diff --git a/src/topi/nn.cc b/src/topi/nn.cc index 1f8118231fae..d946deb78f6e 100644 --- a/src/topi/nn.cc +++ b/src/topi/nn.cc @@ -49,37 +49,37 @@ TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() .def_packed( - "topi.nn.relu", + "tvm.topi.nn.relu", [](ffi::PackedArgs args, ffi::Any* rv) { *rv = relu(args[0].cast()); }) - .def_packed("topi.nn.leaky_relu", + .def_packed("tvm.topi.nn.leaky_relu", [](ffi::PackedArgs args, ffi::Any* rv) { *rv = leaky_relu(args[0].cast(), args[1].cast()); }) - .def_packed("topi.nn.prelu", + .def_packed("tvm.topi.nn.prelu", [](ffi::PackedArgs args, ffi::Any* rv) { *rv = prelu(args[0].cast(), args[1].cast(), args[2].cast()); }) - .def_packed("topi.nn.pad", + .def_packed("tvm.topi.nn.pad", [](ffi::PackedArgs args, ffi::Any* rv) { *rv = pad(args[0].cast(), args[1].cast>(), args[2].cast>(), args[3].cast()); }) - .def_packed("topi.nn.space_to_batch_nd", + .def_packed("tvm.topi.nn.space_to_batch_nd", [](ffi::PackedArgs args, ffi::Any* rv) { *rv = space_to_batch_nd( args[0].cast(), args[1].cast>(), args[2].cast>(), args[3].cast>(), args[4].cast()); }) - .def_packed("topi.nn.batch_to_space_nd", + .def_packed("tvm.topi.nn.batch_to_space_nd", [](ffi::PackedArgs args, ffi::Any* rv) { *rv = batch_to_space_nd( args[0].cast(), args[1].cast>(), args[2].cast>(), args[3].cast>(), args[4].cast()); }) - .def_packed("topi.nn.nll_loss", [](ffi::PackedArgs args, ffi::Any* rv) { + .def_packed("tvm.topi.nn.nll_loss", [](ffi::PackedArgs args, ffi::Any* rv) { *rv = nll_loss(args[0].cast(), args[1].cast(), args[2].cast(), args[3].cast(), args[4].cast()); @@ -89,7 +89,7 @@ TVM_FFI_STATIC_INIT_BLOCK() { /* Ops from nn/dense.h */ TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def_packed("topi.nn.dense", [](ffi::PackedArgs args, ffi::Any* rv) { + refl::GlobalDef().def_packed("tvm.topi.nn.dense", [](ffi::PackedArgs args, ffi::Any* rv) { *rv = nn::dense(args[0].cast(), args[1].cast(), args[2].cast(), args[3].cast()); }); @@ -98,7 +98,7 @@ TVM_FFI_STATIC_INIT_BLOCK() { /* Ops from nn/bias_add.h */ TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def_packed("topi.nn.bias_add", [](ffi::PackedArgs args, ffi::Any* rv) { + refl::GlobalDef().def_packed("tvm.topi.nn.bias_add", [](ffi::PackedArgs args, ffi::Any* rv) { *rv = nn::bias_add(args[0].cast(), args[1].cast(), args[2].cast()); }); } @@ -106,7 +106,7 @@ TVM_FFI_STATIC_INIT_BLOCK() { /* Ops from nn/dilate.h */ TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def_packed("topi.nn.dilate", [](ffi::PackedArgs args, ffi::Any* rv) { + refl::GlobalDef().def_packed("tvm.topi.nn.dilate", [](ffi::PackedArgs args, ffi::Any* rv) { *rv = nn::dilate(args[0].cast(), args[1].cast>(), args[2].cast()); }); @@ -115,7 +115,7 @@ TVM_FFI_STATIC_INIT_BLOCK() { /* Ops from nn/flatten.h */ TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def_packed("topi.nn.flatten", [](ffi::PackedArgs args, ffi::Any* rv) { + refl::GlobalDef().def_packed("tvm.topi.nn.flatten", [](ffi::PackedArgs args, ffi::Any* rv) { *rv = nn::flatten(args[0].cast()); }); } @@ -124,13 +124,13 @@ TVM_FFI_STATIC_INIT_BLOCK() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def_packed("topi.nn.scale_shift_nchw", + .def_packed("tvm.topi.nn.scale_shift_nchw", [](ffi::PackedArgs args, ffi::Any* rv) { *rv = nn::scale_shift_nchw(args[0].cast(), args[1].cast(), args[2].cast()); }) - .def_packed("topi.nn.scale_shift_nhwc", [](ffi::PackedArgs args, ffi::Any* rv) { + .def_packed("tvm.topi.nn.scale_shift_nhwc", [](ffi::PackedArgs args, ffi::Any* rv) { *rv = nn::scale_shift_nhwc(args[0].cast(), args[1].cast(), args[2].cast()); }); @@ -140,7 +140,7 @@ TVM_FFI_STATIC_INIT_BLOCK() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def_packed("topi.nn.pool_grad", + .def_packed("tvm.topi.nn.pool_grad", [](ffi::PackedArgs args, ffi::Any* rv) { *rv = nn::pool_grad( args[0].cast(), args[1].cast(), @@ -149,34 +149,34 @@ TVM_FFI_STATIC_INIT_BLOCK() { static_cast(args[5].cast()), args[6].cast(), args[7].cast(), args[8].cast()); }) - .def_packed("topi.nn.global_pool", + .def_packed("tvm.topi.nn.global_pool", [](ffi::PackedArgs args, ffi::Any* rv) { *rv = nn::global_pool(args[0].cast(), static_cast(args[1].cast()), args[2].cast()); }) - .def_packed("topi.nn.adaptive_pool1d", + .def_packed("tvm.topi.nn.adaptive_pool1d", [](ffi::PackedArgs args, ffi::Any* rv) { *rv = nn::adaptive_pool1d(args[0].cast(), args[1].cast>(), static_cast(args[2].cast()), args[3].cast()); }) - .def_packed("topi.nn.adaptive_pool", + .def_packed("tvm.topi.nn.adaptive_pool", [](ffi::PackedArgs args, ffi::Any* rv) { *rv = nn::adaptive_pool(args[0].cast(), args[1].cast>(), static_cast(args[2].cast()), args[3].cast()); }) - .def_packed("topi.nn.adaptive_pool3d", + .def_packed("tvm.topi.nn.adaptive_pool3d", [](ffi::PackedArgs args, ffi::Any* rv) { *rv = nn::adaptive_pool3d(args[0].cast(), args[1].cast>(), static_cast(args[2].cast()), args[3].cast()); }) - .def_packed("topi.nn.pool1d", + .def_packed("tvm.topi.nn.pool1d", [](ffi::PackedArgs args, ffi::Any* rv) { *rv = nn::pool1d( args[0].cast(), args[1].cast>(), @@ -185,7 +185,7 @@ TVM_FFI_STATIC_INIT_BLOCK() { static_cast(args[5].cast()), args[6].cast(), args[7].cast(), args[8].cast()); }) - .def_packed("topi.nn.pool2d", + .def_packed("tvm.topi.nn.pool2d", [](ffi::PackedArgs args, ffi::Any* rv) { *rv = nn::pool2d( args[0].cast(), args[1].cast>(), @@ -194,7 +194,7 @@ TVM_FFI_STATIC_INIT_BLOCK() { static_cast(args[5].cast()), args[6].cast(), args[7].cast(), args[8].cast()); }) - .def_packed("topi.nn.pool3d", [](ffi::PackedArgs args, ffi::Any* rv) { + .def_packed("tvm.topi.nn.pool3d", [](ffi::PackedArgs args, ffi::Any* rv) { *rv = nn::pool3d(args[0].cast(), args[1].cast>(), args[2].cast>(), args[3].cast>(), args[4].cast>(), @@ -207,15 +207,15 @@ TVM_FFI_STATIC_INIT_BLOCK() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def_packed("topi.nn.softmax", + .def_packed("tvm.topi.nn.softmax", [](ffi::PackedArgs args, ffi::Any* rv) { *rv = nn::softmax(args[0].cast(), args[1].cast()); }) - .def_packed("topi.nn.log_softmax", + .def_packed("tvm.topi.nn.log_softmax", [](ffi::PackedArgs args, ffi::Any* rv) { *rv = nn::log_softmax(args[0].cast()); }) - .def_packed("topi.nn.lrn", [](ffi::PackedArgs args, ffi::Any* rv) { + .def_packed("tvm.topi.nn.lrn", [](ffi::PackedArgs args, ffi::Any* rv) { *rv = nn::lrn(args[0].cast(), args[1].cast(), args[2].cast(), args[3].cast(), args[4].cast(), args[5].cast()); }); @@ -225,11 +225,11 @@ TVM_FFI_STATIC_INIT_BLOCK() { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def_packed("topi.nn.binarize_pack", + .def_packed("tvm.topi.nn.binarize_pack", [](ffi::PackedArgs args, ffi::Any* rv) { *rv = nn::binarize_pack(args[0].cast(), args[1].cast()); }) - .def_packed("topi.nn.binary_dense", [](ffi::PackedArgs args, ffi::Any* rv) { + .def_packed("tvm.topi.nn.binary_dense", [](ffi::PackedArgs args, ffi::Any* rv) { *rv = nn::binary_dense(args[0].cast(), args[1].cast()); }); } @@ -237,7 +237,7 @@ TVM_FFI_STATIC_INIT_BLOCK() { /* Ops from nn/layer_norm.h */ TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def_packed("topi.nn.layer_norm", [](ffi::PackedArgs args, ffi::Any* rv) { + refl::GlobalDef().def_packed("tvm.topi.nn.layer_norm", [](ffi::PackedArgs args, ffi::Any* rv) { *rv = nn::layer_norm(args[0].cast(), args[1].cast(), args[2].cast(), args[3].cast>(), args[4].cast()); @@ -247,7 +247,7 @@ TVM_FFI_STATIC_INIT_BLOCK() { /* Ops from nn/group_norm.h */ TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def_packed("topi.nn.group_norm", [](ffi::PackedArgs args, ffi::Any* rv) { + refl::GlobalDef().def_packed("tvm.topi.nn.group_norm", [](ffi::PackedArgs args, ffi::Any* rv) { *rv = nn::group_norm(args[0].cast(), args[1].cast(), args[2].cast(), args[3].cast(), args[4].cast(), args[5].cast>(), args[6].cast()); @@ -257,7 +257,7 @@ TVM_FFI_STATIC_INIT_BLOCK() { /* Ops from nn/instance_norm.h */ TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def_packed("topi.nn.instance_norm", [](ffi::PackedArgs args, ffi::Any* rv) { + refl::GlobalDef().def_packed("tvm.topi.nn.instance_norm", [](ffi::PackedArgs args, ffi::Any* rv) { *rv = nn::instance_norm(args[0].cast(), args[1].cast(), args[2].cast(), args[3].cast(), args[4].cast>(), args[5].cast()); @@ -267,7 +267,7 @@ TVM_FFI_STATIC_INIT_BLOCK() { /* Ops from nn/rms_norm.h */ TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def_packed("topi.nn.rms_norm", [](ffi::PackedArgs args, ffi::Any* rv) { + refl::GlobalDef().def_packed("tvm.topi.nn.rms_norm", [](ffi::PackedArgs args, ffi::Any* rv) { *rv = nn::rms_norm(args[0].cast(), args[1].cast(), args[2].cast>(), args[3].cast()); }); diff --git a/src/topi/reduction.cc b/src/topi/reduction.cc index 0f2a7f49fc73..d18b1efbe4cf 100644 --- a/src/topi/reduction.cc +++ b/src/topi/reduction.cc @@ -35,47 +35,47 @@ using namespace tvm::runtime; TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def_packed("topi.sum", + .def_packed("tvm.topi.sum", [](ffi::PackedArgs args, ffi::Any* rv) { *rv = topi::sum(args[0].cast(), ArrayOrInt(args[1]), args[2].cast()); }) - .def_packed("topi.min", + .def_packed("tvm.topi.min", [](ffi::PackedArgs args, ffi::Any* rv) { *rv = topi::min(args[0].cast(), ArrayOrInt(args[1]), args[2].cast()); }) - .def_packed("topi.max", + .def_packed("tvm.topi.max", [](ffi::PackedArgs args, ffi::Any* rv) { *rv = topi::max(args[0].cast(), ArrayOrInt(args[1]), args[2].cast()); }) - .def_packed("topi.argmin", + .def_packed("tvm.topi.argmin", [](ffi::PackedArgs args, ffi::Any* rv) { *rv = topi::argmin(args[0].cast(), ArrayOrInt(args[1]), args[2].cast(), false, args[3].cast()); }) - .def_packed("topi.argmax", + .def_packed("tvm.topi.argmax", [](ffi::PackedArgs args, ffi::Any* rv) { *rv = topi::argmax(args[0].cast(), ArrayOrInt(args[1]), args[2].cast(), false, args[3].cast()); }) - .def_packed("topi.prod", + .def_packed("tvm.topi.prod", [](ffi::PackedArgs args, ffi::Any* rv) { *rv = topi::prod(args[0].cast(), ArrayOrInt(args[1]), args[2].cast()); }) - .def_packed("topi.all", + .def_packed("tvm.topi.all", [](ffi::PackedArgs args, ffi::Any* rv) { *rv = topi::all(args[0].cast(), ArrayOrInt(args[1]), args[2].cast()); }) - .def_packed("topi.any", + .def_packed("tvm.topi.any", [](ffi::PackedArgs args, ffi::Any* rv) { *rv = topi::any(args[0].cast(), ArrayOrInt(args[1]), args[2].cast()); }) - .def_packed("topi.collapse_sum", [](ffi::PackedArgs args, ffi::Any* rv) { + .def_packed("tvm.topi.collapse_sum", [](ffi::PackedArgs args, ffi::Any* rv) { *rv = topi::collapse_sum(args[0].cast(), args[1].cast>()); }); } diff --git a/src/topi/transform.cc b/src/topi/transform.cc index d9545e637405..8a3972688345 100644 --- a/src/topi/transform.cc +++ b/src/topi/transform.cc @@ -40,58 +40,58 @@ using namespace tvm::runtime; TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def_packed("topi.expand_dims", + .def_packed("tvm.topi.expand_dims", [](ffi::PackedArgs args, ffi::Any* rv) { *rv = expand_dims(args[0].cast(), args[1].cast(), args[2].cast()); }) - .def_packed("topi.transpose", + .def_packed("tvm.topi.transpose", [](ffi::PackedArgs args, ffi::Any* rv) { *rv = transpose(args[0].cast(), args[1].cast>>()); }) - .def_packed("topi.flip", + .def_packed("tvm.topi.flip", [](ffi::PackedArgs args, ffi::Any* rv) { // pass empty seq_lengths tensor to reverse_sequence *rv = reverse_sequence(args[0].cast(), te::Tensor(), args[1].cast()); }) - .def_packed("topi.reverse_sequence", + .def_packed("tvm.topi.reverse_sequence", [](ffi::PackedArgs args, ffi::Any* rv) { *rv = reverse_sequence(args[0].cast(), args[1].cast(), args[2].cast()); }) - .def_packed("topi.reshape", + .def_packed("tvm.topi.reshape", [](ffi::PackedArgs args, ffi::Any* rv) { *rv = reshape(args[0].cast(), args[1].cast>()); }) - .def_packed("topi.sliding_window", + .def_packed("tvm.topi.sliding_window", [](ffi::PackedArgs args, ffi::Any* rv) { *rv = sliding_window(args[0].cast(), args[1].cast(), args[2].cast>(), args[3].cast>()); }) - .def_packed("topi.squeeze", + .def_packed("tvm.topi.squeeze", [](ffi::PackedArgs args, ffi::Any* rv) { *rv = squeeze(args[0].cast(), ArrayOrInt(args[1])); }) - .def_packed("topi.concatenate", + .def_packed("tvm.topi.concatenate", [](ffi::PackedArgs args, ffi::Any* rv) { *rv = concatenate(args[0].cast>(), args[1].cast()); }) - .def_packed("topi.stack", + .def_packed("tvm.topi.stack", [](ffi::PackedArgs args, ffi::Any* rv) { *rv = stack(args[0].cast>(), args[1].cast()); }) - .def_packed("topi.shape", + .def_packed("tvm.topi.shape", [](ffi::PackedArgs args, ffi::Any* rv) { *rv = shape(args[0].cast(), args[1].cast()); }) - .def_packed("topi.tensor_size", + .def_packed("tvm.topi.tensor_size", [](ffi::PackedArgs args, ffi::Any* rv) { *rv = tensor_size(args[0].cast(), args[1].cast()); }) - .def_packed("topi.split", + .def_packed("tvm.topi.split", [](ffi::PackedArgs args, ffi::Any* rv) { if (args[1].try_cast()) { *rv = split_n_sections(args[0].cast(), args[1].cast(), @@ -102,14 +102,14 @@ TVM_FFI_STATIC_INIT_BLOCK() { args[2].cast()); } }) - .def_packed("topi.layout_transform", + .def_packed("tvm.topi.layout_transform", [](ffi::PackedArgs args, ffi::Any* rv) { *rv = layout_transform(args[0].cast(), args[1].cast(), args[2].cast(), args[3].cast()); }) .def_packed( - "topi.take", + "tvm.topi.take", [](ffi::PackedArgs args, ffi::Any* rv) { if (args.size() == 4) { auto mode = args[3].cast(); @@ -125,59 +125,59 @@ TVM_FFI_STATIC_INIT_BLOCK() { args[1].cast>(), batch_dims, axis, mode); } }) - .def_packed("topi.sequence_mask", + .def_packed("tvm.topi.sequence_mask", [](ffi::PackedArgs args, ffi::Any* rv) { double pad_val = args[2].cast(); int axis = args[3].cast(); *rv = sequence_mask(args[0].cast(), args[1].cast(), pad_val, axis); }) - .def_packed("topi.where", + .def_packed("tvm.topi.where", [](ffi::PackedArgs args, ffi::Any* rv) { *rv = where(args[0].cast(), args[1].cast(), args[2].cast()); }) - .def_packed("topi.arange", + .def_packed("tvm.topi.arange", [](ffi::PackedArgs args, ffi::Any* rv) { *rv = arange(args[0].cast(), args[1].cast(), args[2].cast(), args[3].cast()); }) - .def_packed("topi.meshgrid", + .def_packed("tvm.topi.meshgrid", [](ffi::PackedArgs args, ffi::Any* rv) { *rv = meshgrid(args[0].cast>(), args[1].cast()); }) - .def_packed("topi.repeat", + .def_packed("tvm.topi.repeat", [](ffi::PackedArgs args, ffi::Any* rv) { *rv = repeat(args[0].cast(), args[1].cast(), args[2].cast()); }) - .def_packed("topi.tile", + .def_packed("tvm.topi.tile", [](ffi::PackedArgs args, ffi::Any* rv) { *rv = tile(args[0].cast(), args[1].cast>()); }) - .def_packed("topi.gather", + .def_packed("tvm.topi.gather", [](ffi::PackedArgs args, ffi::Any* rv) { *rv = gather(args[0].cast(), args[1].cast(), args[2].cast()); }) - .def_packed("topi.gather_nd", + .def_packed("tvm.topi.gather_nd", [](ffi::PackedArgs args, ffi::Any* rv) { int batch_dims = args[2].cast(); *rv = gather_nd(args[0].cast(), args[1].cast(), batch_dims); }) - .def_packed("topi.unravel_index", + .def_packed("tvm.topi.unravel_index", [](ffi::PackedArgs args, ffi::Any* rv) { *rv = unravel_index(args[0].cast(), args[1].cast()); }) - .def_packed("topi.sparse_to_dense", + .def_packed("tvm.topi.sparse_to_dense", [](ffi::PackedArgs args, ffi::Any* rv) { *rv = sparse_to_dense(args[0].cast(), args[1].cast>(), args[2].cast(), args[3].cast()); }) - .def_packed("topi.matmul", + .def_packed("tvm.topi.matmul", [](ffi::PackedArgs args, ffi::Any* rv) { switch (args.size()) { case 2: @@ -195,7 +195,7 @@ TVM_FFI_STATIC_INIT_BLOCK() { ICHECK(0) << "topi.matmul expects 2, 3 or 4 arguments"; } }) - .def_packed("topi.tensordot", + .def_packed("tvm.topi.tensordot", [](ffi::PackedArgs args, ffi::Any* rv) { if (args.size() == 2) { *rv = tensordot(args[0].cast(), args[1].cast()); @@ -209,7 +209,7 @@ TVM_FFI_STATIC_INIT_BLOCK() { } }) .def_packed( - "topi.strided_slice", + "tvm.topi.strided_slice", [](ffi::PackedArgs args, ffi::Any* rv) { te::Tensor x = args[0].cast(); ffi::Array begin = args[1].cast>(); @@ -237,19 +237,19 @@ TVM_FFI_STATIC_INIT_BLOCK() { } } }) - .def_packed("topi.dynamic_strided_slice", + .def_packed("tvm.topi.dynamic_strided_slice", [](ffi::PackedArgs args, ffi::Any* rv) { te::Tensor begin = args[1].cast(); te::Tensor end = args[2].cast(); te::Tensor strides = args[3].cast(); *rv = dynamic_strided_slice(args[0].cast(), begin, end, strides); }) - .def("topi.relax_dynamic_strided_slice", + .def("tvm.topi.relax_dynamic_strided_slice", [](te::Tensor x, te::Tensor begin, te::Tensor end, te::Tensor strides, ffi::Array output_shape) { return relax::dynamic_strided_slice(x, begin, end, strides, output_shape); }) - .def_packed("topi.one_hot", + .def_packed("tvm.topi.one_hot", [](ffi::PackedArgs args, ffi::Any* rv) { int depth = args[3].cast(); int axis = args[4].cast(); @@ -257,7 +257,7 @@ TVM_FFI_STATIC_INIT_BLOCK() { *rv = one_hot(args[0].cast(), args[1].cast(), args[2].cast(), depth, axis, dtype); }) - .def_packed("topi.matrix_set_diag", + .def_packed("tvm.topi.matrix_set_diag", [](ffi::PackedArgs args, ffi::Any* rv) { int k1 = args[2].cast(); int k2 = args[3].cast(); @@ -266,7 +266,7 @@ TVM_FFI_STATIC_INIT_BLOCK() { *rv = matrix_set_diag(args[0].cast(), args[1].cast(), k1, k2, super_diag_right_align, sub_diag_right_align); }) - .def("topi.adv_index", + .def("tvm.topi.adv_index", [](te::Tensor x, ffi::Array indices) { return adv_index(x, indices); }); } diff --git a/src/topi/utils.cc b/src/topi/utils.cc index 6bc1570bd196..e8c0c1fd2f5a 100644 --- a/src/topi/utils.cc +++ b/src/topi/utils.cc @@ -31,17 +31,17 @@ namespace topi { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def_packed("topi.utils.is_empty_shape", + .def_packed("tvm.topi.utils.is_empty_shape", [](ffi::PackedArgs args, ffi::Any* rv) { *rv = topi::detail::is_empty_shape(args[0].cast>()); }) - .def_packed("topi.utils.bilinear_sample_nchw", + .def_packed("tvm.topi.utils.bilinear_sample_nchw", [](ffi::PackedArgs args, ffi::Any* rv) { *rv = detail::bilinear_sample_nchw( args[0].cast(), args[1].cast>(), args[2].cast(), args[3].cast()); }) - .def_packed("topi.utils.bilinear_sample_nhwc", [](ffi::PackedArgs args, ffi::Any* rv) { + .def_packed("tvm.topi.utils.bilinear_sample_nhwc", [](ffi::PackedArgs args, ffi::Any* rv) { *rv = detail::bilinear_sample_nhwc(args[0].cast(), args[1].cast>(), args[2].cast(), args[3].cast()); diff --git a/src/topi/vision.cc b/src/topi/vision.cc index 7babb0591676..12de0ba41827 100644 --- a/src/topi/vision.cc +++ b/src/topi/vision.cc @@ -33,7 +33,7 @@ using namespace tvm::runtime; TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def_packed("topi.vision.reorg", [](ffi::PackedArgs args, ffi::Any* rv) { + refl::GlobalDef().def_packed("tvm.topi.vision.reorg", [](ffi::PackedArgs args, ffi::Any* rv) { *rv = vision::reorg(args[0].cast(), args[1].cast()); }); } diff --git a/web/apps/node/example.js b/web/apps/node/example.js index 62c9157c7c29..24dccca833e6 100644 --- a/web/apps/node/example.js +++ b/web/apps/node/example.js @@ -31,7 +31,7 @@ const wasmSource = fs.readFileSync(path.join(wasmPath, "tvmjs_runtime.wasm")); tvmjs.instantiate(wasmSource, tvmjs.createPolyfillWASI()) .then((tvm) => { tvm.beginScope(); - const log_info = tvm.getGlobalFunc("tvmjs.testing.log_info_str"); + const log_info = tvm.getGlobalFunc("tvm.tvmjs.testing.log_info_str"); log_info("hello world"); // List all the global functions from the runtime. console.log("Runtime functions using EmccWASI\n", tvm.listGlobalFuncNames()); diff --git a/web/emcc/tvmjs_support.cc b/web/emcc/tvmjs_support.cc index d6b94bda32fe..0b48e6ff0e32 100644 --- a/web/emcc/tvmjs_support.cc +++ b/web/emcc/tvmjs_support.cc @@ -116,7 +116,7 @@ class AsyncLocalSession : public LocalSession { AsyncLocalSession() {} PackedFuncHandle GetFunction(const std::string& name) final { - if (name == "runtime.RPCTimeEvaluator") { + if (name == "tvm.runtime.RPCTimeEvaluator") { return get_time_eval_placeholder_.get(); } else if (auto fp = tvm::ffi::Function::GetGlobal(name)) { TVMFFIAny val = tvm::ffi::details::AnyUnsafe::MoveAnyToTVMFFIAny(tvm::ffi::Any(*fp)); @@ -305,7 +305,7 @@ class AsyncLocalSession : public LocalSession { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def("wasm.LocalSession", []() { + refl::GlobalDef().def("tvm.wasm.LocalSession", []() { return CreateRPCSessionModule(std::make_shared()); }); } diff --git a/web/emcc/wasm_runtime.cc b/web/emcc/wasm_runtime.cc index c1839947bacf..f0ff35d7ac74 100644 --- a/web/emcc/wasm_runtime.cc +++ b/web/emcc/wasm_runtime.cc @@ -111,15 +111,15 @@ void LogMessageImpl(const std::string& file, int lineno, int level, const std::s TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def_packed("tvmjs.testing.call", + .def_packed("tvm.tvmjs.testing.call", [](ffi::PackedArgs args, ffi::Any* ret) { (args[0].cast()).CallPacked(args.Slice(1), ret); }) .def_packed( - "tvmjs.testing.log_info_str", + "tvm.tvmjs.testing.log_info_str", [](ffi::PackedArgs args, ffi::Any* ret) { LOG(INFO) << args[0].cast(); }) - .def("tvmjs.testing.add_one", [](int x) { return x + 1; }) - .def_packed("tvmjs.testing.wrap_callback", [](ffi::PackedArgs args, ffi::Any* ret) { + .def("tvm.tvmjs.testing.add_one", [](int x) { return x + 1; }) + .def_packed("tvm.tvmjs.testing.wrap_callback", [](ffi::PackedArgs args, ffi::Any* ret) { ffi::Function pf = args[0].cast(); *ret = ffi::TypedFunction([pf]() { pf(); }); }); @@ -150,7 +150,7 @@ void ArrayDecodeStorage(Tensor cpu_arr, TVMFFIByteArray* bytes, const std::strin TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef().def_packed( - "tvmjs.array.decode_storage", [](ffi::PackedArgs args, ffi::Any* ret) { + "tvm.tvmjs.array.decode_storage", [](ffi::PackedArgs args, ffi::Any* ret) { Tensor cpu_arr = args[0].cast(); TVMFFIByteArray* bytes = args[1].cast(); std::string format = args[2].cast().operator std::string(); @@ -162,7 +162,7 @@ TVM_FFI_STATIC_INIT_BLOCK() { // Concatenate n TVMArrays TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; - refl::GlobalDef().def_packed("tvmjs.runtime.ArrayConcat", + refl::GlobalDef().def_packed("tvm.tvmjs.runtime.ArrayConcat", [](ffi::PackedArgs args, ffi::Any* ret) { std::vector data; for (int i = 0; i < args.size(); ++i) { @@ -216,7 +216,7 @@ Tensor ConcatEmbeddings(const std::vector& embeddings) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def_packed("tvmjs.runtime.ConcatEmbeddings", + .def_packed("tvm.tvmjs.runtime.ConcatEmbeddings", [](ffi::PackedArgs args, ffi::Any* ret) { std::vector embeddings; for (int i = 0; i < args.size(); ++i) { @@ -225,9 +225,9 @@ TVM_FFI_STATIC_INIT_BLOCK() { Tensor result = ConcatEmbeddings(std::move(embeddings)); *ret = result; }) - .def("tvmjs.runtime.TensorCopyFromBytes", + .def("tvm.tvmjs.runtime.TensorCopyFromBytes", [](Tensor nd, TVMFFIByteArray* bytes) { nd.CopyFromBytes(bytes->data, bytes->size); }) - .def("tvmjs.runtime.TensorCopyToBytes", [](Tensor nd) -> ffi::Bytes { + .def("tvm.tvmjs.runtime.TensorCopyToBytes", [](Tensor nd) -> ffi::Bytes { size_t size = ffi::GetDataSize(*(nd.operator->())); std::string bytes; bytes.resize(size); diff --git a/web/emcc/webgpu_runtime.cc b/web/emcc/webgpu_runtime.cc index 03d08f731b95..371c8cfc37d5 100644 --- a/web/emcc/webgpu_runtime.cc +++ b/web/emcc/webgpu_runtime.cc @@ -244,8 +244,8 @@ ffi::Module WebGPUModuleLoadFromBytes(const ffi::Bytes& bytes) { TVM_FFI_STATIC_INIT_BLOCK() { namespace refl = tvm::ffi::reflection; refl::GlobalDef() - .def("ffi.Module.load_from_bytes.webgpu", WebGPUModuleLoadFromBytes) - .def_packed("device_api.webgpu", [](ffi::PackedArgs args, ffi::Any* rv) { + .def("tvm.ffi.Module.load_from_bytes.webgpu", WebGPUModuleLoadFromBytes) + .def_packed("tvm.device_api.webgpu", [](ffi::PackedArgs args, ffi::Any* rv) { DeviceAPI* ptr = WebGPUDeviceAPI::Global(); *rv = static_cast(ptr); }); diff --git a/web/src/rpc_server.ts b/web/src/rpc_server.ts index 3adab93be103..8857736f20a2 100644 --- a/web/src/rpc_server.ts +++ b/web/src/rpc_server.ts @@ -300,7 +300,7 @@ export class RPCServer { if (this.asyncOnServerLoad !== undefined) { await this.asyncOnServerLoad(this.inst); } - const fcreate = this.inst.getGlobalFunc("rpc.CreateEventDrivenServer"); + const fcreate = this.inst.getGlobalFunc("tvm.rpc.CreateEventDrivenServer"); const messageHandler = fcreate( (cbytes: Uint8Array): runtime.Scalar => { assert(this.inst !== undefined); @@ -356,7 +356,7 @@ export class RPCServer { // The RPC will look for "rpc.wasmSession" // and we will redirect it to the correct local session. // register the callback to redirect the session to local. - const flocal = this.inst.getGlobalFunc("wasm.LocalSession"); + const flocal = this.inst.getGlobalFunc("tvm.wasm.LocalSession"); const localSession = flocal(); assert(localSession instanceof runtime.Module); diff --git a/web/src/runtime.ts b/web/src/runtime.ts index 41bc43b54c5f..ffdf67903782 100644 --- a/web/src/runtime.ts +++ b/web/src/runtime.ts @@ -191,30 +191,30 @@ class RuntimeContext implements Disposable { ); this.moduleGetFunction = getGlobalFunc("ffi.ModuleGetFunction"); this.moduleImport = getGlobalFunc("ffi.ModuleImportModule"); - this.tensorEmpty = getGlobalFunc("runtime.TVMTensorAllocWithScope"); - this.tensorCopyFromTo = getGlobalFunc("runtime.TVMTensorCopyFromTo"); - this.tensorCopyFromJSBytes = getGlobalFunc("tvmjs.runtime.TensorCopyFromBytes"); - this.tensorCopyToJSBytes = getGlobalFunc("tvmjs.runtime.TensorCopyToBytes"); + this.tensorEmpty = getGlobalFunc("tvm.runtime.TVMTensorAllocWithScope"); + this.tensorCopyFromTo = getGlobalFunc("tvm.runtime.TVMTensorCopyFromTo"); + this.tensorCopyFromJSBytes = getGlobalFunc("tvm.tvmjs.runtime.TensorCopyFromBytes"); + this.tensorCopyToJSBytes = getGlobalFunc("tvm.tvmjs.runtime.TensorCopyToBytes"); this.arrayGetItem = getGlobalFunc("ffi.ArrayGetItem"); this.arrayGetSize = getGlobalFunc("ffi.ArraySize"); this.arrayMake = getGlobalFunc("ffi.Array"); - this.arrayConcat = getGlobalFunc("tvmjs.runtime.ArrayConcat"); + this.arrayConcat = getGlobalFunc("tvm.tvmjs.runtime.ArrayConcat"); this.getSysLib = getGlobalFunc("ffi.SystemLib"); - this.tensorCacheGet = getGlobalFunc("vm.builtin.tensor_cache.get"); - this.tensorCacheRemove = getGlobalFunc("vm.builtin.tensor_cache.remove"); - this.tensorCacheUpdate = getGlobalFunc("vm.builtin.tensor_cache.update"); - this.tensorCacheClear = getGlobalFunc("vm.builtin.tensor_cache.clear"); - this.arrayDecodeStorage = getGlobalFunc("tvmjs.array.decode_storage"); - this.paramModuleFromCache = getGlobalFunc("vm.builtin.param_module_from_cache"); - this.paramModuleFromCacheByName = getGlobalFunc("vm.builtin.param_module_from_cache_by_name"); + this.tensorCacheGet = getGlobalFunc("tvm.vm.builtin.tensor_cache.get"); + this.tensorCacheRemove = getGlobalFunc("tvm.vm.builtin.tensor_cache.remove"); + this.tensorCacheUpdate = getGlobalFunc("tvm.vm.builtin.tensor_cache.update"); + this.tensorCacheClear = getGlobalFunc("tvm.vm.builtin.tensor_cache.clear"); + this.arrayDecodeStorage = getGlobalFunc("tvm.tvmjs.array.decode_storage"); + this.paramModuleFromCache = getGlobalFunc("tvm.vm.builtin.param_module_from_cache"); + this.paramModuleFromCacheByName = getGlobalFunc("tvm.vm.builtin.param_module_from_cache_by_name"); this.makeShapeTuple = getGlobalFunc("ffi.Shape"); - this.tensorCreateView = getGlobalFunc("runtime.TVMTensorCreateView"); - this.sampleTopPFromLogits = getGlobalFunc("vm.builtin.sample_top_p_from_logits"); - this.sampleTopPFromProb = getGlobalFunc("vm.builtin.sample_top_p_from_prob"); - this.applyRepetitionPenalty = getGlobalFunc("vm.builtin.apply_repetition_penalty"); - this.applyPresenceAndFrequencyPenalty = getGlobalFunc("vm.builtin.apply_presence_and_frequency_penalty"); - this.applySoftmaxWithTemperature = getGlobalFunc("vm.builtin.apply_softmax_with_temperature"); - this.concatEmbeddings = getGlobalFunc("tvmjs.runtime.ConcatEmbeddings"); + this.tensorCreateView = getGlobalFunc("tvm.runtime.TVMTensorCreateView"); + this.sampleTopPFromLogits = getGlobalFunc("tvm.vm.builtin.sample_top_p_from_logits"); + this.sampleTopPFromProb = getGlobalFunc("tvm.vm.builtin.sample_top_p_from_prob"); + this.applyRepetitionPenalty = getGlobalFunc("tvm.vm.builtin.apply_repetition_penalty"); + this.applyPresenceAndFrequencyPenalty = getGlobalFunc("tvm.vm.builtin.apply_presence_and_frequency_penalty"); + this.applySoftmaxWithTemperature = getGlobalFunc("tvm.vm.builtin.apply_softmax_with_temperature"); + this.concatEmbeddings = getGlobalFunc("tvm.tvmjs.runtime.ConcatEmbeddings"); } dispose(): void { @@ -1142,7 +1142,7 @@ export class Instance implements Disposable { */ isPackedFunc(func: unknown): boolean { // eslint-disable-next-line no-prototype-builtins - return typeof func === "function" && func.hasOwnProperty("_tvmPackedCell"); + return typeof func === "tvm.function" && func.hasOwnProperty("_tvmPackedCell"); } /** @@ -2069,7 +2069,7 @@ export class Instance implements Disposable { stack.storeI32(argTypeIndexOffset, TypeIndex.kTVMFFIFloat); stack.storeF64(argValueOffset, val); // eslint-disable-next-line no-prototype-builtins - } else if (tp === "function" && val.hasOwnProperty("_tvmPackedCell")) { + } else if (tp === "tvm.function" && val.hasOwnProperty("_tvmPackedCell")) { stack.storePtr(argValueOffset, val._tvmPackedCell.getHandle()); stack.storeI32(argTypeIndexOffset, TypeIndex.kTVMFFIFunction); } else if (val === null || val === undefined) { diff --git a/web/src/support.ts b/web/src/support.ts index be85e85b7bab..63480a967e21 100644 --- a/web/src/support.ts +++ b/web/src/support.ts @@ -26,8 +26,8 @@ */ export function isPromise(value: any): boolean { return value !== undefined && ( - typeof value == "object" || typeof value == "function" - ) && typeof value.then == "function"; + typeof value == "object" || typeof value == "tvm.function" + ) && typeof value.then == "tvm.function"; } /** * Convert string to Uint8array. diff --git a/web/tests/node/test_packed_func.js b/web/tests/node/test_packed_func.js index 83ac61156430..99220689cb79 100644 --- a/web/tests/node/test_packed_func.js +++ b/web/tests/node/test_packed_func.js @@ -37,15 +37,15 @@ let tvm = new tvmjs.Instance( test("GetGlobal", () => { tvm.beginScope(); let flist = tvm.listGlobalFuncNames(); - let faddOne = tvm.getGlobalFunc("tvmjs.testing.add_one"); - let fecho = tvm.getGlobalFunc("testing.echo"); + let faddOne = tvm.getGlobalFunc("tvm.tvmjs.testing.add_one"); + let fecho = tvm.getGlobalFunc("tvm.testing.echo"); assert(faddOne(tvm.scalar(1, "int")) == 2); assert(faddOne(tvm.scalar(-1, "int")) == 0); // check function argument with different types. assert(fecho(1123) == 1123); - assert(fecho("xyz") == "xyz"); + assert(fecho("tvm.xyz") == "tvm.xyz"); // test long string as the abi can be different from small str const long_str = "1234567890123456789abcdefghijklmnopqrstuvwxyz"; assert(fecho(long_str) == long_str); @@ -105,7 +105,7 @@ test("ReturnFunc", () => { return add; } - let fecho = tvm.getGlobalFunc("testing.echo"); + let fecho = tvm.getGlobalFunc("tvm.testing.echo"); let myf = tvm.toPackedFunc(addy); assert(tvm.isPackedFunc(myf)); let myf2 = tvm.toPackedFunc(myf); @@ -128,11 +128,11 @@ test("ReturnFunc", () => { test("RegisterGlobal", () => { tvm.beginScope(); - tvm.registerFunc("xyz", function (x, y) { + tvm.registerFunc("tvm.xyz", function (x, y) { return x + y; }); - let f = tvm.getGlobalFunc("xyz"); + let f = tvm.getGlobalFunc("tvm.xyz"); assert(f(1, 2) == 3); f.dispose(); @@ -145,10 +145,10 @@ test("ExceptionPassing", () => { if (!exceptionEnabled) return; tvm.beginScope(); - tvm.registerFunc("throw_error", function (msg) { + tvm.registerFunc("tvm.throw_error", function (msg) { throw Error(msg); }); - let f = tvm.getGlobalFunc("throw_error"); + let f = tvm.getGlobalFunc("tvm.throw_error"); try { f("error-xyz"); throw Error("error not caught"); @@ -160,7 +160,7 @@ test("ExceptionPassing", () => { test("TensorCbArg", () => { tvm.beginScope(); - let use_count = tvm.getGlobalFunc("testing.object_use_count"); + let use_count = tvm.getGlobalFunc("tvm.testing.object_use_count"); let record = []; let fcheck = tvm.toPackedFunc(function (x, retain) { @@ -191,7 +191,7 @@ test("TensorCbArg", () => { test("Logging", () => { tvm.beginScope(); - const log_info = tvm.getGlobalFunc("tvmjs.testing.log_info_str"); + const log_info = tvm.getGlobalFunc("tvm.tvmjs.testing.log_info_str"); log_info("helow world") log_info.dispose(); tvm.endScope(); @@ -203,15 +203,15 @@ test("AsyncifyFunc", async () => { return; } tvm.beginScope(); - tvm.registerAsyncifyFunc("async_sleep_echo", async function (x) { + tvm.registerAsyncifyFunc("tvm.async_sleep_echo", async function (x) { await new Promise(resolve => setTimeout(resolve, 10)); return x; }); let fecho = tvm.wrapAsyncifyPackedFunc( - tvm.getGlobalFunc("async_sleep_echo") + tvm.getGlobalFunc("tvm.async_sleep_echo") ); let fcall = tvm.wrapAsyncifyPackedFunc( - tvm.getGlobalFunc("tvmjs.testing.call") + tvm.getGlobalFunc("tvm.tvmjs.testing.call") ); assert((await fecho(1)) == 1); assert((await fecho(2)) == 2);