Documentation
¶
Overview ¶
Package fpgagzip is the public SDK for the FPGA gzip shell.
The package provides a high-level file-to-file API and re-exports the device, pipeline, and configuration types used by the command-line tool. It is pure Go and accesses XDMA through the public device subpackage.
Index ¶
- Variables
- func AppendCSV(path string, result Result, opts Options) error
- func InspectFirmware(ctx context.Context, userDevice string) (firmware.Info, error)
- type Config
- type Device
- type DevicePaths
- type DevicePool
- type Hardware
- type Options
- type Progress
- type Result
- func Compress(ctx context.Context, inputPath, outputPath string, hw Hardware, opts Options, ...) (Result, error)
- func CompressAlgorithm(ctx context.Context, algorithm string, input io.Reader, size uint64, ...) (Result, error)
- func CompressReader(ctx context.Context, input io.Reader, inputSize uint64, output io.Writer, ...) (Result, error)
- func Run(ctx context.Context, inputPath, outputPath string, hw Hardware, opts Options, ...) (Result, error)
- type Snapshot
- type Writer
Constants ¶
This section is empty.
Variables ¶
var ( ErrFirmwareSwitching = firmware.ErrSwitching ErrFirmwareIncompatible = firmware.ErrIncompatible ErrFirmwareAlgorithm = firmware.ErrAlgorithm )
var ( // ErrWriterClosed is returned when Write is called after Close. ErrWriterClosed = errors.New("fpgagzip: writer is closed") // ErrWriterNotClosed is returned when Result is requested before Close. ErrWriterNotClosed = errors.New("fpgagzip: writer is not closed") )
var ErrHelp = config.ErrHelp
ErrHelp is returned by ParseConfig when --help is requested.
Functions ¶
func InspectFirmware ¶ added in v0.0.3
InspectFirmware reads the image identity under a temporary shared card lock. It never opens DMA channels or resets an engine. The transaction still checks the identity again after opening its own device, so a switch between these two operations cannot submit data to the wrong algorithm.
Types ¶
type Config ¶
Config is the merged CLI/config-file/environment configuration.
func Parse ¶
Parse is kept as a short alias for ParseConfig for SDK callers that already use the package as their application's argument parser.
func ParseConfig ¶
ParseConfig parses CLI arguments using the same precedence rules as the command-line program: command line, environment, config file, then defaults.
type Device ¶
Device is an opened XDMA user BAR and H2C/C2H stream pair.
func Open ¶
func Open(paths DevicePaths) (*Device, error)
Open opens the XDMA devices described by paths. The caller must close the returned device.
type DevicePaths ¶
DevicePaths identifies the XDMA character devices.
func FourCorePaths ¶ added in v0.0.3
func FourCorePaths(first DevicePaths, count int) ([]DevicePaths, error)
FourCorePaths selects the validated quad shell's channel/core mapping.
type DevicePool ¶ added in v0.0.3
DevicePool leases independent core/channel pairs until the lease is closed.
func NewDevicePool ¶ added in v0.0.3
func NewDevicePool(paths []DevicePaths) (*DevicePool, error)
type Hardware ¶
Hardware is the interface accepted by Run and Compress. The production implementation is *Device; applications can provide a simulator or wrapper that implements the same contract.
type Options ¶
Options controls the streaming pipeline.
func DefaultOptions ¶
func DefaultOptions() Options
DefaultOptions returns the settings validated for the gzip shell used by this module.
type Result ¶
Result contains validated output counters and timing information. Total, Pipeline, and FPGA use the same streaming boundary; Sync is reported separately and is completed before Run returns.
func Compress ¶
func Compress(ctx context.Context, inputPath, outputPath string, hw Hardware, opts Options, report func(Progress)) (Result, error)
Compress is an alias for Run, provided as a descriptive SDK entry point.
func CompressAlgorithm ¶ added in v0.0.3
func CompressAlgorithm(ctx context.Context, algorithm string, input io.Reader, size uint64, output io.Writer, hw Hardware, options Options, report func(Progress)) (Result, error)
CompressAlgorithm selects raw, gzip, lz4, zstd or minlz explicitly. The existing CompressReader and gzip.Writer-like API continue to emit only gzip. This convenience API uses the same validation and bounded transport as accelerator.
func CompressReader ¶
func CompressReader(ctx context.Context, input io.Reader, inputSize uint64, output io.Writer, hw Hardware, opts Options, report func(Progress)) (Result, error)
CompressReader compresses exactly inputSize bytes from input into output. It uses the supplied readers directly and does not create temporary files.
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
Writer has the shape of compress/gzip.Writer while using the FPGA gzip shell as its compressor. Write appends uncompressed bytes to an in-memory buffer. Close submits the complete buffer to the FPGA and writes the gzip stream to the destination.
The current shell requires the complete input length before it can start, so Write does not begin FPGA work. This API is intended for small and medium-sized payloads. For large inputs, use CompressReader with a known length or Compress/Run with a file path to avoid holding the input in RAM.
func NewWriter ¶
NewWriter returns an FPGA-backed writer using DefaultOptions. The argument order follows compress/gzip.NewWriter: the destination comes first.
func NewWriterContext ¶
func NewWriterContext(ctx context.Context, dst io.Writer, hw Hardware, opts Options, report func(Progress)) *Writer
NewWriterContext is NewWriterOptions with a context used when Close starts the FPGA operation.
func NewWriterOptions ¶
NewWriterOptions returns an FPGA-backed writer with explicit pipeline options and an optional progress callback.
func (*Writer) Close ¶
Close compresses the complete input buffer through the FPGA and writes the resulting gzip stream to the destination. Close is idempotent and returns the first error from the operation.
func (*Writer) Reset ¶
Reset discards the current input and reuses the writer for a new destination. It mirrors compress/gzip.Writer.Reset; the hardware, options, context, and progress callback remain unchanged.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package accelerator uses the common FPGA shell with raw, gzip, LZ4, Zstd and MinLZ images.
|
Package accelerator uses the common FPGA shell with raw, gzip, LZ4, Zstd and MinLZ images. |
|
Package client is a small HTTP client for fpga-gzipd.
|
Package client is a small HTTP client for fpga-gzipd. |
|
cmd
|
|
|
fpga-compress
command
Command fpga-compress encodes a file using the matching loaded FPGA image.
|
Command fpga-compress encodes a file using the matching loaded FPGA image. |
|
fpga-fw
command
Command fpga-fw inspects and switches versioned compression images.
|
Command fpga-fw inspects and switches versioned compression images. |
|
fpga-gzip
command
|
|
|
fpga-gzipd
command
Command fpga-gzipd exposes the pure-Go FPGA gzip pipeline over HTTP.
|
Command fpga-gzipd exposes the pure-Go FPGA gzip pipeline over HTTP. |
|
Package config owns command-line, environment and config-file parsing.
|
Package config owns command-line, environment and config-file parsing. |
|
Package device contains the small pure-Go access layer for the Xilinx XDMA character devices.
|
Package device contains the small pure-Go access layer for the Xilinx XDMA character devices. |
|
examples
|
|
|
benchmark-algorithms
command
Command benchmark-algorithms compares RAM compression using the current SDK, the DMA pipeline with verification deferred, and reusable pure Go encoders.
|
Command benchmark-algorithms compares RAM compression using the current SDK, the DMA pipeline with verification deferred, and reusable pure Go encoders. |
|
benchmark-capacity
command
Command benchmark-capacity compares bounded chunks and long streams in RAM.
|
Command benchmark-capacity compares bounded chunks and long streams in RAM. |
|
benchmark-cores
command
Command benchmark-cores measures independent FPGA cores with distinct inputs.
|
Command benchmark-cores measures independent FPGA cores with distinct inputs. |
|
hls-vectors
command
Command hls-vectors reproduces the random inputs that exposed the Zstd sequence lookahead deadlock on hardware.
|
Command hls-vectors reproduces the random inputs that exposed the Zstd sequence lookahead deadlock on hardware. |
|
sdk
command
Command sdk demonstrates using the public fpgagzip package from another Go program.
|
Command sdk demonstrates using the public fpgagzip package from another Go program. |
|
verify-cores
command
Command verify-cores validates the real board's independent gzip cores.
|
Command verify-cores validates the real board's independent gzip cores. |
|
verify-firmware
command
Command verify-firmware checks every active core against independent software decoders, including sub-beat tails, block boundaries and a large input.
|
Command verify-firmware checks every active core against independent software decoders, including sub-beat tails, block boundaries and a large input. |
|
verify-hls
command
Command verify-hls decodes every standard frame emitted by the C simulation with independent pure Go code and compares every byte with the input.
|
Command verify-hls decodes every standard frame emitted by the C simulation with independent pure Go code and compares every byte with the input. |
|
Package firmware describes the versioned compression shell shared by FPGA images.
|
Package firmware describes the versioned compression shell shared by FPGA images. |
|
Package pipeline implements the gzip shell's file-to-file streaming workflow.
|
Package pipeline implements the gzip shell's file-to-file streaming workflow. |
|
Package server exposes the FPGA gzip pipeline as a small HTTP service.
|
Package server exposes the FPGA gzip pipeline as a small HTTP service. |
|
Package size parses human-readable byte sizes used by the CLI and config file.
|
Package size parses human-readable byte sizes used by the CLI and config file. |