Cookiee235 opened a new issue, #18380:
URL: https://github.com/apache/tvm/issues/18380

   The provided TIR module can be successfully compiled using `tvm.build` with 
target='llvm'. However, when using `ms.tir_integration.tune_tir` for 
Meta-Schedule tuning, the script crashes unexpectedly with a 
`tvm.tir.schedule.ScheduleError`.
   It seems a bug in the Meta-Schedule component.
   
   
   ### Actual behavior
   
   ```
   Traceback (most recent call last):
     File "/share_container/LLMFuzz/TirFuzz/bug_tp/topi.max_0_M2.py", line 29, 
in <module>
       database = ms.tir_integration.tune_tir(mod=mod, target='llvm 
--num-cores=16', work_dir='./tune_tmp', max_trials_global=1, 
num_trials_per_iter=1)
                  
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File "/software/tvm-latest/python/tvm/meta_schedule/tir_integration.py", 
line 146, in tune_tir
       return tune_tasks(
              ^^^^^^^^^^^
     File "/software/tvm-latest/python/tvm/meta_schedule/tune.py", line 122, in 
tune_tasks
       task_scheduler.tune(
     File 
"/software/tvm-latest/python/tvm/meta_schedule/task_scheduler/task_scheduler.py",
 line 132, in tune
       _ffi_api.TaskSchedulerTune(  # type: ignore # pylint: disable=no-member
     File "python/tvm_ffi/cython/function.pxi", line 758, in 
core.Function.__call__
     File "<unknown>", line 0, in 
tvm::meta_schedule::GradientBasedNode::Tune(tvm::ffi::Array<tvm::meta_schedule::TuneContext,
 void>, tvm::ffi::Array<tvm::FloatImm, void>, int, int, int, 
tvm::meta_schedule::Builder, tvm::meta_schedule::Runner, 
tvm::ffi::Array<tvm::meta_schedule::MeasureCallback, void>, 
tvm::ffi::Optional<tvm::meta_schedule::Database, void>, 
tvm::ffi::Optional<tvm::meta_schedule::CostModel, void>)
     File "<unknown>", line 0, in 
tvm::meta_schedule::TaskSchedulerNode::Tune(tvm::ffi::Array<tvm::meta_schedule::TuneContext,
 void>, tvm::ffi::Array<tvm::FloatImm, void>, int, int, int, 
tvm::meta_schedule::Builder, tvm::meta_schedule::Runner, 
tvm::ffi::Array<tvm::meta_schedule::MeasureCallback, void>, 
tvm::ffi::Optional<tvm::meta_schedule::Database, void>, 
tvm::ffi::Optional<tvm::meta_schedule::CostModel, void>)
     File "<unknown>", line 0, in 
tvm::meta_schedule::PostOrderApplyNode::GenerateDesignSpace(tvm::IRModule 
const&)
     File "<unknown>", line 0, in 
tvm::meta_schedule::AutoInlineNode::Apply(tvm::tir::Schedule const&, 
tvm::tir::BlockRV const&)
     File "<unknown>", line 0, in 
tvm::meta_schedule::AutoInlineNode::CheckInline(tvm::tir::Schedule const&, 
tvm::tir::BlockRV const&)
     File "<unknown>", line 0, in 
tvm::tir::GetScopeRoot(tvm::tir::ScheduleState const&, tvm::tir::StmtSRef 
const&, bool) [clone .cold]
     File "<unknown>", line 0, in tvm::tir::ScheduleError::ScheduleError()
   tvm.tir.schedule.schedule.ScheduleError
   ```
   
   ### Environment
   
   tvm-0.22.dev0
   
   ### Steps to reproduce
   
   ```
   import tvm
   from tvm import meta_schedule as ms
   
   
   tir_str = """# from tvm.script import ir as I
   # from tvm.script import tir as T
   
   @I.ir_module
   class Module:
       @T.prim_func
       def main(data: T.Buffer((8, 8), "float32"), data_red: T.Buffer((), 
"float32")):
           T.func_attr({"target": T.target({"keys": ["cpu"], "kind": "llvm", 
"mtriple": "x86_64-unknown-linux-gnu", "tag": ""}), "tir.noalias": 
T.bool(True)})
           with T.block("data_red"):
               T.reads(data[0:8, 0:8])
               T.writes(data_red[()])
               with T.init():
                   data_red[()] = T.float32(-3400000.0)
               for i, j in T.grid(8, 8):
                   with T.block("update"):
                       T.reads(data_red[()], data[i, j])
                       T.writes(data_red[()])
                       data_red[()] = T.max(data_red[()], data[i, j])
   """
   
   mod = tvm.script.from_source(tir_str)
   mod.show()
   #with tvm.transform.PassContext(0):
   #    tvm.build(mod, target='llvm')
   database = ms.tir_integration.tune_tir(mod=mod, target='llvm 
--num-cores=16', work_dir='./tune_tmp', max_trials_global=1, 
num_trials_per_iter=1)
   
   ```
   
   
   ### Triage
   
   * needs-triage
   * tune:meta_schedule


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