Class AttentionBackends

java.lang.Object
smile.llm.attention.AttentionBackends

public final class AttentionBackends extends Object
Process-wide attention backend selector (installed at chat-service startup).
  • Method Details

    • install

      public static void install(AttentionBackend selected)
      Installs the attention backend for this process.

      When AttentionBackend.FLASHINFER is requested but the native library lacks FlashInfer support, falls back to AttentionBackend.TORCH_NATIVE and logs a warning.

      Parameters:
      selected - backend from config.
    • current

      public static AttentionBackend current()
      Returns the currently installed backend.
      Returns:
      currently installed backend.
    • kernel

      public static AttentionKernel kernel()
      Returns the kernel for current().
      Returns:
      kernel for current().
    • flashInferAvailable

      public static boolean flashInferAvailable()
      Reports whether FlashInfer support is present in the native library.
      Returns:
      true when FlashInfer was compiled into libsmile_torch.