gpu_pipeline 1.5.2 copy "gpu_pipeline: ^1.5.2" to clipboard
gpu_pipeline: ^1.5.2 copied to clipboard

A GPU-accelerated streaming pipeline for Dart and Flutter. Define directed stage graphs that route Tensors and host data through WGSL compute shaders with typed I/O ports, resource management, and rea [...]

gpu_pipeline #

A GPU-accelerated streaming pipeline for Dart and Flutter. Define directed graphs of processing stages that route Tensor and host typed-data through WGSL compute shaders via minigpu, with typed I/O ports, resource management, and real-time constraints.

Part of the minigpu package family.

Features #

  • Directed stage graph — connect PipelineStage nodes via typed InputPort/OutputPort pairs; the pipeline routes data automatically
  • GPU + CPU stagesShaderStageOperation runs WGSL compute shaders on Tensor data; CpuStageOperation processes host TypedData; mix freely in the same graph
  • Multi-stream routing — each stage declares a StageStreamConfig to receive all streams, a merged view, or only selected stream IDs
  • Resource-aware schedulingResourceRequirements, MemoryStrategy, and RealTimeConstraints let stages express their resource needs; the pipeline honours them during execution
  • Dynamic stagesPipelineDynamicStage can modify the graph topology at runtime
  • Asset management — stages declare StaticAsset requirements; the built-in AssetManager loads and caches them before first execution
  • Event busPipelineEventNotifier delivers lifecycle and error events to any observer

Getting started #

Add to pubspec.yaml:

dependencies:
  gpu_pipeline: ^1.0.0
  gpu_tensor: ^1.3.0
  minigpu: ^1.3.0

Initialise minigpu once before creating pipelines:

import 'package:minigpu/minigpu.dart';

await Minigpu.initialize();

Usage #

Define a stage #

import 'package:gpu_pipeline/gpu_pipeline.dart';
import 'package:gpu_tensor/gpu_tensor.dart';

class NormalizeStage extends PipelineStage {
  NormalizeStage() : super(stageId: 'normalize') {
    addInputPort(InputPort('input', formats: ['tensor']));
    addOutputPort(OutputPort('output', format: 'tensor'));
  }

  @override
  Future<PipelineEvent> process(Map<String, dynamic> inputs) async {
    final tensor = inputs['input'] as Tensor;
    // run a WGSL shader or transform tensors here
    return PipelineEvent.data({'output': tensor});
  }
}

Build and run a pipeline #

final pipeline = Pipeline();
pipeline.addStage(NormalizeStage());
pipeline.addStage(MyOutputStage());
pipeline.connect('normalize.output', 'output.input');

await pipeline.initialize();

final result = await pipeline.process({'normalize.input': myTensor});

Shader stage #

Use ShaderStageOperation to dispatch a WGSL compute shader directly:

final op = ShaderStageOperation(
  shader: myWgslSource,
  workgroupSize: (8, 8, 1),
  bindingLayout: [...],
);

Architecture #

MediaStream  ──►  Stage A  ──►  Stage B  ──►  Stage C  ──►  output
                  (WGSL)        (CPU)          (WGSL)

Each stage receives a Map<String, dynamic> of named inputs and returns a PipelineEvent carrying named outputs. The Pipeline scheduler resolves the connection graph, dispatches stages in dependency order, and propagates errors via the event bus.

Platform support #

Platform Status
Windows
Linux
macOS
Android
iOS
Web ✅ (dart2wasm / dart2js)

Additional information #

1
likes
0
points
597
downloads

Publisher

verified publisherpracticalxr.com

Weekly Downloads

A GPU-accelerated streaming pipeline for Dart and Flutter. Define directed stage graphs that route Tensors and host data through WGSL compute shaders with typed I/O ports, resource management, and real-time constraints.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

directed_graph, gpu_tensor, minigpu, minigpu_web

More

Packages that depend on gpu_pipeline