Loading...
Searching...
No Matches
device_backend.h
Go to the documentation of this file.
122using GraphWorkspaceRequirements = std::array<Index, static_cast<size_t>(GraphWorkspaceKind::Count)>;
123using GraphWorkspaceViews = std::array<GraphWorkspaceView, static_cast<size_t>(GraphWorkspaceKind::Count)>;
379inline bfloat16* ensure_bf16_gradient_workspace(Index n) { return ensure_workspace<bfloat16>(device::GraphWorkspaceKind::Bf16Gradient, n); }
380inline bfloat16* ensure_int8_dequant_workspace(Index n) { return ensure_workspace<bfloat16>(device::GraphWorkspaceKind::Int8Dequant, n); }
381inline float* ensure_bf16_to_fp32_workspace(Index n) { return ensure_workspace<float>(device::GraphWorkspaceKind::Bf16ToFp32, n); }
382inline void* ensure_shared_scratch(size_t bytes) { return ensure_workspace_bytes(device::GraphWorkspaceKind::SharedScratch, Index(bytes)); }
383inline float* ensure_flash_attention_workspace(Index n) { return ensure_workspace<float>(device::GraphWorkspaceKind::FlashAttention, n); }
~CublasMathModeGuard() noexcept
CublasMathModeGuard(BlasHandle, BlasMathMode)
CublasMathModeGuard(const CublasMathModeGuard &)=delete
CublasMathModeGuard & operator=(const CublasMathModeGuard &)=delete
CublasPointerModeGuard(const CublasPointerModeGuard &)=delete
CublasPointerModeGuard(BlasHandle, BlasPointerMode)
CublasPointerModeGuard & operator=(const CublasPointerModeGuard &)=delete
~CublasPointerModeGuard() noexcept
~CudaAllocationGrowthGuard() noexcept
CudaAllocationGrowthGuard(const CudaAllocationGrowthGuard &)=delete
CudaAllocationGrowthGuard & operator=(const CudaAllocationGrowthGuard &)=delete
CudaAllocationGrowthGuard(bool enabled, bool forbid_matmul_plan_creation=true)
CudaBlockCacheBypass() noexcept
CudaEvent(const CudaEvent &)=delete
CudaEvent(CudaEvent &&) noexcept
CudaEvent & operator=(const CudaEvent &)=delete
void create()
CudaEvent()=default
CudaEvent(unsigned flags)
CudaGraphWorkspaceScope(GraphWorkspaceRequirements &, const GraphWorkspaceViews *=nullptr)
~CudaGraphWorkspaceScope() noexcept
CudaGraphWorkspaceScope(const CudaGraphWorkspaceScope &)=delete
CudaGraphWorkspaceScope & operator=(const CudaGraphWorkspaceScope &)=delete
Definition device_backend.h:254
void grow_to(Index)
PinnedBuffer(Index byte_count)
void resize_bytes(Index)
PinnedBuffer(const PinnedBuffer &)=delete
PinnedBuffer()=default
Index byte_size() const noexcept
Definition device_backend.h:280
PinnedBuffer & operator=(const PinnedBuffer &)=delete
PinnedBuffer(PinnedBuffer &&) noexcept
~StreamCapture() noexcept
StreamCapture & operator=(const StreamCapture &)=delete
StreamCapture(DeviceStream)
StreamCapture(const StreamCapture &)=delete
void end(GraphExecHandle &)
Definition energy_meter.h:7
bool conv_autotune_enabled() noexcept
void set_zero(void *, Index, Device)
bool has_cuda_device() noexcept
std::array< GraphWorkspaceView, static_cast< size_t >(GraphWorkspaceKind::Count)> GraphWorkspaceViews
Definition device_backend.h:123
void stream_wait_event(DeviceStream, DeviceEvent)
void synchronize_event(DeviceEvent)
string cuda_unavailable_reason() noexcept
void begin_cuda_shutdown() noexcept
void copy_async(void *, const void *, Index, CopyKind, DeviceStream=nullptr)
Rung rung() noexcept
bool cuda_matmul_plan_creation_forbidden() noexcept
bool allow_tf32() noexcept
void set_cuda_allocation_growth_forbidden(bool forbidden) noexcept
string lt_plan_cache_directory() noexcept
BlasLtHandle get_cublas_lt_handle()
void * allocate(Device, Index)
DnnHandle get_cudnn_handle()
int active_lane() noexcept
DeviceStream lane_stream(int lane)
void set_active_lane(int lane)
void set_conv_workspace_cap(int64_t mode) noexcept
void set_conv_autotune(bool enabled) noexcept
string gpu_info_string() noexcept
void set_rung(Rung) noexcept
optional< void * > graph_workspace_override(GraphWorkspaceKind, Index minimum_bytes)
int cuda_compute_capability() noexcept
bool cuda_allocation_growth_forbidden() noexcept
DeviceStream get_compute_stream()
void record_event(DeviceEvent, DeviceStream)
void deallocate(Device, void *, Index) noexcept
unique_ptr< remove_pointer_t< DeviceGraphExec >, GraphExecDeleter > GraphExecHandle
Definition device_backend.h:326
void refresh_blas_math_mode()
DeviceStream get_transfer_stream()
void set_zero_async(void *, Index, DeviceStream=nullptr)
void set_allow_tf32(bool enabled) noexcept
size_t available_memory()
std::array< Index, static_cast< size_t >(GraphWorkspaceKind::Count)> GraphWorkspaceRequirements
Definition device_backend.h:122
@ GradientPartials
Definition device_backend.h:106
void reset_last_error() noexcept
int64_t conv_workspace_limit_bytes() noexcept
constexpr std::array< const char *, static_cast< size_t >(GraphWorkspaceKind::Count)> graph_workspace_labels
Definition device_backend.h:112
void check_last_error()
DnnOpTensorDescriptor get_op_tensor_add_descriptor()
int lanes_available() noexcept
void synchronize(DeviceStream=nullptr)
BlasHandle get_cublas_handle()
void set_conv_workspace_auto_limit_bytes(int64_t) noexcept
void launch_graph(const GraphExecHandle &, DeviceStream)
Definition configuration.h:10
bfloat16 * ensure_bf16_gradient_workspace(Index n)
Definition device_backend.h:379
void release_thread_workspaces()
void set_threads_number(int)
void * ensure_shared_scratch(size_t bytes)
Definition device_backend.h:382
float * ensure_bf16_to_fp32_workspace(Index n)
Definition device_backend.h:381
cudnnOpTensorDescriptor_t DnnOpTensorDescriptor
Definition opennn_types.h:142
ThreadPoolDevice & get_device()
void 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)
const void * bias_for_gemm_bf16(const TensorView &)
void 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)
const void * data_for_gemm_dtype(const TensorView &, Type)
void * ensure_workspace_bytes(device::GraphWorkspaceKind, Index bytes)
bfloat16 * ensure_int8_dequant_workspace(Index n)
Definition device_backend.h:380
T * ensure_workspace(device::GraphWorkspaceKind kind, Index count)
Definition device_backend.h:375
float * ensure_flash_attention_workspace(Index n)
Definition device_backend.h:383
CudnnDescriptor()=default
CudnnDescriptor & operator=(CudnnDescriptor &&other) noexcept
Definition device_backend.h:31
CudnnDescriptor & operator=(const CudnnDescriptor &)=delete
CudnnDescriptor(const CudnnDescriptor &)=delete
CudnnDescriptor(CudnnDescriptor &&other) noexcept
Definition device_backend.h:27
Definition tensor_types.h:540
Definition device_backend.h:324
void operator()(DeviceGraphExec) const noexcept
Definition device_backend.h:117