Class FlashInferAttentionKernel

java.lang.Object
smile.llm.attention.FlashInferAttentionKernel
All Implemented Interfaces:
AttentionKernel

public final class FlashInferAttentionKernel extends Object implements AttentionKernel
FlashInfer paged BatchPrefill / BatchDecode backend.

Decode (S==1) uses FlashInfer BatchDecodeWithPagedKVCache (vendored headers). Prefill uses GPU page gather + LibTorch SDPA with the same mask semantics as torch_native.

Ragged contiguous prefill (vision tower) uses BatchPrefillWithRaggedKVCache when supported, otherwise batched SDPA inside the FlashInfer module.

Expects AttentionContext.isPaged() with CSR metadata and a FlashInferWorkspace, or AttentionContext.isRaggedContiguous() with cumulative segment indptr. Query layout [B, H, S, D] for paged; [N, H, D] NHD for ragged.

  • Constructor Details

    • FlashInferAttentionKernel

      public FlashInferAttentionKernel()
      Creates a FlashInfer attention kernel.
  • Method Details