Documentation
¶
Overview ¶
Code generated by go generate; DO NOT EDIT.
Package wagogpu provides an optional Wago plugin for small f32 GPU kernels.
Index ¶
- Constants
- func CompileBufferWGSL(source []byte, kernel KernelConfig) (string, error)
- func CompileWGSL(source []byte, export string) (string, error)
- type BindingConfig
- type BufferAccess
- type BufferOperation
- type BufferSnapshot
- type BuildTiming
- type CompileError
- type CompileErrorKind
- type Config
- type ElementType
- type Host
- func (h *Host) BufferSnapshot() BufferSnapshot
- func (h *Host) Close(ctx context.Context) error
- func (h *Host) Compile(source []byte) (*Module, error)
- func (h *Host) Instantiate(ctx context.Context, module *Module) (*wago.Instance, error)
- func (h *Host) Prepare(source []byte) (*Preparation, error)
- func (h *Host) Snapshot() Snapshot
- type InstanceDiagnostic
- type KernelConfig
- type KernelDiagnostic
- type Module
- type Plugin
- type Preparation
- type Snapshot
- type Timing
- type TransferCounters
Constants ¶
const ( TypeI8 ElementType = 1 TypeU8 ElementType = 2 TypeI16 ElementType = 3 TypeU16 ElementType = 4 TypeI32 ElementType = 5 TypeU32 ElementType = 6 TypeF16 ElementType = 7 TypeF32 ElementType = 8 TypeI64 ElementType = 9 TypeU64 ElementType = 10 TypeF64 ElementType = 11 V1OK int32 = 0 V1CPUFallback int32 = 1 V1InvalidHandle int32 = 2 V1InvalidRange int32 = 3 V1TypeMismatch int32 = 4 V1InvalidBinding int32 = 5 V1LimitExceeded int32 = 6 V1DeviceError int32 = 7 V1ContentsLost int32 = 8 V1Cancelled int32 = 9 V1InvalidKernel int32 = 10 V1UnsupportedStorage int32 = 11 V1InvalidState int32 = 12 )
const ( Success int32 = iota Fallback InvalidRange InvalidBatch DefaultMaxElements uint32 = 10_000_000 MaxBatchPasses uint32 = 64 )
Variables ¶
This section is empty.
Functions ¶
func CompileBufferWGSL ¶
func CompileBufferWGSL(source []byte, kernel KernelConfig) (string, error)
CompileBufferWGSL translates the selected kernel, without creating a device. Every failure is a *CompileError. This decoder is bounded; Wago remains the validator for the whole module before any runtime pipeline can be attached.
Types ¶
type BindingConfig ¶
type BindingConfig struct {
Slot uint32
Type ElementType
Access BufferAccess
}
type BufferAccess ¶
type BufferAccess uint8
const ( AccessRead BufferAccess = iota + 1 AccessWrite AccessReadWrite )
type BufferOperation ¶
type BufferOperation struct {
Sequence uint64
Instance wago.InstanceIdentity
KernelID uint32
Import string
Status int32
ReasonCode, Reason, Outcome string
Count uint32
HardwareSubmitted, TransferCountsComplete, ProfileValid, TimestampsValid bool
QueueWait, Total, Upload, DeviceCopy, Compute, Download, Conversion, Commit, DeviceCompute time.Duration
TransferCounters
}
type BufferSnapshot ¶
type BufferSnapshot struct {
PeakRuntimeBufferBytes uint64
State, Reason, DeviceState string
Last BufferOperation
Totals TransferCounters
TotalsComplete bool
Kernels []KernelDiagnostic
Instances []InstanceDiagnostic
PipelineHits, PipelineMisses uint64
PendingCompilations, PendingContracts, PendingTranslations uint32
PendingContractBytes, PendingWGSLBytes uint64
ActiveCompilations uint32
RuntimeBufferBytes, RuntimePoolBytes, LegacyBufferBytes uint64
}
type BuildTiming ¶
type CompileError ¶
type CompileError struct {
Kind CompileErrorKind
Message string
}
CompileError is inspectable with errors.As, including after wrapping.
func (*CompileError) Error ¶
func (e *CompileError) Error() string
type CompileErrorKind ¶
type CompileErrorKind uint8
const ( CompileInvalidContract CompileErrorKind = iota + 1 CompileUnsupported CompileLimit )
type Config ¶
type Config struct {
Kernels []KernelConfig
MaxBuffersPerInstance, MaxKernelsPerModule, MaxBindingsPerKernel uint32
MaxInstanceBufferBytes, MaxRuntimeBufferBytes uint64
KernelExport string
RelaxedFloat bool
Disabled bool
// ProfileStages adds queue waits to measure each stage. Leave false for use.
ProfileStages bool
MaxElements uint32
// MinElements selects CPU below this size. Zero always attempts GPU execution.
// The limit applies to a complete batch, not to each pass separately.
MinElements uint32
// RunTimeout bounds result polling. Native driver entry points may still block.
RunTimeout time.Duration
}
Config selects one export per module. RelaxedFloat must be an explicit opt-in: GPU f32 can fuse operations and flush subnormals (see README).
type ElementType ¶
type ElementType uint32
type Host ¶
type Host struct {
// contains filtered or unexported fields
}
Host is the controlled v1 integration. It exposes source compilation only and supplies no per-instance import overrides. It never adopts compiled artifacts. Use this type when the host cannot otherwise enforce the source-identity rules.
func (*Host) BufferSnapshot ¶
func (h *Host) BufferSnapshot() BufferSnapshot
func (*Host) Instantiate ¶
type InstanceDiagnostic ¶
type InstanceDiagnostic struct {
PeakBytes uint64
Instance wago.InstanceIdentity
Buffers, CPUCurrent, GPUCurrent, BothCurrent, ContentsLost uint32
LogicalBytes, CPUBytes, GPUBytes, StagingBytes, ScratchBytes, RetainedPoolBytes, ReservedBytes uint64
}
type KernelConfig ¶
type KernelConfig struct {
ID uint32
Export, CPUExport string
Bindings []BindingConfig
RelaxedFloat bool
MinElements uint32
}
type KernelDiagnostic ¶
type Plugin ¶
type Plugin struct {
// contains filtered or unexported fields
}
Plugin owns all GPU state. Make a new Plugin for each Wago Runtime. Different instances may call it concurrently; GPU work is serialized so that cached buffers can be reused. Wago controls calls within a single instance.
func (*Plugin) BufferSnapshot ¶
func (p *Plugin) BufferSnapshot() BufferSnapshot
type Preparation ¶
type Preparation struct {
// contains filtered or unexported fields
}
func (*Preparation) Close ¶
func (p *Preparation) Close() error
func (*Preparation) Compile ¶
func (p *Preparation) Compile() (*Module, error)
type Timing ¶
type Timing struct {
Upload, Compute, Download, Commit, Total time.Duration
DeviceCompute time.Duration
TimestampsValid bool
UploadBytes, DownloadBytes uint64
Passes uint32
}
Timing contains host wall times. DeviceCompute and TimestampsValid remain zero and false until a supported backend exposes reliable GPU timestamps. Stage times are present only with ProfileStages. Total includes guest commit.
type TransferCounters ¶
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
buffer-bench
command
Command buffer-bench measures native Wago and the buffer plugin.
|
Command buffer-bench measures native Wago and the buffer plugin. |
|
demo
command
Command demo checks the Wasm kernels and measures complete guest calls.
|
Command demo checks the Wasm kernels and measures complete guest calls. |
|
examples
|
|
|
buffers
command
|
|
|
start
command
Command start runs a GPU import from a real Wasm start function.
|
Command start runs a GPU import from a real Wasm start function. |
|
storage
command
|
|
|
tinygo
command
|
|
|
internal
|
|
|
fixtures
Package fixtures contains real Wasm guests and common demonstration checks.
|
Package fixtures contains real Wasm guests and common demonstration checks. |
|
genabi
command
Command genabi derives Go declarations from the reviewed ABI table.
|
Command genabi derives Go declarations from the reviewed ABI table. |