junrushao1994 commented on a change in pull request #9044:
URL: https://github.com/apache/tvm/pull/9044#discussion_r711699573



##########
File path: python/tvm/meta_schedule/builder/local_builder.py
##########
@@ -0,0 +1,224 @@
+# 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.
+"""Local builder that compile on the local host"""
+import os
+import tempfile
+from typing import Callable, List, Optional
+
+from tvm._ffi import register_func
+from tvm.ir import IRModule
+from tvm.runtime import Module
+from tvm.target import Target
+
+from ...contrib.popen_pool import MapResult, PopenPoolExecutor, StatusKind
+from ..utils import cpu_count, get_global_func_with_default_on_worker
+from .builder import BuilderInput, BuilderResult, PyBuilder
+
+
+class LocalBuilder(PyBuilder):
+    """A builder that builds the given input on local host.
+
+    Parameters
+    ----------
+    pool : PopenPoolExecutor
+        The process pool to run the build.
+    timeout_sec : float
+        The timeout in seconds for the build.
+    f_build : Optional[str]
+        Name of the build function to be used.
+        Defaults to `meta_schedule.builder.default_build`.
+        The signature is Callable[[IRModule, Target], Module].
+    f_export : Optional[str]
+        Name of the export function to be used.
+        Defaults to `meta_schedule.builder.default_export`.
+        The signature is Callable[[Module], str].
+
+    Note
+    ----
+    The build function and export function should be registered in the worker 
process.
+    The worker process is only aware of functions registered in TVM package,
+    if there are extra functions to be registered,
+    please send the registration logic via initializer.
+    """
+
+    pool: PopenPoolExecutor
+    timeout_sec: float
+    f_build: Optional[str]
+    f_export: Optional[str]
+
+    def __init__(
+        self,
+        *,
+        max_workers: Optional[int] = None,
+        timeout_sec: float = 30.0,
+        f_build: str = None,
+        f_export: str = None,

Review comment:
       done in the latest commit




-- 
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]


Reply via email to