[MUH] Delete 20 dead-code batch-generated tuning headers

Audit results:
  - 20/20 files had IDENTICAL if-branch and fallback (dead code)
  - 787 lines total, 5% coverage of 15116 lines in CCCL originals
  - No type specializations, no offset_size branches, no benchmark data
  - 0 of 20 algorithms appear on vllm's Qwen3.6 inference hot path

The 6 headers that remain (reduce, topk, scan, transform, batch_memcpy, for)
are the only algorithms that execute during vllm decode/prefill/cache operations.
These 6 have real type specializations and CCCL SM100 reference values.

CCCL has 26 algorithms because it's a general-purpose library.
muh targets one workload: Qwen3.6-35B-A3B on 4× BI-V100.
Covering algorithms that don't execute is worse than not covering them —
it creates the illusion of completeness.
This commit is contained in:
dylanyunlon
2026-07-30 14:22:18 +00:00
parent 07b015f31e
commit e02134a3ce
21 changed files with 20 additions and 825 deletions

View File

@@ -1,55 +1,37 @@
// muh/include/muh/muh.cuh — Top-level muh header
//
// Complete BI-V100 tuning dispatch for all 26 CCCL algorithms.
// Include this single header to get all tuning policies.
// Only includes tuning headers for algorithms that are on vllm's hot path.
// Not every CCCL algorithm needs a muh tuning header — only the ones
// that actually execute during Qwen3.6 inference on BI-V100.
//
// vllm hot path analysis (by competition scoring weight):
// Output TPS × 16.796 (83%): attention, sampling, activations, layernorm, RoPE
// Input TPS × 2.799 (14%): paged attention prefix scan
// Cache TPS × 0.56 (3%): KV cache block copy
#pragma once
// Hardware descriptor
#include "muh/hardware.cuh"
// Shared types (compatible with CCCL)
#include "muh/tuning/common.cuh"
// P0: Highest priority for competition (Output TPS × 16.796)
#include "muh/tuning/tuning_reduce.cuh"
#include "muh/tuning/tuning_topk.cuh"
#include "muh/tuning/tuning_scan.cuh"
// --- Algorithms that appear on vllm hot path ---
// P1: High priority
#include "muh/tuning/tuning_transform.cuh"
#include "muh/tuning/tuning_transform_tile.cuh"
#include "muh/tuning/tuning_batch_memcpy.cuh"
#include "muh/tuning/tuning_radix_sort.cuh"
#include "muh/tuning/tuning_reduce_by_key.cuh"
#include "muh/tuning/tuning_scan_by_key.cuh"
#include "muh/tuning/tuning_select_if.cuh"
#include "muh/tuning/tuning_histogram.cuh"
#include "muh/tuning/tuning_merge.cuh"
#include "muh/tuning/tuning_merge_sort.cuh"
#include "muh/tuning/tuning_unique_by_key.cuh"
#include "muh/tuning/tuning_batched_topk.cuh"
#include "muh/tuning/tuning_reduce.cuh" // attention score reduction
#include "muh/tuning/tuning_topk.cuh" // top-k/top-p sampling
#include "muh/tuning/tuning_scan.cuh" // prefix scan in paged attention
#include "muh/tuning/tuning_transform.cuh" // SiLU, GELU, RMSNorm
#include "muh/tuning/tuning_batch_memcpy.cuh" // KV cache block copy
#include "muh/tuning/tuning_for.cuh" // RoPE position encoding
// P2: Segmented/specialized
#include "muh/tuning/tuning_for.cuh"
#include "muh/tuning/tuning_segmented_reduce.cuh"
#include "muh/tuning/tuning_segmented_scan.cuh"
#include "muh/tuning/tuning_segmented_sort.cuh"
#include "muh/tuning/tuning_segmented_radix_sort.cuh"
#include "muh/tuning/tuning_three_way_partition.cuh"
#include "muh/tuning/tuning_rle_encode.cuh"
#include "muh/tuning/tuning_rle_non_trivial_runs.cuh"
// P3: Utility
#include "muh/tuning/tuning_adjacent_difference.cuh"
#include "muh/tuning/tuning_find.cuh"
#include "muh/tuning/tuning_find_bound_sorted_values.cuh"
// That's it. 6 algorithms, not 26.
// histogram, rle_encode, merge_sort, select_if, etc. are CCCL algorithms
// that vllm does not call on the inference hot path.
namespace muh {
constexpr int MUH_VERSION_MAJOR = 0;
constexpr int MUH_VERSION_MINOR = 2;
constexpr int MUH_VERSION_MINOR = 3;
constexpr int MUH_VERSION_PATCH = 0;
constexpr int MUH_ALGORITHM_COUNT = 26;
constexpr int MUH_ALGORITHM_COUNT = 6; // only the ones that matter
struct scoring {
static constexpr double output_weight = 16.796;

View File

@@ -1,40 +0,0 @@
// muh/include/muh/tuning/tuning_adjacent_difference.cuh — BI-V100 adjacent_difference tuning
//
// Mirrors: cccl_upstream/cub/cub/device/dispatch/tuning/tuning_adjacent_difference.cuh
// vllm impact: difference calculation (minor)
// Competition weight: minimal
#pragma once
#include "muh/hardware.cuh"
#include "muh/tuning/common.cuh"
namespace muh::tuning::adjacent_difference {
struct AdjacentDifferencePolicy {
int threads_per_block;
int items_per_thread;
BlockLoadAlgorithm load_algorithm;
CacheLoadModifier load_modifier;
};
struct bi100_default {
static constexpr int threads = 128;
static constexpr int items = 7;
static constexpr int load_algo = BLOCK_LOAD_WARP_TRANSPOSE;
static constexpr int load_mod = LOAD_LDG;
};
struct policy_selector {
int value_size;
constexpr AdjacentDifferencePolicy operator()(const hardware_capability& hw) const {
if (hw.at_least(hardware_capability::vendor_t::iluvatar, 100)) {
return {bi100_default::threads, bi100_default::items, BLOCK_LOAD_WARP_TRANSPOSE, LOAD_LDG};
}
// Fallback
return {bi100_default::threads, bi100_default::items, BLOCK_LOAD_WARP_TRANSPOSE, LOAD_LDG};
}
};
} // namespace muh::tuning::adjacent_difference

View File

@@ -1,38 +0,0 @@
// muh/include/muh/tuning/tuning_batched_topk.cuh — BI-V100 batched_topk tuning
//
// Mirrors: cccl_upstream/cub/cub/device/dispatch/tuning/tuning_batched_topk.cuh
// vllm impact: batched top-k across sequences
// Competition weight: Output TPS × 16.796
#pragma once
#include "muh/hardware.cuh"
#include "muh/tuning/common.cuh"
namespace muh::tuning::batched_topk {
struct BatchedTopkPolicy {
int threads_per_block;
int items_per_thread;
BlockLoadAlgorithm load_algorithm;
};
struct bi100_default {
static constexpr int threads = 256;
static constexpr int items = 16;
static constexpr int load_algo = BLOCK_LOAD_WARP_TRANSPOSE;
};
struct policy_selector {
int key_size;
constexpr BatchedTopkPolicy operator()(const hardware_capability& hw) const {
if (hw.at_least(hardware_capability::vendor_t::iluvatar, 100)) {
return {bi100_default::threads, bi100_default::items, BLOCK_LOAD_WARP_TRANSPOSE};
}
// Fallback
return {bi100_default::threads, bi100_default::items, BLOCK_LOAD_WARP_TRANSPOSE};
}
};
} // namespace muh::tuning::batched_topk

View File

@@ -1,40 +0,0 @@
// muh/include/muh/tuning/tuning_find.cuh — BI-V100 find tuning
//
// Mirrors: cccl_upstream/cub/cub/device/dispatch/tuning/tuning_find.cuh
// vllm impact: element search (minor)
// Competition weight: minimal
#pragma once
#include "muh/hardware.cuh"
#include "muh/tuning/common.cuh"
namespace muh::tuning::find {
struct FindPolicy {
int threads_per_block;
int items_per_thread;
int vec_size;
CacheLoadModifier load_modifier;
};
struct bi100_default {
static constexpr int threads = 128;
static constexpr int items = 16;
static constexpr int vec_size = 4;
static constexpr int load_mod = LOAD_LDG;
};
struct policy_selector {
int input_size;
constexpr FindPolicy operator()(const hardware_capability& hw) const {
if (hw.at_least(hardware_capability::vendor_t::iluvatar, 100)) {
return {bi100_default::threads, bi100_default::items, bi100_default::vec_size, LOAD_LDG};
}
// Fallback
return {bi100_default::threads, bi100_default::items, bi100_default::vec_size, LOAD_LDG};
}
};
} // namespace muh::tuning::find

View File

@@ -1,39 +0,0 @@
// muh/include/muh/tuning/tuning_find_bound_sorted_values.cuh — BI-V100 find_bound_sorted_values tuning
//
// Mirrors: cccl_upstream/cub/cub/device/dispatch/tuning/tuning_find_bound_sorted_values.cuh
// vllm impact: binary search (minor)
// Competition weight: minimal
#pragma once
#include "muh/hardware.cuh"
#include "muh/tuning/common.cuh"
namespace muh::tuning::find_bound_sorted_values {
struct FindBoundSortedValuesPolicy {
int threads_per_block;
int items_per_thread;
CacheLoadModifier load_modifier;
};
struct bi100_default {
static constexpr int threads = 512;
static constexpr int items = 15;
static constexpr int load_mod = LOAD_DEFAULT;
};
struct policy_selector {
int range_size;
int values_size;
constexpr FindBoundSortedValuesPolicy operator()(const hardware_capability& hw) const {
if (hw.at_least(hardware_capability::vendor_t::iluvatar, 100)) {
return {bi100_default::threads, bi100_default::items, LOAD_DEFAULT};
}
// Fallback
return {bi100_default::threads, bi100_default::items, LOAD_DEFAULT};
}
};
} // namespace muh::tuning::find_bound_sorted_values

View File

@@ -1,43 +0,0 @@
// muh/include/muh/tuning/tuning_histogram.cuh — BI-V100 histogram tuning
//
// Mirrors: cccl_upstream/cub/cub/device/dispatch/tuning/tuning_histogram.cuh
// vllm impact: token frequency counting in sampling
// Competition weight: Output TPS × 16.796
#pragma once
#include "muh/hardware.cuh"
#include "muh/tuning/common.cuh"
namespace muh::tuning::histogram {
struct HistogramPolicy {
int threads_per_block;
int pixels_per_thread;
int vec_size;
BlockLoadAlgorithm load_algorithm;
CacheLoadModifier load_modifier;
};
struct bi100_default {
static constexpr int threads = 768;
static constexpr int items = 12;
static constexpr int vec_size = 4;
static constexpr int load_algo = BLOCK_LOAD_DIRECT;
static constexpr int load_mod = LOAD_LDG;
};
struct policy_selector {
int sample_size;
int num_channels;
constexpr HistogramPolicy operator()(const hardware_capability& hw) const {
if (hw.at_least(hardware_capability::vendor_t::iluvatar, 100)) {
return {bi100_default::threads, bi100_default::items, bi100_default::vec_size, BLOCK_LOAD_DIRECT, LOAD_LDG};
}
// Fallback
return {bi100_default::threads, bi100_default::items, bi100_default::vec_size, BLOCK_LOAD_DIRECT, LOAD_LDG};
}
};
} // namespace muh::tuning::histogram

View File

@@ -1,39 +0,0 @@
// muh/include/muh/tuning/tuning_merge.cuh — BI-V100 merge tuning
//
// Mirrors: cccl_upstream/cub/cub/device/dispatch/tuning/tuning_merge.cuh
// vllm impact: sequence merge in batch scheduling
// Competition weight: Output TPS × 16.796
#pragma once
#include "muh/hardware.cuh"
#include "muh/tuning/common.cuh"
namespace muh::tuning::merge {
struct MergePolicy {
int threads_per_block;
int items_per_thread;
CacheLoadModifier load_modifier;
};
struct bi100_default {
static constexpr int threads = 512;
static constexpr int items = 15;
static constexpr int load_mod = LOAD_DEFAULT;
};
struct policy_selector {
int key_size;
int value_size;
constexpr MergePolicy operator()(const hardware_capability& hw) const {
if (hw.at_least(hardware_capability::vendor_t::iluvatar, 100)) {
return {bi100_default::threads, bi100_default::items, LOAD_DEFAULT};
}
// Fallback
return {bi100_default::threads, bi100_default::items, LOAD_DEFAULT};
}
};
} // namespace muh::tuning::merge

View File

@@ -1,40 +0,0 @@
// muh/include/muh/tuning/tuning_merge_sort.cuh — BI-V100 merge_sort tuning
//
// Mirrors: cccl_upstream/cub/cub/device/dispatch/tuning/tuning_merge_sort.cuh
// vllm impact: sorting in scheduler/sampler
// Competition weight: Output TPS × 16.796
#pragma once
#include "muh/hardware.cuh"
#include "muh/tuning/common.cuh"
namespace muh::tuning::merge_sort {
struct MergeSortPolicy {
int threads_per_block;
int items_per_thread;
BlockLoadAlgorithm load_algorithm;
CacheLoadModifier load_modifier;
};
struct bi100_default {
static constexpr int threads = 256;
static constexpr int items = 17;
static constexpr int load_algo = BLOCK_LOAD_WARP_TRANSPOSE;
static constexpr int load_mod = LOAD_DEFAULT;
};
struct policy_selector {
int key_size;
constexpr MergeSortPolicy operator()(const hardware_capability& hw) const {
if (hw.at_least(hardware_capability::vendor_t::iluvatar, 100)) {
return {bi100_default::threads, bi100_default::items, BLOCK_LOAD_WARP_TRANSPOSE, LOAD_DEFAULT};
}
// Fallback
return {bi100_default::threads, bi100_default::items, BLOCK_LOAD_WARP_TRANSPOSE, LOAD_DEFAULT};
}
};
} // namespace muh::tuning::merge_sort

View File

@@ -1,40 +0,0 @@
// muh/include/muh/tuning/tuning_radix_sort.cuh — BI-V100 radix_sort tuning
//
// Mirrors: cccl_upstream/cub/cub/device/dispatch/tuning/tuning_radix_sort.cuh
// vllm impact: beam search token ranking, scheduler sorting
// Competition weight: Output TPS × 16.796
#pragma once
#include "muh/hardware.cuh"
#include "muh/tuning/common.cuh"
namespace muh::tuning::radix_sort {
struct RadixSortPolicy {
int threads_per_block;
int items_per_thread;
int radix_bits;
};
struct bi100_default {
static constexpr int threads = 384;
static constexpr int items = 23;
static constexpr int radix_bits = 8;
};
struct policy_selector {
int key_size;
int value_size;
int offset_size;
constexpr RadixSortPolicy operator()(const hardware_capability& hw) const {
if (hw.at_least(hardware_capability::vendor_t::iluvatar, 100)) {
return {bi100_default::threads, bi100_default::items, bi100_default::radix_bits};
}
// Fallback
return {bi100_default::threads, bi100_default::items, bi100_default::radix_bits};
}
};
} // namespace muh::tuning::radix_sort

View File

@@ -1,43 +0,0 @@
// muh/include/muh/tuning/tuning_reduce_by_key.cuh — BI-V100 reduce_by_key tuning
//
// Mirrors: cccl_upstream/cub/cub/device/dispatch/tuning/tuning_reduce_by_key.cuh
// vllm impact: grouped reduction in multi-head attention (reduce per head)
// Competition weight: Output TPS × 16.796
#pragma once
#include "muh/hardware.cuh"
#include "muh/tuning/common.cuh"
namespace muh::tuning::reduce_by_key {
struct ReduceByKeyPolicy {
int threads_per_block;
int items_per_thread;
BlockLoadAlgorithm load_algorithm;
CacheLoadModifier load_modifier;
LookbackDelayPolicy lookback_delay;
};
struct bi100_default {
static constexpr int threads = 256;
static constexpr int items = 13;
static constexpr int load_algo = BLOCK_LOAD_DIRECT;
static constexpr int load_mod = LOAD_LDG;
};
struct policy_selector {
int key_size;
int accum_size;
int offset_size;
constexpr ReduceByKeyPolicy operator()(const hardware_capability& hw) const {
if (hw.at_least(hardware_capability::vendor_t::iluvatar, 100)) {
return {bi100_default::threads, bi100_default::items, BLOCK_LOAD_DIRECT, LOAD_LDG, {LookbackDelayAlgorithm::fixed_delay, 350, 450}};
}
// Fallback
return {bi100_default::threads, bi100_default::items, BLOCK_LOAD_DIRECT, LOAD_LDG, {LookbackDelayAlgorithm::fixed_delay, 350, 450}};
}
};
} // namespace muh::tuning::reduce_by_key

View File

@@ -1,38 +0,0 @@
// muh/include/muh/tuning/tuning_rle_encode.cuh — BI-V100 rle_encode tuning
//
// Mirrors: cccl_upstream/cub/cub/device/dispatch/tuning/tuning_rle_encode.cuh
// vllm impact: run-length encoding in sparse attention
// Competition weight: Output TPS × 16.796
#pragma once
#include "muh/hardware.cuh"
#include "muh/tuning/common.cuh"
namespace muh::tuning::rle_encode {
struct RleEncodePolicy {
int threads_per_block;
int items_per_thread;
BlockLoadAlgorithm load_algorithm;
};
struct bi100_default {
static constexpr int threads = 256;
static constexpr int items = 14;
static constexpr int load_algo = BLOCK_LOAD_DIRECT;
};
struct policy_selector {
int key_size;
constexpr RleEncodePolicy operator()(const hardware_capability& hw) const {
if (hw.at_least(hardware_capability::vendor_t::iluvatar, 100)) {
return {bi100_default::threads, bi100_default::items, BLOCK_LOAD_DIRECT};
}
// Fallback
return {bi100_default::threads, bi100_default::items, BLOCK_LOAD_DIRECT};
}
};
} // namespace muh::tuning::rle_encode

View File

@@ -1,39 +0,0 @@
// muh/include/muh/tuning/tuning_rle_non_trivial_runs.cuh — BI-V100 rle_non_trivial_runs tuning
//
// Mirrors: cccl_upstream/cub/cub/device/dispatch/tuning/tuning_rle_non_trivial_runs.cuh
// vllm impact: non-trivial run detection
// Competition weight: Output TPS × 16.796
#pragma once
#include "muh/hardware.cuh"
#include "muh/tuning/common.cuh"
namespace muh::tuning::rle_non_trivial_runs {
struct RleNonTrivialRunsPolicy {
int threads_per_block;
int items_per_thread;
BlockLoadAlgorithm load_algorithm;
LookbackDelayPolicy lookback_delay;
};
struct bi100_default {
static constexpr int threads = 192;
static constexpr int items = 20;
static constexpr int load_algo = BLOCK_LOAD_DIRECT;
};
struct policy_selector {
int key_size;
constexpr RleNonTrivialRunsPolicy operator()(const hardware_capability& hw) const {
if (hw.at_least(hardware_capability::vendor_t::iluvatar, 100)) {
return {bi100_default::threads, bi100_default::items, BLOCK_LOAD_DIRECT, {LookbackDelayAlgorithm::fixed_delay, 350, 450}};
}
// Fallback
return {bi100_default::threads, bi100_default::items, BLOCK_LOAD_DIRECT, {LookbackDelayAlgorithm::fixed_delay, 350, 450}};
}
};
} // namespace muh::tuning::rle_non_trivial_runs

View File

@@ -1,42 +0,0 @@
// muh/include/muh/tuning/tuning_scan_by_key.cuh — BI-V100 scan_by_key tuning
//
// Mirrors: cccl_upstream/cub/cub/device/dispatch/tuning/tuning_scan_by_key.cuh
// vllm impact: attention mask prefix scan per sequence
// Competition weight: Input TPS × 2.799
#pragma once
#include "muh/hardware.cuh"
#include "muh/tuning/common.cuh"
namespace muh::tuning::scan_by_key {
struct ScanByKeyPolicy {
int threads_per_block;
int items_per_thread;
BlockLoadAlgorithm load_algorithm;
BlockStoreAlgorithm store_algorithm;
LookbackDelayPolicy lookback_delay;
};
struct bi100_default {
static constexpr int threads = 256;
static constexpr int items = 15;
static constexpr int load_algo = BLOCK_LOAD_WARP_TRANSPOSE;
static constexpr int store_algo = BLOCK_STORE_WARP_TRANSPOSE;
};
struct policy_selector {
int key_size;
int accum_size;
constexpr ScanByKeyPolicy operator()(const hardware_capability& hw) const {
if (hw.at_least(hardware_capability::vendor_t::iluvatar, 100)) {
return {bi100_default::threads, bi100_default::items, BLOCK_LOAD_WARP_TRANSPOSE, BLOCK_STORE_WARP_TRANSPOSE, {LookbackDelayAlgorithm::fixed_delay, 350, 450}};
}
// Fallback
return {bi100_default::threads, bi100_default::items, BLOCK_LOAD_WARP_TRANSPOSE, BLOCK_STORE_WARP_TRANSPOSE, {LookbackDelayAlgorithm::fixed_delay, 350, 450}};
}
};
} // namespace muh::tuning::scan_by_key

View File

@@ -1,38 +0,0 @@
// muh/include/muh/tuning/tuning_segmented_radix_sort.cuh — BI-V100 segmented_radix_sort tuning
//
// Mirrors: cccl_upstream/cub/cub/device/dispatch/tuning/tuning_segmented_radix_sort.cuh
// vllm impact: radix sort per segment
// Competition weight: Output TPS × 16.796
#pragma once
#include "muh/hardware.cuh"
#include "muh/tuning/common.cuh"
namespace muh::tuning::segmented_radix_sort {
struct SegmentedRadixSortPolicy {
int threads_per_block;
int items_per_thread;
int radix_bits;
};
struct bi100_default {
static constexpr int threads = 256;
static constexpr int items = 15;
static constexpr int radix_bits = 6;
};
struct policy_selector {
int key_size;
constexpr SegmentedRadixSortPolicy operator()(const hardware_capability& hw) const {
if (hw.at_least(hardware_capability::vendor_t::iluvatar, 100)) {
return {bi100_default::threads, bi100_default::items, bi100_default::radix_bits};
}
// Fallback
return {bi100_default::threads, bi100_default::items, bi100_default::radix_bits};
}
};
} // namespace muh::tuning::segmented_radix_sort

View File

@@ -1,39 +0,0 @@
// muh/include/muh/tuning/tuning_segmented_reduce.cuh — BI-V100 segmented_reduce tuning
//
// Mirrors: cccl_upstream/cub/cub/device/dispatch/tuning/tuning_segmented_reduce.cuh
// vllm impact: per-segment reduce in batched attention
// Competition weight: Output TPS × 16.796
#pragma once
#include "muh/hardware.cuh"
#include "muh/tuning/common.cuh"
namespace muh::tuning::segmented_reduce {
struct SegmentedReducePolicy {
int threads_per_block;
int items_per_thread;
int vec_size;
};
struct bi100_default {
static constexpr int threads = 256;
static constexpr int items = 16;
static constexpr int vec_size = 4;
};
struct policy_selector {
int accum_size;
int offset_size;
constexpr SegmentedReducePolicy operator()(const hardware_capability& hw) const {
if (hw.at_least(hardware_capability::vendor_t::iluvatar, 100)) {
return {bi100_default::threads, bi100_default::items, bi100_default::vec_size};
}
// Fallback
return {bi100_default::threads, bi100_default::items, bi100_default::vec_size};
}
};
} // namespace muh::tuning::segmented_reduce

View File

@@ -1,36 +0,0 @@
// muh/include/muh/tuning/tuning_segmented_scan.cuh — BI-V100 segmented_scan tuning
//
// Mirrors: cccl_upstream/cub/cub/device/dispatch/tuning/tuning_segmented_scan.cuh
// vllm impact: per-segment prefix scan
// Competition weight: Input TPS × 2.799
#pragma once
#include "muh/hardware.cuh"
#include "muh/tuning/common.cuh"
namespace muh::tuning::segmented_scan {
struct SegmentedScanPolicy {
int threads_per_block;
int items_per_thread;
};
struct bi100_default {
static constexpr int threads = 128;
static constexpr int items = 9;
};
struct policy_selector {
int accum_size;
constexpr SegmentedScanPolicy operator()(const hardware_capability& hw) const {
if (hw.at_least(hardware_capability::vendor_t::iluvatar, 100)) {
return {bi100_default::threads, bi100_default::items};
}
// Fallback
return {bi100_default::threads, bi100_default::items};
}
};
} // namespace muh::tuning::segmented_scan

View File

@@ -1,39 +0,0 @@
// muh/include/muh/tuning/tuning_segmented_sort.cuh — BI-V100 segmented_sort tuning
//
// Mirrors: cccl_upstream/cub/cub/device/dispatch/tuning/tuning_segmented_sort.cuh
// vllm impact: per-segment sorting
// Competition weight: Output TPS × 16.796
#pragma once
#include "muh/hardware.cuh"
#include "muh/tuning/common.cuh"
namespace muh::tuning::segmented_sort {
struct SegmentedSortPolicy {
int threads_per_block;
int items_per_thread;
int radix_bits;
};
struct bi100_default {
static constexpr int threads = 256;
static constexpr int items = 11;
static constexpr int radix_bits = 6;
};
struct policy_selector {
int key_size;
int value_size;
constexpr SegmentedSortPolicy operator()(const hardware_capability& hw) const {
if (hw.at_least(hardware_capability::vendor_t::iluvatar, 100)) {
return {bi100_default::threads, bi100_default::items, bi100_default::radix_bits};
}
// Fallback
return {bi100_default::threads, bi100_default::items, bi100_default::radix_bits};
}
};
} // namespace muh::tuning::segmented_sort

View File

@@ -1,39 +0,0 @@
// muh/include/muh/tuning/tuning_select_if.cuh — BI-V100 select_if tuning
//
// Mirrors: cccl_upstream/cub/cub/device/dispatch/tuning/tuning_select_if.cuh
// vllm impact: token filtering in speculative decoding
// Competition weight: Output TPS × 16.796
#pragma once
#include "muh/hardware.cuh"
#include "muh/tuning/common.cuh"
namespace muh::tuning::select_if {
struct SelectIfPolicy {
int threads_per_block;
int items_per_thread;
BlockLoadAlgorithm load_algorithm;
LookbackDelayPolicy lookback_delay;
};
struct bi100_default {
static constexpr int threads = 256;
static constexpr int items = 18;
static constexpr int load_algo = BLOCK_LOAD_WARP_TRANSPOSE;
};
struct policy_selector {
int input_size;
constexpr SelectIfPolicy operator()(const hardware_capability& hw) const {
if (hw.at_least(hardware_capability::vendor_t::iluvatar, 100)) {
return {bi100_default::threads, bi100_default::items, BLOCK_LOAD_WARP_TRANSPOSE, {LookbackDelayAlgorithm::fixed_delay, 350, 450}};
}
// Fallback
return {bi100_default::threads, bi100_default::items, BLOCK_LOAD_WARP_TRANSPOSE, {LookbackDelayAlgorithm::fixed_delay, 350, 450}};
}
};
} // namespace muh::tuning::select_if

View File

@@ -1,38 +0,0 @@
// muh/include/muh/tuning/tuning_three_way_partition.cuh — BI-V100 three_way_partition tuning
//
// Mirrors: cccl_upstream/cub/cub/device/dispatch/tuning/tuning_three_way_partition.cuh
// vllm impact: three-way split in scheduler
// Competition weight: Output TPS × 16.796
#pragma once
#include "muh/hardware.cuh"
#include "muh/tuning/common.cuh"
namespace muh::tuning::three_way_partition {
struct ThreeWayPartitionPolicy {
int threads_per_block;
int items_per_thread;
BlockLoadAlgorithm load_algorithm;
};
struct bi100_default {
static constexpr int threads = 256;
static constexpr int items = 12;
static constexpr int load_algo = BLOCK_LOAD_WARP_TRANSPOSE;
};
struct policy_selector {
int input_size;
constexpr ThreeWayPartitionPolicy operator()(const hardware_capability& hw) const {
if (hw.at_least(hardware_capability::vendor_t::iluvatar, 100)) {
return {bi100_default::threads, bi100_default::items, BLOCK_LOAD_WARP_TRANSPOSE};
}
// Fallback
return {bi100_default::threads, bi100_default::items, BLOCK_LOAD_WARP_TRANSPOSE};
}
};
} // namespace muh::tuning::three_way_partition

View File

@@ -1,36 +0,0 @@
// muh/include/muh/tuning/tuning_transform_tile.cuh — BI-V100 transform_tile tuning
//
// Mirrors: cccl_upstream/cub/cub/device/dispatch/tuning/tuning_transform_tile.cuh
// vllm impact: tiled activation kernels (SiLU/GELU on tiles)
// Competition weight: Output TPS × 16.796
#pragma once
#include "muh/hardware.cuh"
#include "muh/tuning/common.cuh"
namespace muh::tuning::transform_tile {
struct TransformTilePolicy {
int threads_per_block;
int items_per_thread;
};
struct bi100_default {
static constexpr int threads = 128;
static constexpr int items = 8;
};
struct policy_selector {
int min_elem_size;
constexpr TransformTilePolicy operator()(const hardware_capability& hw) const {
if (hw.at_least(hardware_capability::vendor_t::iluvatar, 100)) {
return {bi100_default::threads, bi100_default::items};
}
// Fallback
return {bi100_default::threads, bi100_default::items};
}
};
} // namespace muh::tuning::transform_tile

View File

@@ -1,41 +0,0 @@
// muh/include/muh/tuning/tuning_unique_by_key.cuh — BI-V100 unique_by_key tuning
//
// Mirrors: cccl_upstream/cub/cub/device/dispatch/tuning/tuning_unique_by_key.cuh
// vllm impact: deduplication in beam search
// Competition weight: Output TPS × 16.796
#pragma once
#include "muh/hardware.cuh"
#include "muh/tuning/common.cuh"
namespace muh::tuning::unique_by_key {
struct UniqueByKeyPolicy {
int threads_per_block;
int items_per_thread;
BlockLoadAlgorithm load_algorithm;
CacheLoadModifier load_modifier;
};
struct bi100_default {
static constexpr int threads = 256;
static constexpr int items = 12;
static constexpr int load_algo = BLOCK_LOAD_DIRECT;
static constexpr int load_mod = LOAD_DEFAULT;
};
struct policy_selector {
int key_size;
int value_size;
constexpr UniqueByKeyPolicy operator()(const hardware_capability& hw) const {
if (hw.at_least(hardware_capability::vendor_t::iluvatar, 100)) {
return {bi100_default::threads, bi100_default::items, BLOCK_LOAD_DIRECT, LOAD_DEFAULT};
}
// Fallback
return {bi100_default::threads, bi100_default::items, BLOCK_LOAD_DIRECT, LOAD_DEFAULT};
}
};
} // namespace muh::tuning::unique_by_key