```
import tvm
from tvm.script import relax as R
from tvm.script import ir as I
from tvm.script import tir as T
import tempfile
import tvm.meta_schedule as ms
from tvm.ir import IRModule

@I.ir_module
class Module:
    @T.prim_func
    def dense_loop(
        VAL: T.handle,
        VEC: T.handle,
        OUT: T.handle,
    ):
        val = T.match_buffer(VAL, (37,), "float64")
        vec = T.match_buffer(VEC, (11,), "float64")
        out = T.match_buffer(OUT, (11,), "float64")

        for j in T.serial(2):
            for i in T.serial(2):
                with T.block("db0"):
                    T.init()
                    out[i + 0] += val[0 + j * 2 + i] * vec[j + 0]
        for j in T.serial(1):
            for i in T.serial(2):
                with T.block("db1"):
                    T.init()
                    out[i + 0] += val[4 + j * 2 + i] * vec[j + 5]
        for j in T.serial(3):
            for i in T.serial(3):
                with T.block("db3"):
                    T.init()
                    out[i + 2] += val[6 + j * 3 + i] * vec[j + 2]
        for j in T.serial(2):
            for i in T.serial(1):
                with T.block("db5"):
                    T.init()
                    out[i + 5] += val[15 + j * 1 + i] * vec[j + 0]
        for j in T.serial(3):
            for i in T.serial(1):
                with T.block("db8"):
                    T.init()
                    out[i + 5] += val[21 + j * 1 + i] * vec[j + 6]

    @R.function
    def main(val: R.Tensor(("v",), dtype="float64"), vec: R.Tensor(("k",), 
dtype="float64")):
        cls = Module
        out = R.call_tir(cls.dense_loop, (val, vec), out_sinfo=R.Tensor((11,), 
dtype="float64"))
        return out

if __name__ == "__main__":
    ...
    target = tvm.target.Target("llvm -num-cores 1")

    with tempfile.TemporaryDirectory() as work_dir:
        database = ms.tir_integration.tune_tir(
            mod=Module,
            target=target,
            work_dir=work_dir,
            max_trials_global=64,
        )

        workload = database.commit_workload(IRModule({"dense_loop": 
Module["dense_loop"]}))
        top_k = database.get_top_k(workload, 1)
        if not top_k:
            raise RuntimeError("No schedules found in the database.")
        print("Best schedule found:")
        print(top_k[0])
```
I always hit the "No schedules found in the database" code path. Why is that 
the case? Am I using meta schedule incorrectly?





---
[Visit 
Topic](https://discuss.tvm.apache.org/t/why-does-meta-schedule-not-find-any-schedules/18468/1)
 to respond.

You are receiving this because you enabled mailing list mode.

To unsubscribe from these emails, [click 
here](https://discuss.tvm.apache.org/email/unsubscribe/0a329a8c231e469aaf2f5b2fc3b2283b0a0c94d7aa479da81df224d90b0b3cd8).

Reply via email to