Loading...
Searching...
No Matches
device_backend.h File Reference
#include <array>
#include <utility>
#include "opennn/core/opennn_types.h"
#include "opennn/core/configuration.h"

Go to the source code of this file.

Classes

struct  opennn::CudnnDescriptor< Handle >
 
struct  opennn::device::GraphWorkspaceView
 
class  opennn::device::CudaGraphWorkspaceScope
 
class  opennn::device::CudaAllocationGrowthGuard
 
class  opennn::device::CudaBlockCacheBypass
 
class  opennn::device::CublasPointerModeGuard
 
class  opennn::device::CublasMathModeGuard
 
class  opennn::device::PinnedBuffer
 
class  opennn::device::CudaEvent
 
struct  opennn::device::GraphExecDeleter
 
class  opennn::device::StreamCapture
 

Namespaces

namespace  opennn
 
namespace  opennn::device
 

Typedefs

using opennn::device::GraphWorkspaceRequirements = std::array<Index, static_cast<size_t>(GraphWorkspaceKind::Count)>
 
using opennn::device::GraphWorkspaceViews = std::array<GraphWorkspaceView, static_cast<size_t>(GraphWorkspaceKind::Count)>
 
using opennn::device::GraphExecHandle = unique_ptr<remove_pointer_t<DeviceGraphExec>, GraphExecDeleter>
 

Enumerations

enum class  opennn::device::CopyKind { opennn::device::HostToHost , opennn::device::HostToDevice , opennn::device::DeviceToHost , opennn::device::DeviceToDevice }
 
enum class  opennn::device::GraphWorkspaceKind {
  opennn::device::SharedScratch , opennn::device::Bf16Input , opennn::device::Bf16Gradient , opennn::device::Bf16ToFp32 ,
  opennn::device::Int8Dequant , opennn::device::PoolingMask , opennn::device::NormPartials , opennn::device::GradientPartials ,
  opennn::device::FlashAttention , opennn::device::Count
}
 
enum class  opennn::device::BatchNormBackwardRung { opennn::device::Auto , opennn::device::StagedFp32 , opennn::device::PlainNative , opennn::device::OwnKernel }
 
enum class  opennn::device::BatchNormForwardRung { opennn::device::Auto , opennn::device::CudnnGraph , opennn::device::OwnKernel }
 
enum class  opennn::device::MaxPoolingRung { opennn::device::Auto , opennn::device::Cudnn , opennn::device::OwnKernel }
 
enum class  opennn::device::AttentionRung { opennn::device::Auto , opennn::device::CudnnGraph , opennn::device::FlashAttention }
 

Functions

constexpr bool opennn::device::is_cuda_build () noexcept
 
bool opennn::device::has_cuda_device () noexcept
 
string opennn::device::cuda_unavailable_reason () noexcept
 
int opennn::device::cuda_compute_capability () noexcept
 
size_t opennn::device::available_memory ()
 
string opennn::device::gpu_info_string () noexcept
 
string opennn::device::lt_plan_cache_directory () noexcept
 
bool opennn::device::cuda_allocation_growth_forbidden () noexcept
 
void opennn::device::set_cuda_allocation_growth_forbidden (bool forbidden) noexcept
 
void opennn::device::begin_cuda_shutdown () noexcept
 
bool opennn::device::cuda_matmul_plan_creation_forbidden () noexcept
 
optional< void * > opennn::device::graph_workspace_override (GraphWorkspaceKind, Index minimum_bytes)
 
int64_t opennn::device::conv_workspace_limit_bytes () noexcept
 
void opennn::device::set_conv_workspace_cap (int64_t mode) noexcept
 
void opennn::device::set_conv_workspace_auto_limit_bytes (int64_t) noexcept
 
bool opennn::device::conv_autotune_enabled () noexcept
 
void opennn::device::set_conv_autotune (bool enabled) noexcept
 
bool opennn::device::allow_tf32 () noexcept
 
void opennn::device::set_allow_tf32 (bool enabled) noexcept
 
void opennn::device::refresh_blas_math_mode ()
 
template<typename Rung>
Rung opennn::device::rung () noexcept
 
template<typename Rung>
void opennn::device::set_rung (Rung) noexcept
 
void * opennn::device::allocate (Device, Index)
 
void opennn::device::deallocate (Device, void *, Index) noexcept
 
void opennn::device::set_zero (void *, Index, Device)
 
void opennn::device::set_zero_async (void *, Index, DeviceStream=nullptr)
 
void opennn::device::copy_async (void *, const void *, Index, CopyKind, DeviceStream=nullptr)
 
void opennn::device::copy_async (void *, const void *, Index, Device, Device, DeviceStream=nullptr)
 
void opennn::device::synchronize (DeviceStream=nullptr)
 
void opennn::device::check_last_error ()
 
void opennn::device::reset_last_error () noexcept
 
void opennn::device::record_event (DeviceEvent, DeviceStream)
 
void opennn::device::synchronize_event (DeviceEvent)
 
void opennn::device::stream_wait_event (DeviceStream, DeviceEvent)
 
void opennn::device::launch_graph (const GraphExecHandle &, DeviceStream)
 
int opennn::device::lanes_available () noexcept
 
int opennn::device::active_lane () noexcept
 
void opennn::device::set_active_lane (int lane)
 
DeviceStream opennn::device::lane_stream (int lane)
 
DeviceStream opennn::device::get_compute_stream ()
 
DeviceStream opennn::device::get_transfer_stream ()
 
BlasHandle opennn::device::get_cublas_handle ()
 
BlasLtHandle opennn::device::get_cublas_lt_handle ()
 
DnnHandle opennn::device::get_cudnn_handle ()
 
DnnOpTensorDescriptor opennn::device::get_op_tensor_add_descriptor ()
 
ThreadPoolDevice & opennn::get_device ()
 
void opennn::set_threads_number (int)
 
void * opennn::ensure_workspace_bytes (device::GraphWorkspaceKind, Index bytes)
 
template<typename T>
T * opennn::ensure_workspace (device::GraphWorkspaceKind kind, Index count)
 
bfloat16 * opennn::ensure_bf16_gradient_workspace (Index n)
 
bfloat16 * opennn::ensure_int8_dequant_workspace (Index n)
 
float * opennn::ensure_bf16_to_fp32_workspace (Index n)
 
void * opennn::ensure_shared_scratch (size_t bytes)
 
float * opennn::ensure_flash_attention_workspace (Index n)
 
void opennn::release_thread_workspaces ()
 
const void * opennn::data_for_gemm_dtype (const TensorView &, Type)
 
const void * opennn::bias_for_gemm_bf16 (const TensorView &)
 
void opennn::run_lt_matmul_cached (int, int, int, BlasOperation transA, BlasOperation transB, LinearEpilogue epilogue, const void *, const void *, void *, const void *, DeviceDataType dtype_a=CUDA_R_32F, DeviceDataType dtype_b=CUDA_R_32F, DeviceDataType out_dtype=CUDA_R_32F, const void *aux_pointer=nullptr, const void *addend=nullptr, float alpha=1.0f, float beta=0.0f, int lda=0, int ldb=0, int ldd=0)
 
void opennn::gemm_strided_batched_cuda (BlasOperation transa, BlasOperation transb, int, int, int, const void *, DeviceDataType Atype, int, long long stride_a, const void *, DeviceDataType Btype, int, long long stride_b, void *, DeviceDataType Ctype, int, long long stride_c, int, float alpha=1.0f, float beta=0.0f)
 

Variables

constexpr std::array< const char *, static_cast< size_t >(GraphWorkspaceKind::Count)> opennn::device::graph_workspace_labels
 
constexpr int opennn::device::MAX_LANES = 4