sycl

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package sycl provides zero-CGo bindings to the SYCL runtime via purego/dlopen. It supports Intel oneAPI (libsycl.so) for accelerating ML inference on Intel GPUs, CPUs, and FPGAs through the SYCL standard.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Available

func Available() bool

Available returns true if a SYCL runtime is available on this machine.

func GetDeviceCount

func GetDeviceCount() (int, error)

GetDeviceCount returns the number of SYCL-capable devices.

func KernelsAvailable

func KernelsAvailable() bool

KernelsAvailable returns true if the SYCL kernel library has been loaded.

func ScaledSoftmaxF32

func ScaledSoftmaxF32(
	input, output unsafe.Pointer,
	outer, inner, axisSize int,
	scale float32,
	stream unsafe.Pointer,
) error

ScaledSoftmaxF32 applies fused scaled softmax: output = softmax(input * scale).

func ScaledSoftmaxF32Available

func ScaledSoftmaxF32Available() bool

ScaledSoftmaxF32Available returns true if the SYCL ScaledSoftmaxF32 kernel is available.

func SgemvM1

func SgemvM1(y, A, x unsafe.Pointer, M, N int, stream unsafe.Pointer) error

SgemvM1 computes y = A*x for M=1 decode (single-token GEMV). y[M], A[M x N] row-major, x[N]. All FP32.

func SgemvM1Available

func SgemvM1Available() bool

SgemvM1Available returns true if the SYCL SgemvM1 kernel is available.

Types

type Context

type Context struct {
	// contains filtered or unexported fields
}

Context holds a SYCL platform, device, context, and queue.

func NewContext

func NewContext(deviceID int) (*Context, error)

NewContext creates a SYCL context on the specified device.

func (*Context) CreateStream

func (c *Context) CreateStream() (*Stream, error)

CreateStream creates a new SYCL queue.

func (*Context) Destroy

func (c *Context) Destroy() error

Destroy releases the SYCL context resources.

func (*Context) DeviceID

func (c *Context) DeviceID() int

DeviceID returns the device ordinal.

func (*Context) Free

func (c *Context) Free(ptr unsafe.Pointer) error

Free releases SYCL device memory.

func (*Context) Malloc

func (c *Context) Malloc(size int) (unsafe.Pointer, error)

Malloc allocates device memory via SYCL.

func (*Context) Memcpy

func (c *Context) Memcpy(dst, src unsafe.Pointer, count int, kind MemcpyKind) error

Memcpy copies data between host and SYCL device memory.

type MemcpyKind

type MemcpyKind int

MemcpyKind specifies the direction of a memory copy.

const (
	MemcpyHostToDevice MemcpyKind = iota
	MemcpyDeviceToHost
	MemcpyDeviceToDevice
)

type SYCLKernelLib

type SYCLKernelLib struct {
	// contains filtered or unexported fields
}

SYCLKernelLib holds dlopen'd function pointers for custom SYCL kernels compiled into libsycl_kernels.so.

type SYCLLib

type SYCLLib struct {
	// contains filtered or unexported fields
}

SYCLLib holds dlopen handles and resolved function pointers for the SYCL runtime. Currently supports Intel oneAPI Level Zero runtime via libsycl.so. Function pointers are resolved at Open() time via dlsym.

func Lib

func Lib() *SYCLLib

Lib returns the global SYCLLib instance, or nil if not available.

func Open

func Open() (*SYCLLib, error)

Open loads the SYCL runtime library via dlopen and resolves required function pointers. It tries libsycl.so (Intel oneAPI DPC++ runtime) first.

type Stream

type Stream struct {
	// contains filtered or unexported fields
}

Stream wraps a SYCL queue for stream-like semantics.

func (*Stream) Destroy

func (s *Stream) Destroy() error

Destroy releases the SYCL queue.

func (*Stream) Ptr

func (s *Stream) Ptr() unsafe.Pointer

Ptr returns the underlying queue handle as unsafe.Pointer.

func (*Stream) Synchronize

func (s *Stream) Synchronize() error

Synchronize waits for all commands in the queue to complete.

Jump to

Keyboard shortcuts

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