levelzero

package
v0.1.5259 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 1, 2026 License: MIT Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package levelzero runs a compiled OpenVINO graph on an Intel NPU through the system's Level Zero loader and the driver's ZE_extension_graph, with nothing extra to download: ze_loader.dll in System32 on Windows, with no cgo, and libze_loader.so.1 on Linux, opened with dlopen when the NPU is first asked for, so magpie starts the same on a computer without it. Everywhere else, and on a Linux build without cgo, there is no NPU and the encoder reads on the CPU.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compile

func Compile(ir []byte) ([]byte, error)

Compile compiles a serialized OpenVINO IR buffer into a native NPU binary blob.

Types

type Info

type Info struct {
	Device        string
	DeviceID      uint32
	DriverVersion uint32
	CompilerMajor uint16
	CompilerMinor uint16
	MaxOpset      uint32
}

Info describes the NPU driver and graph compiler on this computer.

func Probe

func Probe() (info Info, ok bool, err error)

Probe checks once whether an Intel NPU is available on this computer. When ok is false, no NPU is present and err is nil.

type Model

type Model struct {
	Device string
	// contains filtered or unexported fields
}

Model is a compiled NPU graph opened on Level Zero; it is released when the last reference to it is collected.

func Open

func Open(path string, s, h, k int) (*Model, error)

Open loads a native NPU binary blob from path and prepares its execution command list for input x [1, s, h], mask [1, 1, 1, s] and output logits [1, s, k].

func (*Model) Run

func (m *Model) Run(x, mask []float32, s, h, k int) ([]float32, error)

Run computes logits [s, k] for x [s, h] and mask [s] on the NPU.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL