Expected behavior
- Instantiating
TuneContext with a SearchStrategy should either:
- Provide a meaningful Python-side error (e.g.,
TypeError: cannot instantiate abstract class), or
- Require a concrete subclass to be used.
In either case, it should not crash with a segmentation fault.
Actual behavior
- Directly calling
SearchStrategy() segfaults via FFI into C++ when used in TuneContext.
- Python receives no exception, only a hard crash.
Environment
- OS: (Ubuntu 22.04.4 LTS (x86_64))
- TVM version: (release v0.21.0)
- Python: (3.10.16)
- LLVM: (17.0.6)
Steps to reproduce
import tvm
from tvm.target import Target
from tvm.meta_schedule import TuneContext, SearchStrategy
from tvm.script import ir as I, relax as R
# A minimal Relax IRModule (identity)
@I.ir_module
class M:
@R.function
def main(x: R.Tensor((1,), "float32")) -> R.Tensor((1,), "float32"):
return x
# Abstract SearchStrategy() => FFI into C++ => segfault in some versions
ctx = TuneContext(
mod=M,
target=Target("llvm"),
search_strategy=SearchStrategy(), # ❌ abstract class instantiation
)
# Typically segfaults here or later during ctx.tune()
print(ctx)
Error log
!!!!!!! TVM FFI encountered a Segfault !!!!!!!
File "<unknown>", in __pyx_pw_3tvm_3ffi_4core_6Object_27__init_handle_by_constructor__(_object*, _object* const*, long, _object*)
File "<unknown>", in __pyx_f_3tvm_3ffi_4core_FuncCall(void*, _object*, TVMFFIAny*, int*) [clone .constprop.0]
File "<unknown>", in __pyx_f_3tvm_3ffi_4core_make_args(_object*, TVMFFIAny*, _object*)
File "./signal/../sysdeps/unix/sysv/linux/x86_64/libc_sigaction.c", in 0x00007289e284251f
File "<unknown>", in tvm::ffi::(anonymous namespace)::backtrace_handler(int)
File "<unknown>", in tvm::ffi::(anonymous namespace)::Traceback()
Segmentation fault (core dumped)
Triage
Expected behavior
TuneContextwith aSearchStrategyshould either:TypeError: cannot instantiate abstract class), orIn either case, it should not crash with a segmentation fault.
Actual behavior
SearchStrategy()segfaults via FFI into C++ when used inTuneContext.Environment
Steps to reproduce
Error log
Triage