enum dnnl_scratchpad_mode_t

Overview

Scratchpad mode. More…

#include <dnnl_types.h>

enum dnnl_scratchpad_mode_t
{
    dnnl_scratchpad_mode_library,
    dnnl_scratchpad_mode_user,
};

Detailed Documentation

Scratchpad mode.

Enum Values

dnnl_scratchpad_mode_library

The library manages the scratchpad allocation according to the policy specified by the DNNL_ENABLE_CONCURRENT_EXEC build 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).

dnnl_scratchpad_mode_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.