[MUH] Fix three-layer disconnect — C++ headers are now the single source of truth
Problems fixed:
1. gen_patch.py was reading .muh YAML (all nulls) instead of C++ headers.
Now it parses bi100_* structs directly from tuning_*.cuh via regex,
extracts constexpr values, and maps them to vllm injection points.
Verified: 11 patches generated from 6 algorithms.
2. C++ headers had no build system or tests.
Added CMakeLists.txt (header-only library target) and compile_test.cpp.
Verified: g++ -std=c++17 compiles all headers, 17/17 runtime checks pass.
Also added cuda_compile_test.cu for when nvcc is available.
3. baseline.muh had a tuning section full of nulls duplicating C++ values.
Stripped to vllm launch config only. Tuning values live exclusively
in muh/include/muh/tuning/tuning_*.cuh bi100_* structs.
4. Fixed constexpr goto in tuning_scan.cuh (C++17 doesn't allow goto in
constexpr; replaced with early-return + default: break pattern).
Data flow is now:
tuning_*.cuh (bi100_* constexpr) ──→ gen_patch.py ──→ vllm patches
baseline.muh (launch config) ──→ gen_yaml.py ──→ computility-run.yaml
compile_test.cpp ──→ g++/nvcc ──→ verify values are real
This commit is contained in:
41
muh/test/cuda_compile_test.cu
Normal file
41
muh/test/cuda_compile_test.cu
Normal file
@@ -0,0 +1,41 @@
|
||||
// muh/test/cuda_compile_test.cu — CUDA compilation test
|
||||
//
|
||||
// Verifies muh headers compile under nvcc/clang CUDA mode.
|
||||
// Does NOT require GPU execution — just compilation.
|
||||
|
||||
#include "muh/muh.cuh"
|
||||
|
||||
__global__ void dummy_kernel() {
|
||||
// Instantiate policy selectors in device code to verify
|
||||
// all constexpr paths compile on the device side
|
||||
auto hw = muh::hardware_capability::bi_v100();
|
||||
|
||||
// Reduce
|
||||
auto rp = muh::tuning::reduce::policy_selector{
|
||||
.accum_t = muh::tuning::type_t::float32,
|
||||
.operation_t = muh::tuning::op_kind_t::plus,
|
||||
.offset_size = 4,
|
||||
.accum_size = 4,
|
||||
}(hw);
|
||||
(void)rp;
|
||||
|
||||
// Topk
|
||||
auto tp = muh::tuning::topk::policy_selector{.key_size = 2}(hw);
|
||||
(void)tp;
|
||||
}
|
||||
|
||||
int main() {
|
||||
// Host-side test (same as compile_test.cpp core)
|
||||
auto hw = muh::target_hw;
|
||||
|
||||
auto reduce_policy = muh::tuning::reduce::policy_selector{
|
||||
.accum_t = muh::tuning::type_t::float32,
|
||||
.operation_t = muh::tuning::op_kind_t::plus,
|
||||
.offset_size = 4,
|
||||
.accum_size = 4,
|
||||
}(hw);
|
||||
|
||||
printf("CUDA compile test passed: reduce.threads=%d\n",
|
||||
reduce_policy.multi_tile.threads_per_block);
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user