Skip to content

Commit feb2bfe

Browse files
committed
Address issues.
1 parent 578bce0 commit feb2bfe

File tree

4 files changed

+17
-12
lines changed

4 files changed

+17
-12
lines changed

python/tvm/meta_schedule/task_scheduler/task_scheduler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
from typing import Callable, List, Optional
2121

2222
from tvm._ffi import register_object
23-
from tvm.meta_schedule.utils import make_logging_func
2423
from tvm.runtime import Object
2524

2625
from .. import _ffi_api
@@ -30,6 +29,7 @@
3029
from ..measure_callback import MeasureCallback
3130
from ..runner import Runner, RunnerResult
3231
from ..tune_context import TuneContext
32+
from ..utils import make_logging_func
3333

3434

3535
logger = logging.getLogger(__name__) # pylint: disable=invalid-name

python/tvm/meta_schedule/tune.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
"""User-facing Tuning API"""
1818
# pylint: disable=import-outside-toplevel
1919
import logging
20-
from pathlib import Path
21-
import os.path as osp
20+
import os
21+
from os import path as osp
2222
from typing import Any, Callable, Dict, List, NamedTuple, Optional, Union
2323

2424
from tvm._ffi.registry import register_func
@@ -502,7 +502,7 @@ def tune_extracted_tasks(
502502
"""
503503
# pylint: disable=protected-access
504504
log_dir = osp.join(work_dir, "logs")
505-
Path(log_dir).mkdir(parents=True, exist_ok=True)
505+
os.makedirs(log_dir, exist_ok=True)
506506
logger_config = config.create_logger_config(
507507
log_dir=log_dir,
508508
propagate=False,
@@ -545,7 +545,8 @@ def tune_extracted_tasks(
545545
mutator_probs=Parse._mutator_probs(mutator_probs, task.target),
546546
task_name=task.task_name,
547547
logger=Parse._logger(
548-
name="tvm.meta_schedule."
548+
name=__name__
549+
+ "."
549550
+ "_".join(["task", str(i).zfill(max_width), task.task_name]),
550551
**logger_config,
551552
),

python/tvm/meta_schedule/utils.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -374,21 +374,22 @@ def autotvm_silencer():
374374
autotvm.GLOBAL_SCOPE.silent = silent
375375

376376

377-
def make_logging_func(logger: logging.Logger):
377+
def make_logging_func(logger: logging.Logger) -> Optional[Callable]:
378378
"""Get the logging function.
379379
Parameters
380380
----------
381381
logger : logging.Logger
382382
The logger instance.
383383
Returns
384384
-------
385-
result : Callable
385+
result : Optional[Callable]
386386
The function to do the specified level of logging.
387387
"""
388388
if logger is None:
389389
return None
390390

391391
level2log = {
392+
logging.DEBUG: logger.debug,
392393
logging.INFO: logger.info,
393394
logging.WARNING: logger.warning,
394395
logging.ERROR: logger.error,

src/meta_schedule/utils.h

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,17 +53,22 @@
5353
#include "../tir/schedule/primitive.h"
5454
#include "../tir/schedule/utils.h"
5555

56-
#define TVM_PY_LOG(logging_level, logging_func) \
57-
PyLogMessage(__FILE__, __LINE__, logging_func, PyLogMessage::Level::logging_level).stream()
56+
#define TVM_PY_LOG(logging_level, logging_func) \
57+
::tvm::meta_schedule::PyLogMessage(__FILE__, __LINE__, logging_func, \
58+
PyLogMessage::Level::logging_level) \
59+
.stream()
60+
5861
namespace tvm {
62+
namespace meta_schedule {
5963

6064
/*!
6165
* \brief Class to accumulate an log message on the python side. Do not use directly, instead use
62-
* TVM_PY_LOG(INFO), TVM_PY_LOG(WARNING), TVM_PY_ERROR(INFO).
66+
* TVM_PY_LOG(DEBUG), TVM_PY_LOG(INFO), TVM_PY_LOG(WARNING), TVM_PY_ERROR(ERROR).
6367
*/
6468
class PyLogMessage {
6569
public:
6670
enum class Level : int32_t {
71+
DEBUG = 10,
6772
INFO = 20,
6873
WARNING = 30,
6974
ERROR = 40,
@@ -96,8 +101,6 @@ class PyLogMessage {
96101
Level logging_level;
97102
};
98103

99-
namespace meta_schedule {
100-
101104
/*! \brief The type of the random state */
102105
using TRandState = support::LinearCongruentialEngine::TRandState;
103106

0 commit comments

Comments
 (0)