repo
stringclasses
3 values
commit
stringlengths
40
40
date
stringdate
2023-04-02 02:30:17-0500
2026-10-18 07:42:16-0500
pr_number
int64
20
61.9k
⌀
pr_url
stringlengths
44
53
⌀
title
stringlengths
8
263
message
stringlengths
8
8k
path
stringlengths
10
155
language
stringclasses
4 values
license
stringclasses
4 values
before_code
stringlengths
160
118k
after_code
stringlengths
340
120k
diff
stringlengths
149
51k
lines_added
int64
0
729
lines_removed
int64
0
488
files_in_commit
int64
1
10
models_mentioned
listlengths
0
4
hardware_mentioned
listlengths
0
16
speedup_claims
listlengths
0
10
prompt
stringlengths
569
119k
pr_body
stringlengths
0
24k
gains
stringlengths
2
197k
kernel_speedup
float64
0.78
150
⌀
e2e_speedup
float64
0.76
136
⌀
flashinfer
4aed50cfa663708fab3931b2d5fcab6adc5e1f55
2025-11-16T17:40:45-05:00
2,095
https://github.com/flashinfer-ai/flashinfer/pull/2095
perf: enable pdl for cutlass fp4 gemm (#2095)
perf: enable pdl for cutlass fp4 gemm (#2095) <!-- .github/pull_request_template.md --> ## 📌 Description The `enablePDL` flag is set to false, this PR turned them on. Set to true for both because sm_100 and sm_120 should have support of pdl. ## 🔍 Related Issues <!-- Link any related issues here --> ## 🚀 Pull R...
include/flashinfer/gemm/fp4_gemm_template_sm100.h
cpp
Apache-2.0
/* * Copyright (c) 2020-2023, NVIDIA CORPORATION. All rights reserved. * * 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 ...
/* * Copyright (c) 2020-2023, NVIDIA CORPORATION. All rights reserved. * * 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 ...
--- include/flashinfer/gemm/fp4_gemm_template_sm100.h +++ include/flashinfer/gemm/fp4_gemm_template_sm100.h @@ -273,7 +273,7 @@ std::string(cutlassGetStatusString(initStatus)); \ throw std::runtime_error("[FP4 gemm Runner] " + errMsg); ...
1
1
2
[]
[ "SM100", "SM120" ]
[]
Optimize this cpp kernel file from flashinfer (include/flashinfer/gemm/fp4_gemm_template_sm100.h). Goal: perf: enable pdl for cutlass fp4 gemm Target hardware: SM100, SM120 Target models: unspecified Current file: ```cpp /* * Copyright (c) 2020-2023, NVIDIA CORPORATION. All rights reserved. * * Licensed under the...
<!-- .github/pull_request_template.md --> ## 📌 Description The `enablePDL` flag is set to false, this PR turned them on. Set to true for both because sm_100 and sm_120 should have support of pdl. ## 🔍 Related Issues <!-- Link any related issues here --> ## 🚀 Pull Request Checklist Thank you for contributing to...
[]
null
null
flashinfer
4aed50cfa663708fab3931b2d5fcab6adc5e1f55
2025-11-16T17:40:45-05:00
2,095
https://github.com/flashinfer-ai/flashinfer/pull/2095
perf: enable pdl for cutlass fp4 gemm (#2095)
perf: enable pdl for cutlass fp4 gemm (#2095) <!-- .github/pull_request_template.md --> ## 📌 Description The `enablePDL` flag is set to false, this PR turned them on. Set to true for both because sm_100 and sm_120 should have support of pdl. ## 🔍 Related Issues <!-- Link any related issues here --> ## 🚀 Pull R...
include/flashinfer/gemm/fp4_gemm_template_sm120.h
cpp
Apache-2.0
/* * Copyright (c) 2020-2023, NVIDIA CORPORATION. All rights reserved. * * 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 ...
/* * Copyright (c) 2020-2023, NVIDIA CORPORATION. All rights reserved. * * 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 ...
--- include/flashinfer/gemm/fp4_gemm_template_sm120.h +++ include/flashinfer/gemm/fp4_gemm_template_sm120.h @@ -257,7 +257,7 @@ std::string(cutlass::cutlassGetStatusString(initStatus)); \ throw std::runtime_error("[FP4 gemm Runner] " + errMsg); ...
1
1
2
[]
[ "SM100", "SM120" ]
[]
Optimize this cpp kernel file from flashinfer (include/flashinfer/gemm/fp4_gemm_template_sm120.h). Goal: perf: enable pdl for cutlass fp4 gemm Target hardware: SM100, SM120 Target models: unspecified Current file: ```cpp /* * Copyright (c) 2020-2023, NVIDIA CORPORATION. All rights reserved. * * Licensed under the...
<!-- .github/pull_request_template.md --> ## 📌 Description The `enablePDL` flag is set to false, this PR turned them on. Set to true for both because sm_100 and sm_120 should have support of pdl. ## 🔍 Related Issues <!-- Link any related issues here --> ## 🚀 Pull Request Checklist Thank you for contributing to...
[]
null
null
flashinfer
cce4952fdd41b353325e11d99e1fc0b0737961ff
2025-11-14T22:43:40+01:00
2,092
https://github.com/flashinfer-ai/flashinfer/pull/2092
perf: TRT-LLM Gen finalize kernel optimization (#2092)
perf: TRT-LLM Gen finalize kernel optimization (#2092) <!-- .github/pull_request_template.md --> ## 📌 Description - Small optimization for TRT-LLM Gen MoE finalize kernel TopK=8, NumExperts=128, HiddenSize=4096 | BS | Baseline, us | Optimized, us | Speed-up | | ------------- | ------------- | ------------- | ----...
csrc/trtllm_fused_moe_dev_kernel.cu
cuda
Apache-2.0
/* * Copyright (c) 2022-2024, NVIDIA CORPORATION. All rights reserved. * * 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 ...
/* * Copyright (c) 2022-2024, NVIDIA CORPORATION. All rights reserved. * * 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 ...
--- csrc/trtllm_fused_moe_dev_kernel.cu +++ csrc/trtllm_fused_moe_dev_kernel.cu @@ -672,11 +672,128 @@ // Final kernel to unpermute and scale // This kernel unpermutes the original data, does the k-way reduction and performs the final skip // connection. +/////////////////////////////////////////////////////////////...
172
23
2
[]
[]
[]
Optimize this cuda kernel file from flashinfer (csrc/trtllm_fused_moe_dev_kernel.cu). Goal: perf: TRT-LLM Gen finalize kernel optimization Target hardware: unspecified Target models: unspecified Current file: ```cuda /* * Copyright (c) 2022-2024, NVIDIA CORPORATION. All rights reserved. * * Licensed under the Apa...
<!-- .github/pull_request_template.md --> ## 📌 Description - Small optimization for TRT-LLM Gen MoE finalize kernel TopK=8, NumExperts=128, HiddenSize=4096 | BS | Baseline, us | Optimized, us | Speed-up | | ------------- | ------------- | ------------- | ------------- | | 256 | 11 | 6 | 1.83 | | 512 | 12 | 7 ...
[]
null
null
flashinfer
cce4952fdd41b353325e11d99e1fc0b0737961ff
2025-11-14T22:43:40+01:00
2,092
https://github.com/flashinfer-ai/flashinfer/pull/2092
perf: TRT-LLM Gen finalize kernel optimization (#2092)
perf: TRT-LLM Gen finalize kernel optimization (#2092) <!-- .github/pull_request_template.md --> ## 📌 Description - Small optimization for TRT-LLM Gen MoE finalize kernel TopK=8, NumExperts=128, HiddenSize=4096 | BS | Baseline, us | Optimized, us | Speed-up | | ------------- | ------------- | ------------- | ----...
include/flashinfer/trtllm/fused_moe/DevKernel.h
cpp
Apache-2.0
/* * Copyright (c) 2022-2024, NVIDIA CORPORATION. All rights reserved. * * 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 ...
/* * Copyright (c) 2022-2024, NVIDIA CORPORATION. All rights reserved. * * 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 ...
--- include/flashinfer/trtllm/fused_moe/DevKernel.h +++ include/flashinfer/trtllm/fused_moe/DevKernel.h @@ -116,27 +116,36 @@ FLASHINFER_WARN("Unsupported dtypeElt"); \ } -#define LAUNCH_EXPW(data, kernel, numBlocks, numThreads, smemSize, stream) ...
32
22
2
[]
[]
[]
Optimize this cpp kernel file from flashinfer (include/flashinfer/trtllm/fused_moe/DevKernel.h). Goal: perf: TRT-LLM Gen finalize kernel optimization Target hardware: unspecified Target models: unspecified Current file: ```cpp /* * Copyright (c) 2022-2024, NVIDIA CORPORATION. All rights reserved. * * Licensed und...
<!-- .github/pull_request_template.md --> ## 📌 Description - Small optimization for TRT-LLM Gen MoE finalize kernel TopK=8, NumExperts=128, HiddenSize=4096 | BS | Baseline, us | Optimized, us | Speed-up | | ------------- | ------------- | ------------- | ------------- | | 256 | 11 | 6 | 1.83 | | 512 | 12 | 7 ...
[]
null
null
flashinfer
ba011d15ed44d32c9c226fd1d66746707233729c
2025-11-08T07:14:05+01:00
2,063
https://github.com/flashinfer-ai/flashinfer/pull/2063
perf: TRT-LLM MoE Block-FP8 activation optimization (#2063)
perf: TRT-LLM MoE Block-FP8 activation optimization (#2063) <!-- .github/pull_request_template.md --> ## 📌 Description - Small optimization to the activation kernel for block-FP8 MoE for large batch size. | BS | Baseline, us | Optimized, us | | ------------- | ------------- | ------------- | | 1 | 2.4 | 2.1 | | ...
csrc/trtllm_fused_moe_dev_kernel.cu
cuda
Apache-2.0
/* * Copyright (c) 2022-2024, NVIDIA CORPORATION. All rights reserved. * * 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 ...
/* * Copyright (c) 2022-2024, NVIDIA CORPORATION. All rights reserved. * * 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 ...
--- csrc/trtllm_fused_moe_dev_kernel.cu +++ csrc/trtllm_fused_moe_dev_kernel.cu @@ -19,6 +19,7 @@ #include <cutlass/numeric_conversion.h> #include <cutlass/numeric_types.h> +#include <algorithm> #include <cub/cub.cuh> #include <cuda/functional> #include <cuda/std/functional> @@ -26,6 +27,7 @@ #include "flashi...
233
52
2
[]
[]
[]
Optimize this cuda kernel file from flashinfer (csrc/trtllm_fused_moe_dev_kernel.cu). Goal: perf: TRT-LLM MoE Block-FP8 activation optimization Target hardware: unspecified Target models: unspecified Current file: ```cuda /* * Copyright (c) 2022-2024, NVIDIA CORPORATION. All rights reserved. * * Licensed under th...
<!-- .github/pull_request_template.md --> ## 📌 Description - Small optimization to the activation kernel for block-FP8 MoE for large batch size. | BS | Baseline, us | Optimized, us | | ------------- | ------------- | ------------- | | 1 | 2.4 | 2.1 | | 32 | 3.5 | 2.6 | | 256 | 21.7 | 8.7 | | 1024 | 84.4 | 2...
[]
null
null
flashinfer
ba011d15ed44d32c9c226fd1d66746707233729c
2025-11-08T07:14:05+01:00
2,063
https://github.com/flashinfer-ai/flashinfer/pull/2063
perf: TRT-LLM MoE Block-FP8 activation optimization (#2063)
perf: TRT-LLM MoE Block-FP8 activation optimization (#2063) <!-- .github/pull_request_template.md --> ## 📌 Description - Small optimization to the activation kernel for block-FP8 MoE for large batch size. | BS | Baseline, us | Optimized, us | | ------------- | ------------- | ------------- | | 1 | 2.4 | 2.1 | | ...
include/flashinfer/trtllm/fused_moe/DevKernel.h
cpp
Apache-2.0
/* * Copyright (c) 2022-2024, NVIDIA CORPORATION. All rights reserved. * * 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 ...
/* * Copyright (c) 2022-2024, NVIDIA CORPORATION. All rights reserved. * * 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 ...
--- include/flashinfer/trtllm/fused_moe/DevKernel.h +++ include/flashinfer/trtllm/fused_moe/DevKernel.h @@ -90,6 +90,32 @@ FLASHINFER_WARN("Unsupported dtypeElt"); \ } +#define LAUNCH_NUM_TOKENS_PER_CTA(data, type, numTokensPerCta, kernel, numBlocks, numTh...
28
1
2
[]
[]
[]
Optimize this cpp kernel file from flashinfer (include/flashinfer/trtllm/fused_moe/DevKernel.h). Goal: perf: TRT-LLM MoE Block-FP8 activation optimization Target hardware: unspecified Target models: unspecified Current file: ```cpp /* * Copyright (c) 2022-2024, NVIDIA CORPORATION. All rights reserved. * * License...
<!-- .github/pull_request_template.md --> ## 📌 Description - Small optimization to the activation kernel for block-FP8 MoE for large batch size. | BS | Baseline, us | Optimized, us | | ------------- | ------------- | ------------- | | 1 | 2.4 | 2.1 | | 32 | 3.5 | 2.6 | | 256 | 21.7 | 8.7 | | 1024 | 84.4 | 2...
[]
null
null
flashinfer
f588d96af1d27bd8714b63e40ccc2955d92a5593
2025-11-07T11:50:59-08:00
2,058
https://github.com/flashinfer-ai/flashinfer/pull/2058
perf: Optimize helper max/minmax function in sampling.cuh (#2058)
perf: Optimize helper max/minmax function in sampling.cuh (#2058) <!-- .github/pull_request_template.md --> ## 📌 Description Apply optimizations similar to #2044 to max/min functions. <!-- What does this PR do? Briefly describe the changes and why they’re needed. --> ## 🔍 Related Issues <!-- Link any related is...
include/flashinfer/sampling.cuh
cuda
Apache-2.0
/* * Copyright (c) 2024 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 ...
/* * Copyright (c) 2024 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 ...
--- include/flashinfer/sampling.cuh +++ include/flashinfer/sampling.cuh @@ -249,27 +249,31 @@ TempStorage& temp_storage) { const uint32_t tx = threadIdx.x; vec_t<float, VEC_SIZE> in_data_vec; - float max_val = -cuda::std::numeric_limits<float>::...
28
23
1
[]
[]
[]
Optimize this cuda kernel file from flashinfer (include/flashinfer/sampling.cuh). Goal: perf: Optimize helper max/minmax function in sampling.cuh Target hardware: unspecified Target models: unspecified Current file: ```cuda /* * Copyright (c) 2024 by FlashInfer team. * * Licensed under the Apache License, Version ...
<!-- .github/pull_request_template.md --> ## 📌 Description Apply optimizations similar to #2044 to max/min functions. `top_p_renorm_probs`, `top_k_renorm_probs`, and `top_k_mask_logits` see 14%, 7%, and 19% speedups on B200 (logs from `bench_sampling.py`: [bench_sampling_before.txt](https://github.com/user-attachme...
[{"scope": "kernel", "hardware": "B200", "model": null, "shape": null, "batch_size": null, "metric": "latency", "unit": null, "higher_is_better": false, "baseline": null, "optimized": null, "stated_speedup": 1.14, "speedup": 1.14}, {"scope": "kernel", "hardware": "B200", "model": null, "shape": null, "batch_size": null...
1.14
null
flashinfer
adcc5dd41037bbd77a68800b15f5e0235c2975ac
2025-11-06T16:58:30-08:00
2,044
https://github.com/flashinfer-ai/flashinfer/pull/2044
perf: improve sampling/mask/softmax performance (part 1/2) (#2044)
perf: improve sampling/mask/softmax performance (part 1/2) (#2044) <!-- .github/pull_request_template.md --> ## 📌 Description This is the first part of the performance improvement PR for sampling/mask/softmax operator, in this PR, we defer the cross thread reduction till the end of the loop (similar to how FA2 hand...
include/flashinfer/sampling.cuh
cuda
Apache-2.0
/* * Copyright (c) 2024 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 ...
/* * Copyright (c) 2024 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 ...
--- include/flashinfer/sampling.cuh +++ include/flashinfer/sampling.cuh @@ -333,6 +333,7 @@ float running_max = -cuda::std::numeric_limits<float>::infinity(); float running_denominator = 0.0f; + float threadlocal_running_denominator = 0.0f; #if (__CUDACC_VER_MAJOR__ >= 12 && defined(__CUDA_ARCH__) && (__CUD...
161
148
1
[]
[]
[]
Optimize this cuda kernel file from flashinfer (include/flashinfer/sampling.cuh). Goal: perf: improve sampling/mask/softmax performance (part 1/2) Target hardware: unspecified Target models: unspecified Current file: ```cuda /* * Copyright (c) 2024 by FlashInfer team. * * Licensed under the Apache License, Version...
<!-- .github/pull_request_template.md --> ## 📌 Description This is the first part of the performance improvement PR for sampling/mask/softmax operator, in this PR, we defer the cross thread reduction till the end of the loop (similar to how FA2 handles denominator) to reduce the number of shuffling and thread sync i...
[]
null
null
flashinfer
2580610b46ba5fa45532256ca77730acba2f5a03
2025-11-04T22:07:19-08:00
2,025
https://github.com/flashinfer-ai/flashinfer/pull/2025
perf: Speed up fp4 quantization for small batch with swizzling for cutlass MoE (#2025)
perf: Speed up fp4 quantization for small batch with swizzling for cutlass MoE (#2025) <!-- .github/pull_request_template.md --> ## 📌 Description Performance optimization for `fp4_quantize()` function. The performance issue was raised in issues #1734 and #2021 Observed behavior was slow performance when `is_sf_swi...
csrc/nv_internal/cpp/kernels/quantization.cu
cuda
Apache-2.0
/* * Copyright (c) 2019-2023, NVIDIA CORPORATION. All rights reserved. * * 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 ...
/* * Copyright (c) 2019-2023, NVIDIA CORPORATION. All rights reserved. * * 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 ...
--- csrc/nv_internal/cpp/kernels/quantization.cu +++ csrc/nv_internal/cpp/kernels/quantization.cu @@ -71,6 +71,21 @@ //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////...
21
3
2
[]
[]
[ "10×" ]
Optimize this cuda kernel file from flashinfer (csrc/nv_internal/cpp/kernels/quantization.cu). Goal: perf: Speed up fp4 quantization for small batch with swizzling for cutlass MoE Target hardware: unspecified Target models: unspecified Current file: ```cuda /* * Copyright (c) 2019-2023, NVIDIA CORPORATION. All righ...
<!-- .github/pull_request_template.md --> ## 📌 Description Performance optimization for `fp4_quantize()` function. The performance issue was raised in issues #1734 and #2021 Observed behavior was slow performance when `is_sf_swizzled_layout=True` (as opposed to False). Root cause of the issue was * Excessive Padd...
[{"scope": "kernel", "hardware": null, "model": null, "shape": "N=5120", "batch_size": 1, "metric": "latency", "unit": "us", "higher_is_better": false, "baseline": 71.52, "optimized": 3.456, "stated_speedup": null, "speedup": 20.6944}, {"scope": "kernel", "hardware": null, "model": null, "shape": "N=5120", "batch_size"...
1.68
null
flashinfer
2580610b46ba5fa45532256ca77730acba2f5a03
2025-11-04T22:07:19-08:00
2,025
https://github.com/flashinfer-ai/flashinfer/pull/2025
perf: Speed up fp4 quantization for small batch with swizzling for cutlass MoE (#2025)
perf: Speed up fp4 quantization for small batch with swizzling for cutlass MoE (#2025) <!-- .github/pull_request_template.md --> ## 📌 Description Performance optimization for `fp4_quantize()` function. The performance issue was raised in issues #1734 and #2021 Observed behavior was slow performance when `is_sf_swi...
csrc/nv_internal/tensorrt_llm/kernels/quantization.cuh
cuda
Apache-2.0
/* * Copyright (c) 2019-2023, NVIDIA CORPORATION. All rights reserved. * * 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 ...
/* * Copyright (c) 2019-2023, NVIDIA CORPORATION. All rights reserved. * * 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 ...
--- csrc/nv_internal/tensorrt_llm/kernels/quantization.cuh +++ csrc/nv_internal/tensorrt_llm/kernels/quantization.cuh @@ -778,56 +778,86 @@ int numColThreadsForSf = numColsForSf / ELTS_PER_THREAD; asm volatile("griddepcontrol.wait;"); + // Input tensor batch/row/col loops. + // Optimization: Iterate over ac...
74
44
2
[]
[]
[ "10×" ]
Optimize this cuda kernel file from flashinfer (csrc/nv_internal/tensorrt_llm/kernels/quantization.cuh). Goal: perf: Speed up fp4 quantization for small batch with swizzling for cutlass MoE Target hardware: unspecified Target models: unspecified Current file: ```cuda /* * Copyright (c) 2019-2023, NVIDIA CORPORATION....
<!-- .github/pull_request_template.md --> ## 📌 Description Performance optimization for `fp4_quantize()` function. The performance issue was raised in issues #1734 and #2021 Observed behavior was slow performance when `is_sf_swizzled_layout=True` (as opposed to False). Root cause of the issue was * Excessive Padd...
[{"scope": "kernel", "hardware": null, "model": null, "shape": "N=5120", "batch_size": 1, "metric": "latency", "unit": "us", "higher_is_better": false, "baseline": 71.52, "optimized": 3.456, "stated_speedup": null, "speedup": 20.6944}, {"scope": "kernel", "hardware": null, "model": null, "shape": "N=5120", "batch_size"...
1.68
null
flashinfer
bb6b62089a13db0a6b90887d68b161bbc1b5fc8e
2025-10-28T23:47:25-07:00
1,980
https://github.com/flashinfer-ai/flashinfer/pull/1980
feat: autotune tile_tokens_dim in trtllm-gen MOE (#1980)
feat: autotune tile_tokens_dim in trtllm-gen MOE (#1980) <!-- .github/pull_request_template.md --> ## 📌 Description - Update the autotune logic in trtllm-gen moe. Instead of using a fixed `tile_tokens_dim`, tune in a range of `[max(8,tile_token_dim/2), tile_token_dim, min(128, tile_token_dim*2), min(128, tile_token_...
csrc/trtllm_fused_moe_kernel_launcher.cu
cuda
Apache-2.0
/* * 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 * distribut...
/* * 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 * distribut...
--- csrc/trtllm_fused_moe_kernel_launcher.cu +++ csrc/trtllm_fused_moe_kernel_launcher.cu @@ -18,6 +18,8 @@ #include <algorithm> #include <cmath> #include <iostream> +#include <set> +#include <unordered_map> #include <vector> #include "flashinfer/trtllm/batched_gemm/trtllmGen_bmm_export/GemmGatedActOptions.h" @@...
230
94
3
[]
[]
[]
Optimize this cuda kernel file from flashinfer (csrc/trtllm_fused_moe_kernel_launcher.cu). Goal: feat: autotune tile_tokens_dim in trtllm-gen MOE Target hardware: unspecified Target models: unspecified Current file: ```cuda /* * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this ...
<!-- .github/pull_request_template.md --> ## 📌 Description - Update the autotune logic in trtllm-gen moe. Instead of using a fixed `tile_tokens_dim`, tune in a range of `[max(8,tile_token_dim/2), tile_token_dim, min(128, tile_token_dim*2), min(128, tile_token_dim*4)]` - Add FP8 MOE autotune logic, initial PR https:/...
[]
null
null
flashinfer
ed1d8c1461d8cf85bd6d1c2f46eb4fbf4b14aa1a
2025-09-19T17:13:55+08:00
1,685
https://github.com/flashinfer-ai/flashinfer/pull/1685
perf: Port the separate reduce kernel mode from trtllm. (#1685)
perf: Port the separate reduce kernel mode from trtllm. (#1685) <!-- .github/pull_request_template.md --> ## 📌 Description <!-- What does this PR do? Briefly describe the changes and why they’re needed. --> ## 🔍 Related Issues <!-- Link any related issues here --> ## 🚀 Pull Request Checklist Thank you for con...
include/flashinfer/trtllm/common/cudaUtils.h
cpp
Apache-2.0
/* * SPDX-FileCopyrightText: Copyright (c) 2022-2024 NVIDIA CORPORATION & AFFILIATES. All rights * reserved. SPDX-License-Identifier: Apache-2.0 * * 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 Lic...
/* * SPDX-FileCopyrightText: Copyright (c) 2022-2024 NVIDIA CORPORATION & AFFILIATES. All rights * reserved. SPDX-License-Identifier: Apache-2.0 * * 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 Lic...
--- include/flashinfer/trtllm/common/cudaUtils.h +++ include/flashinfer/trtllm/common/cudaUtils.h @@ -22,6 +22,7 @@ // #include "tensorrt_llm/common/logger.h" // #include "tensorrt_llm/common/tllmException.h" +#include <c10/util/Exception.h> #include <cublasLt.h> #include <cublas_v2.h> #include <cuda.h> @@ -31,1...
4
1
5
[]
[]
[]
Optimize this cpp kernel file from flashinfer (include/flashinfer/trtllm/common/cudaUtils.h). Goal: perf: Port the separate reduce kernel mode from trtllm. Target hardware: unspecified Target models: unspecified Current file: ```cpp /* * SPDX-FileCopyrightText: Copyright (c) 2022-2024 NVIDIA CORPORATION & AFFILIATES...
<!-- .github/pull_request_template.md --> ## 📌 Description This also updated the kernels which fixed mha perf regression and fp8 sink attention accuracy issue. <!-- What does this PR do? Briefly describe the changes and why they’re needed. --> ## 🔍 Related Issues <!-- Link any related issues here --> ## 🚀 Pull...
[]
null
null
flashinfer
ed1d8c1461d8cf85bd6d1c2f46eb4fbf4b14aa1a
2025-09-19T17:13:55+08:00
1,685
https://github.com/flashinfer-ai/flashinfer/pull/1685
perf: Port the separate reduce kernel mode from trtllm. (#1685)
perf: Port the separate reduce kernel mode from trtllm. (#1685) <!-- .github/pull_request_template.md --> ## 📌 Description <!-- What does this PR do? Briefly describe the changes and why they’re needed. --> ## 🔍 Related Issues <!-- Link any related issues here --> ## 🚀 Pull Request Checklist Thank you for con...
include/flashinfer/trtllm/fmha/fmhaKernels.cuh
cuda
Apache-2.0
/* * Copyright (c) 2020-2023, NVIDIA CORPORATION. All rights reserved. * * 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 r...
/* * Copyright (c) 2020-2023, NVIDIA CORPORATION. All rights reserved. * * 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 r...
--- include/flashinfer/trtllm/fmha/fmhaKernels.cuh +++ include/flashinfer/trtllm/fmha/fmhaKernels.cuh @@ -28,6 +28,7 @@ #include "../common.h" #include "cuda_runtime_api.h" #include "flashInferMetaInfo.h" +#include "fmhaReduction.h" #include "fmhaRunnerParams.h" #include "kernelParams.h" #include "lse.cuh" @@ -25...
9
0
5
[]
[]
[]
Optimize this cuda kernel file from flashinfer (include/flashinfer/trtllm/fmha/fmhaKernels.cuh). Goal: perf: Port the separate reduce kernel mode from trtllm. Target hardware: unspecified Target models: unspecified Current file: ```cuda /* * Copyright (c) 2020-2023, NVIDIA CORPORATION. All rights reserved. * * Lic...
<!-- .github/pull_request_template.md --> ## 📌 Description This also updated the kernels which fixed mha perf regression and fp8 sink attention accuracy issue. <!-- What does this PR do? Briefly describe the changes and why they’re needed. --> ## 🔍 Related Issues <!-- Link any related issues here --> ## 🚀 Pull...
[]
null
null
flashinfer
ed1d8c1461d8cf85bd6d1c2f46eb4fbf4b14aa1a
2025-09-19T17:13:55+08:00
1,685
https://github.com/flashinfer-ai/flashinfer/pull/1685
perf: Port the separate reduce kernel mode from trtllm. (#1685)
perf: Port the separate reduce kernel mode from trtllm. (#1685) <!-- .github/pull_request_template.md --> ## 📌 Description <!-- What does this PR do? Briefly describe the changes and why they’re needed. --> ## 🔍 Related Issues <!-- Link any related issues here --> ## 🚀 Pull Request Checklist Thank you for con...
include/flashinfer/trtllm/fmha/fmhaRunnerParams.h
cpp
Apache-2.0
/* * Copyright (c) 2020-2023, NVIDIA CORPORATION. All rights reserved. * * 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 ...
/* * Copyright (c) 2020-2023, NVIDIA CORPORATION. All rights reserved. * * 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 ...
--- include/flashinfer/trtllm/fmha/fmhaRunnerParams.h +++ include/flashinfer/trtllm/fmha/fmhaRunnerParams.h @@ -134,10 +134,14 @@ //////////////////////////////////////////////////////////////////////////////////////////////////// enum class MultiCtasKvMode { - // No multiCtasKvMode. + // Disable the multiCtasKvM...
6
1
5
[]
[]
[]
Optimize this cpp kernel file from flashinfer (include/flashinfer/trtllm/fmha/fmhaRunnerParams.h). Goal: perf: Port the separate reduce kernel mode from trtllm. Target hardware: unspecified Target models: unspecified Current file: ```cpp /* * Copyright (c) 2020-2023, NVIDIA CORPORATION. All rights reserved. * * L...
<!-- .github/pull_request_template.md --> ## 📌 Description This also updated the kernels which fixed mha perf regression and fp8 sink attention accuracy issue. <!-- What does this PR do? Briefly describe the changes and why they’re needed. --> ## 🔍 Related Issues <!-- Link any related issues here --> ## 🚀 Pull...
[]
null
null
flashinfer
67c7e889605106778aac5cdd6d7feee0fccfc86f
2025-09-15T20:01:07-04:00
1,681
https://github.com/flashinfer-ai/flashinfer/pull/1681
perf: improve performance of cutlass fmha (#1681)
perf: improve performance of cutlass fmha (#1681) <!-- .github/pull_request_template.md --> ## 📌 Description 1. fix the bug in `get_unmasked_trip_count` calculation in causal attention 2. add skip correction rescale optimization in FA4. ## 🔍 Related Issues <!-- Link any related issues here --> ## 🚀 Pull Reques...
include/flashinfer/attention/blackwell/collective/fmha_fusion.hpp
cpp
BSD-3-Clause
/*************************************************************************************************** * Copyright (c) 2024 - 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without * modification, are p...
/*************************************************************************************************** * Copyright (c) 2024 - 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without * modification, are p...
--- include/flashinfer/attention/blackwell/collective/fmha_fusion.hpp +++ include/flashinfer/attention/blackwell/collective/fmha_fusion.hpp @@ -121,7 +121,8 @@ template <class BlkCoord, class TileShape, class ProblemSize> CUTLASS_DEVICE int get_masked_trip_count(BlkCoord const& blk_coord, TileShape const& tile_sh...
2
1
2
[]
[ "BLACKWELL" ]
[]
Optimize this cpp kernel file from flashinfer (include/flashinfer/attention/blackwell/collective/fmha_fusion.hpp). Goal: perf: improve performance of cutlass fmha Target hardware: BLACKWELL Target models: unspecified Current file: ```cpp /*******************************************************************************...
<!-- .github/pull_request_template.md --> ## 📌 Description 1. fix the bug in `get_unmasked_trip_count` calculation in causal attention 2. add skip correction rescale optimization in FA4. ## 🔍 Related Issues <!-- Link any related issues here --> ## 🚀 Pull Request Checklist Thank you for contributing to FlashInf...
[]
null
null
flashinfer
67c7e889605106778aac5cdd6d7feee0fccfc86f
2025-09-15T20:01:07-04:00
1,681
https://github.com/flashinfer-ai/flashinfer/pull/1681
perf: improve performance of cutlass fmha (#1681)
perf: improve performance of cutlass fmha (#1681) <!-- .github/pull_request_template.md --> ## 📌 Description 1. fix the bug in `get_unmasked_trip_count` calculation in causal attention 2. add skip correction rescale optimization in FA4. ## 🔍 Related Issues <!-- Link any related issues here --> ## 🚀 Pull Reques...
include/flashinfer/attention/blackwell/collective/sm100_fmha_fwd_mainloop_tma_warpspecialized.hpp
cpp
BSD-3-Clause
/*************************************************************************************************** * Copyright (c) 2024 - 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without * modification, are p...
/*************************************************************************************************** * Copyright (c) 2024 - 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without * modification, are p...
--- include/flashinfer/attention/blackwell/collective/sm100_fmha_fwd_mainloop_tma_warpspecialized.hpp +++ include/flashinfer/attention/blackwell/collective/sm100_fmha_fwd_mainloop_tma_warpspecialized.hpp @@ -961,10 +961,13 @@ // e^(scale * (old_max - new_max) float scale = ::exp2f(params.scale_softmax_log...
8
2
2
[]
[ "BLACKWELL" ]
[]
Optimize this cpp kernel file from flashinfer (include/flashinfer/attention/blackwell/collective/sm100_fmha_fwd_mainloop_tma_warpspecialized.hpp). Goal: perf: improve performance of cutlass fmha Target hardware: BLACKWELL Target models: unspecified Current file: ```cpp /***********************************************...
<!-- .github/pull_request_template.md --> ## 📌 Description 1. fix the bug in `get_unmasked_trip_count` calculation in causal attention 2. add skip correction rescale optimization in FA4. ## 🔍 Related Issues <!-- Link any related issues here --> ## 🚀 Pull Request Checklist Thank you for contributing to FlashInf...
[]
null
null
flashinfer
73bc88ec1210a73bf2bd67316ca221b4f677de3c
2025-09-09T19:38:03+08:00
1,660
https://github.com/flashinfer-ai/flashinfer/pull/1660
Speedup MLARopeQuantize by 20-35% (#1660)
Speedup MLARopeQuantize by 20-35% (#1660) <!-- .github/pull_request_template.md --> ## 📌 Description baseline ``` num_tokens FlashInfer 0 1.0 0.002714 1 2.0 0.003126 2 4.0 0.003328 3 8.0 0.003328 4 16.0 0.003530 5 32.0 0.004144 6 64...
include/flashinfer/pos_enc.cuh
cuda
Apache-2.0
/* * Copyright (c) 2023 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 ...
/* * Copyright (c) 2023 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 ...
--- include/flashinfer/pos_enc.cuh +++ include/flashinfer/pos_enc.cuh @@ -370,7 +370,7 @@ // 2. if not interleave // - cos = cos_cache[pos_id][(tx * vec_size) % (rot_dim // 2)] // - sin = sin_cache[pos_id][(rot_dim // 2) + (tx * vec_size) % (rot_dim // 2)] - if (tx * vec_size < rotary_dim) { + if...
2
2
1
[]
[]
[]
Optimize this cuda kernel file from flashinfer (include/flashinfer/pos_enc.cuh). Goal: Speedup MLARopeQuantize by 20-35% Target hardware: unspecified Target models: unspecified Current file: ```cuda /* * Copyright (c) 2023 by FlashInfer team. * * Licensed under the Apache License, Version 2.0 (the "License"); * y...
<!-- .github/pull_request_template.md --> ## 📌 Description baseline ``` num_tokens FlashInfer 0 1.0 0.002714 1 2.0 0.003126 2 4.0 0.003328 3 8.0 0.003328 4 16.0 0.003530 5 32.0 0.004144 6 64.0 0.005430 7 128.0 0.007837 ...
[]
null
null
flashinfer
375a26b6550578799a739d91c3470cd1727f35a4
2025-09-05T03:48:15-04:00
1,548
https://github.com/flashinfer-ai/flashinfer/pull/1548
Enable SplitK and fix autotuner for trtllm fp4 fused moe (#1548)
Enable SplitK and fix autotuner for trtllm fp4 fused moe (#1548) Enable splitK for trtllm-gen fused moe. Make autotuner for trtllm-gen fp4 fused moe more robust. Add autotuner for trtllm-gen fused moe test. <!-- .github/pull_request_template.md --> ## 📌 Description <!-- What does this PR do? Briefly describe the ...
csrc/trtllm_batched_gemm_runner.cu
cuda
Apache-2.0
/* * Copyright (c) 2020-2025, NVIDIA CORPORATION. All rights reserved. * * 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 ...
/* * Copyright (c) 2020-2025, NVIDIA CORPORATION. All rights reserved. * * 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 ...
--- csrc/trtllm_batched_gemm_runner.cu +++ csrc/trtllm_batched_gemm_runner.cu @@ -104,13 +104,6 @@ tileSize == mOptions.tileSize && options.mUseShuffledMatrixA == mOptions.useShuffledMatrixA && options.mLayoutA == mOptions.weightLayout) { - // FIXME: Disable split-k for swiglu for now. -...
0
7
4
[]
[]
[]
Optimize this cuda kernel file from flashinfer (csrc/trtllm_batched_gemm_runner.cu). Goal: Enable SplitK and fix autotuner for trtllm fp4 fused moe Target hardware: unspecified Target models: unspecified Current file: ```cuda /* * Copyright (c) 2020-2025, NVIDIA CORPORATION. All rights reserved. * * Licensed unde...
Enable splitK for trtllm-gen fused moe. Make autotuner for trtllm-gen fp4 fused moe more robust. Add autotuner for trtllm-gen fused moe test. <!-- .github/pull_request_template.md --> ## 📌 Description <!-- What does this PR do? Briefly describe the changes and why they’re needed. --> ## 🔍 Related Issues <!-- Li...
[]
null
null
flashinfer
375a26b6550578799a739d91c3470cd1727f35a4
2025-09-05T03:48:15-04:00
1,548
https://github.com/flashinfer-ai/flashinfer/pull/1548
Enable SplitK and fix autotuner for trtllm fp4 fused moe (#1548)
Enable SplitK and fix autotuner for trtllm fp4 fused moe (#1548) Enable splitK for trtllm-gen fused moe. Make autotuner for trtllm-gen fp4 fused moe more robust. Add autotuner for trtllm-gen fused moe test. <!-- .github/pull_request_template.md --> ## 📌 Description <!-- What does this PR do? Briefly describe the ...
include/flashinfer/trtllm/batched_gemm/trtllmGen_bmm_export/GemmOptions.h
cpp
Apache-2.0
/* * SPDX-FileCopyrightText: Copyright (c) 1993-2025 NVIDIA CORPORATION & * AFFILIATES. All rights reserved. SPDX-License-Identifier: Apache-2.0 * * 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 Lic...
/* * SPDX-FileCopyrightText: Copyright (c) 1993-2025 NVIDIA CORPORATION & * AFFILIATES. All rights reserved. SPDX-License-Identifier: Apache-2.0 * * 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 Lic...
--- include/flashinfer/trtllm/batched_gemm/trtllmGen_bmm_export/GemmOptions.h +++ include/flashinfer/trtllm/batched_gemm/trtllmGen_bmm_export/GemmOptions.h @@ -1085,22 +1085,34 @@ ")"); } + // Number of iterations in K dimension after padding. + // Note the perCtaK in each CTA in the splitK...
28
11
4
[]
[]
[]
Optimize this cpp kernel file from flashinfer (include/flashinfer/trtllm/batched_gemm/trtllmGen_bmm_export/GemmOptions.h). Goal: Enable SplitK and fix autotuner for trtllm fp4 fused moe Target hardware: unspecified Target models: unspecified Current file: ```cpp /* * SPDX-FileCopyrightText: Copyright (c) 1993-2025 N...
Enable splitK for trtllm-gen fused moe. Make autotuner for trtllm-gen fp4 fused moe more robust. Add autotuner for trtllm-gen fused moe test. <!-- .github/pull_request_template.md --> ## 📌 Description <!-- What does this PR do? Briefly describe the changes and why they’re needed. --> ## 🔍 Related Issues <!-- Li...
[]
null
null
flashinfer
da937d73c6dd59419bf6beaf7e5c5c0f1d0d0d93
2025-09-03T04:32:32+08:00
1,615
https://github.com/flashinfer-ai/flashinfer/pull/1615
perf: Fix the tactic sorting in TrtllmGenBatchedGemmRunner::getValidConfigIndices (#1615)
perf: Fix the tactic sorting in TrtllmGenBatchedGemmRunner::getValidConfigIndices (#1615)
csrc/trtllm_batched_gemm_runner.cu
cuda
Apache-2.0
/* * Copyright (c) 2020-2025, NVIDIA CORPORATION. All rights reserved. * * 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 ...
/* * Copyright (c) 2020-2025, NVIDIA CORPORATION. All rights reserved. * * 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 ...
--- csrc/trtllm_batched_gemm_runner.cu +++ csrc/trtllm_batched_gemm_runner.cu @@ -24,6 +24,7 @@ #include "flashinfer/trtllm/batched_gemm/trtllmGen_bmm_export/Enums.h" #include "flashinfer/trtllm/batched_gemm/trtllmGen_bmm_export/trtllm/gen/DtypeDecl.h" #include "flashinfer/trtllm/common.h" +#include "tensorrt_llm/co...
45
52
2
[]
[]
[]
Optimize this cuda kernel file from flashinfer (csrc/trtllm_batched_gemm_runner.cu). Goal: perf: Fix the tactic sorting in TrtllmGenBatchedGemmRunner::getValidConfigIndices Target hardware: unspecified Target models: unspecified Current file: ```cuda /* * Copyright (c) 2020-2025, NVIDIA CORPORATION. All rights rese...
<!-- .github/pull_request_template.md --> ## 📌 Description The tactic sorting in `TrtllmGenBatchedGemmRunner::getValidConfigIndices` may not be as expected because different criteria are applied in different sorting function calls. This PR fixes the issue by applying these criteria in the same sorting function call....
[]
null
null
flashinfer
da937d73c6dd59419bf6beaf7e5c5c0f1d0d0d93
2025-09-03T04:32:32+08:00
1,615
https://github.com/flashinfer-ai/flashinfer/pull/1615
perf: Fix the tactic sorting in TrtllmGenBatchedGemmRunner::getValidConfigIndices (#1615)
perf: Fix the tactic sorting in TrtllmGenBatchedGemmRunner::getValidConfigIndices (#1615)
include/flashinfer/trtllm/batched_gemm/trtllmGen_bmm_export/BatchedGemmInterface.h
cpp
Apache-2.0
/* * SPDX-FileCopyrightText: Copyright (c) 1993-2025 NVIDIA CORPORATION & * AFFILIATES. All rights reserved. SPDX-License-Identifier: Apache-2.0 * * 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 Lic...
/* * SPDX-FileCopyrightText: Copyright (c) 1993-2025 NVIDIA CORPORATION & * AFFILIATES. All rights reserved. SPDX-License-Identifier: Apache-2.0 * * 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 Lic...
--- include/flashinfer/trtllm/batched_gemm/trtllmGen_bmm_export/BatchedGemmInterface.h +++ include/flashinfer/trtllm/batched_gemm/trtllmGen_bmm_export/BatchedGemmInterface.h @@ -522,13 +522,14 @@ // Returns true if the configuration of the cubin can be executed for the given params. bool isValidConfig(BatchedGemm...
4
3
2
[]
[]
[]
Optimize this cpp kernel file from flashinfer (include/flashinfer/trtllm/batched_gemm/trtllmGen_bmm_export/BatchedGemmInterface.h). Goal: perf: Fix the tactic sorting in TrtllmGenBatchedGemmRunner::getValidConfigIndices Target hardware: unspecified Target models: unspecified Current file: ```cpp /* * SPDX-FileCopyri...
<!-- .github/pull_request_template.md --> ## 📌 Description The tactic sorting in `TrtllmGenBatchedGemmRunner::getValidConfigIndices` may not be as expected because different criteria are applied in different sorting function calls. This PR fixes the issue by applying these criteria in the same sorting function call....
[]
null
null
flashinfer
eab0de466deea57771f152e5ee6969d744ddfcf7
2025-08-30T02:11:12+08:00
1,607
https://github.com/flashinfer-ai/flashinfer/pull/1607
[cute dsl] optimize cute dsl make_ptr perf (#1607)
[cute dsl] optimize cute dsl make_ptr perf (#1607)
flashinfer/cute_dsl/blockscaled_gemm.py
cute_dsl
BSD-3-Clause
# Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: BSD-3-Clause # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # 1. Redistributions of source code must retain the abov...
# Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: BSD-3-Clause # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # 1. Redistributions of source code must retain the abov...
--- flashinfer/cute_dsl/blockscaled_gemm.py +++ flashinfer/cute_dsl/blockscaled_gemm.py @@ -40,7 +40,8 @@ import functools from cutlass._mlir import ir from cutlass.cute.nvgpu import cpasync, tcgen05 -from cutlass.cute.runtime import from_dlpack, make_ptr +from cutlass.cute.runtime import from_dlpack + from cutlass...
3
2
2
[]
[]
[]
Optimize this cute_dsl kernel file from flashinfer (flashinfer/cute_dsl/blockscaled_gemm.py). Goal: [cute dsl] optimize cute dsl make_ptr perf Target hardware: unspecified Target models: unspecified Current file: ```python # Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Ident...
<!-- .github/pull_request_template.md --> ## 📌 Description Optimize make_ptr performance for cute_dsl as a workaround. Will remove the WAR after CuTeDSL release the optimization. Performance: 20us+ => 1.4us ## 🔍 Related Issues <!-- Link any related issues here --> ## 🚀 Pull Request Checklist Thank you for con...
[{"scope": "kernel", "hardware": null, "model": null, "shape": null, "batch_size": null, "metric": "latency", "unit": "us", "higher_is_better": false, "baseline": 20, "optimized": 1.4, "stated_speedup": null, "speedup": 14.2857}]
14.2857
null
flashinfer
eab0de466deea57771f152e5ee6969d744ddfcf7
2025-08-30T02:11:12+08:00
1,607
https://github.com/flashinfer-ai/flashinfer/pull/1607
[cute dsl] optimize cute dsl make_ptr perf (#1607)
[cute dsl] optimize cute dsl make_ptr perf (#1607)
flashinfer/cute_dsl/utils.py
cute_dsl
Apache-2.0
""" 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, s...
""" 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, s...
--- flashinfer/cute_dsl/utils.py +++ flashinfer/cute_dsl/utils.py @@ -14,10 +14,16 @@ limitations under the License. """ +import ctypes +import functools +import importlib.util +from typing import Union + import cutlass +import cutlass._mlir.dialects.cute as _cute_ir import torch -import importlib.util -import fu...
156
2
2
[]
[]
[]
Optimize this cute_dsl kernel file from flashinfer (flashinfer/cute_dsl/utils.py). Goal: [cute dsl] optimize cute dsl make_ptr perf Target hardware: unspecified Target models: unspecified Current file: ```python """ Copyright (c) 2025 by FlashInfer team. Licensed under the Apache License, Version 2.0 (the "License")...
<!-- .github/pull_request_template.md --> ## 📌 Description Optimize make_ptr performance for cute_dsl as a workaround. Will remove the WAR after CuTeDSL release the optimization. Performance: 20us+ => 1.4us ## 🔍 Related Issues <!-- Link any related issues here --> ## 🚀 Pull Request Checklist Thank you for con...
[{"scope": "kernel", "hardware": null, "model": null, "shape": null, "batch_size": null, "metric": "latency", "unit": "us", "higher_is_better": false, "baseline": 20, "optimized": 1.4, "stated_speedup": null, "speedup": 14.2857}]
14.2857
null
flashinfer
8ce1b089088e89f89fae7778d689ebc313477717
2025-08-27T00:48:06-07:00
1,573
https://github.com/flashinfer-ai/flashinfer/pull/1573
update trtllm-gen fp4 autotuner and routing (#1573)
update trtllm-gen fp4 autotuner and routing (#1573) <!-- .github/pull_request_template.md --> ## 📌 Description - remove `.to(torch.bfloat16)` which causes illegal memory access when using deepseek v3 routing. - handle the case when `routing_logits` is `None` to support `trtllm_fp4_block_scale_routed_moe` - fix the ...
csrc/trtllm_fused_moe_routing_llama4.cu
cuda
Apache-2.0
/* * Copyright (c) 2022-2025, NVIDIA CORPORATION. All rights reserved. * * 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 ...
/* * Copyright (c) 2022-2025, NVIDIA CORPORATION. All rights reserved. * * 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 ...
--- csrc/trtllm_fused_moe_routing_llama4.cu +++ csrc/trtllm_fused_moe_routing_llama4.cu @@ -449,7 +449,7 @@ } else { // Reset the global histograms. CHECK_CUDA_ERROR(cudaMemsetAsync(data.mPtrExpertCounts, 0, - static_cast<size_t>(2 * NumThreads) * sizeof(int32_t)...
1
1
3
[ "deepseek", "llama" ]
[]
[]
Optimize this cuda kernel file from flashinfer (csrc/trtllm_fused_moe_routing_llama4.cu). Goal: update trtllm-gen fp4 autotuner and routing Target hardware: unspecified Target models: deepseek, llama Current file: ```cuda /* * Copyright (c) 2022-2025, NVIDIA CORPORATION. All rights reserved. * * Licensed under th...
<!-- .github/pull_request_template.md --> ## 📌 Description - remove `.to(torch.bfloat16)` which causes illegal memory access when using deepseek v3 routing. - handle the case when `routing_logits` is `None` to support `trtllm_fp4_block_scale_routed_moe` - fix the `invalid argument` error in llama and renormalize rou...
[]
null
null
flashinfer
8ce1b089088e89f89fae7778d689ebc313477717
2025-08-27T00:48:06-07:00
1,573
https://github.com/flashinfer-ai/flashinfer/pull/1573
update trtllm-gen fp4 autotuner and routing (#1573)
update trtllm-gen fp4 autotuner and routing (#1573) <!-- .github/pull_request_template.md --> ## 📌 Description - remove `.to(torch.bfloat16)` which causes illegal memory access when using deepseek v3 routing. - handle the case when `routing_logits` is `None` to support `trtllm_fp4_block_scale_routed_moe` - fix the ...
csrc/trtllm_fused_moe_routing_renormalize.cu
cuda
Apache-2.0
/* * Copyright (c) 2022-2025, NVIDIA CORPORATION. All rights reserved. * * 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 ...
/* * Copyright (c) 2022-2025, NVIDIA CORPORATION. All rights reserved. * * 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 ...
--- csrc/trtllm_fused_moe_routing_renormalize.cu +++ csrc/trtllm_fused_moe_routing_renormalize.cu @@ -278,7 +278,7 @@ } else { // Reset the global histograms. CHECK_CUDA_ERROR(cudaMemsetAsync(data.mPtrExpertCounts, 0, - static_cast<size_t>(2 * NumThreads) * sizeo...
1
1
3
[ "deepseek", "llama" ]
[]
[]
Optimize this cuda kernel file from flashinfer (csrc/trtllm_fused_moe_routing_renormalize.cu). Goal: update trtllm-gen fp4 autotuner and routing Target hardware: unspecified Target models: deepseek, llama Current file: ```cuda /* * Copyright (c) 2022-2025, NVIDIA CORPORATION. All rights reserved. * * Licensed und...
<!-- .github/pull_request_template.md --> ## 📌 Description - remove `.to(torch.bfloat16)` which causes illegal memory access when using deepseek v3 routing. - handle the case when `routing_logits` is `None` to support `trtllm_fp4_block_scale_routed_moe` - fix the `invalid argument` error in llama and renormalize rou...
[]
null
null
flashinfer
e2448aa6e3d268c0b4451d17d8cb5c1804ca1fb7
2025-08-22T11:46:52-07:00
1,547
https://github.com/flashinfer-ai/flashinfer/pull/1547
perf: replace cudaGetDeviceProperties with cudaDeviceGetAttribute (#1547)
perf: replace cudaGetDeviceProperties with cudaDeviceGetAttribute (#1547) <!-- .github/pull_request_template.md --> ## 📌 Description This change replaces the use of cudaGetDeviceProperties with cudaDeviceGetAttribute when querying the number of GPU Streaming Multiprocessors. Rather than retrieving the entire device...
csrc/cudnn_sdpa_kernel_launcher.cu
cuda
Apache-2.0
/* * 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 * distribut...
/* * 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 * distribut...
--- csrc/cudnn_sdpa_kernel_launcher.cu +++ csrc/cudnn_sdpa_kernel_launcher.cu @@ -973,10 +973,10 @@ CU_FUNC_ATTRIBUTE_NON_PORTABLE_CLUSTER_SIZE_ALLOWED, 1)); } - // Get number of SMs perf GPU - cudaDeviceProp prop; - cudaGetDeviceProperties(&prop, 0); - sm_count =...
4
4
3
[]
[]
[]
Optimize this cuda kernel file from flashinfer (csrc/cudnn_sdpa_kernel_launcher.cu). Goal: perf: replace cudaGetDeviceProperties with cudaDeviceGetAttribute Target hardware: unspecified Target models: unspecified Current file: ```cuda /* * Licensed under the Apache License, Version 2.0 (the "License"); * you may no...
<!-- .github/pull_request_template.md --> ## 📌 Description This change replaces the use of cudaGetDeviceProperties with cudaDeviceGetAttribute when querying the number of GPU Streaming Multiprocessors. Rather than retrieving the entire device properties, the updated approach directly fetches only the needed attribut...
[]
null
null
flashinfer
e2448aa6e3d268c0b4451d17d8cb5c1804ca1fb7
2025-08-22T11:46:52-07:00
1,547
https://github.com/flashinfer-ai/flashinfer/pull/1547
perf: replace cudaGetDeviceProperties with cudaDeviceGetAttribute (#1547)
perf: replace cudaGetDeviceProperties with cudaDeviceGetAttribute (#1547) <!-- .github/pull_request_template.md --> ## 📌 Description This change replaces the use of cudaGetDeviceProperties with cudaDeviceGetAttribute when querying the number of GPU Streaming Multiprocessors. Rather than retrieving the entire device...
include/flashinfer/comm/trtllm_allreduce_fusion.cuh
cuda
Apache-2.0
#include <cooperative_groups.h> #include <cuda.h> #include <cuda_bf16.h> #include <cuda_fp16.h> #if CUDA_VERSION >= 120800 #include <cuda_fp4.h> #endif #include <cuda/std/optional> #include <tuple> #include <type_traits> #include "../exception.h" #include "../fp4_layout.cuh" #include "../logging.h" #include "../util...
#include <cooperative_groups.h> #include <cuda.h> #include <cuda_bf16.h> #include <cuda_fp16.h> #if CUDA_VERSION >= 120800 #include <cuda_fp4.h> #endif #include <cuda/std/optional> #include <tuple> #include <type_traits> #include "../exception.h" #include "../fp4_layout.cuh" #include "../logging.h" #include "../util...
--- include/flashinfer/comm/trtllm_allreduce_fusion.cuh +++ include/flashinfer/comm/trtllm_allreduce_fusion.cuh @@ -1292,9 +1292,8 @@ if (sm_count == 0) { int device_id; FLASHINFER_CUDA_CALL(cudaGetDevice(&device_id)); - cudaDeviceProp device_prop; - cudaGetDeviceProperties(&device_prop, device_id); ...
2
3
3
[]
[]
[]
Optimize this cuda kernel file from flashinfer (include/flashinfer/comm/trtllm_allreduce_fusion.cuh). Goal: perf: replace cudaGetDeviceProperties with cudaDeviceGetAttribute Target hardware: unspecified Target models: unspecified Current file: ```cuda #include <cooperative_groups.h> #include <cuda.h> #include <cuda_b...
<!-- .github/pull_request_template.md --> ## 📌 Description This change replaces the use of cudaGetDeviceProperties with cudaDeviceGetAttribute when querying the number of GPU Streaming Multiprocessors. Rather than retrieving the entire device properties, the updated approach directly fetches only the needed attribut...
[]
null
null
flashinfer
e2448aa6e3d268c0b4451d17d8cb5c1804ca1fb7
2025-08-22T11:46:52-07:00
1,547
https://github.com/flashinfer-ai/flashinfer/pull/1547
perf: replace cudaGetDeviceProperties with cudaDeviceGetAttribute (#1547)
perf: replace cudaGetDeviceProperties with cudaDeviceGetAttribute (#1547) <!-- .github/pull_request_template.md --> ## 📌 Description This change replaces the use of cudaGetDeviceProperties with cudaDeviceGetAttribute when querying the number of GPU Streaming Multiprocessors. Rather than retrieving the entire device...
include/flashinfer/comm/trtllm_moe_allreduce_fusion.cuh
cuda
Apache-2.0
#include <cooperative_groups.h> #include <cuda.h> #include <cuda_bf16.h> #include <cuda_fp16.h> #if CUDA_VERSION >= 120800 #include <cuda_fp4.h> #endif #include <cuda/std/optional> #include <tuple> #include <type_traits> #include "../exception.h" #include "../fp4_layout.cuh" #include "../logging.h" #include "../util...
#include <cooperative_groups.h> #include <cuda.h> #include <cuda_bf16.h> #include <cuda_fp16.h> #if CUDA_VERSION >= 120800 #include <cuda_fp4.h> #endif #include <cuda/std/optional> #include <tuple> #include <type_traits> #include "../exception.h" #include "../fp4_layout.cuh" #include "../logging.h" #include "../util...
--- include/flashinfer/comm/trtllm_moe_allreduce_fusion.cuh +++ include/flashinfer/comm/trtllm_moe_allreduce_fusion.cuh @@ -919,9 +919,7 @@ auto status = cudaGetDevice(&device_id); FLASHINFER_CHECK(status == cudaSuccess, "cudaGetDevice failed with error code " + ...
1
3
3
[]
[]
[]
Optimize this cuda kernel file from flashinfer (include/flashinfer/comm/trtllm_moe_allreduce_fusion.cuh). Goal: perf: replace cudaGetDeviceProperties with cudaDeviceGetAttribute Target hardware: unspecified Target models: unspecified Current file: ```cuda #include <cooperative_groups.h> #include <cuda.h> #include <cu...
<!-- .github/pull_request_template.md --> ## 📌 Description This change replaces the use of cudaGetDeviceProperties with cudaDeviceGetAttribute when querying the number of GPU Streaming Multiprocessors. Rather than retrieving the entire device properties, the updated approach directly fetches only the needed attribut...
[]
null
null
flashinfer
6518ce42a8a3d4d32c2262b638c63049c02a3d62
2025-08-16T22:30:37-07:00
1,491
https://github.com/flashinfer-ai/flashinfer/pull/1491
perf: support scale_a/scale_b instead of combined scale in cutlass bmm_fp8 (#1491)
perf: support scale_a/scale_b instead of combined scale in cutlass bmm_fp8 (#1491) Previous cutlass implementation require combine of scale_a/scale_b in the python, so extra aten kernel is used which may cost 1us. Now we support separate alpha_a and alpha_b in epilog, to avoid this extra aten kernel. <!-- .github/pul...
csrc/fp8_gemm_cutlass.cu
cuda
Apache-2.0
/* * Copyright (c) 2020-2023, NVIDIA CORPORATION. All rights reserved. * * 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 ...
/* * Copyright (c) 2020-2023, NVIDIA CORPORATION. All rights reserved. * * 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 ...
--- csrc/fp8_gemm_cutlass.cu +++ csrc/fp8_gemm_cutlass.cu @@ -59,8 +59,8 @@ template <typename T> void runGemm(at::Tensor& out, at::Tensor const& mat1, at::Tensor const& mat2, - at::Tensor const& scale, int64_t m, int64_t n, int64_t k, int64_t b, - CutlassGemmConfig const& gemmConfig, at::Te...
17
11
5
[]
[]
[]
Optimize this cuda kernel file from flashinfer (csrc/fp8_gemm_cutlass.cu). Goal: perf: support scale_a/scale_b instead of combined scale in cutlass bmm_fp8 Target hardware: unspecified Target models: unspecified Current file: ```cuda /* * Copyright (c) 2020-2023, NVIDIA CORPORATION. All rights reserved. * * Licen...
Previous cutlass implementation require combine of scale_a/scale_b in the python, so extra aten kernel is used which may cost 1us. Now we support separate alpha_a and alpha_b in epilog, to avoid this extra aten kernel. <!-- .github/pull_request_template.md --> ## 📌 Description <!-- What does this PR do? Briefly des...
[]
null
null
flashinfer
6518ce42a8a3d4d32c2262b638c63049c02a3d62
2025-08-16T22:30:37-07:00
1,491
https://github.com/flashinfer-ai/flashinfer/pull/1491
perf: support scale_a/scale_b instead of combined scale in cutlass bmm_fp8 (#1491)
perf: support scale_a/scale_b instead of combined scale in cutlass bmm_fp8 (#1491) Previous cutlass implementation require combine of scale_a/scale_b in the python, so extra aten kernel is used which may cost 1us. Now we support separate alpha_a and alpha_b in epilog, to avoid this extra aten kernel. <!-- .github/pul...
include/flashinfer/gemm/fp8_gemm_cutlass.h
cpp
Apache-2.0
/* * Copyright (c) 2020-2023, NVIDIA CORPORATION. All rights reserved. * * 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 ...
/* * Copyright (c) 2020-2023, NVIDIA CORPORATION. All rights reserved. * * 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 ...
--- include/flashinfer/gemm/fp8_gemm_cutlass.h +++ include/flashinfer/gemm/fp8_gemm_cutlass.h @@ -31,9 +31,10 @@ CutlassFp8GemmRunnerInterface() = default; virtual ~CutlassFp8GemmRunnerInterface() = default; - virtual void gemm(__nv_fp8_e4m3 const* A, __nv_fp8_e4m3 const* B, float const* alpha, void* D, - ...
7
6
5
[]
[]
[]
Optimize this cpp kernel file from flashinfer (include/flashinfer/gemm/fp8_gemm_cutlass.h). Goal: perf: support scale_a/scale_b instead of combined scale in cutlass bmm_fp8 Target hardware: unspecified Target models: unspecified Current file: ```cpp /* * Copyright (c) 2020-2023, NVIDIA CORPORATION. All rights reser...
Previous cutlass implementation require combine of scale_a/scale_b in the python, so extra aten kernel is used which may cost 1us. Now we support separate alpha_a and alpha_b in epilog, to avoid this extra aten kernel. <!-- .github/pull_request_template.md --> ## 📌 Description <!-- What does this PR do? Briefly des...
[]
null
null
flashinfer
6518ce42a8a3d4d32c2262b638c63049c02a3d62
2025-08-16T22:30:37-07:00
1,491
https://github.com/flashinfer-ai/flashinfer/pull/1491
perf: support scale_a/scale_b instead of combined scale in cutlass bmm_fp8 (#1491)
perf: support scale_a/scale_b instead of combined scale in cutlass bmm_fp8 (#1491) Previous cutlass implementation require combine of scale_a/scale_b in the python, so extra aten kernel is used which may cost 1us. Now we support separate alpha_a and alpha_b in epilog, to avoid this extra aten kernel. <!-- .github/pul...
include/flashinfer/gemm/fp8_gemm_cutlass_template.h
cpp
Apache-2.0
/* * Copyright (c) 2020-2023, NVIDIA CORPORATION. All rights reserved. * * 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 ...
/* * Copyright (c) 2020-2023, NVIDIA CORPORATION. All rights reserved. * * 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 ...
--- include/flashinfer/gemm/fp8_gemm_cutlass_template.h +++ include/flashinfer/gemm/fp8_gemm_cutlass_template.h @@ -50,43 +50,44 @@ template <typename T, typename arch, int32_t CTA_M_, int32_t CTA_N_, int32_t CTA_K_, typename ClusterShape_, typename XSM_> size_t genericFp8GemmKernelLauncherSm100(__nv_fp8_e...
41
38
5
[]
[]
[]
Optimize this cpp kernel file from flashinfer (include/flashinfer/gemm/fp8_gemm_cutlass_template.h). Goal: perf: support scale_a/scale_b instead of combined scale in cutlass bmm_fp8 Target hardware: unspecified Target models: unspecified Current file: ```cpp /* * Copyright (c) 2020-2023, NVIDIA CORPORATION. All rig...
Previous cutlass implementation require combine of scale_a/scale_b in the python, so extra aten kernel is used which may cost 1us. Now we support separate alpha_a and alpha_b in epilog, to avoid this extra aten kernel. <!-- .github/pull_request_template.md --> ## 📌 Description <!-- What does this PR do? Briefly des...
[]
null
null
flashinfer
6518ce42a8a3d4d32c2262b638c63049c02a3d62
2025-08-16T22:30:37-07:00
1,491
https://github.com/flashinfer-ai/flashinfer/pull/1491
perf: support scale_a/scale_b instead of combined scale in cutlass bmm_fp8 (#1491)
perf: support scale_a/scale_b instead of combined scale in cutlass bmm_fp8 (#1491) Previous cutlass implementation require combine of scale_a/scale_b in the python, so extra aten kernel is used which may cost 1us. Now we support separate alpha_a and alpha_b in epilog, to avoid this extra aten kernel. <!-- .github/pul...
include/flashinfer/gemm/fp8_gemm_template_sm100.h
cpp
Apache-2.0
/* * Copyright (c) 2020-2023, NVIDIA CORPORATION. All rights reserved. * * 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 ...
/* * Copyright (c) 2020-2023, NVIDIA CORPORATION. All rights reserved. * * 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 ...
--- include/flashinfer/gemm/fp8_gemm_template_sm100.h +++ include/flashinfer/gemm/fp8_gemm_template_sm100.h @@ -23,9 +23,12 @@ #include "cutlass/arch/arch.h" #include "cutlass/cutlass.h" #include "cutlass/epilogue/collective/collective_builder.hpp" +#include "cutlass/epilogue/fusion/sm90_visitor_load_tma_warpspecial...
32
11
5
[]
[]
[]
Optimize this cpp kernel file from flashinfer (include/flashinfer/gemm/fp8_gemm_template_sm100.h). Goal: perf: support scale_a/scale_b instead of combined scale in cutlass bmm_fp8 Target hardware: unspecified Target models: unspecified Current file: ```cpp /* * Copyright (c) 2020-2023, NVIDIA CORPORATION. All right...
Previous cutlass implementation require combine of scale_a/scale_b in the python, so extra aten kernel is used which may cost 1us. Now we support separate alpha_a and alpha_b in epilog, to avoid this extra aten kernel. <!-- .github/pull_request_template.md --> ## 📌 Description <!-- What does this PR do? Briefly des...
[]
null
null
flashinfer
cba02c4e9858eba08d26f97436e8fb42870492ef
2025-08-14T16:11:59+08:00
1,483
https://github.com/flashinfer-ai/flashinfer/pull/1483
perf: add fast path to TopPRenormProbKernel for top_p >= 1.0, significantly boosting SGLang workloads (#1483)
perf: add fast path to TopPRenormProbKernel for top_p >= 1.0, significantly boosting SGLang workloads (#1483) <!-- .github/pull_request_template.md --> ## 📌 Description ### Summary When deploying **DeepSeek-R1** with **DP+EP+MTP** in SGLang and sending requests with `temperature > 0.0`, we observed a **\~15% perfor...
include/flashinfer/sampling.cuh
cuda
Apache-2.0
/* * Copyright (c) 2024 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 ...
/* * Copyright (c) 2024 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 ...
--- include/flashinfer/sampling.cuh +++ include/flashinfer/sampling.cuh @@ -1539,6 +1539,7 @@ struct { float max_val; float min_val; + float row_sum; union { struct { float values[2]; @@ -1565,9 +1566,61 @@ uint8_t smem_renorm[]; auto& temp_storage = reinterpret_cas...
55
2
1
[ "deepseek" ]
[]
[ "200×" ]
Optimize this cuda kernel file from flashinfer (include/flashinfer/sampling.cuh). Goal: perf: add fast path to TopPRenormProbKernel for top_p >= 1.0, significantly boosting SGLang workloads Target hardware: unspecified Target models: deepseek Current file: ```cuda /* * Copyright (c) 2024 by FlashInfer team. * * Li...
<!-- .github/pull_request_template.md --> ## 📌 Description ### Summary When deploying **DeepSeek-R1** with **DP+EP+MTP** in SGLang and sending requests with `temperature > 0.0`, we observed a **\~15% performance degradation**. Profiling revealed that `TopPRenormProbKernel` took about **13 ms**, whereas disabling MTP...
[{"scope": "kernel", "hardware": null, "model": null, "shape": null, "batch_size": null, "metric": "latency", "unit": null, "higher_is_better": false, "baseline": null, "optimized": null, "stated_speedup": 200, "speedup": 200.0}, {"scope": "kernel", "hardware": null, "model": "DeepSeek-R1", "shape": null, "batch_size":...
100.575
null
flashinfer
7e98d8b94ae626aaebf2f5e25d115bc30c2229f2
2025-08-12T12:46:20-07:00
1,473
https://github.com/flashinfer-ai/flashinfer/pull/1473
perf: add 1x4x1 cluster shape for fp8 bmm M<16 cases (#1473)
perf: add 1x4x1 cluster shape for fp8 bmm M<16 cases (#1473)
include/flashinfer/gemm/fp8_gemm_cutlass_template.h
cpp
Apache-2.0
/* * Copyright (c) 2020-2023, NVIDIA CORPORATION. All rights reserved. * * 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 ...
/* * Copyright (c) 2020-2023, NVIDIA CORPORATION. All rights reserved. * * 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 ...
--- include/flashinfer/gemm/fp8_gemm_cutlass_template.h +++ include/flashinfer/gemm/fp8_gemm_cutlass_template.h @@ -83,6 +83,11 @@ _2SM>(A, B, alpha, D, m, n, k, b, gemmConfig, workspacePtr, workspaceBytes, stream); ...
7
3
1
[]
[]
[]
Optimize this cpp kernel file from flashinfer (include/flashinfer/gemm/fp8_gemm_cutlass_template.h). Goal: perf: add 1x4x1 cluster shape for fp8 bmm M<16 cases Target hardware: unspecified Target models: unspecified Current file: ```cpp /* * Copyright (c) 2020-2023, NVIDIA CORPORATION. All rights reserved. * * Li...
there is perf gain in M<16 cases when we use the 1x4x1 cluster shape. <!-- .github/pull_request_template.md --> ## 📌 Description <!-- What does this PR do? Briefly describe the changes and why they’re needed. --> ## 🔍 Related Issues <!-- Link any related issues here --> ## 🚀 Pull Request Checklist Thank you f...
[]
null
null
flashinfer
43e08e9b0fa58b4d51998ce20ca439771c8ac200
2025-07-25T04:21:27-07:00
1,321
https://github.com/flashinfer-ai/flashinfer/pull/1321
comm: Optimizations for TRTLLM MNNVL Allreduce (#1321)
comm: Optimizations for TRTLLM MNNVL Allreduce (#1321) <!-- .github/pull_request_template.md --> ## 📌 Description This PR introduces a series of optimizations to the trtllm_mnnvl_allreduce. These optimizations are also added by [https://github.com/NVIDIA/TensorRT-LLM/pull/5934](https://github.com/NVIDIA/TensorRT-LL...
csrc/trtllm_mnnvl_allreduce.cu
cuda
Apache-2.0
#include "flashinfer/comm/trtllm_mnnvl_allreduce.cuh" #include "pytorch_extension_utils.h" using namespace flashinfer::trtllm_mnnvl_allreduce; #define DISPATCH_FLOATING_TYPES_FOR_MNNVL_ALLREDUCE(scalar_type, c_type, ...) \ [&] { ...
#include "flashinfer/comm/trtllm_mnnvl_allreduce.cuh" #include "pytorch_extension_utils.h" using namespace flashinfer::trtllm_mnnvl_allreduce; #define DISPATCH_FLOATING_TYPES_FOR_MNNVL_ALLREDUCE(scalar_type, c_type, ...) \ [&] { ...
--- csrc/trtllm_mnnvl_allreduce.cu +++ csrc/trtllm_mnnvl_allreduce.cu @@ -37,6 +37,8 @@ int64_t token_dim = in.size(1); // Validate input parameters + TORCH_CHECK(token_dim % (sizeof(float2) / sizeof(c_type)) == 0, + "token_dim must be divisible by ", sizeof(float2) / sizeof(c_type)); ...
2
0
4
[]
[]
[]
Optimize this cuda kernel file from flashinfer (csrc/trtllm_mnnvl_allreduce.cu). Goal: comm: Optimizations for TRTLLM MNNVL Allreduce Target hardware: unspecified Target models: unspecified Current file: ```cuda #include "flashinfer/comm/trtllm_mnnvl_allreduce.cuh" #include "pytorch_extension_utils.h" using namespac...
<!-- .github/pull_request_template.md --> ## 📌 Description This PR introduces a series of optimizations to the trtllm_mnnvl_allreduce. These optimizations are also added by [https://github.com/NVIDIA/TensorRT-LLM/pull/5934](https://github.com/NVIDIA/TensorRT-LLM/pull/5934) and [https://github.com/NVIDIA/TensorRT-LLM...
[]
null
null
flashinfer
43e08e9b0fa58b4d51998ce20ca439771c8ac200
2025-07-25T04:21:27-07:00
1,321
https://github.com/flashinfer-ai/flashinfer/pull/1321
comm: Optimizations for TRTLLM MNNVL Allreduce (#1321)
comm: Optimizations for TRTLLM MNNVL Allreduce (#1321) <!-- .github/pull_request_template.md --> ## 📌 Description This PR introduces a series of optimizations to the trtllm_mnnvl_allreduce. These optimizations are also added by [https://github.com/NVIDIA/TensorRT-LLM/pull/5934](https://github.com/NVIDIA/TensorRT-LL...
include/flashinfer/comm/trtllm_mnnvl_allreduce.cuh
cuda
Apache-2.0
/* * Copyright (c) 2022-2024, NVIDIA CORPORATION. All rights reserved. * * 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 ...
/* * Copyright (c) 2022-2024, NVIDIA CORPORATION. All rights reserved. * * 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 ...
--- include/flashinfer/comm/trtllm_mnnvl_allreduce.cuh +++ include/flashinfer/comm/trtllm_mnnvl_allreduce.cuh @@ -63,6 +63,8 @@ __device__ bool isNegZero(__nv_bfloat16 val) { return isNegZero(__bfloat162float(val)); } +__device__ bool isNegZero(__nv_half val) { return isNegZero(__half2float(val)); } + template <t...
149
82
4
[]
[]
[]
Optimize this cuda kernel file from flashinfer (include/flashinfer/comm/trtllm_mnnvl_allreduce.cuh). Goal: comm: Optimizations for TRTLLM MNNVL Allreduce Target hardware: unspecified Target models: unspecified Current file: ```cuda /* * Copyright (c) 2022-2024, NVIDIA CORPORATION. All rights reserved. * * License...
<!-- .github/pull_request_template.md --> ## 📌 Description This PR introduces a series of optimizations to the trtllm_mnnvl_allreduce. These optimizations are also added by [https://github.com/NVIDIA/TensorRT-LLM/pull/5934](https://github.com/NVIDIA/TensorRT-LLM/pull/5934) and [https://github.com/NVIDIA/TensorRT-LLM...
[]
null
null
flashinfer
3f99f1867051924d6a7347df1fc1d2e50f7fd0e2
2025-07-21T23:20:55-07:00
1,298
https://github.com/flashinfer-ai/flashinfer/pull/1298
perfix: use lightweight API to query device property (#1298)
perfix: use lightweight API to query device property (#1298) <!-- .github/pull_request_template.md --> ## 📌 Description <!-- What does this PR do? Briefly describe the changes and why they’re needed. --> ## 🔍 Related Issues <!-- Link any related issues here --> ## 🚀 Pull Request Checklist Thank you for contri...
csrc/trtllm_fused_moe_kernel_launcher.cu
cuda
Apache-2.0
/* * 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 * distribut...
/* * 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 * distribut...
--- csrc/trtllm_fused_moe_kernel_launcher.cu +++ csrc/trtllm_fused_moe_kernel_launcher.cu @@ -56,11 +56,17 @@ bool const use_routing_scales_on_input, int64_t const tile_tokens_dim, int64_t const routing_method_type) { auto device = hidden_states.device(); - cudaDeviceProp prop; - cudaGetDeviceProperties(...
33
15
1
[]
[]
[]
Optimize this cuda kernel file from flashinfer (csrc/trtllm_fused_moe_kernel_launcher.cu). Goal: perfix: use lightweight API to query device property Target hardware: unspecified Target models: unspecified Current file: ```cuda /* * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use t...
<!-- .github/pull_request_template.md --> ## 📌 Description <!-- What does this PR do? Briefly describe the changes and why they’re needed. --> ## 🔍 Related Issues <!-- Link any related issues here --> ## 🚀 Pull Request Checklist Thank you for contributing to FlashInfer! Before we review your pull request, plea...
[]
null
null
flashinfer
40db3fadfd5f361882dcd4cc797bd8867b7893a2
2025-06-30T15:10:25-07:00
1,200
https://github.com/flashinfer-ai/flashinfer/pull/1200
[feat] optimize persistent batch attention perf. (#1200)
[feat] optimize persistent batch attention perf. (#1200) <!-- .github/pull_request_template.md --> ## 📌 Description <!-- What does this PR do? Briefly describe the changes and why they’re needed. --> This is a follow-up PR on https://github.com/flashinfer-ai/flashinfer/pull/1137, optimizing scheduling balance & red...
csrc/batch_attention.cu
cuda
Apache-2.0
/* * 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 ...
/* * 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 ...
--- csrc/batch_attention.cu +++ csrc/batch_attention.cu @@ -68,7 +68,8 @@ at::Tensor v_cache, at::Tensor kv_indices, at::Tensor o, std::optional<at::Tensor> maybe_lse, int64_t mask_mode_code, int64_t layout_code, int64_t num_qo_heads...
3
1
9
[]
[ "H200" ]
[ "2x" ]
Optimize this cuda kernel file from flashinfer (csrc/batch_attention.cu). Goal: [feat] optimize persistent batch attention perf. Target hardware: H200 Target models: unspecified Current file: ```cuda /* * Copyright (c) 2025 by FlashInfer team. * * Licensed under the Apache License, Version 2.0 (the "License"); * ...
<!-- .github/pull_request_template.md --> ## 📌 Description <!-- What does this PR do? Briefly describe the changes and why they’re needed. --> This is a follow-up PR on https://github.com/flashinfer-ai/flashinfer/pull/1137, optimizing scheduling balance & reduction overhead, and achieving 2x speedup. Optimization in...
[{"scope": "kernel", "hardware": "H200", "model": null, "shape": "head_dim=128, num_qo_heads=28, num_kv_heads=4, page_size=1", "batch_size": null, "metric": "performance", "unit": null, "higher_is_better": true, "baseline": null, "optimized": null, "stated_speedup": 2.0, "speedup": 2.0}]
2
null
flashinfer
40db3fadfd5f361882dcd4cc797bd8867b7893a2
2025-06-30T15:10:25-07:00
1,200
https://github.com/flashinfer-ai/flashinfer/pull/1200
[feat] optimize persistent batch attention perf. (#1200)
[feat] optimize persistent batch attention perf. (#1200) <!-- .github/pull_request_template.md --> ## 📌 Description <!-- What does this PR do? Briefly describe the changes and why they’re needed. --> This is a follow-up PR on https://github.com/flashinfer-ai/flashinfer/pull/1137, optimizing scheduling balance & red...
csrc/batch_attention_jit_pybind.cu
cuda
Apache-2.0
/* * 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 ...
/* * 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 ...
--- csrc/batch_attention_jit_pybind.cu +++ csrc/batch_attention_jit_pybind.cu @@ -28,7 +28,8 @@ at::Tensor v_cache, at::Tensor kv_indices, at::Tensor o, std::optional<at::Tensor> maybe_lse, int64_t mask_mode_code, int64_t layout_code...
2
1
9
[]
[ "H200" ]
[ "2x" ]
Optimize this cuda kernel file from flashinfer (csrc/batch_attention_jit_pybind.cu). Goal: [feat] optimize persistent batch attention perf. Target hardware: H200 Target models: unspecified Current file: ```cuda /* * Copyright (c) 2025 by FlashInfer team. * * Licensed under the Apache License, Version 2.0 (the "Lic...
<!-- .github/pull_request_template.md --> ## 📌 Description <!-- What does this PR do? Briefly describe the changes and why they’re needed. --> This is a follow-up PR on https://github.com/flashinfer-ai/flashinfer/pull/1137, optimizing scheduling balance & reduction overhead, and achieving 2x speedup. Optimization in...
[{"scope": "kernel", "hardware": "H200", "model": null, "shape": "head_dim=128, num_qo_heads=28, num_kv_heads=4, page_size=1", "batch_size": null, "metric": "performance", "unit": null, "higher_is_better": true, "baseline": null, "optimized": null, "stated_speedup": 2.0, "speedup": 2.0}]
2
null
flashinfer
40db3fadfd5f361882dcd4cc797bd8867b7893a2
2025-06-30T15:10:25-07:00
1,200
https://github.com/flashinfer-ai/flashinfer/pull/1200
[feat] optimize persistent batch attention perf. (#1200)
[feat] optimize persistent batch attention perf. (#1200) <!-- .github/pull_request_template.md --> ## 📌 Description <!-- What does this PR do? Briefly describe the changes and why they’re needed. --> This is a follow-up PR on https://github.com/flashinfer-ai/flashinfer/pull/1137, optimizing scheduling balance & red...
include/flashinfer/attention/cascade.cuh
cuda
Apache-2.0
/*! * Copyright (c) 2023 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...
/*! * Copyright (c) 2023 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...
--- include/flashinfer/attention/cascade.cuh +++ include/flashinfer/attention/cascade.cuh @@ -125,6 +125,25 @@ s_smem[ty] = st.get_lse(); st.init(); __syncthreads(); + +#pragma unroll + for (uint32_t iter = 0; iter < bdy; ++iter) { + float s = s_smem[iter]; + vec_t<float, vec_size> v; + v.cast_load(v...
19
0
9
[]
[ "H200" ]
[ "2x" ]
Optimize this cuda kernel file from flashinfer (include/flashinfer/attention/cascade.cuh). Goal: [feat] optimize persistent batch attention perf. Target hardware: H200 Target models: unspecified Current file: ```cuda /*! * Copyright (c) 2023 by FlashInfer team. * * Licensed under the Apache License, Version 2.0 (t...
<!-- .github/pull_request_template.md --> ## 📌 Description <!-- What does this PR do? Briefly describe the changes and why they’re needed. --> This is a follow-up PR on https://github.com/flashinfer-ai/flashinfer/pull/1137, optimizing scheduling balance & reduction overhead, and achieving 2x speedup. Optimization in...
[{"scope": "kernel", "hardware": "H200", "model": null, "shape": "head_dim=128, num_qo_heads=28, num_kv_heads=4, page_size=1", "batch_size": null, "metric": "performance", "unit": null, "higher_is_better": true, "baseline": null, "optimized": null, "stated_speedup": 2.0, "speedup": 2.0}]
2
null
flashinfer
40db3fadfd5f361882dcd4cc797bd8867b7893a2
2025-06-30T15:10:25-07:00
1,200
https://github.com/flashinfer-ai/flashinfer/pull/1200
[feat] optimize persistent batch attention perf. (#1200)
[feat] optimize persistent batch attention perf. (#1200) <!-- .github/pull_request_template.md --> ## 📌 Description <!-- What does this PR do? Briefly describe the changes and why they’re needed. --> This is a follow-up PR on https://github.com/flashinfer-ai/flashinfer/pull/1137, optimizing scheduling balance & red...
include/flashinfer/attention/persistent.cuh
cuda
Apache-2.0
/* * 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 ...
/* * 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 ...
--- include/flashinfer/attention/persistent.cuh +++ include/flashinfer/attention/persistent.cuh @@ -144,7 +144,8 @@ using Params = Params_; static __device__ __forceinline__ void Run(const Params& params, - typename KTraits::SharedStorage* smem_storage) { + ...
77
49
9
[]
[ "H200" ]
[ "2x" ]
Optimize this cuda kernel file from flashinfer (include/flashinfer/attention/persistent.cuh). Goal: [feat] optimize persistent batch attention perf. Target hardware: H200 Target models: unspecified Current file: ```cuda /* * Copyright (c) 2025 by FlashInfer team. * * Licensed under the Apache License, Version 2.0 ...
<!-- .github/pull_request_template.md --> ## 📌 Description <!-- What does this PR do? Briefly describe the changes and why they’re needed. --> This is a follow-up PR on https://github.com/flashinfer-ai/flashinfer/pull/1137, optimizing scheduling balance & reduction overhead, and achieving 2x speedup. Optimization in...
[{"scope": "kernel", "hardware": "H200", "model": null, "shape": "head_dim=128, num_qo_heads=28, num_kv_heads=4, page_size=1", "batch_size": null, "metric": "performance", "unit": null, "higher_is_better": true, "baseline": null, "optimized": null, "stated_speedup": 2.0, "speedup": 2.0}]
2
null
flashinfer
40db3fadfd5f361882dcd4cc797bd8867b7893a2
2025-06-30T15:10:25-07:00
1,200
https://github.com/flashinfer-ai/flashinfer/pull/1200
[feat] optimize persistent batch attention perf. (#1200)
[feat] optimize persistent batch attention perf. (#1200) <!-- .github/pull_request_template.md --> ## 📌 Description <!-- What does this PR do? Briefly describe the changes and why they’re needed. --> This is a follow-up PR on https://github.com/flashinfer-ai/flashinfer/pull/1137, optimizing scheduling balance & red...
include/flashinfer/attention/persistent_template.cuh
cuda
Apache-2.0
/* * 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 ...
/* * 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 ...
--- include/flashinfer/attention/persistent_template.cuh +++ include/flashinfer/attention/persistent_template.cuh @@ -30,8 +30,11 @@ enum class PersistentProfileEventType { kRunner1 = 0U, kRunner2 = 1U, - kRunner3 = 2U, - kRunner4 = 3U, + kReduction = 2U, +}; + +struct ProfilerClosure { + PROFILER_CLOSURE_PA...
22
11
9
[]
[ "H200" ]
[ "2x" ]
Optimize this cuda kernel file from flashinfer (include/flashinfer/attention/persistent_template.cuh). Goal: [feat] optimize persistent batch attention perf. Target hardware: H200 Target models: unspecified Current file: ```cuda /* * Copyright (c) 2025 by FlashInfer team. * * Licensed under the Apache License, Ver...
<!-- .github/pull_request_template.md --> ## 📌 Description <!-- What does this PR do? Briefly describe the changes and why they’re needed. --> This is a follow-up PR on https://github.com/flashinfer-ai/flashinfer/pull/1137, optimizing scheduling balance & reduction overhead, and achieving 2x speedup. Optimization in...
[{"scope": "kernel", "hardware": "H200", "model": null, "shape": "head_dim=128, num_qo_heads=28, num_kv_heads=4, page_size=1", "batch_size": null, "metric": "performance", "unit": null, "higher_is_better": true, "baseline": null, "optimized": null, "stated_speedup": 2.0, "speedup": 2.0}]
2
null
flashinfer
40db3fadfd5f361882dcd4cc797bd8867b7893a2
2025-06-30T15:10:25-07:00
1,200
https://github.com/flashinfer-ai/flashinfer/pull/1200
[feat] optimize persistent batch attention perf. (#1200)
[feat] optimize persistent batch attention perf. (#1200) <!-- .github/pull_request_template.md --> ## 📌 Description <!-- What does this PR do? Briefly describe the changes and why they’re needed. --> This is a follow-up PR on https://github.com/flashinfer-ai/flashinfer/pull/1137, optimizing scheduling balance & red...
include/flashinfer/attention/scheduler.cuh
cuda
Apache-2.0
/* * Copyright (c) 2023 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 ...
/* * Copyright (c) 2023 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 ...
--- include/flashinfer/attention/scheduler.cuh +++ include/flashinfer/attention/scheduler.cuh @@ -1120,7 +1120,6 @@ int packed_qo_len = qo_len * gqa_group_size; int kv_len = kv_len_arr_h[i]; - // TODO(Zihao): add more stages if (packed_qo_len > CTA_TILE_Q_SIZES[1]) { idx_qo_kv_len_vec[0].push...
28
15
9
[]
[ "H200" ]
[ "2x" ]
Optimize this cuda kernel file from flashinfer (include/flashinfer/attention/scheduler.cuh). Goal: [feat] optimize persistent batch attention perf. Target hardware: H200 Target models: unspecified Current file: ```cuda /* * Copyright (c) 2023 by FlashInfer team. * * Licensed under the Apache License, Version 2.0 (...
<!-- .github/pull_request_template.md --> ## 📌 Description <!-- What does this PR do? Briefly describe the changes and why they’re needed. --> This is a follow-up PR on https://github.com/flashinfer-ai/flashinfer/pull/1137, optimizing scheduling balance & reduction overhead, and achieving 2x speedup. Optimization in...
[{"scope": "kernel", "hardware": "H200", "model": null, "shape": "head_dim=128, num_qo_heads=28, num_kv_heads=4, page_size=1", "batch_size": null, "metric": "performance", "unit": null, "higher_is_better": true, "baseline": null, "optimized": null, "stated_speedup": 2.0, "speedup": 2.0}]
2
null
flashinfer
40db3fadfd5f361882dcd4cc797bd8867b7893a2
2025-06-30T15:10:25-07:00
1,200
https://github.com/flashinfer-ai/flashinfer/pull/1200
[feat] optimize persistent batch attention perf. (#1200)
[feat] optimize persistent batch attention perf. (#1200) <!-- .github/pull_request_template.md --> ## 📌 Description <!-- What does this PR do? Briefly describe the changes and why they’re needed. --> This is a follow-up PR on https://github.com/flashinfer-ai/flashinfer/pull/1137, optimizing scheduling balance & red...
include/flashinfer/profiler.cuh
cuda
Apache-2.0
/* * 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 ...
/* * 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 ...
--- include/flashinfer/profiler.cuh +++ include/flashinfer/profiler.cuh @@ -68,20 +68,23 @@ #ifdef FLASHINFER_ENABLE_PROFILER #define PROFILER_CLOSURE_PARAMS_DECL \ + ProfilerEntry entry; \ uint64_t* profiler_write_ptr; \ uint32_t profiler_write_stride; \ uint32_t profiler_entry_tag_...
18
13
9
[]
[ "H200" ]
[ "2x" ]
Optimize this cuda kernel file from flashinfer (include/flashinfer/profiler.cuh). Goal: [feat] optimize persistent batch attention perf. Target hardware: H200 Target models: unspecified Current file: ```cuda /* * Copyright (c) 2025 by FlashInfer team. * * Licensed under the Apache License, Version 2.0 (the "Licens...
<!-- .github/pull_request_template.md --> ## 📌 Description <!-- What does this PR do? Briefly describe the changes and why they’re needed. --> This is a follow-up PR on https://github.com/flashinfer-ai/flashinfer/pull/1137, optimizing scheduling balance & reduction overhead, and achieving 2x speedup. Optimization in...
[{"scope": "kernel", "hardware": "H200", "model": null, "shape": "head_dim=128, num_qo_heads=28, num_kv_heads=4, page_size=1", "batch_size": null, "metric": "performance", "unit": null, "higher_is_better": true, "baseline": null, "optimized": null, "stated_speedup": 2.0, "speedup": 2.0}]
2
null
flashinfer
4d92f008831aac4ef7adec1159d5b6d80c1f7831
2025-05-22T23:38:35-07:00
1,086
https://github.com/flashinfer-ai/flashinfer/pull/1086
perf: accelerate blackwell grouped gemm (#1086)
perf: accelerate blackwell grouped gemm (#1086)
csrc/group_gemm_groupwise_sm100.cu
cuda
Apache-2.0
/* * 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 ...
/* * 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 ...
--- csrc/group_gemm_groupwise_sm100.cu +++ csrc/group_gemm_groupwise_sm100.cu @@ -19,6 +19,19 @@ #include "pytorch_extension_utils.h" using namespace flashinfer; + +#define DISPATCH_MMA_SM(mma_sm, MMA_SM, ...) \ + [&]() -> bool { \ + if (mma_sm == 1) { \ + ...
33
18
4
[]
[ "BLACKWELL" ]
[]
Optimize this cuda kernel file from flashinfer (csrc/group_gemm_groupwise_sm100.cu). Goal: perf: accelerate blackwell grouped gemm Target hardware: BLACKWELL Target models: unspecified Current file: ```cuda /* * Copyright (c) 2025 by FlashInfer team. * * Licensed under the Apache License, Version 2.0 (the "License...
<!-- .github/pull_request_template.md --> ## 📌 Description This PR reduce the grouped gemm overhead outside kernel itself: 1. remove the multiple of 4 check, and add notice in the documentation (the multiple ensurance should be guaranteed when we prepare these inputs, in an outer moe module). 2. use pdl for prepare a...
[]
null
null
flashinfer
4d92f008831aac4ef7adec1159d5b6d80c1f7831
2025-05-22T23:38:35-07:00
1,086
https://github.com/flashinfer-ai/flashinfer/pull/1086
perf: accelerate blackwell grouped gemm (#1086)
perf: accelerate blackwell grouped gemm (#1086)
csrc/group_gemm_sm100_pybind.cu
cuda
Apache-2.0
/* * 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 ...
/* * 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 ...
--- csrc/group_gemm_sm100_pybind.cu +++ csrc/group_gemm_sm100_pybind.cu @@ -20,7 +20,7 @@ at::Tensor B, at::Tensor SFA, at::Tensor SFB, at::Tensor C, at::Tensor m_indptr, int64_t n, int64_t k, ...
1
1
4
[]
[ "BLACKWELL" ]
[]
Optimize this cuda kernel file from flashinfer (csrc/group_gemm_sm100_pybind.cu). Goal: perf: accelerate blackwell grouped gemm Target hardware: BLACKWELL Target models: unspecified Current file: ```cuda /* * Copyright (c) 2025 by FlashInfer team. * * Licensed under the Apache License, Version 2.0 (the "License");...
<!-- .github/pull_request_template.md --> ## 📌 Description This PR reduce the grouped gemm overhead outside kernel itself: 1. remove the multiple of 4 check, and add notice in the documentation (the multiple ensurance should be guaranteed when we prepare these inputs, in an outer moe module). 2. use pdl for prepare a...
[]
null
null
flashinfer
4d92f008831aac4ef7adec1159d5b6d80c1f7831
2025-05-22T23:38:35-07:00
1,086
https://github.com/flashinfer-ai/flashinfer/pull/1086
perf: accelerate blackwell grouped gemm (#1086)
perf: accelerate blackwell grouped gemm (#1086)
include/flashinfer/gemm/group_gemm_groupwise_sm100.cuh
cuda
Apache-2.0
/* * 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 ...
/* * 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 ...
--- include/flashinfer/gemm/group_gemm_groupwise_sm100.cuh +++ include/flashinfer/gemm/group_gemm_groupwise_sm100.cuh @@ -47,16 +47,20 @@ stride_C[i] = cutlass::make_cute_packed_stride(StrideC{}, {m, n, 1}); layout_SFA[i] = ScaleConfig::tile_atom_to_shape_SFA(make_shape(m_indptr[batch_size], n, k, 1)); layout_...
46
18
4
[]
[ "BLACKWELL" ]
[]
Optimize this cuda kernel file from flashinfer (include/flashinfer/gemm/group_gemm_groupwise_sm100.cuh). Goal: perf: accelerate blackwell grouped gemm Target hardware: BLACKWELL Target models: unspecified Current file: ```cuda /* * Copyright (c) 2025 by FlashInfer team. * * Licensed under the Apache License, Versi...
<!-- .github/pull_request_template.md --> ## 📌 Description This PR reduce the grouped gemm overhead outside kernel itself: 1. remove the multiple of 4 check, and add notice in the documentation (the multiple ensurance should be guaranteed when we prepare these inputs, in an outer moe module). 2. use pdl for prepare a...
[]
null
null
flashinfer
d7a9234263ef9a60161abc7419795fc8f101f451
2025-03-31T17:27:39-04:00
991
https://github.com/flashinfer-ai/flashinfer/pull/991
perf: prefetch page indices for mla kernel (#991)
perf: prefetch page indices for mla kernel (#991) Followup of https://github.com/flashinfer-ai/flashinfer/pull/952 cc @abcdabcd987 ## Before this PR ``` Config: batch_size=64, seq_len=1024, num_heads=64 Memory bandwidth: 1509.87 GB/s FLOPs: 163.25 TFLOPs Config: batch_size=64, seq_len=1024, num_heads=128 Memory ban...
include/flashinfer/attention/mla.cuh
cuda
Apache-2.0
/* * Copyright (c) 2023 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 ...
/* * Copyright (c) 2023 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 ...
--- include/flashinfer/attention/mla.cuh +++ include/flashinfer/attention/mla.cuh @@ -629,7 +629,7 @@ typename KTraits::IdType* merge_partial_stride, typename KTraits::DTypeO* partial_o, float* partial_lse, typename KTraits::DTypeO* final_o, float* final_lse, const uint32_t o_stride_n, const uint32_t o_s...
1
1
2
[]
[]
[]
Optimize this cuda kernel file from flashinfer (include/flashinfer/attention/mla.cuh). Goal: perf: prefetch page indices for mla kernel Target hardware: unspecified Target models: unspecified Current file: ```cuda /* * Copyright (c) 2023 by FlashInfer team. * * Licensed under the Apache License, Version 2.0 (the "...
Followup of https://github.com/flashinfer-ai/flashinfer/pull/952 cc @abcdabcd987 ## Before this PR ``` Config: batch_size=64, seq_len=1024, num_heads=64 Memory bandwidth: 1509.87 GB/s FLOPs: 163.25 TFLOPs Config: batch_size=64, seq_len=1024, num_heads=128 Memory bandwidth: 1766.19 GB/s FLOPs: 345.46 TFLOPs Config: b...
[{"scope": "kernel", "hardware": null, "model": null, "shape": "batch_size=64,seq_len=1024,num_heads=64", "batch_size": 64, "metric": "memory bandwidth", "unit": "GB/s", "higher_is_better": true, "baseline": 1509.87, "optimized": 1596.98, "stated_speedup": null, "speedup": 1.0577}, {"scope": "kernel", "hardware": null,...
1.0053
null
flashinfer
d7a9234263ef9a60161abc7419795fc8f101f451
2025-03-31T17:27:39-04:00
991
https://github.com/flashinfer-ai/flashinfer/pull/991
perf: prefetch page indices for mla kernel (#991)
perf: prefetch page indices for mla kernel (#991) Followup of https://github.com/flashinfer-ai/flashinfer/pull/952 cc @abcdabcd987 ## Before this PR ``` Config: batch_size=64, seq_len=1024, num_heads=64 Memory bandwidth: 1509.87 GB/s FLOPs: 163.25 TFLOPs Config: batch_size=64, seq_len=1024, num_heads=128 Memory ban...
include/flashinfer/attention/mla_hopper.cuh
cuda
Apache-2.0
/* * Copyright (c) 2023 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 ...
/* * Copyright (c) 2023 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 ...
--- include/flashinfer/attention/mla_hopper.cuh +++ include/flashinfer/attention/mla_hopper.cuh @@ -170,20 +170,47 @@ } } +template <typename KTraits> +__device__ __forceinline__ void prefetch_offset( + const uint32_t packed_block_iter_base, const uint32_t packed_kv_bound, + const uint32_t ckv_stride_page, ...
57
24
2
[]
[]
[]
Optimize this cuda kernel file from flashinfer (include/flashinfer/attention/mla_hopper.cuh). Goal: perf: prefetch page indices for mla kernel Target hardware: unspecified Target models: unspecified Current file: ```cuda /* * Copyright (c) 2023 by FlashInfer team. * * Licensed under the Apache License, Version 2.0...
Followup of https://github.com/flashinfer-ai/flashinfer/pull/952 cc @abcdabcd987 ## Before this PR ``` Config: batch_size=64, seq_len=1024, num_heads=64 Memory bandwidth: 1509.87 GB/s FLOPs: 163.25 TFLOPs Config: batch_size=64, seq_len=1024, num_heads=128 Memory bandwidth: 1766.19 GB/s FLOPs: 345.46 TFLOPs Config: b...
[{"scope": "kernel", "hardware": null, "model": null, "shape": "batch_size=64,seq_len=1024,num_heads=64", "batch_size": 64, "metric": "memory bandwidth", "unit": "GB/s", "higher_is_better": true, "baseline": 1509.87, "optimized": 1596.98, "stated_speedup": null, "speedup": 1.0577}, {"scope": "kernel", "hardware": null,...
1.0053
null
flashinfer
60d37b741f88f11159e7eec35e2261aa668dc2a4
2025-03-28T21:34:14-07:00
952
https://github.com/flashinfer-ai/flashinfer/pull/952
perf: Use 2WG pipeline design for MLA implementation on Hopper (#952)
perf: Use 2WG pipeline design for MLA implementation on Hopper (#952) This PR implements #892 . Per benchmark, 2WG pipeline (FlashMLA's implementation) is faster than our current 3WG pipeline design on Hopper. While it remains investigation where the gap comes from, we should implements the 2WG (and 4WG in the future...
include/flashinfer/attention/mla_hopper.cuh
cuda
Apache-2.0
/* * Copyright (c) 2023 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 ...
/* * Copyright (c) 2023 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 ...
--- include/flashinfer/attention/mla_hopper.cuh +++ include/flashinfer/attention/mla_hopper.cuh @@ -44,7 +44,7 @@ kSplitK = 8U, }; -enum class NamedBarriers { kBarrierQ = 1, kBarrierO = 2, kConsumerSync = 3 }; +enum class NamedBarriers { kOScaleReady = 1U, kBarrierO = 2U, kMDReady = 3U }; __device__ __forceinl...
251
306
1
[]
[ "HOPPER" ]
[]
Optimize this cuda kernel file from flashinfer (include/flashinfer/attention/mla_hopper.cuh). Goal: perf: Use 2WG pipeline design for MLA implementation on Hopper Target hardware: HOPPER Target models: unspecified Current file: ```cuda /* * Copyright (c) 2023 by FlashInfer team. * * Licensed under the Apache Licen...
This PR implements #892 . Per benchmark, 2WG pipeline (FlashMLA's implementation) is faster than our current 3WG pipeline design on Hopper. While it remains investigation where the gap comes from, we should implements the 2WG (and 4WG in the future) pipeline in FlashInfer to make sure our implementation not getting wo...
[{"scope": "kernel", "hardware": null, "model": null, "shape": "seq_len=1024,num_heads=64", "batch_size": 64, "metric": "memory bandwidth", "unit": "GB/s", "higher_is_better": true, "baseline": 1547.23, "optimized": 1509.87, "stated_speedup": null, "speedup": 0.9759}, {"scope": "kernel", "hardware": null, "model": null...
1.1521
null
flashinfer
e19cb7bafbd7c426e0d563c30418cbe4a02230c6
2025-03-27T02:04:55-07:00
974
https://github.com/flashinfer-ai/flashinfer/pull/974
perf: dual pivot top-p/top-k renorm (#974)
perf: dual pivot top-p/top-k renorm (#974) Uses one more pivot and a fixed Block Threads of 1024 in the sampling.renorm kernels. Benchmark and comparisons can be found [here](https://docs.google.com/spreadsheets/d/15Qxh7fRxO2HiYaSxpyZs7sWQKoJ-8gscQFTG3rW_hZI/edit?usp=sharing). --------- Co-authored-by: Zihao Ye <exp...
include/flashinfer/sampling.cuh
cuda
Apache-2.0
/* * Copyright (c) 2024 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 ...
/* * Copyright (c) 2024 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 ...
--- include/flashinfer/sampling.cuh +++ include/flashinfer/sampling.cuh @@ -943,9 +943,15 @@ float max_val; float min_val; union { - float value; - int count; - ValueCount<float> pair; + struct { + float values[2]; + }; + struct { + int counts[2]; + }; + ...
102
43
1
[]
[]
[]
Optimize this cuda kernel file from flashinfer (include/flashinfer/sampling.cuh). Goal: perf: dual pivot top-p/top-k renorm Target hardware: unspecified Target models: unspecified Current file: ```cuda /* * Copyright (c) 2024 by FlashInfer team. * * Licensed under the Apache License, Version 2.0 (the "License"); ...
Uses one more pivot and a fixed Block Threads of 1024 in the sampling.renorm kernels. Benchmark and comparisons can be found [here](https://docs.google.com/spreadsheets/d/15Qxh7fRxO2HiYaSxpyZs7sWQKoJ-8gscQFTG3rW_hZI/edit?usp=sharing).
[]
null
null
flashinfer
e3853ddcab052582fca689646bdaad6dbd0d29b6
2025-03-09T18:12:32-04:00
925
https://github.com/flashinfer-ai/flashinfer/pull/925
perf: use max probability instead of 1 as upper bound in top-p/k sampling (#925)
perf: use max probability instead of 1 as upper bound in top-p/k sampling (#925) Reduce maximum number of iterations.
include/flashinfer/sampling.cuh
cuda
Apache-2.0
/* * Copyright (c) 2024 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 ...
/* * Copyright (c) 2024 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 ...
--- include/flashinfer/sampling.cuh +++ include/flashinfer/sampling.cuh @@ -25,6 +25,7 @@ #include <cub/block/block_scan.cuh> #include <cuda/std/limits> #include <numeric> +#include <tuple> #include "math.cuh" #include "utils.cuh" @@ -97,10 +98,10 @@ struct { int32_t sampled_id; int32_t last_valid_i...
106
103
1
[]
[]
[]
Optimize this cuda kernel file from flashinfer (include/flashinfer/sampling.cuh). Goal: perf: use max probability instead of 1 as upper bound in top-p/k sampling Target hardware: unspecified Target models: unspecified Current file: ```cuda /* * Copyright (c) 2024 by FlashInfer team. * * Licensed under the Apache L...
Reduce maximum number of iterations.
[]
null
null
flashinfer
0ed1ce8377d06747c2e9c6b39012f63ef5fad9ef
2025-02-27T00:55:29-05:00
901
https://github.com/flashinfer-ai/flashinfer/pull/901
perf: tweak the pipeline design of mla kernel (#901)
perf: tweak the pipeline design of mla kernel (#901) 1. defer barrier sync for `p_smem` 2. change unroll number from 1 to 2 We found there are still significant overhead for synchronizing two consumers in qk stage. Use only one warpgroup for qk can resolve the issue.
include/flashinfer/attention/mla_hopper.cuh
cuda
Apache-2.0
/* * Copyright (c) 2023 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 ...
/* * Copyright (c) 2023 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 ...
--- include/flashinfer/attention/mla_hopper.cuh +++ include/flashinfer/attention/mla_hopper.cuh @@ -275,6 +275,7 @@ template <typename KTraits> __device__ __forceinline__ void compute_mla_pv(typename KTraits::SharedStorage* smem_storage, const uint32_t stage_idx, float*...
2
2
1
[]
[]
[]
Optimize this cuda kernel file from flashinfer (include/flashinfer/attention/mla_hopper.cuh). Goal: perf: tweak the pipeline design of mla kernel Target hardware: unspecified Target models: unspecified Current file: ```cuda /* * Copyright (c) 2023 by FlashInfer team. * * Licensed under the Apache License, Version ...
1. defer barrier sync for `p_smem` 2. change unroll number from 1 to 2 We found there are still significant overhead for synchronizing two consumers in qk stage. Use only one warpgroup for qk can resolve the issue.
[]
null
null
flashinfer
e4a68e4a84626a5e823bbec31a80f8194047d8d9
2025-02-26T23:00:22-05:00
900
https://github.com/flashinfer-ai/flashinfer/pull/900
perf: use f16 as split-k partial output data type (#900)
perf: use f16 as split-k partial output data type (#900) We use f32 as split-k partial output data type, mainly for accuracy concern. However, the official FlashMLA implementation uses 16-bit partial data type, so I guess 16bit split-k is enough for production. This PR changes flashinfer mla implementation's intermedi...
csrc/batch_mla_run.cu
cuda
Apache-2.0
/* * 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 ...
/* * 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 ...
--- csrc/batch_mla_run.cu +++ csrc/batch_mla_run.cu @@ -95,7 +95,7 @@ params.final_lse = maybe_lse.has_value() ? static_cast<float*>(maybe_lse->data_ptr()) : nullptr; params.partial_o = - GetPtrFromBaseOffset<float>(float_buffer_ptr, plan_info.partial_o_offset); + Ge...
1
1
6
[]
[]
[]
Optimize this cuda kernel file from flashinfer (csrc/batch_mla_run.cu). Goal: perf: use f16 as split-k partial output data type Target hardware: unspecified Target models: unspecified Current file: ```cuda /* * Copyright (c) 2025 by FlashInfer team. * * Licensed under the Apache License, Version 2.0 (the "License"...
We use f32 as split-k partial output data type, mainly for accuracy concern. However, the official FlashMLA implementation uses 16-bit partial data type, so I guess 16bit split-k is enough for production. This PR changes flashinfer mla implementation's intermediate data type to 16bit. This is the third piece (4 in tot...
[]
null
null
flashinfer
e4a68e4a84626a5e823bbec31a80f8194047d8d9
2025-02-26T23:00:22-05:00
900
https://github.com/flashinfer-ai/flashinfer/pull/900
perf: use f16 as split-k partial output data type (#900)
perf: use f16 as split-k partial output data type (#900) We use f32 as split-k partial output data type, mainly for accuracy concern. However, the official FlashMLA implementation uses 16-bit partial data type, so I guess 16bit split-k is enough for production. This PR changes flashinfer mla implementation's intermedi...
csrc/batch_mla_sm90_run.cu
cuda
Apache-2.0
/* * 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 ...
/* * 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 ...
--- csrc/batch_mla_sm90_run.cu +++ csrc/batch_mla_sm90_run.cu @@ -96,7 +96,7 @@ params.final_lse = maybe_lse.has_value() ? static_cast<float*>(maybe_lse->data_ptr()) : nullptr; params.partial_o = - GetPtrFromBaseOffset<float>(float_buffer_ptr, plan_info.partial_o_offset); + ...
1
1
6
[]
[]
[]
Optimize this cuda kernel file from flashinfer (csrc/batch_mla_sm90_run.cu). Goal: perf: use f16 as split-k partial output data type Target hardware: unspecified Target models: unspecified Current file: ```cuda /* * Copyright (c) 2025 by FlashInfer team. * * Licensed under the Apache License, Version 2.0 (the "Lic...
We use f32 as split-k partial output data type, mainly for accuracy concern. However, the official FlashMLA implementation uses 16-bit partial data type, so I guess 16bit split-k is enough for production. This PR changes flashinfer mla implementation's intermediate data type to 16bit. This is the third piece (4 in tot...
[]
null
null
flashinfer
e4a68e4a84626a5e823bbec31a80f8194047d8d9
2025-02-26T23:00:22-05:00
900
https://github.com/flashinfer-ai/flashinfer/pull/900
perf: use f16 as split-k partial output data type (#900)
perf: use f16 as split-k partial output data type (#900) We use f32 as split-k partial output data type, mainly for accuracy concern. However, the official FlashMLA implementation uses 16-bit partial data type, so I guess 16bit split-k is enough for production. This PR changes flashinfer mla implementation's intermedi...
include/flashinfer/attention/mla.cuh
cuda
Apache-2.0
/* * Copyright (c) 2023 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 ...
/* * Copyright (c) 2023 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 ...
--- include/flashinfer/attention/mla.cuh +++ include/flashinfer/attention/mla.cuh @@ -620,9 +620,9 @@ typename KTraits::IdType* merge_packed_offset_end, typename KTraits::IdType* merge_partial_packed_offset_start, typename KTraits::IdType* merge_partial_packed_offset_end, - typename KTraits::IdType* m...
50
48
6
[]
[]
[]
Optimize this cuda kernel file from flashinfer (include/flashinfer/attention/mla.cuh). Goal: perf: use f16 as split-k partial output data type Target hardware: unspecified Target models: unspecified Current file: ```cuda /* * Copyright (c) 2023 by FlashInfer team. * * Licensed under the Apache License, Version 2.0...
We use f32 as split-k partial output data type, mainly for accuracy concern. However, the official FlashMLA implementation uses 16-bit partial data type, so I guess 16bit split-k is enough for production. This PR changes flashinfer mla implementation's intermediate data type to 16bit. This is the third piece (4 in tot...
[]
null
null
flashinfer
e4a68e4a84626a5e823bbec31a80f8194047d8d9
2025-02-26T23:00:22-05:00
900
https://github.com/flashinfer-ai/flashinfer/pull/900
perf: use f16 as split-k partial output data type (#900)
perf: use f16 as split-k partial output data type (#900) We use f32 as split-k partial output data type, mainly for accuracy concern. However, the official FlashMLA implementation uses 16-bit partial data type, so I guess 16bit split-k is enough for production. This PR changes flashinfer mla implementation's intermedi...
include/flashinfer/attention/mla_hopper.cuh
cuda
Apache-2.0
/* * Copyright (c) 2023 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 ...
/* * Copyright (c) 2023 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 ...
--- include/flashinfer/attention/mla_hopper.cuh +++ include/flashinfer/attention/mla_hopper.cuh @@ -441,11 +441,14 @@ } template <typename KTraits> -__device__ __forceinline__ void write_o( - typename KTraits::SharedStorage* smem_storage, const uint32_t stage_counter, - typename KTraits::DTypeO* final_o, floa...
53
48
6
[]
[]
[]
Optimize this cuda kernel file from flashinfer (include/flashinfer/attention/mla_hopper.cuh). Goal: perf: use f16 as split-k partial output data type Target hardware: unspecified Target models: unspecified Current file: ```cuda /* * Copyright (c) 2023 by FlashInfer team. * * Licensed under the Apache License, Vers...
We use f32 as split-k partial output data type, mainly for accuracy concern. However, the official FlashMLA implementation uses 16-bit partial data type, so I guess 16bit split-k is enough for production. This PR changes flashinfer mla implementation's intermediate data type to 16bit. This is the third piece (4 in tot...
[]
null
null
flashinfer
e4a68e4a84626a5e823bbec31a80f8194047d8d9
2025-02-26T23:00:22-05:00
900
https://github.com/flashinfer-ai/flashinfer/pull/900
perf: use f16 as split-k partial output data type (#900)
perf: use f16 as split-k partial output data type (#900) We use f32 as split-k partial output data type, mainly for accuracy concern. However, the official FlashMLA implementation uses 16-bit partial data type, so I guess 16bit split-k is enough for production. This PR changes flashinfer mla implementation's intermedi...
include/flashinfer/attention/mla_params.cuh
cuda
Apache-2.0
/* * 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 ...
/* * 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 ...
--- include/flashinfer/attention/mla_params.cuh +++ include/flashinfer/attention/mla_params.cuh @@ -32,7 +32,7 @@ DTypeQ* q_pe; DTypeKV* ckv; DTypeKV* kpe; - float* partial_o; + DTypeO* partial_o; float* partial_lse; DTypeO* final_o; float* final_lse;
1
1
6
[]
[]
[]
Optimize this cuda kernel file from flashinfer (include/flashinfer/attention/mla_params.cuh). Goal: perf: use f16 as split-k partial output data type Target hardware: unspecified Target models: unspecified Current file: ```cuda /* * Copyright (c) 2025 by FlashInfer team. * * Licensed under the Apache License, Vers...
We use f32 as split-k partial output data type, mainly for accuracy concern. However, the official FlashMLA implementation uses 16-bit partial data type, so I guess 16bit split-k is enough for production. This PR changes flashinfer mla implementation's intermediate data type to 16bit. This is the third piece (4 in tot...
[]
null
null
flashinfer
e4a68e4a84626a5e823bbec31a80f8194047d8d9
2025-02-26T23:00:22-05:00
900
https://github.com/flashinfer-ai/flashinfer/pull/900
perf: use f16 as split-k partial output data type (#900)
perf: use f16 as split-k partial output data type (#900) We use f32 as split-k partial output data type, mainly for accuracy concern. However, the official FlashMLA implementation uses 16-bit partial data type, so I guess 16bit split-k is enough for production. This PR changes flashinfer mla implementation's intermedi...
include/flashinfer/attention/scheduler.cuh
cuda
Apache-2.0
/* * Copyright (c) 2023 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 ...
/* * Copyright (c) 2023 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 ...
--- include/flashinfer/attention/scheduler.cuh +++ include/flashinfer/attention/scheduler.cuh @@ -1104,7 +1104,21 @@ total_kv_lens += effective_kv_len; } } - int kv_len_limit = ceil_div(std::max(ceil_div(total_kv_lens, num_clusters), 1L), 256L) * 256L; + + auto f = [](int x) { + if (x <= 8) { + ...
17
2
6
[]
[]
[]
Optimize this cuda kernel file from flashinfer (include/flashinfer/attention/scheduler.cuh). Goal: perf: use f16 as split-k partial output data type Target hardware: unspecified Target models: unspecified Current file: ```cuda /* * Copyright (c) 2023 by FlashInfer team. * * Licensed under the Apache License, Versi...
We use f32 as split-k partial output data type, mainly for accuracy concern. However, the official FlashMLA implementation uses 16-bit partial data type, so I guess 16bit split-k is enough for production. This PR changes flashinfer mla implementation's intermediate data type to 16bit. This is the third piece (4 in tot...
[]
null
null
flashinfer
1e330b712c23315d76d9f1692a0a225623666d1a
2025-02-25T20:32:04-05:00
898
https://github.com/flashinfer-ai/flashinfer/pull/898
perf: fix MLA split-k performance bug (#898)
perf: fix MLA split-k performance bug (#898) As observed in #892 , we found flashinfer mla's second stage of split-k is very slow (when batch size is small), this is because our scheduler only uses one CTA for the second stage of split-k. This PR fixes the issue.
csrc/batch_mla_run.cu
cuda
Apache-2.0
/* * 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 ...
/* * 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 ...
--- csrc/batch_mla_run.cu +++ csrc/batch_mla_run.cu @@ -85,8 +85,12 @@ int_buffer_ptr, plan_info.merge_packed_offset_start_offset); params.merge_packed_offset_end = GetPtrFromBaseOffset<IdType>(int_buffer_ptr, plan_info.merge_packed_offset_end_offset); - params.merge_indptr = -...
6
2
6
[]
[]
[]
Optimize this cuda kernel file from flashinfer (csrc/batch_mla_run.cu). Goal: perf: fix MLA split-k performance bug Target hardware: unspecified Target models: unspecified Current file: ```cuda /* * Copyright (c) 2025 by FlashInfer team. * * Licensed under the Apache License, Version 2.0 (the "License"); * you ma...
As observed in #892 , we found flashinfer mla's second stage of split-k is very slow (when batch size is small), this is because our scheduler only uses one CTA for the second stage of split-k. This PR fixes the issue.
[]
null
null
flashinfer
1e330b712c23315d76d9f1692a0a225623666d1a
2025-02-25T20:32:04-05:00
898
https://github.com/flashinfer-ai/flashinfer/pull/898
perf: fix MLA split-k performance bug (#898)
perf: fix MLA split-k performance bug (#898) As observed in #892 , we found flashinfer mla's second stage of split-k is very slow (when batch size is small), this is because our scheduler only uses one CTA for the second stage of split-k. This PR fixes the issue.
csrc/batch_mla_sm90_run.cu
cuda
Apache-2.0
/* * 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 ...
/* * 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 ...
--- csrc/batch_mla_sm90_run.cu +++ csrc/batch_mla_sm90_run.cu @@ -86,8 +86,12 @@ int_buffer_ptr, plan_info.merge_packed_offset_start_offset); params.merge_packed_offset_end = GetPtrFromBaseOffset<IdType>(int_buffer_ptr, plan_info.merge_packed_offset_end_offset); - params.merge_...
6
2
6
[]
[]
[]
Optimize this cuda kernel file from flashinfer (csrc/batch_mla_sm90_run.cu). Goal: perf: fix MLA split-k performance bug Target hardware: unspecified Target models: unspecified Current file: ```cuda /* * Copyright (c) 2025 by FlashInfer team. * * Licensed under the Apache License, Version 2.0 (the "License"); * y...
As observed in #892 , we found flashinfer mla's second stage of split-k is very slow (when batch size is small), this is because our scheduler only uses one CTA for the second stage of split-k. This PR fixes the issue.
[]
null
null
flashinfer
1e330b712c23315d76d9f1692a0a225623666d1a
2025-02-25T20:32:04-05:00
898
https://github.com/flashinfer-ai/flashinfer/pull/898
perf: fix MLA split-k performance bug (#898)
perf: fix MLA split-k performance bug (#898) As observed in #892 , we found flashinfer mla's second stage of split-k is very slow (when batch size is small), this is because our scheduler only uses one CTA for the second stage of split-k. This PR fixes the issue.
include/flashinfer/attention/mla.cuh
cuda
Apache-2.0
/* * Copyright (c) 2023 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 ...
/* * Copyright (c) 2023 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 ...
--- include/flashinfer/attention/mla.cuh +++ include/flashinfer/attention/mla.cuh @@ -615,28 +615,27 @@ } template <typename KTraits> -__device__ void DevicePersistentMergeStates(typename KTraits::IdType* merge_packed_offset_start, - typename KTraits::IdType* merge_packed_...
22
22
6
[]
[]
[]
Optimize this cuda kernel file from flashinfer (include/flashinfer/attention/mla.cuh). Goal: perf: fix MLA split-k performance bug Target hardware: unspecified Target models: unspecified Current file: ```cuda /* * Copyright (c) 2023 by FlashInfer team. * * Licensed under the Apache License, Version 2.0 (the "Licen...
As observed in #892 , we found flashinfer mla's second stage of split-k is very slow (when batch size is small), this is because our scheduler only uses one CTA for the second stage of split-k. This PR fixes the issue.
[]
null
null
flashinfer
1e330b712c23315d76d9f1692a0a225623666d1a
2025-02-25T20:32:04-05:00
898
https://github.com/flashinfer-ai/flashinfer/pull/898
perf: fix MLA split-k performance bug (#898)
perf: fix MLA split-k performance bug (#898) As observed in #892 , we found flashinfer mla's second stage of split-k is very slow (when batch size is small), this is because our scheduler only uses one CTA for the second stage of split-k. This PR fixes the issue.
include/flashinfer/attention/mla_hopper.cuh
cuda
Apache-2.0
/* * Copyright (c) 2023 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 ...
/* * Copyright (c) 2023 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 ...
--- include/flashinfer/attention/mla_hopper.cuh +++ include/flashinfer/attention/mla_hopper.cuh @@ -838,10 +838,11 @@ __syncthreads(); // the second stage, merge partial outputs - DevicePersistentMergeStates<KTraits>(params.merge_packed_offset_start, - params.merge_packed_...
5
4
6
[]
[]
[]
Optimize this cuda kernel file from flashinfer (include/flashinfer/attention/mla_hopper.cuh). Goal: perf: fix MLA split-k performance bug Target hardware: unspecified Target models: unspecified Current file: ```cuda /* * Copyright (c) 2023 by FlashInfer team. * * Licensed under the Apache License, Version 2.0 (the...
As observed in #892 , we found flashinfer mla's second stage of split-k is very slow (when batch size is small), this is because our scheduler only uses one CTA for the second stage of split-k. This PR fixes the issue.
[]
null
null
flashinfer
1e330b712c23315d76d9f1692a0a225623666d1a
2025-02-25T20:32:04-05:00
898
https://github.com/flashinfer-ai/flashinfer/pull/898
perf: fix MLA split-k performance bug (#898)
perf: fix MLA split-k performance bug (#898) As observed in #892 , we found flashinfer mla's second stage of split-k is very slow (when batch size is small), this is because our scheduler only uses one CTA for the second stage of split-k. This PR fixes the issue.
include/flashinfer/attention/mla_params.cuh
cuda
Apache-2.0
/* * 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 ...
/* * 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 ...
--- include/flashinfer/attention/mla_params.cuh +++ include/flashinfer/attention/mla_params.cuh @@ -42,7 +42,9 @@ IdType* partial_indptr; IdType* merge_packed_offset_start; IdType* merge_packed_offset_end; - IdType* merge_indptr; + IdType* merge_partial_packed_offset_start; + IdType* merge_partial_packed_of...
3
1
6
[]
[]
[]
Optimize this cuda kernel file from flashinfer (include/flashinfer/attention/mla_params.cuh). Goal: perf: fix MLA split-k performance bug Target hardware: unspecified Target models: unspecified Current file: ```cuda /* * Copyright (c) 2025 by FlashInfer team. * * Licensed under the Apache License, Version 2.0 (the...
As observed in #892 , we found flashinfer mla's second stage of split-k is very slow (when batch size is small), this is because our scheduler only uses one CTA for the second stage of split-k. This PR fixes the issue.
[]
null
null
flashinfer
1e330b712c23315d76d9f1692a0a225623666d1a
2025-02-25T20:32:04-05:00
898
https://github.com/flashinfer-ai/flashinfer/pull/898
perf: fix MLA split-k performance bug (#898)
perf: fix MLA split-k performance bug (#898) As observed in #892 , we found flashinfer mla's second stage of split-k is very slow (when batch size is small), this is because our scheduler only uses one CTA for the second stage of split-k. This PR fixes the issue.
include/flashinfer/attention/scheduler.cuh
cuda
Apache-2.0
/* * Copyright (c) 2023 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 ...
/* * Copyright (c) 2023 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 ...
--- include/flashinfer/attention/scheduler.cuh +++ include/flashinfer/attention/scheduler.cuh @@ -989,7 +989,9 @@ int64_t partial_indptr_offset; int64_t merge_packed_offset_start_offset; int64_t merge_packed_offset_end_offset; - int64_t merge_indptr_offset; + int64_t merge_partial_packed_offset_start_offset;...
83
36
6
[]
[]
[]
Optimize this cuda kernel file from flashinfer (include/flashinfer/attention/scheduler.cuh). Goal: perf: fix MLA split-k performance bug Target hardware: unspecified Target models: unspecified Current file: ```cuda /* * Copyright (c) 2023 by FlashInfer team. * * Licensed under the Apache License, Version 2.0 (the ...
As observed in #892 , we found flashinfer mla's second stage of split-k is very slow (when batch size is small), this is because our scheduler only uses one CTA for the second stage of split-k. This PR fixes the issue.
[]
null
null
flashinfer
56e56ea4e22fc7cf5ca3b41f8143e8847eb5f3fa
2025-02-24T12:41:10-05:00
896
https://github.com/flashinfer-ai/flashinfer/pull/896
perf: tweak register amount for producer/consumer in MLA template (#896)
perf: tweak register amount for producer/consumer in MLA template (#896) 56, 224 is faster.
include/flashinfer/attention/mla_hopper.cuh
cuda
Apache-2.0
/* * Copyright (c) 2023 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 ...
/* * Copyright (c) 2023 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 ...
--- include/flashinfer/attention/mla_hopper.cuh +++ include/flashinfer/attention/mla_hopper.cuh @@ -626,7 +626,7 @@ if (warp_group_idx == 0) { // producer - cutlass::arch::warpgroup_reg_dealloc<72>(); + cutlass::arch::warpgroup_reg_dealloc<56>(); const uint32_t warp_idx_in_warpgroup = __shfl_sync(0...
2
2
1
[]
[]
[]
Optimize this cuda kernel file from flashinfer (include/flashinfer/attention/mla_hopper.cuh). Goal: perf: tweak register amount for producer/consumer in MLA template Target hardware: unspecified Target models: unspecified Current file: ```cuda /* * Copyright (c) 2023 by FlashInfer team. * * Licensed under the Apac...
56, 224 is faster.
[]
null
null
flashinfer
341ae09ecd33c441de6060ef51c5f369ec020694
2025-02-24T03:01:09-05:00
894
https://github.com/flashinfer-ai/flashinfer/pull/894
perf: fix the performance of stage stage of split-k (#894)
perf: fix the performance of stage stage of split-k (#894) As pointed in https://github.com/flashinfer-ai/flashinfer/issues/892#issuecomment-2677596676 The second stage of split-k seems to have a huge overhead. This PR is the first second in addressing these issues, by changing the vector size from 4 to 8.
include/flashinfer/attention/mla.cuh
cuda
Apache-2.0
/* * Copyright (c) 2023 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 ...
/* * Copyright (c) 2023 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 ...
--- include/flashinfer/attention/mla.cuh +++ include/flashinfer/attention/mla.cuh @@ -623,7 +623,7 @@ const uint32_t o_stride_n, const uint32_t o_stride_h, const uint32_t cluster_tile_q, ...
2
2
1
[]
[]
[]
Optimize this cuda kernel file from flashinfer (include/flashinfer/attention/mla.cuh). Goal: perf: fix the performance of stage stage of split-k Target hardware: unspecified Target models: unspecified Current file: ```cuda /* * Copyright (c) 2023 by FlashInfer team. * * Licensed under the Apache License, Version 2...
As pointed in https://github.com/flashinfer-ai/flashinfer/issues/892#issuecomment-2677596676 The second stage of split-k seems to have a huge overhead. This PR is the first attempt in addressing these issues, by changing the vector size from 4 to 8.
[]
null
null
flashinfer
2b24293bc7dd6536596a0fc06ebc1ddc490a113a
2025-02-23T06:37:57-05:00
887
https://github.com/flashinfer-ai/flashinfer/pull/887
perf: FlashAttention-3 style MLA PageAttention (#887)
perf: FlashAttention-3 style MLA PageAttention (#887) This PR is the followup of #804 , we implemented a FlashAttention-3 version of warp specialization pattern (splitting on head-dimension) in #804 for faster attention on Hopper GPUs. Compared to the previous version (in FA2 style), this PR did the following changes:...
csrc/batch_mla_run.cu
cuda
Apache-2.0
/* * 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 ...
/* * 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 ...
--- csrc/batch_mla_run.cu +++ csrc/batch_mla_run.cu @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include <flashinfer/attention/mla_fa2.cuh> +#include <flashinfer/attention/mla.cuh> #include <flashinfer/attention/scheduler.cuh> #inc...
1
1
5
[]
[ "H100", "HOPPER" ]
[]
Optimize this cuda kernel file from flashinfer (csrc/batch_mla_run.cu). Goal: perf: FlashAttention-3 style MLA PageAttention Target hardware: H100, HOPPER Target models: unspecified Current file: ```cuda /* * Copyright (c) 2025 by FlashInfer team. * * Licensed under the Apache License, Version 2.0 (the "License");...
This PR is the followup of #804 , we implemented a FlashAttention-3 version of warp specialization pattern (splitting on head-dimension) in #804 for faster attention on Hopper GPUs. Compared to the previous version (in FA2 style), this PR did the following changes: 1. use one warpgroup for producer, two warpgroup for...
[{"scope": "kernel", "hardware": "H100 SXM3", "model": null, "shape": "seq_len=1024,num_heads=64", "batch_size": 64, "metric": "memory bandwidth", "unit": "GB/s", "higher_is_better": true, "baseline": 1067.74, "optimized": 1305.4, "stated_speedup": null, "speedup": 1.2226}, {"scope": "kernel", "hardware": "H100 SXM3", ...
1.2979
null
flashinfer
2b24293bc7dd6536596a0fc06ebc1ddc490a113a
2025-02-23T06:37:57-05:00
887
https://github.com/flashinfer-ai/flashinfer/pull/887
perf: FlashAttention-3 style MLA PageAttention (#887)
perf: FlashAttention-3 style MLA PageAttention (#887) This PR is the followup of #804 , we implemented a FlashAttention-3 version of warp specialization pattern (splitting on head-dimension) in #804 for faster attention on Hopper GPUs. Compared to the previous version (in FA2 style), this PR did the following changes:...
include/flashinfer/attention/hopper/epilogue.cuh
cuda
Apache-2.0
/* * Copyright (c) 2024, Jay Shah, Ganesh Bikshandi, Ying Zhang, Vijay Thakkar, Pradeep Ramani, Tri * Dao. Licensed under the BSD 3-Clause. * * Modified by the FlashInfer team. */ #ifndef FLASHINFER_ATTENTION_HOPPER_EPILOGUE_CUH_ #define FLASHINFER_ATTENTION_HOPPER_EPILOGUE_CUH_ #include <cutlass/cutlass.h> #inc...
/* * Copyright (c) 2024, Jay Shah, Ganesh Bikshandi, Ying Zhang, Vijay Thakkar, Pradeep Ramani, Tri * Dao. Licensed under the BSD 3-Clause. * * Modified by the FlashInfer team. */ #ifndef FLASHINFER_ATTENTION_HOPPER_EPILOGUE_CUH_ #define FLASHINFER_ATTENTION_HOPPER_EPILOGUE_CUH_ #include <cutlass/cutlass.h> #inc...
--- include/flashinfer/attention/hopper/epilogue.cuh +++ include/flashinfer/attention/hopper/epilogue.cuh @@ -160,13 +160,13 @@ auto smem_thr_copy_O = smem_tiled_copy_O.get_thread_slice(thread_idx); Tensor tOrO_out = convert_type<DTypeO>(tOrO); - Tensor taccOrO = smem_thr_copy_O.retile_S(tOrO_out); // (...
13
13
5
[]
[ "H100", "HOPPER" ]
[]
Optimize this cuda kernel file from flashinfer (include/flashinfer/attention/hopper/epilogue.cuh). Goal: perf: FlashAttention-3 style MLA PageAttention Target hardware: H100, HOPPER Target models: unspecified Current file: ```cuda /* * Copyright (c) 2024, Jay Shah, Ganesh Bikshandi, Ying Zhang, Vijay Thakkar, Pradee...
This PR is the followup of #804 , we implemented a FlashAttention-3 version of warp specialization pattern (splitting on head-dimension) in #804 for faster attention on Hopper GPUs. Compared to the previous version (in FA2 style), this PR did the following changes: 1. use one warpgroup for producer, two warpgroup for...
[{"scope": "kernel", "hardware": "H100 SXM3", "model": null, "shape": "seq_len=1024,num_heads=64", "batch_size": 64, "metric": "memory bandwidth", "unit": "GB/s", "higher_is_better": true, "baseline": 1067.74, "optimized": 1305.4, "stated_speedup": null, "speedup": 1.2226}, {"scope": "kernel", "hardware": "H100 SXM3", ...
1.2979
null
flashinfer
41a4f5618179f0366ef814951efac6d5a2f967b3
2025-02-17T07:30:20-08:00
863
https://github.com/flashinfer-ai/flashinfer/pull/863
perf: dynamic split-k for MLA (#863)
perf: dynamic split-k for MLA (#863) #804 didn't implement split-k, which might result in performance degradation if concurrency is not large enough. This PR fixes issue. We implemented the v2 scheduler and write-through optimization mentioned in [our paper](https://arxiv.org/pdf/2501.01005) (section 3.3 and appendix...
csrc/batch_mla_run.cu
cuda
Apache-2.0
/* * 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 ...
/* * 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 ...
--- csrc/batch_mla_run.cu +++ csrc/batch_mla_run.cu @@ -71,6 +71,8 @@ params.q_indptr = GetPtrFromBaseOffset<IdType>(int_buffer_ptr, plan_info.q_indptr_offset); params.kv_indptr = GetPtrFromBaseOffset<IdType>(int_buffer_ptr, plan_info.kv_indptr_offset); + params.partial_indptr = + ...
8
0
5
[]
[ "H100" ]
[]
Optimize this cuda kernel file from flashinfer (csrc/batch_mla_run.cu). Goal: perf: dynamic split-k for MLA Target hardware: H100 Target models: unspecified Current file: ```cuda /* * Copyright (c) 2025 by FlashInfer team. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this ...
#804 didn't implement split-k, which might result in performance degradation if concurrency is not large enough. This PR fixes issue. We implemented the v2 scheduler and write-through optimization mentioned in [our paper](https://arxiv.org/pdf/2501.01005) (section 3.3 and appendix in D.2) for load-balancing. In an ea...
[{"scope": "kernel", "hardware": "H100", "model": null, "shape": "seq_len=1024,num_heads=16", "batch_size": 1, "metric": "memory bandwidth", "unit": "GB/s", "higher_is_better": true, "baseline": 15.46, "optimized": 22.33, "stated_speedup": null, "speedup": 1.4444}, {"scope": "kernel", "hardware": "H100", "model": null,...
2.7115
null
flashinfer
41a4f5618179f0366ef814951efac6d5a2f967b3
2025-02-17T07:30:20-08:00
863
https://github.com/flashinfer-ai/flashinfer/pull/863
perf: dynamic split-k for MLA (#863)
perf: dynamic split-k for MLA (#863) #804 didn't implement split-k, which might result in performance degradation if concurrency is not large enough. This PR fixes issue. We implemented the v2 scheduler and write-through optimization mentioned in [our paper](https://arxiv.org/pdf/2501.01005) (section 3.3 and appendix...
include/flashinfer/attention/cascade.cuh
cuda
Apache-2.0
/*! * Copyright (c) 2023 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...
/*! * Copyright (c) 2023 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...
--- include/flashinfer/attention/cascade.cuh +++ include/flashinfer/attention/cascade.cuh @@ -16,8 +16,6 @@ #ifndef FLASHINFER_CASCADE_CUH_ #define FLASHINFER_CASCADE_CUH_ -#include <cooperative_groups.h> - #include "../cp_async.cuh" #include "../math.cuh" #include "../utils.cuh" @@ -25,7 +23,6 @@ namespace f...
2
5
5
[]
[ "H100" ]
[]
Optimize this cuda kernel file from flashinfer (include/flashinfer/attention/cascade.cuh). Goal: perf: dynamic split-k for MLA Target hardware: H100 Target models: unspecified Current file: ```cuda /*! * Copyright (c) 2023 by FlashInfer team. * * Licensed under the Apache License, Version 2.0 (the "License"); * y...
#804 didn't implement split-k, which might result in performance degradation if concurrency is not large enough. This PR fixes issue. We implemented the v2 scheduler and write-through optimization mentioned in [our paper](https://arxiv.org/pdf/2501.01005) (section 3.3 and appendix in D.2) for load-balancing. In an ea...
[{"scope": "kernel", "hardware": "H100", "model": null, "shape": "seq_len=1024,num_heads=16", "batch_size": 1, "metric": "memory bandwidth", "unit": "GB/s", "higher_is_better": true, "baseline": 15.46, "optimized": 22.33, "stated_speedup": null, "speedup": 1.4444}, {"scope": "kernel", "hardware": "H100", "model": null,...
2.7115
null
flashinfer
41a4f5618179f0366ef814951efac6d5a2f967b3
2025-02-17T07:30:20-08:00
863
https://github.com/flashinfer-ai/flashinfer/pull/863
perf: dynamic split-k for MLA (#863)
perf: dynamic split-k for MLA (#863) #804 didn't implement split-k, which might result in performance degradation if concurrency is not large enough. This PR fixes issue. We implemented the v2 scheduler and write-through optimization mentioned in [our paper](https://arxiv.org/pdf/2501.01005) (section 3.3 and appendix...
include/flashinfer/attention/mla_fa2.cuh
cuda
Apache-2.0
/* * Copyright (c) 2023 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 ...
/* * Copyright (c) 2023 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 ...
--- include/flashinfer/attention/mla_fa2.cuh +++ include/flashinfer/attention/mla_fa2.cuh @@ -15,6 +15,8 @@ */ #ifndef FLASHINFER_MLA_FA2_CUH_ #define FLASHINFER_MLA_FA2_CUH_ +#include <cooperative_groups.h> + #include <cstdint> #include <sstream> @@ -90,7 +92,6 @@ static constexpr uint32_t UPCAST_STRIDE_KPE...
110
22
5
[]
[ "H100" ]
[]
Optimize this cuda kernel file from flashinfer (include/flashinfer/attention/mla_fa2.cuh). Goal: perf: dynamic split-k for MLA Target hardware: H100 Target models: unspecified Current file: ```cuda /* * Copyright (c) 2023 by FlashInfer team. * * Licensed under the Apache License, Version 2.0 (the "License"); * yo...
#804 didn't implement split-k, which might result in performance degradation if concurrency is not large enough. This PR fixes issue. We implemented the v2 scheduler and write-through optimization mentioned in [our paper](https://arxiv.org/pdf/2501.01005) (section 3.3 and appendix in D.2) for load-balancing. In an ea...
[{"scope": "kernel", "hardware": "H100", "model": null, "shape": "seq_len=1024,num_heads=16", "batch_size": 1, "metric": "memory bandwidth", "unit": "GB/s", "higher_is_better": true, "baseline": 15.46, "optimized": 22.33, "stated_speedup": null, "speedup": 1.4444}, {"scope": "kernel", "hardware": "H100", "model": null,...
2.7115
null
flashinfer
41a4f5618179f0366ef814951efac6d5a2f967b3
2025-02-17T07:30:20-08:00
863
https://github.com/flashinfer-ai/flashinfer/pull/863
perf: dynamic split-k for MLA (#863)
perf: dynamic split-k for MLA (#863) #804 didn't implement split-k, which might result in performance degradation if concurrency is not large enough. This PR fixes issue. We implemented the v2 scheduler and write-through optimization mentioned in [our paper](https://arxiv.org/pdf/2501.01005) (section 3.3 and appendix...
include/flashinfer/attention/mla_params.cuh
cuda
Apache-2.0
/* * 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 ...
/* * 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 ...
--- include/flashinfer/attention/mla_params.cuh +++ include/flashinfer/attention/mla_params.cuh @@ -39,6 +39,10 @@ IdType* q_indptr; IdType* kv_indptr; + IdType* partial_indptr; + IdType* merge_packed_offset_start; + IdType* merge_packed_offset_end; + IdType* merge_indptr; IdType* kv_indices; IdType* ...
4
0
5
[]
[ "H100" ]
[]
Optimize this cuda kernel file from flashinfer (include/flashinfer/attention/mla_params.cuh). Goal: perf: dynamic split-k for MLA Target hardware: H100 Target models: unspecified Current file: ```cuda /* * Copyright (c) 2025 by FlashInfer team. * * Licensed under the Apache License, Version 2.0 (the "License"); *...
#804 didn't implement split-k, which might result in performance degradation if concurrency is not large enough. This PR fixes issue. We implemented the v2 scheduler and write-through optimization mentioned in [our paper](https://arxiv.org/pdf/2501.01005) (section 3.3 and appendix in D.2) for load-balancing. In an ea...
[{"scope": "kernel", "hardware": "H100", "model": null, "shape": "seq_len=1024,num_heads=16", "batch_size": 1, "metric": "memory bandwidth", "unit": "GB/s", "higher_is_better": true, "baseline": 15.46, "optimized": 22.33, "stated_speedup": null, "speedup": 1.4444}, {"scope": "kernel", "hardware": "H100", "model": null,...
2.7115
null
flashinfer
41a4f5618179f0366ef814951efac6d5a2f967b3
2025-02-17T07:30:20-08:00
863
https://github.com/flashinfer-ai/flashinfer/pull/863
perf: dynamic split-k for MLA (#863)
perf: dynamic split-k for MLA (#863) #804 didn't implement split-k, which might result in performance degradation if concurrency is not large enough. This PR fixes issue. We implemented the v2 scheduler and write-through optimization mentioned in [our paper](https://arxiv.org/pdf/2501.01005) (section 3.3 and appendix...
include/flashinfer/attention/scheduler.cuh
cuda
Apache-2.0
/* * Copyright (c) 2023 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 ...
/* * Copyright (c) 2023 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 ...
--- include/flashinfer/attention/scheduler.cuh +++ include/flashinfer/attention/scheduler.cuh @@ -44,10 +44,10 @@ __global__ void BatchDecodeWithPagedKVCacheKernelMLA(Params params); template <uint32_t HEAD_DIM_CKV, uint32_t HEAD_DIM_KPE, uint32_t QO_TILE_LEN, typename DTypeKV> -std::tuple<uint32_t, uint32_t, uint3...
145
49
5
[]
[ "H100" ]
[]
Optimize this cuda kernel file from flashinfer (include/flashinfer/attention/scheduler.cuh). Goal: perf: dynamic split-k for MLA Target hardware: H100 Target models: unspecified Current file: ```cuda /* * Copyright (c) 2023 by FlashInfer team. * * Licensed under the Apache License, Version 2.0 (the "License"); * ...
#804 didn't implement split-k, which might result in performance degradation if concurrency is not large enough. This PR fixes issue. We implemented the v2 scheduler and write-through optimization mentioned in [our paper](https://arxiv.org/pdf/2501.01005) (section 3.3 and appendix in D.2) for load-balancing. In an ea...
[{"scope": "kernel", "hardware": "H100", "model": null, "shape": "seq_len=1024,num_heads=16", "batch_size": 1, "metric": "memory bandwidth", "unit": "GB/s", "higher_is_better": true, "baseline": 15.46, "optimized": 22.33, "stated_speedup": null, "speedup": 1.4444}, {"scope": "kernel", "hardware": "H100", "model": null,...
2.7115
null
flashinfer
88e3dee17cc64a61eb6b5a45ef79742a5599ef7a
2025-02-15T01:45:14+08:00
844
https://github.com/flashinfer-ai/flashinfer/pull/844
perf: MLA decode kernel implemented by CuTe targeted to SM80 (#844)
perf: MLA decode kernel implemented by CuTe targeted to SM80 (#844) Hi @yzh119 , this is a follow up of #766, an interesting idea came to my mind today, can't help to change few lines to verify this idea. We can use asymmetric warp config to solve the register file size limit issue, the solution is simply to use 8 war...
include/flashinfer/attention/scheduler.cuh
cuda
Apache-2.0
/* * Copyright (c) 2023 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 ...
/* * Copyright (c) 2023 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 ...
--- include/flashinfer/attention/scheduler.cuh +++ include/flashinfer/attention/scheduler.cuh @@ -42,6 +42,13 @@ uint32_t bdy, uint32_t bdz, uint32_t tile_size_qo_heads, typename AttentionVariant, typename Params> __global__ void BatchDecodeWithPagedKVCacheKernelMLA(Params params); + +template <u...
65
0
3
[]
[ "SM80" ]
[]
Optimize this cuda kernel file from flashinfer (include/flashinfer/attention/scheduler.cuh). Goal: perf: MLA decode kernel implemented by CuTe targeted to SM80 Target hardware: SM80 Target models: unspecified Current file: ```cuda /* * Copyright (c) 2023 by FlashInfer team. * * Licensed under the Apache License, V...
Hi @yzh119 , this is a follow up of #766, an interesting idea came to my mind today, can't help to change few lines to verify this idea. We can use asymmetric warp config to solve the register file size limit issue, the solution is simply to use 8 warps for the output mma stage, and keep other parts unchanged, because...
[]
null
null
flashinfer
106e6fc24a80ee2aa534dfd29274bb67091dce65
2025-02-12T00:02:18-05:00
804
https://github.com/flashinfer-ai/flashinfer/pull/804
perf: memory efficient deepseek mla fused page-attention kernel (#804)
perf: memory efficient deepseek mla fused page-attention kernel (#804) **Description:** This PR implements a memory efficient fused Deepseek MLA PageAttention kernel for decode, prefill, and chunked prefill operations. MLA computation after matrix absorption can be described as a (multi-query attention) MQA kern...
include/flashinfer/attention/heap.h
cpp
Apache-2.0
/* * Copyright (c) 2023 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 ...
/* * Copyright (c) 2023 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 ...
--- include/flashinfer/attention/heap.h +++ include/flashinfer/attention/heap.h @@ -27,12 +27,12 @@ * \brief Heap data structure for (index, value) pairs * \note minimal element on top */ -class CTACostHeap { +class MinHeap { public: // first: index, second: cost using Element = std::pair<int, float>; -...
4
2
7
[ "deepseek" ]
[ "A100", "H100" ]
[]
Optimize this cpp kernel file from flashinfer (include/flashinfer/attention/heap.h). Goal: perf: memory efficient deepseek mla fused page-attention kernel Target hardware: A100, H100 Target models: deepseek Current file: ```cpp /* * Copyright (c) 2023 by FlashInfer team. * * Licensed under the Apache License, Vers...
**Description:** This PR implements a memory efficient fused Deepseek MLA PageAttention kernel for decode, prefill, and chunked prefill operations. MLA computation after matrix absorption can be described as a (multi-query attention) MQA kernel, with same K/V cache and special head dimensions: `head_dim_qk=576, head_d...
[]
null
null
flashinfer
106e6fc24a80ee2aa534dfd29274bb67091dce65
2025-02-12T00:02:18-05:00
804
https://github.com/flashinfer-ai/flashinfer/pull/804
perf: memory efficient deepseek mla fused page-attention kernel (#804)
perf: memory efficient deepseek mla fused page-attention kernel (#804) **Description:** This PR implements a memory efficient fused Deepseek MLA PageAttention kernel for decode, prefill, and chunked prefill operations. MLA computation after matrix absorption can be described as a (multi-query attention) MQA kern...
include/flashinfer/attention/prefill.cuh
cuda
Apache-2.0
/* * Copyright (c) 2023 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 ...
/* * Copyright (c) 2023 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 ...
--- include/flashinfer/attention/prefill.cuh +++ include/flashinfer/attention/prefill.cuh @@ -102,10 +102,10 @@ static constexpr uint32_t NUM_WARPS = NUM_WARPS_Q * NUM_WARPS_KV; static constexpr uint32_t HEAD_DIM_QK = NUM_MMA_D_QK * 16; static constexpr uint32_t HEAD_DIM_VO = NUM_MMA_D_VO * 16; - static const...
80
81
7
[ "deepseek" ]
[ "A100", "H100" ]
[]
Optimize this cuda kernel file from flashinfer (include/flashinfer/attention/prefill.cuh). Goal: perf: memory efficient deepseek mla fused page-attention kernel Target hardware: A100, H100 Target models: deepseek Current file: ```cuda /* * Copyright (c) 2023 by FlashInfer team. * * Licensed under the Apache Licens...
**Description:** This PR implements a memory efficient fused Deepseek MLA PageAttention kernel for decode, prefill, and chunked prefill operations. MLA computation after matrix absorption can be described as a (multi-query attention) MQA kernel, with same K/V cache and special head dimensions: `head_dim_qk=576, head_d...
[]
null
null
flashinfer
106e6fc24a80ee2aa534dfd29274bb67091dce65
2025-02-12T00:02:18-05:00
804
https://github.com/flashinfer-ai/flashinfer/pull/804
perf: memory efficient deepseek mla fused page-attention kernel (#804)
perf: memory efficient deepseek mla fused page-attention kernel (#804) **Description:** This PR implements a memory efficient fused Deepseek MLA PageAttention kernel for decode, prefill, and chunked prefill operations. MLA computation after matrix absorption can be described as a (multi-query attention) MQA kern...
include/flashinfer/attention/scheduler.cuh
cuda
Apache-2.0
/* * Copyright (c) 2023 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 ...
/* * Copyright (c) 2023 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 ...
--- include/flashinfer/attention/scheduler.cuh +++ include/flashinfer/attention/scheduler.cuh @@ -17,6 +17,7 @@ #define FLASHINFER_ATTENTION_SCHEDULER_CUH_ #include <cuda_runtime_api.h> +#include <driver_types.h> #include <algorithm> #include <cstddef> @@ -702,9 +703,7 @@ return cudaSuccess; } -inline flo...
195
10
7
[ "deepseek" ]
[ "A100", "H100" ]
[]
Optimize this cuda kernel file from flashinfer (include/flashinfer/attention/scheduler.cuh). Goal: perf: memory efficient deepseek mla fused page-attention kernel Target hardware: A100, H100 Target models: deepseek Current file: ```cuda /* * Copyright (c) 2023 by FlashInfer team. * * Licensed under the Apache Lice...
**Description:** This PR implements a memory efficient fused Deepseek MLA PageAttention kernel for decode, prefill, and chunked prefill operations. MLA computation after matrix absorption can be described as a (multi-query attention) MQA kernel, with same K/V cache and special head dimensions: `head_dim_qk=576, head_d...
[]
null
null
flashinfer
106e6fc24a80ee2aa534dfd29274bb67091dce65
2025-02-12T00:02:18-05:00
804
https://github.com/flashinfer-ai/flashinfer/pull/804
perf: memory efficient deepseek mla fused page-attention kernel (#804)
perf: memory efficient deepseek mla fused page-attention kernel (#804) **Description:** This PR implements a memory efficient fused Deepseek MLA PageAttention kernel for decode, prefill, and chunked prefill operations. MLA computation after matrix absorption can be described as a (multi-query attention) MQA kern...
include/flashinfer/attention/variant_helper.cuh
cuda
Apache-2.0
/* * Copyright (c) 2024 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 ...
/* * 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 ...
--- include/flashinfer/attention/variant_helper.cuh +++ include/flashinfer/attention/variant_helper.cuh @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 by FlashInfer team. + * Copyright (c) 2025 by FlashInfer team. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except i...
2
1
7
[ "deepseek" ]
[ "A100", "H100" ]
[]
Optimize this cuda kernel file from flashinfer (include/flashinfer/attention/variant_helper.cuh). Goal: perf: memory efficient deepseek mla fused page-attention kernel Target hardware: A100, H100 Target models: deepseek Current file: ```cuda /* * Copyright (c) 2024 by FlashInfer team. * * Licensed under the Apache...
**Description:** This PR implements a memory efficient fused Deepseek MLA PageAttention kernel for decode, prefill, and chunked prefill operations. MLA computation after matrix absorption can be described as a (multi-query attention) MQA kernel, with same K/V cache and special head dimensions: `head_dim_qk=576, head_d...
[]
null
null
flashinfer
fc037728a9abaafdc0cedb1559c8844e4b59b264
2025-02-04T00:20:55-05:00
776
https://github.com/flashinfer-ai/flashinfer/pull/776
perf: refactor fa2 prefill template (#776)
perf: refactor fa2 prefill template (#776) This PR refactors the FA2-based prefill template, including the following changes: 1. Using KernelTraits for all constexpr and data types. 2. Using SharedStorage class for a clean interface shared memory management. 3. Unlock `CTA_TILE_Q=32`. We also tried `CTA_TILE_Q...
include/flashinfer/attention/scheduler.cuh
cuda
Apache-2.0
/* * Copyright (c) 2023 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 ...
/* * Copyright (c) 2023 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 ...
--- include/flashinfer/attention/scheduler.cuh +++ include/flashinfer/attention/scheduler.cuh @@ -418,27 +418,6 @@ return cudaSuccess; } -inline uint32_t DetermineCtaTileQ(int64_t avg_packed_qo_len, uint32_t head_dim) { - if (avg_packed_qo_len > 64 && head_dim < 256) { - return 128; - } else { - auto comp...
2
23
4
[]
[]
[]
Optimize this cuda kernel file from flashinfer (include/flashinfer/attention/scheduler.cuh). Goal: perf: refactor fa2 prefill template Target hardware: unspecified Target models: unspecified Current file: ```cuda /* * Copyright (c) 2023 by FlashInfer team. * * Licensed under the Apache License, Version 2.0 (the "L...
This PR refactors the FA2-based prefill template, including the following changes: 1. Using KernelTraits for all constexpr and data types. 2. Using SharedStorage class for a clean interface shared memory management. 3. Unlock `CTA_TILE_Q=32`. We also tried `CTA_TILE_Q=8`, the half-mma optimization for GQA decoding wit...
[]
null
null
flashinfer
fc037728a9abaafdc0cedb1559c8844e4b59b264
2025-02-04T00:20:55-05:00
776
https://github.com/flashinfer-ai/flashinfer/pull/776
perf: refactor fa2 prefill template (#776)
perf: refactor fa2 prefill template (#776) This PR refactors the FA2-based prefill template, including the following changes: 1. Using KernelTraits for all constexpr and data types. 2. Using SharedStorage class for a clean interface shared memory management. 3. Unlock `CTA_TILE_Q=32`. We also tried `CTA_TILE_Q...
include/flashinfer/mma.cuh
cuda
Apache-2.0
/* * Copyright (c) 2023 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 ...
/* * Copyright (c) 2023 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 ...
--- include/flashinfer/mma.cuh +++ include/flashinfer/mma.cuh @@ -480,7 +480,7 @@ * \brief Use mma instructions to compute rowsum. */ template <typename DType> -__device__ __forceinline__ void rowsum_f8f8f32(float* d, DType* s) { +__device__ __forceinline__ void m16k32_rowsum_f8f8f32(float* d, DType* s) { stati...
2
2
4
[]
[]
[]
Optimize this cuda kernel file from flashinfer (include/flashinfer/mma.cuh). Goal: perf: refactor fa2 prefill template Target hardware: unspecified Target models: unspecified Current file: ```cuda /* * Copyright (c) 2023 by FlashInfer team. * * Licensed under the Apache License, Version 2.0 (the "License"); * you...
This PR refactors the FA2-based prefill template, including the following changes: 1. Using KernelTraits for all constexpr and data types. 2. Using SharedStorage class for a clean interface shared memory management. 3. Unlock `CTA_TILE_Q=32`. We also tried `CTA_TILE_Q=8`, the half-mma optimization for GQA decoding wit...
[]
null
null
flashinfer
fc037728a9abaafdc0cedb1559c8844e4b59b264
2025-02-04T00:20:55-05:00
776
https://github.com/flashinfer-ai/flashinfer/pull/776
perf: refactor fa2 prefill template (#776)
perf: refactor fa2 prefill template (#776) This PR refactors the FA2-based prefill template, including the following changes: 1. Using KernelTraits for all constexpr and data types. 2. Using SharedStorage class for a clean interface shared memory management. 3. Unlock `CTA_TILE_Q=32`. We also tried `CTA_TILE_Q...
include/flashinfer/utils.cuh
cuda
Apache-2.0
/* * Copyright (c) 2023 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 ...
/* * Copyright (c) 2023 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 ...
--- include/flashinfer/utils.cuh +++ include/flashinfer/utils.cuh @@ -108,6 +108,11 @@ __VA_ARGS__ \ break; \ } \ + case 32: { ...
29
0
4
[]
[]
[]
Optimize this cuda kernel file from flashinfer (include/flashinfer/utils.cuh). Goal: perf: refactor fa2 prefill template Target hardware: unspecified Target models: unspecified Current file: ```cuda /* * Copyright (c) 2023 by FlashInfer team. * * Licensed under the Apache License, Version 2.0 (the "License"); * y...
This PR refactors the FA2-based prefill template, including the following changes: 1. Using KernelTraits for all constexpr and data types. 2. Using SharedStorage class for a clean interface shared memory management. 3. Unlock `CTA_TILE_Q=32`. We also tried `CTA_TILE_Q=8`, the half-mma optimization for GQA decoding wit...
[]
null
null
flashinfer
989dbfa65f28939575d4f2c15ed71bb09c030287
2025-01-03T23:31:22-08:00
714
https://github.com/flashinfer-ai/flashinfer/pull/714
perf: fix the iteration bound of SWA in FA2 prefill template (#714)
perf: fix the iteration bound of SWA in FA2 prefill template (#714) We forgot to divide the packed row index by group_size when computing the sliding window iteration bound, making it larger than its actual value, and slows down the execution. Thank @Ying1123 for spotting this bug.
include/flashinfer/attention/prefill.cuh
cuda
Apache-2.0
/* * Copyright (c) 2023 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 ...
/* * Copyright (c) 2023 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 ...
--- include/flashinfer/attention/prefill.cuh +++ include/flashinfer/attention/prefill.cuh @@ -1226,7 +1226,7 @@ 16 * NUM_WARPS_KV * NUM_MMA_KV); const uint32_t window_iteration = - ceil_div(sub_if_greater_or_zero(kv_len + (bx + 1) * num_rows_per_cta, + ceil_div(sub_if_greater_or_zero(kv_le...
3
3
1
[]
[]
[]
Optimize this cuda kernel file from flashinfer (include/flashinfer/attention/prefill.cuh). Goal: perf: fix the iteration bound of SWA in FA2 prefill template Target hardware: unspecified Target models: unspecified Current file: ```cuda /* * Copyright (c) 2023 by FlashInfer team. * * Licensed under the Apache Licen...
We forgot to divide the packed row index by group_size when computing the sliding window iteration bound, making it larger than its actual value, and slows down the execution. Thank @Ying1123 for spotting this bug.
[]
null
null
flashinfer
db8f04d30989f57acef3fbde41cbd3ce373727f1
2024-12-22T16:39:35-08:00
690
https://github.com/flashinfer-ai/flashinfer/pull/690
hotfix: accelerate plan speed of fa3 template (#690)
hotfix: accelerate plan speed of fa3 template (#690) The fa3 template's plan speed is very slow because we overestimate the workspace size that needs to be transferred from CPU to GPU, this PR fixes the issue. cc @nandor @zhyncs
csrc/aot_extension_utils.h
cpp
Apache-2.0
/* * Copyright (c) 2024 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 ...
/* * Copyright (c) 2024 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 ...
--- csrc/aot_extension_utils.h +++ csrc/aot_extension_utils.h @@ -30,17 +30,6 @@ #define DISPATCH_mask_mode(expr, const_expr, ...) \ _DISPATCH_SWITCH("mask_mode", expr, _DISPATCH_CASES_mask_mode(const_expr, __VA_ARGS__)) -#define DISPATCH_BOOL(expr, const_expr, ...) \ - [&]() -> bool { ...
0
11
10
[]
[ "CPU" ]
[]
Optimize this cpp kernel file from flashinfer (csrc/aot_extension_utils.h). Goal: hotfix: accelerate plan speed of fa3 template Target hardware: CPU Target models: unspecified Current file: ```cpp /* * Copyright (c) 2024 by FlashInfer team. * * Licensed under the Apache License, Version 2.0 (the "License"); * you...
The fa3 template's plan speed is very slow because we overestimate the workspace size that needs to be transferred from CPU to GPU, this PR fixes the issue. cc @nandor @zhyncs
[]
null
null
flashinfer
db8f04d30989f57acef3fbde41cbd3ce373727f1
2024-12-22T16:39:35-08:00
690
https://github.com/flashinfer-ai/flashinfer/pull/690
hotfix: accelerate plan speed of fa3 template (#690)
hotfix: accelerate plan speed of fa3 template (#690) The fa3 template's plan speed is very slow because we overestimate the workspace size that needs to be transferred from CPU to GPU, this PR fixes the issue. cc @nandor @zhyncs
csrc/batch_prefill_sm90.cu
cuda
Apache-2.0
/* * Copyright (c) 2023 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 ...
/* * Copyright (c) 2023 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 ...
--- csrc/batch_prefill_sm90.cu +++ csrc/batch_prefill_sm90.cu @@ -29,14 +29,14 @@ namespace flashinfer { template <uint32_t HEAD_DIM, MaskMode MASK_MODE, bool LEFT_SLINDING_WINDOW, - typename AttentionVariant, typename DTypeQ, typename DTypeKV, typename DTypeO, - typename IdType> + bool S...
39
31
10
[]
[ "CPU" ]
[]
Optimize this cuda kernel file from flashinfer (csrc/batch_prefill_sm90.cu). Goal: hotfix: accelerate plan speed of fa3 template Target hardware: CPU Target models: unspecified Current file: ```cuda /* * Copyright (c) 2023 by FlashInfer team. * * Licensed under the Apache License, Version 2.0 (the "License"); * y...
The fa3 template's plan speed is very slow because we overestimate the workspace size that needs to be transferred from CPU to GPU, this PR fixes the issue. cc @nandor @zhyncs
[]
null
null
flashinfer
db8f04d30989f57acef3fbde41cbd3ce373727f1
2024-12-22T16:39:35-08:00
690
https://github.com/flashinfer-ai/flashinfer/pull/690
hotfix: accelerate plan speed of fa3 template (#690)
hotfix: accelerate plan speed of fa3 template (#690) The fa3 template's plan speed is very slow because we overestimate the workspace size that needs to be transferred from CPU to GPU, this PR fixes the issue. cc @nandor @zhyncs
csrc/flashinfer_ops_sm90.cu
cuda
Apache-2.0
/* * Copyright (c) 2023 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 ...
/* * Copyright (c) 2023 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 ...
--- csrc/flashinfer_ops_sm90.cu +++ csrc/flashinfer_ops_sm90.cu @@ -33,9 +33,9 @@ std::vector<int64_t> BatchPrefillWithKVCacheSM90Plan( unsigned int head_dim, bool causal, at::Tensor float_workspace_buffer, at::Tensor int_workspace_buffer, at::Tensor page_locked_int_workspace_buffer, - at::Tensor qo_indpt...
3
3
10
[]
[ "CPU" ]
[]
Optimize this cuda kernel file from flashinfer (csrc/flashinfer_ops_sm90.cu). Goal: hotfix: accelerate plan speed of fa3 template Target hardware: CPU Target models: unspecified Current file: ```cuda /* * Copyright (c) 2023 by FlashInfer team. * * Licensed under the Apache License, Version 2.0 (the "License"); * ...
The fa3 template's plan speed is very slow because we overestimate the workspace size that needs to be transferred from CPU to GPU, this PR fixes the issue. cc @nandor @zhyncs
[]
null
null
flashinfer
db8f04d30989f57acef3fbde41cbd3ce373727f1
2024-12-22T16:39:35-08:00
690
https://github.com/flashinfer-ai/flashinfer/pull/690
hotfix: accelerate plan speed of fa3 template (#690)
hotfix: accelerate plan speed of fa3 template (#690) The fa3 template's plan speed is very slow because we overestimate the workspace size that needs to be transferred from CPU to GPU, this PR fixes the issue. cc @nandor @zhyncs
csrc/pytorch_extension_utils.h
cpp
Apache-2.0
/* * Copyright (c) 2023 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 ...
/* * Copyright (c) 2023 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 ...
--- csrc/pytorch_extension_utils.h +++ csrc/pytorch_extension_utils.h @@ -189,6 +189,17 @@ return __VA_ARGS__(); \ } +#define DISPATCH_BOOL(expr, const_expr, ...) \ + [&]() -> bool { \ + if (expr) { \ + constexpr bool cons...
11
0
10
[]
[ "CPU" ]
[]
Optimize this cpp kernel file from flashinfer (csrc/pytorch_extension_utils.h). Goal: hotfix: accelerate plan speed of fa3 template Target hardware: CPU Target models: unspecified Current file: ```cpp /* * Copyright (c) 2023 by FlashInfer team. * * Licensed under the Apache License, Version 2.0 (the "License"); *...
The fa3 template's plan speed is very slow because we overestimate the workspace size that needs to be transferred from CPU to GPU, this PR fixes the issue. cc @nandor @zhyncs
[]
null
null
flashinfer
db8f04d30989f57acef3fbde41cbd3ce373727f1
2024-12-22T16:39:35-08:00
690
https://github.com/flashinfer-ai/flashinfer/pull/690
hotfix: accelerate plan speed of fa3 template (#690)
hotfix: accelerate plan speed of fa3 template (#690) The fa3 template's plan speed is very slow because we overestimate the workspace size that needs to be transferred from CPU to GPU, this PR fixes the issue. cc @nandor @zhyncs
include/flashinfer/attention/hopper/prefill_sm90.cuh
cuda
Apache-2.0
/* * Copyright (c) 2024, Jay Shah, Ganesh Bikshandi, Ying Zhang, Vijay Thakkar, Pradeep Ramani, Tri * Dao. Licensed under the BSD 3-Clause. * * Modified by the FlashInfer team. */ #ifndef FLASHINFER_ATTENTION_HOPPER_PREFILL_SM90_CUH_ #define FLASHINFER_ATTENTION_HOPPER_PREFILL_SM90_CUH_ #include <cuda_device_runt...
/* * Copyright (c) 2024, Jay Shah, Ganesh Bikshandi, Ying Zhang, Vijay Thakkar, Pradeep Ramani, Tri * Dao. Licensed under the BSD 3-Clause. * * Modified by the FlashInfer team. */ #ifndef FLASHINFER_ATTENTION_HOPPER_PREFILL_SM90_CUH_ #define FLASHINFER_ATTENTION_HOPPER_PREFILL_SM90_CUH_ #include <cuda_device_runt...
--- include/flashinfer/attention/hopper/prefill_sm90.cuh +++ include/flashinfer/attention/hopper/prefill_sm90.cuh @@ -291,7 +291,8 @@ return cudaSuccess; } -template <typename KernelTraits, bool LEFT_SLINDING_WINDOW, bool CAUSAL, typename IdType> +template <typename KernelTraits, bool LEFT_SLINDING_WINDOW, bool C...
25
17
10
[]
[ "CPU", "HOPPER" ]
[]
Optimize this cuda kernel file from flashinfer (include/flashinfer/attention/hopper/prefill_sm90.cuh). Goal: hotfix: accelerate plan speed of fa3 template Target hardware: CPU, HOPPER Target models: unspecified Current file: ```cuda /* * Copyright (c) 2024, Jay Shah, Ganesh Bikshandi, Ying Zhang, Vijay Thakkar, Prad...
The fa3 template's plan speed is very slow because we overestimate the workspace size that needs to be transferred from CPU to GPU, this PR fixes the issue. cc @nandor @zhyncs
[]
null
null
flashinfer
db8f04d30989f57acef3fbde41cbd3ce373727f1
2024-12-22T16:39:35-08:00
690
https://github.com/flashinfer-ai/flashinfer/pull/690
hotfix: accelerate plan speed of fa3 template (#690)
hotfix: accelerate plan speed of fa3 template (#690) The fa3 template's plan speed is very slow because we overestimate the workspace size that needs to be transferred from CPU to GPU, this PR fixes the issue. cc @nandor @zhyncs
include/flashinfer/attention/hopper/tile_scheduler.cuh
cuda
Apache-2.0
/* * Copyright (c) 2024, Jay Shah, Ganesh Bikshandi, Ying Zhang, Vijay Thakkar, Pradeep Ramani, Tri * Dao. Licensed under the BSD 3-Clause. * * Modified by the FlashInfer team. */ #ifndef FLASHINFER_ATTENTION_HOPPER_TILE_SCHEDULER_CUH_ #define FLASHINFER_ATTENTION_HOPPER_TILE_SCHEDULER_CUH_ #include "cutlass/arch...
/* * Copyright (c) 2024, Jay Shah, Ganesh Bikshandi, Ying Zhang, Vijay Thakkar, Pradeep Ramani, Tri * Dao. Licensed under the BSD 3-Clause. * * Modified by the FlashInfer team. */ #ifndef FLASHINFER_ATTENTION_HOPPER_TILE_SCHEDULER_CUH_ #define FLASHINFER_ATTENTION_HOPPER_TILE_SCHEDULER_CUH_ #include "cutlass/arch...
--- include/flashinfer/attention/hopper/tile_scheduler.cuh +++ include/flashinfer/attention/hopper/tile_scheduler.cuh @@ -78,13 +78,14 @@ }; template <typename IdType> -struct BatchPrefillTileScheduler { +struct BatchPrefillPersistentTileScheduler { public: // Host side kernel arguments struct Arguments { ...
116
6
10
[]
[ "CPU", "HOPPER" ]
[]
Optimize this cuda kernel file from flashinfer (include/flashinfer/attention/hopper/tile_scheduler.cuh). Goal: hotfix: accelerate plan speed of fa3 template Target hardware: CPU, HOPPER Target models: unspecified Current file: ```cuda /* * Copyright (c) 2024, Jay Shah, Ganesh Bikshandi, Ying Zhang, Vijay Thakkar, Pr...
The fa3 template's plan speed is very slow because we overestimate the workspace size that needs to be transferred from CPU to GPU, this PR fixes the issue. cc @nandor @zhyncs
[]
null
null
flashinfer
db8f04d30989f57acef3fbde41cbd3ce373727f1
2024-12-22T16:39:35-08:00
690
https://github.com/flashinfer-ai/flashinfer/pull/690
hotfix: accelerate plan speed of fa3 template (#690)
hotfix: accelerate plan speed of fa3 template (#690) The fa3 template's plan speed is very slow because we overestimate the workspace size that needs to be transferred from CPU to GPU, this PR fixes the issue. cc @nandor @zhyncs
include/flashinfer/attention/scheduler.cuh
cuda
Apache-2.0
/* * Copyright (c) 2023 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 ...
/* * Copyright (c) 2023 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 ...
--- include/flashinfer/attention/scheduler.cuh +++ include/flashinfer/attention/scheduler.cuh @@ -742,6 +742,7 @@ int64_t kv_len_offset; int64_t head_indices_offset; int64_t work_indptr_offset; + bool same_schedule_for_all_heads; PrefillPlanSM90Info() : qo_tile_indices_offset(0), @@ -750,17 +751,2...
29
16
10
[]
[ "CPU" ]
[]
Optimize this cuda kernel file from flashinfer (include/flashinfer/attention/scheduler.cuh). Goal: hotfix: accelerate plan speed of fa3 template Target hardware: CPU Target models: unspecified Current file: ```cuda /* * Copyright (c) 2023 by FlashInfer team. * * Licensed under the Apache License, Version 2.0 (the ...
The fa3 template's plan speed is very slow because we overestimate the workspace size that needs to be transferred from CPU to GPU, this PR fixes the issue. cc @nandor @zhyncs
[]
null
null
flashinfer
553ace5eb91fc07681fa9edf8b6c09827a72617a
2024-12-04T02:27:50-08:00
644
https://github.com/flashinfer-ai/flashinfer/pull/644
perf: reduce total_num_tiles_q by one (#644)
perf: reduce total_num_tiles_q by one (#644) The bound can be reduced by one to slightly decrease workspace memory usage.
include/flashinfer/attention/scheduler.cuh
cuda
Apache-2.0
/* * Copyright (c) 2023 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 ...
/* * Copyright (c) 2023 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 ...
--- include/flashinfer/attention/scheduler.cuh +++ include/flashinfer/attention/scheduler.cuh @@ -483,7 +483,7 @@ // number of rows and the batch size. The sum of qo lengths rounded // up to cta_tile_q will not exceed this number derived from the total // number of rows. - total_num_tiles_q = ceil_di...
1
1
1
[]
[]
[]
Optimize this cuda kernel file from flashinfer (include/flashinfer/attention/scheduler.cuh). Goal: perf: reduce total_num_tiles_q by one Target hardware: unspecified Target models: unspecified Current file: ```cuda /* * Copyright (c) 2023 by FlashInfer team. * * Licensed under the Apache License, Version 2.0 (the ...
The bound can be reduced by one to slightly decrease workspace memory usage.
[]
null
null
flashinfer
ff05155581f5e085b573f803aed398434859e22f
2024-11-14T07:46:16Z
609
https://github.com/flashinfer-ai/flashinfer/pull/609
perf: improve parallelism in RoPE with pos_ids (#609)
perf: improve parallelism in RoPE with pos_ids (#609) The previous kernel was not parallelised sufficiently well for low batch sizes. Similarly to the regular rotary kernel, now all qo/kv heads are split across separate blocks. In decode mode, the pos_ids kernel is now faster.
include/flashinfer/pos_enc.cuh
cuda
Apache-2.0
/* * Copyright (c) 2023 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 ...
/* * Copyright (c) 2023 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 ...
--- include/flashinfer/pos_enc.cuh +++ include/flashinfer/pos_enc.cuh @@ -229,65 +229,61 @@ float smooth_b, float rope_rcp_scale, float rope_rcp_theta) { // NOTE: q and q_rope may be the same ptr, so do k and k_rope uint32_t bx = blockIdx.x, tx = threadIdx.x, ty = threadIdx.y; - const uint32_t bdy = blockDi...
49
53
1
[]
[]
[]
Optimize this cuda kernel file from flashinfer (include/flashinfer/pos_enc.cuh). Goal: perf: improve parallelism in RoPE with pos_ids Target hardware: unspecified Target models: unspecified Current file: ```cuda /* * Copyright (c) 2023 by FlashInfer team. * * Licensed under the Apache License, Version 2.0 (the "Li...
The previous kernel was not parallelised sufficiently well for low batch sizes. Similarly to the regular rotary kernel, now all qo/kv heads are split across separate blocks. In decode mode, the pos_ids kernel is now faster.
[]
null
null
flashinfer
595cf602e73688d2f96f8cf1aad7cb2fce689d41
2024-11-10T16:24:18-08:00
602
https://github.com/flashinfer-ai/flashinfer/pull/602
perf: fix prefill kernel performance degradation (step 1) (#602)
perf: fix prefill kernel performance degradation (step 1) (#602) The prefill attention kernel performance has degraded significantly in recent releases (since v0.1.2), especially on A100 when `causal=True`, this is mainly because we add new attention variants (which increases register usage thus incurs register spi...
include/flashinfer/attention/prefill.cuh
cuda
Apache-2.0
/* * Copyright (c) 2023 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 ...
/* * Copyright (c) 2023 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 ...
--- include/flashinfer/attention/prefill.cuh +++ include/flashinfer/attention/prefill.cuh @@ -623,18 +623,25 @@ const uint_fastdiv group_size, DTypeQKAccum (*s_frag)[NUM_FRAGS_KV][8]) { const uint32_t lane_idx = threa...
26
12
1
[]
[ "A100" ]
[]
Optimize this cuda kernel file from flashinfer (include/flashinfer/attention/prefill.cuh). Goal: perf: fix prefill kernel performance degradation (step 1) Target hardware: A100 Target models: unspecified Current file: ```cuda /* * Copyright (c) 2023 by FlashInfer team. * * Licensed under the Apache License, Versio...
The prefill attention kernel performance has degraded significantly in recent releases (since v0.1.2), especially on A100 when `causal=True`, this is mainly because we add new attention variants (which increases register usage thus incurs register spilling) and move some parameters from compile-time to runtime. This P...
[]
null
null
flashinfer
2043ca2181d1e9119a1fb8b86a739c245be5b536
2024-11-09T10:32:14+08:00
592
https://github.com/flashinfer-ai/flashinfer/pull/592
perf: reduce the read and write of shared memory in the FusedAddRMSNormKernel (#592)
perf: reduce the read and write of shared memory in the FusedAddRMSNormKernel (#592) Use `vec_t<float, VEC_SIZE> x_vec` to reduce the number of read and write operations to shared memory.
include/flashinfer/norm.cuh
cuda
Apache-2.0
/* * Copyright (c) 2024 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 ...
/* * Copyright (c) 2024 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 ...
--- include/flashinfer/norm.cuh +++ include/flashinfer/norm.cuh @@ -133,6 +133,8 @@ input_vec.fill(0.f); vec_t<T, VEC_SIZE> residual_vec; residual_vec.fill(0.f); + vec_t<float, VEC_SIZE> x_vec; + x_vec.fill(0.f); if ((i * num_threads + thread_id) * VEC_SIZE < d) { input_vec.load(input +...
11
6
1
[]
[]
[]
Optimize this cuda kernel file from flashinfer (include/flashinfer/norm.cuh). Goal: perf: reduce the read and write of shared memory in the FusedAddRMSNormKernel Target hardware: unspecified Target models: unspecified Current file: ```cuda /* * Copyright (c) 2024 by FlashInfer team. * * Licensed under the Apache L...
Use `vec_t<float, VEC_SIZE> x_vec` to reduce the number of read and write operations to shared memory.
[]
null
null
flashinfer
e15f7c984bc4152c0b65cfec916ace37c98668cd
2024-11-06T14:02:19-08:00
588
https://github.com/flashinfer-ai/flashinfer/pull/588
perf: fix the performance issue of `append_paged_kv_cache` (#588)
perf: fix the performance issue of `append_paged_kv_cache` (#588) The performance of `append_paged_kv_cache` is terrible for small batch size, which is a known issue that we haven't fixed for a long time, this PR fixes it. This PR also adds support for non-contiguous append keys/values (which could be sliced from f...
include/flashinfer/page.cuh
cuda
Apache-2.0
/* * Copyright (c) 2023 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 ...
/* * Copyright (c) 2023 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 ...
--- include/flashinfer/page.cuh +++ include/flashinfer/page.cuh @@ -249,38 +249,34 @@ * \param paged_kv The paged key-value cache * \param key The key to be appended * \param value The value to be appended - * \param append_indptr The indptr array of the appended ragged tensor + * \param batch_indices The batch i...
42
30
1
[]
[]
[]
Optimize this cuda kernel file from flashinfer (include/flashinfer/page.cuh). Goal: perf: fix the performance issue of `append_paged_kv_cache` Target hardware: unspecified Target models: unspecified Current file: ```cuda /* * Copyright (c) 2023 by FlashInfer team. * * Licensed under the Apache License, Version 2.0...
The performance of `append_paged_kv_cache` is terrible for small batch size, which is a known issue that we haven't fixed for a long time, this PR fixes it. This PR also adds support for non-contiguous append keys/values (which could be sliced from fused qkv matrix). We first call a triton kernel to convert `append_in...
[]
null
null
flashinfer
be6bf5bb26f1f1b3edf094d903544600c574ee09
2024-08-21T12:08:36-07:00
459
https://github.com/flashinfer-ai/flashinfer/pull/459
perf: use persistent kernel for merging attention states (#459)
perf: use persistent kernel for merging attention states (#459) As observed by @MasterJH5574 , there are cases where our `VariableLengthMergeStatesKernel` launches a lot of CTAs (>=10k) while most of the CTAs only work on small number of merges, this PR fixes the issue by using a persistent kernel. There is stil...
include/flashinfer/attention/cascade.cuh
cuda
Apache-2.0
/*! * Copyright (c) 2023 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...
/*! * Copyright (c) 2023 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...
--- include/flashinfer/attention/cascade.cuh +++ include/flashinfer/attention/cascade.cuh @@ -301,85 +301,94 @@ */ template <uint32_t vec_size, uint32_t bdx, uint32_t bdy, uint32_t num_smem_stages, typename DTypeIn, typename DTypeOut, typename IdType> -__global__ void VariableLengthMergeStatesKernel(DType...
96
77
1
[]
[]
[]
Optimize this cuda kernel file from flashinfer (include/flashinfer/attention/cascade.cuh). Goal: perf: use persistent kernel for merging attention states Target hardware: unspecified Target models: unspecified Current file: ```cuda /*! * Copyright (c) 2023 by FlashInfer team. * * Licensed under the Apache License,...
As observed by @MasterJH5574 , there are cases where our `VariableLengthMergeStatesKernel` launches a lot of CTAs (>=10k) while most of the CTAs only work on small number of merges, this PR fixes the issue by using a persistent kernel. There is still load imbalance issue, and I plan to resolve it inside scheduler. I'l...
[]
null
null
flashinfer
7c397cbd81d4fa5da8aef9f105576dbe67f6c22b
2024-08-20T23:03:22-07:00
458
https://github.com/flashinfer-ai/flashinfer/pull/458
perf: slight optimization on fragment layout swizzle (#458)
perf: slight optimization on fragment layout swizzle (#458) fuse two byte perm into one.
include/flashinfer/frag_layout_swizzle.cuh
cuda
Apache-2.0
/* * Copyright (c) 2024 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 ...
/* * Copyright (c) 2024 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 ...
--- include/flashinfer/frag_layout_swizzle.cuh +++ include/flashinfer/frag_layout_swizzle.cuh @@ -29,9 +29,8 @@ } __device__ __forceinline__ uint32_t frag_layout_swizzle_16b_to_8b_trans(uint32_t x) { - x = __byte_perm(x, x, 0x3120); uint32_t tmp = __shfl_xor_sync(0xffffffff, x, 0x4); - x = __byte_perm(x, tmp, ...
1
2
2
[]
[]
[]
Optimize this cuda kernel file from flashinfer (include/flashinfer/frag_layout_swizzle.cuh). Goal: perf: slight optimization on fragment layout swizzle Target hardware: unspecified Target models: unspecified Current file: ```cuda /* * Copyright (c) 2024 by FlashInfer team. * * Licensed under the Apache License, Ve...
fuse two byte perm into one.
[]
null
null
flashinfer
7c397cbd81d4fa5da8aef9f105576dbe67f6c22b
2024-08-20T23:03:22-07:00
458
https://github.com/flashinfer-ai/flashinfer/pull/458
perf: slight optimization on fragment layout swizzle (#458)
perf: slight optimization on fragment layout swizzle (#458) fuse two byte perm into one.
include/flashinfer/vec_dtypes.cuh
cuda
Apache-2.0
/* * Copyright (c) 2023 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 ...
/* * Copyright (c) 2023 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 ...
--- include/flashinfer/vec_dtypes.cuh +++ include/flashinfer/vec_dtypes.cuh @@ -126,7 +126,6 @@ constexpr int MASK2 = MASK1 >> (FP8_EXPONENT + FP8_MANTISSA); constexpr int MASK3 = MASK2 & 0x7fffffff; constexpr int MASK = MASK3 | (MASK3 >> 16); - // Final MASK value: 0x7F007F00 q = __byte_perm(q, ...
0
1
2
[]
[]
[]
Optimize this cuda kernel file from flashinfer (include/flashinfer/vec_dtypes.cuh). Goal: perf: slight optimization on fragment layout swizzle Target hardware: unspecified Target models: unspecified Current file: ```cuda /* * Copyright (c) 2023 by FlashInfer team. * * Licensed under the Apache License, Version 2.0...
fuse two byte perm into one.
[]
null
null
flashinfer
0d618712faff20a84bbd513d02ac01e16be19306
2024-08-17T23:26:02-07:00
453
https://github.com/flashinfer-ai/flashinfer/pull/453
perf: slight optimization on f16->f8 fragment layout swizzling (#453)
perf: slight optimization on f16->f8 fragment layout swizzling (#453) swap after dequantize.
include/flashinfer/attention/prefill.cuh
cuda
Apache-2.0
/* * Copyright (c) 2023 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 ...
/* * Copyright (c) 2023 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 ...
--- include/flashinfer/attention/prefill.cuh +++ include/flashinfer/attention/prefill.cuh @@ -802,8 +802,8 @@ } b_frag_f8[0] = frag_layout_swizzle_16b_to_8b_trans(b_frag_f8[0]); b_frag_f8[1] = frag_layout_swizzle_16b_to_8b_trans(b_frag_f8[1]); - bfly_exch(b_frag_f8[0], b_frag_f8[1]); ...
1
1
3
[]
[]
[]
Optimize this cuda kernel file from flashinfer (include/flashinfer/attention/prefill.cuh). Goal: perf: slight optimization on f16->f8 fragment layout swizzling Target hardware: unspecified Target models: unspecified Current file: ```cuda /* * Copyright (c) 2023 by FlashInfer team. * * Licensed under the Apache Lic...
swap after dequantize.
[]
null
null
flashinfer
0d618712faff20a84bbd513d02ac01e16be19306
2024-08-17T23:26:02-07:00
453
https://github.com/flashinfer-ai/flashinfer/pull/453
perf: slight optimization on f16->f8 fragment layout swizzling (#453)
perf: slight optimization on f16->f8 fragment layout swizzling (#453) swap after dequantize.
include/flashinfer/frag_layout_swizzle.cuh
cuda
Apache-2.0
/* * Copyright (c) 2024 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 ...
/* * Copyright (c) 2024 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 ...
--- include/flashinfer/frag_layout_swizzle.cuh +++ include/flashinfer/frag_layout_swizzle.cuh @@ -39,11 +39,4 @@ return x; } -__device__ __forceinline__ void bfly_exch(uint32_t& a, uint32_t& b) { - uint32_t tmp = __byte_perm(a, b, 0x5410); - uint32_t tmp2 = __byte_perm(a, b, 0x7632); - a = tmp; - b = tmp2; -}...
0
7
3
[]
[]
[]
Optimize this cuda kernel file from flashinfer (include/flashinfer/frag_layout_swizzle.cuh). Goal: perf: slight optimization on f16->f8 fragment layout swizzling Target hardware: unspecified Target models: unspecified Current file: ```cuda /* * Copyright (c) 2024 by FlashInfer team. * * Licensed under the Apache L...
swap after dequantize.
[]
null
null