-
Notifications
You must be signed in to change notification settings - Fork 552
Description
As today, AF does not correctly forward any af exception done in a custom memory manager.
To reproduce:
- create your own mem mgr alloc
- throw a AF OOM (101) exception from the alloc of your mem manager
- see that at the user level, AF has strangeley converted the AF OOM exception to a unknown 999 exception preventing to get the root cause of the exception
Example :
const unsigned N = 99999; // high chance to OOM
try {
a = af::array({N,N,N}, af::dtype::f32);
} catch(af::exception& ex) {
std::cerr << "OOM unittest: AF exception: " << ex.what() << std::endl;
ASSERT_EQ(ex.err(), AF_ERR_NO_MEM);
return;
}
...
[ RUN ] CachingMemoryManagerTest.OOM
AF_ERR_NO_MEM in fl::MemoryManagerInstaller::MemoryManagerInstaller(std::shared_ptrfl::MemoryManagerAdapter)::<lambda(size_t)>
in repos/flashlight/flashlight/memory/MemoryManagerInstaller.cpp at line 178
AF_ERR_NO_MEM in fl::MemoryManagerInstaller::MemoryManagerInstaller(std::shared_ptrfl::MemoryManagerAdapter)::<lambda(size_t)>
in repos/flashlight/flashlight/memory/MemoryManagerInstaller.cpp at line 178
Unable to allocate memory with native alloc for size 3999880001355776 bytes with AF error 'ArrayFire Exception (Device out of memory:101):
ArrayFire error:
In function fl::MemoryManagerInstaller::MemoryManagerInstaller(std::shared_ptrfl::MemoryManagerAdapter)::<lambda(size_t)>
In file repos/flashlight/flashlight/memory/MemoryManagerInstaller.cpp:178' AF errcode:101
OOM unittest AF exception: ArrayFire Exception (Unknown error:999):
In function void* {anonymous}::initEmptyArray(af::dtype, dim_t, dim_t, dim_t, dim_t)
In file src/api/cpp/array.cpp:115
Kind