Class NativeAPI.Experimental
WARNING: The APIs declared in this class are EXPERIMENTAL and subject to change or removal without notice. API stability and backward compatibility are not guaranteed.
public static class NativeAPI.Experimental
- Inheritance
-
objectNativeAPI.Experimental
Methods
litert_lm_experimental_conversation_get_session_debug_info(nint)
Returns session debug info for the conversation's underlying session, or nint.Zero on failure or if debugging is unsupported/disabled. The caller is responsible for deleting the returned object using litert_lm_experimental_session_debug_info_delete(nint).
public static extern nint litert_lm_experimental_conversation_get_session_debug_info(nint conversation)
Parameters
conversationnintThe conversation to query.
Returns
- nint
A pointer to the session debug info result, or nint.Zero on failure or if debugging is unsupported.
litert_lm_experimental_engine_update_gpu_enable_metal_residency_set(nint, bool)
Updates whether to enable Metal residency set on GPU for the given engine at runtime.
public static extern int litert_lm_experimental_engine_update_gpu_enable_metal_residency_set(nint engine, bool enableMetalResidencySet)
Parameters
enginenintThe engine to update.
enableMetalResidencySetboolWhether to enable Metal residency set.
Returns
- int
0 on success, non-zero on failure.
Remarks
To configure this setting during initialization, use litert_lm_engine_settings_set_gpu_enable_metal_residency_set(nint, bool) instead.
When enabled on Apple platforms (macOS and iOS with Metal GPU backend), this uses Apple's MTLResidencySet API to ensure model weights and allocations remain resident in GPU memory, preventing memory swapping and reducing allocation overhead.
This setting is only supported on Apple platforms (macOS / iOS) with the GPU backend. On other platforms (e.g. Linux, Android, Windows) or non-GPU backends, this setting has no effect and is safely ignored.
litert_lm_experimental_is_debugger_enabled()
Checks whether the LiteRT-LM runtime binary was built with the debugger tracing backend enabled (LITERT_LM_DEBUGGER_ENABLED=1).
public static extern int litert_lm_experimental_is_debugger_enabled()
Returns
- int
1 if debugger is enabled at compile-time, 0 otherwise.
Remarks
NOTE: this is a boolean predicate, NOT a StatusCode. Unlike the status-returning functions in this API, 0 here means "debugger disabled", not "success".
litert_lm_experimental_session_debug_info_delete(nint)
Destroys a LiteRtLmSessionDebugInfo object.
public static extern void litert_lm_experimental_session_debug_info_delete(nint debugInfo)
Parameters
debugInfonintThe session debug info object to destroy.
litert_lm_experimental_session_debug_info_get_capture_dir(nint)
Returns the relative debug capture directory from a LiteRtLmSessionDebugInfo
object (e.g. "litert_lm_debugger/0"), containing intermediate activation
Safetensors dumps and token generation trace logs. The returned string is
owned by the debugInfo object and is valid only for its lifetime.
public static extern nint litert_lm_experimental_session_debug_info_get_capture_dir(nint debugInfo)
Parameters
debugInfonintThe session debug info object.
Returns
- nint
The relative capture directory string.
litert_lm_experimental_session_get_debug_info(nint)
Returns debug info for the session, or nint.Zero on failure or if debugging is unsupported/disabled. The caller is responsible for deleting the returned object using litert_lm_experimental_session_debug_info_delete(nint).
public static extern nint litert_lm_experimental_session_get_debug_info(nint session)
Parameters
sessionnintThe session to query.
Returns
- nint
A pointer to the session debug info result, or nint.Zero on failure or if debugging is unsupported.