Visible to Intel only — GUID: GUID-B9159B7A-F439-47A4-889F-D5AE0D49F006
Visible to Intel only — GUID: GUID-B9159B7A-F439-47A4-889F-D5AE0D49F006
enum dnnl::scratchpad_mode
Overview
Scratchpad mode. More…
#include <dnnl.hpp>
enum scratchpad_mode
{
library = dnnl_scratchpad_mode_library,
user = dnnl_scratchpad_mode_user,
};
Detailed Documentation
Scratchpad mode.
Enum Values
library
The library manages the scratchpad allocation according to the policy specified by the DNNL_ENABLE_CONCURRENT_EXECbuild option (default).
When DNNL_ENABLE_CONCURRENT_EXEC=OFF (default), the library scratchpad is common to all primitives to reduce the memory footprint. This configuration comes with limited thread-safety properties, namely primitives can be created and executed in parallel but cannot migrate between threads (in other words, each primitive should be executed in the same thread it was created in).
When DNNL_ENABLE_CONCURRENT_EXEC=ON, the library scratchpad is private to each primitive. The memory footprint is larger than when using DNNL_ENABLE_CONCURRENT_EXEC=OFF but different primitives can be created and run concurrently (the same primitive cannot be run concurrently from two different threads though).
user
The user manages the scratchpad allocation by querying and providing the scratchpad memory to primitives.
This mode is thread-safe as long as the scratchpad buffers are not used concurrently by two primitive executions.