Skip to content

runtime

fn apply_policy #

fn apply_policy[T](mut ctx autograd.Context[T], policy ExecutionPolicy)

apply_policy applies runtime backend settings to an autograd context.

fn available_backends #

fn available_backends() []vtl.Backend

available_backends returns backends compiled in the current binary.

fn backend_from_string #

fn backend_from_string(value string) !vtl.Backend

backend_from_string parses backend names used by env/config files.

fn new_vulkan_device #

fn new_vulkan_device() !VulkanDevice

new_vulkan_device returns an error because Vulkan is not enabled. Compile with -d vulkan to get a real device.

fn nr_cpus #

fn nr_cpus() int

nr_cpus returns a conservative CPU count for stdlib runtime compatibility.

fn nr_jobs #

fn nr_jobs() int

nr_jobs returns a worker count compatible with the stdlib runtime module.

fn policy_from_env #

fn policy_from_env() !ExecutionPolicy

policy_from_env reads backend options from env vars.- VTL_BACKEND: auto|cpu|vulkan|vcl|cuda

  • VTL_BACKEND_STRICT: 1|true|yes to disable fallback

struct ExecutionPolicy #

struct ExecutionPolicy {
pub:
	backend vtl.Backend = .auto
	strict  bool
}

ExecutionPolicy configures runtime backend selection.

struct VulkanDevice #

struct VulkanDevice {}

VulkanDevice is a stub type used when Vulkan is not enabled (-d vulkan not set). Calling new_vulkan_device() always returns an error in this path. Layer functions that accept VulkanDevice return errors without doing any work.

fn (VulkanDevice) release #

fn (mut d VulkanDevice) release() !

release is a no-op in the non-Vulkan build.

fn (VulkanDevice) device #

fn (d &VulkanDevice) device() voidptr

device returns a nil placeholder in non-Vulkan builds.