libraries-openly-fused/fusedkernellibrary/fkl-build-and-test
Claude Code and agent skill by libraries-openly-fused/fusedkernellibrary
- community
Checking that the SKILL.md file is still in the repository.
Build the FusedKernelLibrary tests and run them. Covers cloning with the thread-pool submodule
Install
npx vskill@latest install libraries-openly-fused/fusedkernellibrary/fkl-build-and-testSKILL.md
Building and testing FKL
Build Options & Requirements
- Requires CMake >= 3.28, a C++20 host compiler, and CUDA.
- Only nvcc is supported as the CUDA compiler; clang-as-CUDA-compiler is not supported despite the
CLANG_HOST_DEVICE macro.
- Options:
ENABLE_CUDA(default ON if found),ENABLE_CPU(ON),ENABLE_CPU_MULTITHREAD(see below),
ENABLE_BENCHMARK (OFF).
- Binaries land in the out-of-source build folder at
../build— one executable per test unit,
suffixed _cu (CUDA) / _cpp (CPU).
The thread-pool submodule (ParArch::CPU_MULTITHREAD)
- The multithreaded CPU backend,
ParArch::CPU_MULTITHREAD, uses thethread-poolgit submodule. ALWAYS clone
with --recursive, or run git submodule update --init in an existing clone.
ENABLE_CPU_MULTITHREADdefaults to ON whenthread-pool/include/ThreadPool.hexists and to OFF otherwise. Forcing
it ON without the submodule is a FATAL_ERROR. When ON, the FKL target defines FK_CPU_MULTITHREAD_ENABLED (every test target gets it), adds thread-pool/include and links Threads::Threads.
- Without the submodule the backend is silently off: CMake only prints a STATUS line, the CPU_MULTITHREAD code of
the tests is compiled out, and utest_cpu_multithread_cpp passes while printing that it tested nothing. Check the configure output for CPU_MULTITHREAD backend (ENABLE_CPU_MULTITHREAD): ON.
- CI checks out submodules (
actions/checkoutwithsubmodules: true).
Build (Linux & WSL2)
- Requires CMake >= 3.28, a C++ host compiler, and CUDA.
- Options:
ENABLE_CUDA(default ON if found),ENABLE_CPU(ON),ENABLE_CPU_MULTITHREAD(ON if the
thread-pool submodule is checked out), ENABLE_BENCHMARK (OFF) for the benchmark targets.
- Binaries land in
../build— one executable per test unit,
suffixed _cu (CUDA) / _cpp (CPU).
Build (Windows)
Running the suite (Cross-Platform)
All tests must pass. The full suite is the merge gate: a header change that compiles can still break a distant instantiation, so ALWAYS run everything using ctest (66+ binaries, a few minutes). Tests are automatically registered with CTest.
Test tree layout
Tests are not written with a traditional framework. CMake auto-discovers test headers (*.h) via discover_tests() (excluding files matching *_common.*) and generates a launcher.cpp/launcher.cu stub. A new utest_*.h in an existing directory is picked up without CMake edits.
Writing a utest (Agent Instructions)
- ALWAYS use the TestCaseBuilder pattern when I ask you to write a test.
- DO NOT write standard Google Test/Catch2 macros; instantiate the op and pass it through TestCaseBuilder::addTest.
- Every test header must define a
launch()function returningint(0 = pass, non-zero = fail).
TestCaseBuilderinstantiates the op, runs exec on every input and compares against expected,
printing Running test for fk::...: Success!!.
- For ops with params, pass them through the builder's params overloads.
- Test EVERY public alias and
build()overload: template code only breaks on instantiation
(the ColorConversion alias bug shipped because no test instantiated COLOR_BGR2GRAY — see issue #244).
Testing ParArch::CPU_MULTITHREAD code
- Extend the EXISTING test of the DPP family under
#ifdef FK_CPU_MULTITHREAD_ENABLED: run every case also through
the Stream_<ParArch::CPU_MULTITHREAD>& entry point, stream.sync(), and require the output to match the ParArch::CPU output, plus the existing oracle checks: exactly (memcmp or ==) for integer outputs and float pipelines without multiply-add; within a tight tolerance (e.g. 1e-5 relative) for float pipelines that multiply and add, since g++ with FMA (-march=native, arm64) may contract a * b + c differently in the two versions.
- Use host memory (
MemType::Host): the_cutarget compiles the same header, and theredefaultMemTypeis
DeviceAndPinned. The CPU_MULTITHREAD code must compile under nvcc too.
- A check that means "GPU" must be
PA == ParArch::GPU_NVIDIA || PA == ParArch::GPU_AMD, notPA != ParArch::CPU. - The backend itself (stream order, sync, errors, buffer lifetime) is tested by
utests/core/execution_model/utest_cpu_multithread.h, which is _cpp only.
- Also check that the code compiles with the backend OFF (
-DENABLE_CPU_MULTITHREAD=OFF), and run the affected
_cpp tests under ThreadSanitizer. There is no CMake option for sanitizers; compile the generated launcher directly: g++ -O1 -g -fsanitize=thread -std=c++20 -ftemplate-depth=1000 -DFK_CPU_MULTITHREAD_ENABLED -I<repo> -I<repo>/include -I<repo>/thread-pool/include <build>/{tests,utests}/<name>_cpp/launcher.cpp <repo>/tests/main.cpp -pthread.
CI Matrix
GitHub workflows build on linux-amd64, linux-arm64 and windows-amd64 using self-hosted runners.
- Every workflow checks out submodules, so
ParArch::CPU_MULTITHREADis built and tested in CI. - Linux builds against
g++-13andclang++-23. - Windows builds against MSVC (
clversions 14.44 and 14.51) andclang-cl. - Keep changes warning-clean on BOTH compilers: clang is a first-class compiler for FKL (single-step host+device compiles matter for downstream packaging).
How to debug compile failures
Follow these steps when you get compilation errors when iterating your work:
- Read nvcc/clang template errors BOTTOM-UP: the last "instantiation of"
frame names the user-level line; the first error names the real culprit.
qualifiers dropped in binding reference of type 'X&&'=> somebody
passed explicit template args to a forwarding-reference function (see issue #245); let deduction happen.
name followed by "::" must be a class or namespace nameinside
fused_operation.h => a raw Operation was passed where an IOp was expected; wrap with Unary<...> / Binary<...>.
- Reduce: extract the failing instantiation into a 20-line main() with
only #include <fused_kernel/fused_kernel.h> + execution_model + algorithms headers — it compiles in seconds instead of minutes and makes upstream bug reports trivial.
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryChecking.github/skills/fkl-build-and-test/SKILL.md
Popularity
- Repository stars
- 58
- Repository forks
- 4
- 7-day trend score
- 20
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/libraries-openly-fused/fusedkernellibrary/fkl-build-and-test)