Poplar.NET
C ABI shim and managed .NET wrapper for Graphcore Poplar/PopART computational graph compilation and execution.
Poplar.NET provides a safe, idiomatic .NET 10 surface for interacting with Graphcore IPUs. By pairing a thin native C ABI shim (libpoplar_shim) with managed SafeHandle lifecycle management, it allows .NET applications to construct tensor graphs, manage multi-tile SRAM allocations, execute asynchronous ring-pipe streams, and run PopART ONNX models on bare-metal IPU accelerators without memory leaks or unsafe pointer arithmetic.
dotnet add package HFLabs.Poplar.NET --version 1.0.0 MK2 GC200 with 1,472 parallel processing tiles & 900MB high-speed In-Processor SRAM
Zero-leak C ABI shim and SafeHandle subclasses for devices, graphs, engines & streams
Asynchronous host-to-device streaming across zero-copy pinned buffers with token flow control
Translates Poplar recovery actions & engine codes into rich, actionable C# exceptions
4 Core Architectural Pillars
A layered bridge between the native Graphcore C++ ecosystem and modern managed .NET 10 applications.
Native C ABI Shim (libpoplar_shim)
A thin C++ wrapper library compiling against the Graphcore Poplar & PopART SDK headers. Flattens C++ class hierarchies, complex templates, and virtual method tables into pure extern "C" exported function symbols for zero-overhead P/Invoke interoperability.
Managed Driver API (Poplar.NET)
Idiomatic .NET 10 surface with safe wrappers for Device, Graph, Engine, Session, and Tensor. Encapsulates raw native pointers inside SafeHandle implementations with deterministic IDisposable cleanup, preventing device tile memory leaks.
PopART Graph & ONNX Execution
Construct computational graphs programmatically or load pre-trained ONNX models directly into IPU tile memory. Supports both training and inference sessions with hardware optimizer bindings (SGD, Adam, LAMB).
Accelerator & QueryAccel Interop
Serves as the IPU compute backend for HFLabs Accelerator Layer (heterogeneous plan routing) and QueryAccel (PostgreSQL Foreign Data Wrapper and SQL Server CLR aggregate pushdown).
Driver Subsystem Capabilities
Comprehensive managed abstractions covering physical hardware discovery, graph construction, engine compilation, and error handling.
IPUDeviceManager
Device Discovery & Tile Partitioning- Enumerates physical IPU devices, multi-IPU PCIe topologies, and IPU-Link bridges
- Configures virtual device targets and offline simulated device profiles
- Performs tile health verification and memory allocation checks
PoplarGraphBuilder
Computational Graph Construction- Adds tensor nodes with custom tile-mapping heuristics and data layouts
- Connects computation vertices across arithmetic, reduction, and activation domains
- Configures deterministic tile sync barriers and exchange phases
EngineSessionHost
Compilation & Execution Lifecycle- Compiles Poplar graph targets into optimized executable engine artifacts
- Maintains warm in-memory engine caches for instantaneous query execution
- Coordinates ring-pipe streams with non-blocking async completion tokens
PoplarExceptionBridge
Fault Isolation & Recovery Mapping- Translates Poplar SDK recovery actions into typed C# exception classes
- Propagates cancellation tokens to abort in-flight tile execution immediately
- Captures detailed tile trace dumps and engine diagnostics on assertion failure
Idiomatic .NET IPU Graph Execution
Safe, clean C# syntax with automatic unmanaged resource cleanup and stream synchronization.
using System;
using System.Threading.Tasks;
using HFLabs.Hardware.Poplar;
// 1. Discover physical IPU devices or attach to virtual simulator
using var device = IPUDevice.Create(deviceId: 0, IPUModel.ColossusMK2);
// 2. Construct computational graph with target-mapped tensors
using var graph = new PoplarGraph(device.Target);
var inputTensor = graph.AddVariable(DataType.Float32, new[] { 1024, 1536 }, "embeddings");
var weights = graph.AddConstant(DataType.Float32, new[] { 1536, 512 }, weightData);
// 3. Add tile-optimized matrix multiplication vertex
var outputTensor = graph.MatMul(inputTensor, weights);
graph.CreateHostWrite("in_stream", inputTensor);
graph.CreateHostRead("out_stream", outputTensor);
// 4. Compile engine and execute asynchronously via ring-pipe streams
using var engine = graph.CompileEngine(new EngineOptions { OptimizationLevel = 3 });
using var session = engine.CreateSession(device);
await session.WriteStreamAsync("in_stream", batchPayloadMemory);
await session.RunAsync(cancellationToken);
await session.ReadStreamAsync("out_stream", resultBufferMemory); Connected HFLabs Products
Poplar.NET serves as the core IPU hardware substrate across the entire HFLabs product ecosystem.
QueryAccel IPU Database Layer
Database OffloadLeverages Poplar.NET to offload SQL relational aggregations (COUNT, SUM, AVG) and 1536-dim vector distance metrics directly to IPU SRAM tiles from PostgreSQL and SQL Server.
Explore Integration →Accelerator & Heterogeneous Engines
Compute FabricA unified gRPC service that coordinates execution plans across Poplar.NET IPU, LevelZero.NET Intel GPU, CUDA, OpenCL, FPGA, and DMA/RDMA backends.
Explore Integration →HFLabs Machine Learning Suite
Local MLUses Poplar.NET for Spiking Neural Network (SNN) membrane potential updates and Knowledge Graph Embedding (KGE) batch scoring.
Explore Integration →AutoMLApp
Node-Graph EditorFeatures 16 dedicated IPU node types for visually designing, compiling, and running Poplar compute graphs on hardware.
Explore Integration →Explore HFLabs Hardware & Native Substrates
Learn how Poplar.NET, LevelZero.NET, and Abigen combine to deliver zero-compromise hardware compute for .NET systems.