Send feedback
litert:: EnvironmentOptions
#include <litert_environment_options.h>
Manages configuration options for a LiteRT Environment .
Summary This class provides methods to access various options related to the LiteRT environment, such as compiler settings, dispatch libraries, and hardware acceleration configurations (e.g., OpenCL, EGL, WebGPU, Metal, Vulkan).
Inheritance Inherits from: internal::NonOwnedHandle< LiteRtEnvironmentOptions >
Public types
Tag { kCompilerPluginLibraryDir = kLiteRtEnvOptionTagCompilerPluginLibraryDir, kDispatchLibraryDir = kLiteRtEnvOptionTagDispatchLibraryDir, kOpenClDeviceId = kLiteRtEnvOptionTagOpenClDeviceId, kOpenClPlatformId = kLiteRtEnvOptionTagOpenClPlatformId, kOpenClContext = kLiteRtEnvOptionTagOpenClContext, kOpenClCommandQueue = kLiteRtEnvOptionTagOpenClCommandQueue, kEglDisplay = kLiteRtEnvOptionTagEglDisplay, kEglContext = kLiteRtEnvOptionTagEglContext, kWebGpuDevice = kLiteRtEnvOptionTagWebGpuDevice, kWebGpuQueue = kLiteRtEnvOptionTagWebGpuQueue, kMetalDevice = kLiteRtEnvOptionTagMetalDevice, kMetalCommandQueue = kLiteRtEnvOptionTagMetalCommandQueue, kVulkanEnvironment = kLiteRtEnvOptionTagVulkanEnvironment, kVulkanCommandPool = kLiteRtEnvOptionTagVulkanCommandPool, kCallbackOnGpuEnvDestroy = kLiteRtEnvOptionTagCallbackOnGpuEnvDestroy, kCallbackUserDataOnGpuEnvDestroy =
kLiteRtEnvOptionTagCallbackUserDataOnGpuEnvDestroy, kMagicNumberConfigs = kLiteRtEnvOptionTagMagicNumberConfigs, kMagicNumberVerifications = kLiteRtEnvOptionTagMagicNumberVerifications, kCompilerCacheDir = kLiteRtEnvOptionTagCompilerCacheDir, kWebGpuInstance = kLiteRtEnvOptionTagWebGpuInstance, kWebGpuProcs = kLiteRtEnvOptionTagWebGpuProcs }
enumTags for environment options.
Public functions
GetOption (Tag tag) const
Retrieves the value of an option specified by a tag.
GetOption (LiteRtEnvOptionTag tag) const
Deprecated.
Use GetOption(Tag) instead.
Public types
Tag
Tag
Tags for environment options.
These tags are used to identify and retrieve specific configuration settings.
Properties
kCallbackOnGpuEnvDestroy
Callback to be invoked on GPU environment destruction.
kCallbackUserDataOnGpuEnvDestroy
User data for the GPU environment destruction callback.
kCompilerCacheDir
Directory for the compiler cache.
kCompilerPluginLibraryDir
Directory for compiler plugin libraries.
kDispatchLibraryDir
Directory for dispatch libraries.
kEglContext
EGL context.
kEglDisplay
EGL display.
kMagicNumberConfigs
Magic number configurations.
kMagicNumberVerifications
Magic number verifications.
kMetalCommandQueue
Metal command queue.
kMetalDevice
Metal device.
kOpenClCommandQueue
OpenCL command queue.
kOpenClContext
OpenCL context.
kOpenClDeviceId
OpenCL device ID.
kOpenClPlatformId
OpenCL platform ID.
kVulkanCommandPool
Vulkan command pool (experimental).
kVulkanEnvironment
Vulkan environment (experimental).
kWebGpuDevice
WebGPU device.
kWebGpuInstance
Singleton ML Drift WebGPU/Dawn instance.
Required for shared libraries to prevent them from creating their own instances.
kWebGpuProcs
Dawn procedure table pointer.
This allows shared libraries to use the shared procedures instead of their own.
kWebGpuQueue
WebGPU queue.
Public functions
EnvironmentOptions
EnvironmentOptions(
LiteRtEnvironmentOptions env
)
GetOption
Expected < LiteRtVariant > GetOption (
Tag tag
) const
Retrieves the value of an option specified by a tag.
Details
Parameters
tag
The tag of the option to retrieve.
Returns
An
Expected object containing the option value if successful, or an error if the option is not found or the handle is null.
GetOption
Expected < LiteRtVariant > GetOption (
LiteRtEnvOptionTag tag
) const
Send feedback
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License , and code samples are licensed under the Apache 2.0 License . For details, see the Google Developers Site Policies . Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2026-01-06 UTC.
Need to tell us more?
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2026-01-06 UTC."],[],[]]