Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash issue due to refcount error with clang compiler #744

Open
Yanfeng-Mi opened this issue Jul 11, 2024 · 5 comments
Open

Crash issue due to refcount error with clang compiler #744

Yanfeng-Mi opened this issue Jul 11, 2024 · 5 comments
Labels

Comments

@Yanfeng-Mi
Copy link

bool AbstractBuffersPool<PoolT, BufferType, BufferParentType>::isPoolBuffer(const BufferParentType *buffer) const {
static_assert(std::is_base_of_v<BufferParentType, BufferType>);

return (buffer && this->mainStorage.get() == buffer);   // for clang compiler, unique_ptr is assigned nullptr firstly

}

@JablonskiMateusz
Copy link
Contributor

Hi @Yanfeng-Mi
could you share more details of the issue? Could you share callstack?

@Yanfeng-Mi
Copy link
Author

the callstack as following:
#00 pc 0000000000067c0e /apex/com.android.runtime/lib64/bionic/libc.so (abort+206) (BuildId: 3f70d7b54a58b7ab204a797b00a4a7cb)
#1 pc 0000000000432da8 /vendor/lib64/libigdrcl.so (NEO::abortExecution()+8) (BuildId: 5f66ed8b63a2c1f5fbd41c24c6ddde9c)
#2 pc 0000000000432e87 /vendor/lib64/libigdrcl.so (NEO::abortUnrecoverable(int, char const*)+55) (BuildId: 5f66ed8b63a2c1f5fbd41c24c6ddde9c)
#3 pc 000000000050b1e5 /vendor/lib64/libigdrcl.so (NEO::ReferenceTrackedObjectNEO::Context::decRefInternal()+117) (BuildId: 5f66ed8b63a2c1f5fbd41c24c6ddde9c)
#4 pc 0000000000598d52 /vendor/lib64/libigdrcl.so (NEO::MemObj::~MemObj()+1458) (BuildId: 5f66ed8b63a2c1f5fbd41c24c6ddde9c)
#5 pc 00000000005817d4 /vendor/lib64/libigdrcl.so (NEO::Buffer::~Buffer()+20) (BuildId: 5f66ed8b63a2c1f5fbd41c24c6ddde9c)
#6 pc 0000000000603844 /vendor/lib64/libigdrcl.so (NEO::BufferHwNEO::XeHpcCoreFamily::~BufferHw()+20) (BuildId: 5f66ed8b63a2c1f5fbd41c24c6ddde9c)
#7 pc 0000000000603868 /vendor/lib64/libigdrcl.so (NEO::BufferHwNEO::XeHpcCoreFamily::~BufferHw()+24) (BuildId: 5f66ed8b63a2c1f5fbd41c24c6ddde9c)
#8 pc 000000000052c551 /vendor/lib64/libigdrcl.so (std::__1::default_deleteNEO::Buffer::operator()(NEO::Buffer*) const+49) (BuildId: 5f66ed8b63a2c1f5fbd41c24c6ddde9c)
#9 pc 0000000000520683 /vendor/lib64/libigdrcl.so (std::__1::unique_ptr<NEO::Buffer, std::__1::default_deleteNEO::Buffer >::reset(NEO::Buffer*)+99) (BuildId: 5f66ed8b63a2c1f5fbd41c24c6ddde9c)
#10 pc 0000000000526ac8 /vendor/lib64/libigdrcl.so (std::__1::unique_ptr<NEO::Buffer, std::__1::default_deleteNEO::Buffer >::~unique_ptr()+24) (BuildId: 5f66ed8b63a2c1f5fbd41c24c6ddde9c)
#11 pc 00000000005207a6 /vendor/lib64/libigdrcl.so (NEO::AbstractBuffersPool<NEO::Context::BufferPool, NEO::Buffer, NEO::MemObj>::~AbstractBuffersPool()+54) (BuildId: 5f66ed8b63a2c1f5fbd41c24c6ddde9c)
#12 pc 0000000000520c14 /vendor/lib64/libigdrcl.so (NEO::Context::BufferPool::~BufferPool()+20) (BuildId: 5f66ed8b63a2c1f5fbd41c24c6ddde9c)
#13 pc 0000000000522378 /vendor/lib64/libigdrcl.so (std::__1::allocatorNEO::Context::BufferPool::destroy(NEO::Context::BufferPool*)+24) (BuildId: 5f66ed8b63a2c1f5fbd41c24c6ddde9c)
#14 pc 000000000052234c /vendor/lib64/libigdrcl.so (void std::__1::allocator_traits<std::__1::allocatorNEO::Context::BufferPool >::__destroyNEO::Context::BufferPool(std::__1::integral_constant<bool, true>, std::__1::allocatorNEO::Context::BufferPool&, NEO::Context::BufferPool*)+28) (BuildId: 5f66ed8b63a2c1f5fbd41c24c6ddde9c)
#15 pc 000000000052231c /vendor/lib64/libigdrcl.so (void std::__1::allocator_traits<std::__1::allocatorNEO::Context::BufferPool >::destroyNEO::Context::BufferPool(std::__1::allocatorNEO::Context::BufferPool&, NEO::Context::BufferPool*)+28) (BuildId: 5f66ed8b63a2c1f5fbd41c24c6ddde9c)
#16 pc 00000000005222cf /vendor/lib64/libigdrcl.so (std::__1::__vector_base<NEO::Context::BufferPool, std::__1::allocatorNEO::Context::BufferPool >::__destruct_at_end(NEO::Context::BufferPool*)+95) (BuildId: 5f66ed8b63a2c1f5fbd41c24c6ddde9c)
#17 pc 0000000000522217 /vendor/lib64/libigdrcl.so (std::__1::__vector_base<NEO::Context::BufferPool, std::__1::allocatorNEO::Context::BufferPool >::clear()+23) (BuildId: 5f66ed8b63a2c1f5fbd41c24c6ddde9c)
#18 pc 0000000000528aad /vendor/lib64/libigdrcl.so (std::__1::vector<NEO::Context::BufferPool, std::__1::allocatorNEO::Context::BufferPool >::clear()+45) (BuildId: 5f66ed8b63a2c1f5fbd41c24c6ddde9c)
#19 pc 000000000051cff8 /vendor/lib64/libigdrcl.so (NEO::AbstractBuffersAllocator<NEO::Context::BufferPool, NEO::Buffer, NEO::MemObj>::releaseSmallBufferPool()+24) (BuildId: 5f66ed8b63a2c1f5fbd41c24c6ddde9c)
#20 pc 000000000051ca58 /vendor/lib64/libigdrcl.so (NEO::Context::~Context()+168) (BuildId: 5f66ed8b63a2c1f5fbd41c24c6ddde9c)
#21 pc 000000000051d228 /vendor/lib64/libigdrcl.so (NEO::Context::~Context()+24) (BuildId: 5f66ed8b63a2c1f5fbd41c24c6ddde9c)
#22 pc 0000000000514ebd /vendor/lib64/libigdrcl.so (NEO::unique_ptr_if_unusedNEO::Context::doDelete(NEO::Context*)+45) (BuildId: 5f66ed8b63a2c1f5fbd41c24c6ddde9c)
#23 pc 000000000047bdd3 /vendor/lib64/libigdrcl.so (std::__1::unique_ptr<NEO::Context, void ()(NEO::Context)>::reset(NEO::Context*)+99) (BuildId: 5f66ed8b63a2c1f5fbd41c24c6ddde9c)
#24 pc 000000000047bd68 /vendor/lib64/libigdrcl.so (std::__1::unique_ptr<NEO::Context, void ()(NEO::Context)>::~unique_ptr()+24) (BuildId: 5f66ed8b63a2c1f5fbd41c24c6ddde9c)
#25 pc 0000000000439754 /vendor/lib64/libigdrcl.so (NEO::unique_ptr_if_unusedNEO::Context::~unique_ptr_if_unused()+20) (BuildId: 5f66ed8b63a2c1f5fbd41c24c6ddde9c)
#26 pc 000000000043944b /vendor/lib64/libigdrcl.so (clReleaseContext+571) (BuildId: 5f66ed8b63a2c1f5fbd41c24c6ddde9c)

@JablonskiMateusz
Copy link
Contributor

@Yanfeng-Mi Thanks for reporting the issue.
Could you share repro steps?

@Yanfeng-Mi
Copy link
Author

@JablonskiMateusz To reproduce this issue, you need to recompile ocl rt driver with clang compiler toolsets. I found this issue on android platform on which clang compiler is used. it's not easy to rebuild the OCL RT with clang compiler tools on Ubuntu and many compiling issues needs to be resolve based on libc++. The root-cause of this issue is different behavior of unique_ptr destruction between gcc(libstdc++) and clang (libc++) . You can refer to my WA patch on android celadon projects:
projectceladon/compute-runtime@dcc1b6f

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants