一键导入
optimize-fft-plan-cache
Replace single-plan FFT cache with multi-plan cache to avoid ~5ms cuFFT plan recreation when alternating between FFT sizes
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Replace single-plan FFT cache with multi-plan cache to avoid ~5ms cuFFT plan recreation when alternating between FFT sizes
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Add device information query functions through HAL → ins:: API → language bindings
Add --device all/--timer/--info CLI flags to demos across all languages for competition scoring
Add composite signal operators using existing primitives (no dedicated backend kernels needed)
How to port a cusignal Python/CUDA module to ins::signal C++ using Insight7 primitives and HAL
Profile and optimize binding language (Lua/Julia/Python) demo performance to match or exceed C++ baseline
busted loads _insight.so from ~/.luarocks/lib first, not build/ — must copy .so after rebuild
| name | optimize-fft-plan-cache |
| description | Replace single-plan FFT cache with multi-plan cache to avoid ~5ms cuFFT plan recreation when alternating between FFT sizes |
| source | auto-skill |
| extracted_at | 2026-06-06T21:02:49.144Z |
雷达 demo 交替调用 range FFT(2048 点)和 Doppler FFT(32 点),单 plan 缓存每次切换大小都 destroy + recreate,cuFFT plan 创建 ~5ms,导致 GPU FFT 和 CPU 差不多快。
unordered_map 多 plan 缓存文件:backends/cuda/kernels/fft/common.cuh
(n, batch, kind, is_f32) — direction 不参与 key,因为 C2C plan 同时支持 forward/inverse,R2C/C2R 方向隐含在 kind 中std::unordered_map<CuFFTKey, cufftHandle, CuFFTKeyHash>plans.begin())cufftDestroy 所有 plancufft_ensure_plan() 简化为一行:return cufft_get_cache().get_or_create(n, batch, kind, is_f32);文件:backends/cpu/kernels/fft/common.h + common_impl.cpp
fft_cache_find_or_create() 用 FFTWCacheEntry[8] 数组,key = (n, batch, direction, kind, is_f64)memmove 前移| 决策 | 原因 |
|---|---|
| direction 不在 cuFFT key 中 | C2C plan 同时 forward/inverse;R2C/C2R 方向隐含 |
| cuFFT 用 unordered_map | 查找 O(1),最多 16 个 plan |
| FFTW 用固定数组 | 避免依赖 C++ STL 在 C 代码中 |
| FFTW C2C 不缓存 | FFTW_ESTIMATE 的 C2C plan 依赖创建时的 buffer 地址 |
| FFTW R2C/C2R 缓存 | fftw_execute_dft_r2c/c2r 不受 buffer 影响 |
ins.fft./insight_tests_cpu 和 ./insight_tests_cuda 全部通过