junrushao commented on code in PR #12948: URL: https://github.com/apache/tvm/pull/12948#discussion_r1018264199
########## python/tvm/meta_schedule/testing/validate_database.py: ########## @@ -0,0 +1,283 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +"""JSON Database validation script""" +from typing import Union, Callable, List +from distutils.util import strtobool +import argparse +import logging +import warnings +import numpy as np # type: ignore + +import tvm +from tvm.target import Target +from tvm.ir import IRModule +from tvm.tir import Schedule +from tvm import meta_schedule as ms +from tvm.meta_schedule.testing.custom_builder_runner import run_module_via_rpc +from tvm.meta_schedule.testing.tune_utils import create_computer, generate_input_data +from tvm._ffi import get_global_func, register_func +from tvm.support import describe + +DELIMITOR = "\n" + "-" * 30 + "\n" + + +def _parse_args(): + args = argparse.ArgumentParser() + args.add_argument( + "--path-workload", + type=str, + required=True, + help="The path to the database workload file.", + ) + args.add_argument( + "--path-tuning-record", + type=str, + required=True, + help="The path to the database tuning record file.", + ) + args.add_argument( + "--target", + type=str, + required=True, + ) + args.add_argument( + "--baseline-target", + type=str, + default="llvm -num-cores=1", + required=False, + help="The baseline target to compile the original module.", + ) + args.add_argument( + "--rpc-host", + type=str, + required=True, + ) + args.add_argument( + "--rpc-port", + type=int, + required=True, + ) + args.add_argument( + "--rpc-key", + type=str, + required=True, + ) + args.add_argument( + "--number", + type=int, + default=3, + ) + args.add_argument( + "--repeat", + type=int, + default=1, + ) + args.add_argument( + "--min-repeat-ms", + type=int, + default=100, + ) + args.add_argument( + "--cpu-flush", + type=lambda x: bool(strtobool(x)), + help="example: True / False", + required=True, + ) + parsed = args.parse_args() + parsed.target = tvm.target.Target(parsed.target) + parsed.rpc_config = ms.runner.RPCConfig( + tracker_host=parsed.rpc_host, + tracker_port=parsed.rpc_port, + tracker_key=parsed.rpc_key, + session_timeout_sec=600, + ) + if parsed.cpu_flush and parsed.target.kind.name != "llvm": + warnings.warn("cpu_flush is only supported on llvm target") + return parsed + + +# logging +logging.basicConfig( + format="%(asctime)s.%(msecs)03d %(levelname)s %(message)s", datefmt="%Y-%m-%d %H:%M:%S" +) +logging.getLogger("tvm.meta_schedule").setLevel(logging.INFO) Review Comment: ```suggestion logging.getLogger("tvm.meta_schedule").setLevel(logging.DEBUG) ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
