بنقرة واحدة
fkl-build-and-test
Build the FusedKernelLibrary tests and run them. Covers CMake configuration for Linux
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Build the FusedKernelLibrary tests and run them. Covers CMake configuration for Linux
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Write user code with the Fused Kernel Library (FKL) — compose fused GPU/CPU pipelines with executeOperations, manage Ptr2D/Tensor data, streams, and runtime parameters. Use when writing an application or library that calls FKL, when porting OpenCV-style image pipelines to fused kernels, or when you need the canonical pipeline patterns (DNN preprocessing, multi-ROI crop, color conversion).
Wrap FKL from another language (Python, Rust, Julia...) using an AST/graph approach and JIT compilation. Covers why NVRTC fails, the Pointer Array ABI (void** for aligned parameters and I/O), generating C++ source strings for IOps and static DPP execution, zero-copy interop, and cross-platform shared library generation (.so/.dll). Use when building or extending a language binding for FKL.
Implement a new Operation for the Fused Kernel Library — Unary, Binary, Ternary, Read, Write, ReadBack or IncompleteReadBack structs, with Parent aliases, DECLARE_*_PARENT macros, build() overloads and unit tests. Use when adding an algorithm to FKL (new arithmetic, color conversion, geometric transform, memory pattern) or when a FusedOperation/alias fails to compile.
Use this skill to classify any FKL work as an Operation (Op), Data Parallel Pattern (DPP), or constexpr_lib. Trigger this before writing a new algorithm, when adapting an existing kernel to FKL standards, or when addressing PR review comments like 'should be a DPP' or 'not FKL'.
FKL data structures — Ptr2D, Tensor, TensorT, RawPtr, PtrDims, MemType, constructors and memory layouts (packed, planar CHW, transposed T3D). Use when allocating or wrapping GPU memory for FKL pipelines, when interfacing external pointers (torch/cupy buffers), or when a Tensor/TensorT constructor or pitch issue appears.
Choose and combine FKL's four fusion techniques — Vertical Fusion (VF), Backwards Vertical Fusion (BVF), Horizontal Fusion (HF) and Divergent Horizontal Fusion (DHF) — as described in the paper (arXiv:2508.07071). Use when deciding how to structure a pipeline for maximum fusion, when batching ROIs or images, or when different data planes need different processing in one kernel.
| name | fkl-build-and-test |
| description | Build the FusedKernelLibrary tests and run them. Covers CMake configuration for Linux |
CLANG_HOST_DEVICE macro.ENABLE_CUDA (default ON if found), ENABLE_CPU (ON), ENABLE_BENCHMARK (OFF).../build — one executable per test unit,
suffixed _cu (CUDA) / _cpp (CPU).mkdir build
git clone https://github.com/Libraries-Openly-Fused/FusedKernelLibrary.git
cd FusedKernelLibrary
# By default using native CUDA architecture
cmake -G "Ninja" -B ../build -DCMAKE_BUILD_TYPE=Release -S .
cmake --build ../build --config Release
ENABLE_CUDA (default ON if found), ENABLE_CPU (ON),
ENABLE_BENCHMARK (OFF) for the benchmark targets.../build — one executable per test unit,
suffixed _cu (CUDA) / _cpp (CPU).mkdir build
git clone https://github.com/Libraries-Openly-Fused/FusedKernelLibrary.git
cd FusedKernelLibrary
# IMPORTANT: You MUST activate the VS Developer Shell before running CMake (Enter-VsDevShell)
# By default using native CUDA architecture
cmake -G "Ninja" -B ..\build -DCMAKE_BUILD_TYPE=Release -S .
# WORKAROUND: The Ninja generator may generate an empty nvcc path in rules.ninja. Patch it before building:
(Get-Content ..\build\CMakeFiles\rules.ninja) -replace "\\nvcc\\bin\\nvcc.exe", "$env:CUDACXX" | Set-Content ..\build\CMakeFiles\rules.ninja
cmake --build ..\build --config Release
cd ../build
ctest --build-config Release --output-junit test_results.xml
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.
utests/ # unit tests (TestCaseBuilder pattern)
algorithm/image_processing/utest_color_conversion.h ...
core/...
tests/ # larger example-style tests
benchmarks/ # fusion benchmarks (ENABLE_BENCHMARK=ON)
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.
launch() function returning int (0 = pass, non-zero = fail).// utests/algorithm/basic_ops/utest_myop.h
#include <tests/main.h>
#include <fused_kernel/algorithms/basic_ops/arithmetic.h>
#include <tests/operation_test_utils.h>
void testMyOp() {
std::array<float, 2> inputVals{2.f, 3.f};
std::array<float, 2> expectedVals{4.f, 6.f};
TestCaseBuilder<fk::MyOp<float>>::addTest(testCases, inputVals, expectedVals);
}
START_ADDING_TESTS
testMyOp();
STOP_ADDING_TESTS
int launch() { RUN_ALL_TESTS }
TestCaseBuilder instantiates the op, runs exec on every input and compares against expected,
printing Running test for fk::...: Success!!.build() overload: template code only breaks on instantiation
(the ColorConversion alias bug shipped because no test instantiated COLOR_BGR2GRAY — see issue #244).GitHub workflows build on linux-amd64, linux-arm64 and windows-amd64 using self-hosted runners.
g++-13 and clang++-21.cl versions 14.44 and 14.51) and clang-cl.Follow these steps when you get compilation errors when iterating your work:
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 name inside
fused_operation.h => a raw Operation was passed where an IOp was
expected; wrap with Unary<...> / Binary<...>.#include <fused_kernel/fused_kernel.h> + execution_model +
algorithms headers — it compiles in seconds instead of minutes and
makes upstream bug reports trivial.