Documentation
¶
Overview ¶
Package cudnn provides an optional Pure-Go (CGO_ENABLED=0) binding to NVIDIA's cuDNN shared library (libcudnn.so.9 / libcudnn.so.8 / cudnn64_9.dll) loaded dynamically via internal/dynlib.
If cuDNN is not installed on the system, Load returns ErrUnavailable and the CUDA backend seamlessly falls back to its built-in im2col + cuBLASLt / PTX convolution kernels.
Index ¶
- Variables
- type API
- func (a *API) Create() (Handle, error)
- func (a *API) CreateConv2DPlan(h Handle, key Conv2DPlanKey, maxWorkspaceBytes uintptr) (*Conv2DPlan, error)
- func (a *API) Destroy(h Handle) error
- func (a *API) DestroyConv2DPlan(p *Conv2DPlan)
- func (a *API) ExecuteConv2DPlan(h Handle, p *Conv2DPlan, xPtr, wPtr, biasPtr, yPtr driver.DevicePtr, ...) error
- func (a *API) SetStream(h Handle, stream driver.Stream) error
- type ActivationDesc
- type ActivationMode
- type Conv2DKind
- type Conv2DPlan
- type Conv2DPlanKey
- type ConvAlgoPerf
- type ConvBwdFilterAlgo
- type ConvDesc
- type ConvFwdAlgo
- type ConvMode
- type DataType
- type FilterDesc
- type Handle
- type MathType
- type NanPropagation
- type Status
- type TensorDesc
- type TensorFormat
Constants ¶
This section is empty.
Variables ¶
ErrUnavailable is returned when libcudnn cannot be located or loaded.
Functions ¶
This section is empty.
Types ¶
type API ¶
type API struct {
// contains filtered or unexported fields
}
API holds dynamically bound cuDNN function pointers.
func (*API) CreateConv2DPlan ¶
func (a *API) CreateConv2DPlan(h Handle, key Conv2DPlanKey, maxWorkspaceBytes uintptr) (*Conv2DPlan, error)
CreateConv2DPlan constructs descriptors and selects the fastest heuristic algorithm fitting within maxWorkspaceBytes.
func (*API) DestroyConv2DPlan ¶
func (a *API) DestroyConv2DPlan(p *Conv2DPlan)
DestroyConv2DPlan frees all descriptors owned by plan.
func (*API) ExecuteConv2DPlan ¶
func (a *API) ExecuteConv2DPlan( h Handle, p *Conv2DPlan, xPtr, wPtr, biasPtr, yPtr driver.DevicePtr, ws driver.DevicePtr, wsBytes uintptr, ) error
ExecuteConv2DPlan launches the cached convolution plan on the handle's bound stream. For Conv2DBwdFilter, yPtr is dy and wPtr is the output dw buffer (in OHWI layout).
type ActivationMode ¶
type ActivationMode int32
ActivationMode represents cudnnActivationMode_t.
const ( ActivationRelu ActivationMode = 1 ActivationIdentity ActivationMode = 5 )
type Conv2DKind ¶
type Conv2DKind uint8
Conv2DKind selects the cuDNN convolution operation for a cached Conv2DPlan.
const ( Conv2DFwd Conv2DKind = iota Conv2DFwdBiasAct Conv2DBwdFilter )
type Conv2DPlan ¶
type Conv2DPlan struct {
Key Conv2DPlanKey
// contains filtered or unexported fields
}
Conv2DPlan caches pre-created cuDNN descriptors and the selected algorithm for zero-allocation steady-state execution and CUDA Graph capture.
type Conv2DPlanKey ¶
type Conv2DPlanKey struct {
Kind Conv2DKind
DataType DataType
ComputeType DataType
MathType MathType
ActMode ActivationMode
B int32
InH, InW int32
CIn int32
OutH, OutW int32
COut int32
KH, KW int32
PadH, PadW int32
StrideH int32
StrideW int32
DilH, DilW int32
}
Conv2DPlanKey uniquely identifies a cached cuDNN 2D NHWC convolution plan.
type ConvAlgoPerf ¶
type ConvAlgoPerf struct {
Algo int32
Status Status
Time float32
Memory uintptr
Determinism int32
MathType MathType
Reserved [3]int32
}
ConvAlgoPerf matches cudnnConvolutionFwdAlgoPerf_t and cudnnConvolutionBwdFilterAlgoPerf_t (identical C ABI layout on 64-bit platforms: 48 bytes).
type ConvBwdFilterAlgo ¶
type ConvBwdFilterAlgo int32
ConvBwdFilterAlgo represents cudnnConvolutionBwdFilterAlgo_t.
type ConvFwdAlgo ¶
type ConvFwdAlgo int32
ConvFwdAlgo represents cudnnConvolutionFwdAlgo_t.
const ( ConvFwdAlgoImplicitGemm ConvFwdAlgo = 0 ConvFwdAlgoImplicitPrecompGemm ConvFwdAlgo = 1 )
type NanPropagation ¶
type NanPropagation int32
NanPropagation represents cudnnNanPropagation_t.
const ( NotPropagateNan NanPropagation = 0 PropagateNan NanPropagation = 1 )
type TensorFormat ¶
type TensorFormat int32
TensorFormat represents cudnnTensorFormat_t.
const ( TensorNCHW TensorFormat = 0 TensorNHWC TensorFormat = 1 )