Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MetaSchedule] Fix a typo in MemoryDatabase #13928

Merged
merged 1 commit into from
Feb 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/meta_schedule/database/memory_database.cc
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class MemoryDatabaseNode : public DatabaseNode {
}
std::stable_sort(results.begin(), results.end(), SortTuningRecordByMeanRunSecs());
if (results.size() > static_cast<size_t>(top_k)) {
return {results.begin(), results.end() + top_k};
return {results.begin(), results.begin() + top_k};
} else {
if (results.size() < static_cast<size_t>(top_k)) {
LOG(WARNING) << "The size of the GetTopK result is smaller than requested. There are not "
Expand Down
13 changes: 7 additions & 6 deletions tests/python/unittest/test_meta_schedule_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,19 @@
"""Test Meta Schedule Database"""
import os.path as osp
import tempfile
import pytest
from typing import Callable, Optional, List
from typing import Callable, List, Optional

import pytest
import tvm
import tvm.testing
from tvm.target import Target
from tvm import meta_schedule as ms
from tvm.meta_schedule.database import TuningRecord, Workload
from tvm import tir
from tvm import relay, tir
from tvm.ir.module import IRModule
from tvm.meta_schedule.database import TuningRecord, Workload
from tvm.script import tir as T
from tvm.target import Target
from tvm.tir import Schedule
from tvm import relay


# pylint: disable=invalid-name,no-member,line-too-long,too-many-nested-blocks,no-self-argument
# fmt: off
Expand Down Expand Up @@ -556,6 +556,7 @@ def call_get_top_k(run_secs_list, database, k):
"k,expected",
[
(0, []),
(1, [[0.0, 2.0]]),
(4, [[0.0, 2.0], [2.0], [1.5, 4.5], [3.0, 1e10]]),
(5, [[0.0, 2.0], [2.0], [1.5, 4.5], [3.0, 1e10]]),
],
Expand Down