Try unsynchronized userptr if regular one fails. https://github.com/FreeBSDDesktop/kms-drm/issues/197 Process 51117 stopped * thread #1, name = 'clinfo', stop reason = signal SIGABRT frame #0: 0x000000080044fe7a libc.so.7`__sys_thr_kill at thr_kill.S:4 (lldb) bt * thread #1, name = 'clinfo', stop reason = signal SIGABRT * frame #0: 0x000000080044fe7a libc.so.7`__sys_thr_kill at thr_kill.S:4 frame #1: 0x000000080044f7e4 libc.so.7`__raise(s=6) at raise.c:52:10 frame #2: 0x00000008003b3a89 libc.so.7`abort at abort.c:67:8 frame #3: 0x000000080043a711 libc.so.7`__assert(func=, file=, line=, failedexpr=) at assert.c:51:2 frame #4: 0x0000000800e255ad libigdrcl.so`NEO::debugBreak(line=58, file="compute-runtime-19.48.14977/runtime/os_interface/linux/drm_memory_manager.cpp") at debug_helpers.cpp:19:9 frame #5: 0x000000080104b4e5 libigdrcl.so`NEO::DrmMemoryManager::DrmMemoryManager(this=0x00000008018e7300, mode=gemCloseWorkerActive, forcePinAllowed=true, validateHostPtrMemory=true, executionEnvironment=0x00000008018f6180) at drm_memory_manager.cpp:58:9 frame #6: 0x0000000800f07bb1 libigdrcl.so`std::__1::__unique_if::__unique_single std::__1::make_unique(__args=0x00007fffffffda4c, __args=0x00007fffffffda4b, __args=0x00007fffffffda4a, __args=0x00000008018f6180) at memory:3003:32 frame #7: 0x0000000800f07ad4 libigdrcl.so`NEO::MemoryManager::createMemoryManager(executionEnvironment=0x00000008018f6180) at create_drm_memory_manager.cpp:16:12 frame #8: 0x0000000800fbce8b libigdrcl.so`NEO::ExecutionEnvironment::initializeMemoryManager(this=0x00000008018f6180) at execution_environment.cpp:63:25 frame #9: 0x0000000801058c9d libigdrcl.so`NEO::Platform::initialize(this=0x00000008025ea0a0) at platform.cpp:144:27 frame #10: 0x0000000800e259f2 libigdrcl.so`::clGetPlatformIDs(numEntries=1, platforms=0x0000000800251500, numPlatforms=0x0000000000000000) at api.cpp:82:35 frame #11: 0x0000000800e25c54 libigdrcl.so`::clIcdGetPlatformIDsKHR(numEntries=1, platforms=0x0000000800251500, numPlatforms=0x0000000000000000) at api.cpp:112:14 frame #12: 0x000000080025d0e0 libOpenCL.so.1`__initClIcd + 3392 frame #13: 0x00000008006a61a8 libthr.so.3`_thr_once(once_control=0x000000080026e038, init_routine=(libOpenCL.so.1`__initClIcd)) at thr_once.c:98:2 frame #14: 0x000000080025b670 libOpenCL.so.1`clGetPlatformIDs_hid + 320 frame #15: 0x000000000020f9cd clinfo`main(argc=, argv=0x00007fffffffe188) at clinfo.c:2656:10 frame #16: 0x000000000020713d clinfo`_start(ap=, cleanup=) at crt1.c:76:7 (lldb) f 5 frame #5: 0x000000080104b4e5 libigdrcl.so`NEO::DrmMemoryManager::DrmMemoryManager(this=0x00000008018e7300, mode=gemCloseWorkerActive, forcePinAllowed=true, validateHostPtrMemory=true, executionEnvironment=0x00000008018f6180) at drm_memory_manager.cpp:58:9 50 51 if (forcePinEnabled || validateHostPtrMemory) { 52 pinBB = allocUserptr(reinterpret_cast(memoryForPinBB), MemoryConstants::pageSize, 0, 0); 53 } 54 55 if (!pinBB) { 56 alignedFreeWrapper(memoryForPinBB); 57 memoryForPinBB = nullptr; -> 58 DEBUG_BREAK_IF(true); 59 UNRECOVERABLE_IF(validateHostPtrMemory); 60 } 61 } --- shared/source/os_interface/linux/drm_memory_manager.cpp.orig 2022-06-01 18:10:32 UTC +++ shared/source/os_interface/linux/drm_memory_manager.cpp @@ -248,7 +248,17 @@ NEO::BufferObject *DrmMemoryManager::allocUserptr(uint auto &drm = this->getDrm(rootDeviceIndex); if (drm.ioctl(DrmIoctl::GemUserptr, &userptr) != 0) { - return nullptr; + if (errno == ENODEV && userptr.flags == 0) { + userptr.flags = I915_USERPTR_UNSYNCHRONIZED; + if (drm.ioctl(DrmIoctl::GemUserptr, &userptr) != 0) { + if (geteuid() != 0) { + printDebugString(true, stderr, "%s", "ioctl(I915_GEM_USERPTR) failed. Try running as root but expect poor stability.\n"); + } + return nullptr; + } + } else { + return nullptr; + } } PRINT_DEBUG_STRING(DebugManager.flags.PrintBOCreateDestroyResult.get(), stdout, "Created new BO with GEM_USERPTR, handle: BO-%d\n", userptr.handle);