XRT
XRT copied to clipboard
what(): failed to close cu context (0): Invalid argument
Hi, XRT team,
in edge, I encountered one issue when xrt::kernel deconstruction, please help on this, thanks!
- my usage: my class has members in sequence: std::map<std::string, DeviceObject> cu_handles_; // components for each cu and struct DeviceObject has member: std::shared_ptrxrt::device device; std::unique_ptrxrt::kernel kernel; std::unique_ptrxrt::ip ip; the initialization in sequence: auto device = std::make_sharedxrt::device(deviceIndex); ............some other codes.................. cu.device = device; cu.kernel = std::make_uniquexrt::kernel(*device, device_uuid, cu_name); cu.ip = std::make_uniquexrt::ip(*device, device_uuid, cu_name);
- all the device operations are correct like load xclbin and get some registers.
- but when ~DeviceObject(), there occurs an exception: terminate called after throwing an instance of 'xrt_core::system_error' what(): failed to close cu context (0): Invalid argument
- the stack is as below:
#0 0x0000fffff7ba7c58 in ?? () from /lib/libc.so.6
#1 0x0000fffff7b63c10 in raise () from /lib/libc.so.6
#2 0x0000fffff7b50d64 in abort () from /lib/libc.so.6
#3 0x0000fffff7d96774 in __gnu_cxx::__verbose_terminate_handler() () from /usr/lib/libstdc++.so.6
#4 0x0000fffff7d94110 in ?? () from /usr/lib/libstdc++.so.6
#5 0x0000fffff7d92f48 in ?? () from /usr/lib/libstdc++.so.6
#6 0x0000fffff7d937c8 in __gxx_personality_v0 () from /usr/lib/libstdc++.so.6
#7 0x0000fffff7cdb14c in ?? () from /lib/libgcc_s.so.1
#8 0x0000fffff7cdb714 in _Unwind_Resume () from /lib/libgcc_s.so.1
#9 0x0000fffff79090c4 in xrt_core::context_mgr::close_context(xrt::hw_context const&, xrt_core::cuidx_type) () from /usr/lib/libxrt_coreutil.so.2
#10 0x0000fffff792e724 in ?? () from /usr/lib/libxrt_coreutil.so.2
#11 0x0000fffff793abcc in ?? () from /usr/lib/libxrt_coreutil.so.2
#12 0x0000aaaaaaaa2f94 in std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release (this=0xaaaaaad67b50)
at /opt/petalinux/2022.2/sysroots/cortexa72-cortexa53-xilinx-linux/usr/include/c++/11.2.0/bits/shared_ptr_base.h:168
#13 0x0000aaaaaaaa2d10 in std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count (this=0xaaaaaac99c08, __in_chrg=
) at /opt/petalinux/2022.2/sysroots/cortexa72-cortexa53-xilinx-linux/usr/include/c++/11.2.0/bits/shared_ptr_base.h:705 #14 0x0000fffff7f9adac in std::__shared_ptr<xrt::kernel_impl, (__gnu_cxx::_Lock_policy)2>::~__shared_ptr (this=0xaaaaaac99c00, __in_chrg= ) at /opt/petalinux/2022.2/sysroots/cortexa72-cortexa53-xilinx-linux/usr/include/c++/11.2.0/bits/shared_ptr_base.h:1154 #15 0x0000fffff7f9add4 in std::shared_ptrxrt::kernel_impl::~shared_ptr (this=0xaaaaaac99c00, __in_chrg= ) at /opt/petalinux/2022.2/sysroots/cortexa72-cortexa53-xilinx-linux/usr/include/c++/11.2.0/bits/shared_ptr.h:122 #16 0x0000fffff7f9adfc in xrt::kernel::~kernel (this=0xaaaaaac99c00, __in_chrg= ) at /opt/petalinux/2022.2/sysroots/cortexa72-cortexa53-xilinx-linux/usr/include/xrt/xrt/xrt_kernel.h:549 #17 0x0000fffff7f9f2fc in std::default_deletexrt::kernel::operator() (this=0xaaaaaad67aa0, __ptr=0xaaaaaac99c00) at /opt/petalinux/2022.2/sysroots/cortexa72-cortexa53-xilinx-linux/usr/include/c++/11.2.0/bits/unique_ptr.h:85 #18 0x0000fffff7f9d658 in std::unique_ptr<xrt::kernel, std::default_deletexrt::kernel >::~unique_ptr (this=0xaaaaaad67aa0, __in_chrg= ) at /opt/petalinux/2022.2/sysroots/cortexa72-cortexa53-xilinx-linux/usr/include/c++/11.2.0/bits/unique_ptr.h:361 #19 0x0000fffff7f992d8 in (anonymous namespace)::DeviceObject::~DeviceObject (this=0xaaaaaad67820, __in_chrg= ) at /workspace/vart/xrt-device-handle/src/./xrt_device_handle_imp.hpp:58