Instructions to use replicate/flashinfer-draft with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Kernels
How to use replicate/flashinfer-draft with Kernels:
# !pip install kernels from kernels import get_kernel # a version (or an explicit revision) is required; see the "Files and versions" tab for the available ones kernel = get_kernel("replicate/flashinfer-draft", version=1) - Notebooks
- Google Colab
- Kaggle
File size: 1,955 Bytes
57c3a10 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | /*
* Copyright (c) 2025 by FlashInfer team.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FLASHINFER_MLA_PARAMS_CUH_
#define FLASHINFER_MLA_PARAMS_CUH_
#include <cuda.h>
#include "../fastdiv.cuh"
#include "../profiler.cuh"
namespace flashinfer {
template <typename DTypeQ_, typename DTypeKV_, typename DTypeO_, typename IdType_>
struct MLAParams {
using DTypeQ = DTypeQ_;
using DTypeKV = DTypeKV_;
using DTypeO = DTypeO_;
using IdType = IdType_;
DTypeQ* q_nope;
DTypeQ* q_pe;
DTypeKV* ckv;
DTypeKV* kpe;
DTypeO* partial_o;
float* partial_lse;
DTypeO* final_o;
float* final_lse;
IdType* q_indptr;
IdType* kv_indptr;
IdType* partial_indptr;
IdType* merge_packed_offset_start;
IdType* merge_packed_offset_end;
IdType* merge_partial_packed_offset_start;
IdType* merge_partial_packed_offset_end;
IdType* merge_partial_stride;
IdType* kv_indices;
IdType* q_len;
IdType* kv_len;
IdType* q_start;
IdType* kv_start;
IdType* kv_end;
IdType* work_indptr;
PROFILER_PARAMS_DECL
uint_fastdiv block_size;
uint_fastdiv num_heads;
uint32_t q_nope_stride_n;
uint32_t q_nope_stride_h;
uint32_t q_pe_stride_n;
uint32_t q_pe_stride_h;
uint32_t ckv_stride_page;
uint32_t ckv_stride_n;
uint32_t kpe_stride_page;
uint32_t kpe_stride_n;
uint32_t o_stride_n;
uint32_t o_stride_h;
float sm_scale;
};
}; // namespace flashinfer
#endif // FLASHINFER_MLA_PARAMS_CUH_
|