gpumode

package
v0.0.0-debug-20260702 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2026 License: Apache-2.0 Imports: 0 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 gpumode declares a process-wide GpuMode flag and a session- sysvar–aware EffectiveGpuMode resolver, used by vector-index dispatch sites (brute force, kmeans, adhoc brute force, pairwise distance) to decide between GPU (cuvs) and CPU implementations at runtime.

The build tag drives the default:

  • `-tags gpu` build → GpuMode = true (init() in gpu_mode_gpu.go).
  • default build → GpuMode = false (Go zero value).

An operator on a gpu-tag binary can flip the dispatch off per session by `SET gpu_mode = 0`, exercising the CPU paths for debugging or benchmarking.

Index

Constants

This section is empty.

Variables

View Source
var GpuMode bool

GpuMode is the process-wide default for whether vector-index dispatch routes to GPU paths. Flipped to true at init() by gpu_mode_gpu.go in -tags gpu builds; defaults false otherwise. Read directly by call sites that have no proc in scope; sites with a proc should consult EffectiveGpuMode().

Functions

func EffectiveGpuMode

func EffectiveGpuMode(resolver func(string, bool, bool) (any, error)) bool

EffectiveGpuMode returns the per-call gpu_mode decision. Session sysvar override (set via `SET gpu_mode = 0/1`) wins over the build- tag default. Pass proc.GetResolveVariableFunc() — nil is safe and falls back to GpuMode.

Bool sysvars come back from the resolver as int8 (matches gSysVarsDefs convention); anything else (nil, error, unexpected type) falls back to GpuMode.

func GpuModeDefaultInt8

func GpuModeDefaultInt8() int8

GpuModeDefaultInt8 returns GpuMode as int8(0) or int8(1) for use as the `Default` field of the gpu_mode entry in pkg/frontend/variables.go's gSysVarsDefs map. Lives alongside GpuMode so the bool→int8 conversion isn't duplicated at the registration site.

Types

This section is empty.

Jump to

Keyboard shortcuts

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