Stay organized with collections
Save and categorize content based on your preferences.
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).
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, kCallbackOnGpuEnvDestroy = kLiteRtEnvOptionTagCallbackOnGpuEnvDestroy, kCallbackUserDataOnGpuEnvDestroy =
kLiteRtEnvOptionTagCallbackUserDataOnGpuEnvDestroy, kMagicNumberConfigs = kLiteRtEnvOptionTagMagicNumberConfigs, kMagicNumberVerifications = kLiteRtEnvOptionTagMagicNumberVerifications, kCompilerCacheDir = kLiteRtEnvOptionTagCompilerCacheDir, kWebGpuInstance = kLiteRtEnvOptionTagWebGpuInstance, kWebGpuProcs = kLiteRtEnvOptionTagWebGpuProcs, kRuntimeLibraryDir = kLiteRtEnvOptionTagRuntimeLibraryDir, kSystemRuntimeHandle = kLiteRtEnvOptionTagSystemRuntimeHandle, kAutoRegisterAccelerators = kLiteRtEnvOptionTagAutoRegisterAccelerators, kMinLoggerSeverity = kLiteRtEnvOptionTagMinLoggerSeverity }
|
enum Tags 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. |
GetOptions() const
|
Retrieves all options.
|
Public types
Tag
Tag
Tags for environment options.
These tags are used to identify and retrieve specific configuration settings.
| Properties |
kAutoRegisterAccelerators
|
Bitmask of LiteRtHwAccelerators to auto-register during environment creation.
If unset, LiteRT auto-registers all supported accelerators.
|
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.
|
kMinLoggerSeverity
|
Minimum logger severity for the environment.
|
kOpenClCommandQueue
|
OpenCL command queue.
|
kOpenClContext
|
OpenCL context.
|
kOpenClDeviceId
|
OpenCL device ID.
|
kOpenClPlatformId
|
OpenCL platform ID.
|
kRuntimeLibraryDir
|
Directory for the runtime library.
|
kSystemRuntimeHandle
|
\internal This is for internal use only.
|
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(
absl::Span< const Option > options
)
Constructs an EnvironmentOptions object from a span of options.
| Details |
| Parameters |
options
|
A span of Option objects to initialize the environment options with.
|
|
GetOption
Expected< const 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< const LiteRtVariant > GetOption(
LiteRtEnvOptionTag tag
) const
GetOptions
absl::Span< const Option > GetOptions() const
Retrieves all options.
| Details |
|
Returns
|
A span of all options.
|
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-05-28 UTC.
[null,null,["Last updated 2026-05-28 UTC."],[],[]]