Bug in MemryX runtime v2.2

Trying to run MemryX in local mode (by setting local_mode = true and ignore_server_ = false
in MX::Runtime::MxAccl constructor leads to a crash with
vector::_M_range_check: __n (which is 0) >= this->size() (which is 0)
exception.

How to reproduce:
In `MemryX_eXamples/video_inference/object_detection_yolo11_mxprepost/src/python/run_objectiondetection.py` line 87 set ignore_server=True and run the example.

The reason is in DFPRunner.cpp:132-151:
When ignore_server_ is true, converted_dev_ids_ is never populated by convert_device_ids() — it is only set in the else branch. As a result:

The device loop that calls memx_open iterated 0 times → open_contexts_ remained empty

The size check open_contexts_.size() != converted_dev_ids_.size() passed (0 == 0), so no error was caught.

MxModel was created with local_mode_ = true but an empty open_contexts_

In input_loop/manual_input_loop, open_contexts_.at(ctx_infer_idx) throws std::out_of_range because ctx_infer_idx = 0 but the vector had size 0.

Hi @barkas ,

Thanks for finding this, this does appear to be a bug!

More generally, note we do discourage using ignore_server=True. Without communicating with mxa-manager to get an exclusive lock on the device (local mode), there’s the possibility multiple applications may try to use the same device simultaneously, which may lock up the chip and need a reboot. We added this option a while back for a customer using a very slim Yocto build [who continue to use only SDK 2.0 C++ API], so to be honest this flag hasn’t been well tested in pybind MxAccl :sweat_smile:

So thank you for finding this – we’ll incorporate it in a patch to 2.2 soon!