tinywisdom opened a new issue, #18268:
URL: https://github.com/apache/tvm/issues/18268
### Expected behavior
- Instantiating `TuneContext` with a `SearchStrategy` should either:
1. Provide a meaningful Python-side error (e.g., `TypeError: cannot
instantiate abstract class`), or
2. 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
* needs-triage
* bug
--
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]