libraries-openly-fused/fusedkernellibrary/fkl-data-structures

Claude Code and agent skill by libraries-openly-fused/fusedkernellibrary

Trust tier 2
  • community
LLM review pending
Source check pending

Checking that the SKILL.md file is still in the repository.

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.

Install

npx vskill@latest install libraries-openly-fused/fusedkernellibrary/fkl-data-structures

SKILL.md

FKL data structures

The hierarchy

  • RawPtr<ND, T> — POD: data pointer + PtrDims<ND>. What kernels see.
  • Ptr<ND, T> — ref-counted owner/wrapper around a RawPtr.
  • Convenience classes: Ptr1D, Ptr2D, Ptr3D, Tensor, TensorT.
  • .ptr() returns the RawPtr; Op::build(container) extracts what it needs. Copies of Ptr objects are SHALLOW (shared refcount).

Dimensionalities (ND)

NDlayoutuse
_1Dwflat arrays
_2Dw x h (pitched)images
_3Dw x h x planes x color_planesbatched images / planar CHW
T3Dtransposed: color_planes outermostNCHW-like DNN ingest

Constructors that matter (and their traps)

cpp
// allocating
Ptr2D<uchar3> img(width, height); // device by default
Tensor<float> t(width, height, planes, color_planes); // 3D batch
// wrapping EXTERNAL memory (zero-copy interop):
Ptr2D<float> wrap(devPtr, width, height, pitchBytes, MemType::Device);
Tensor<float> wrapT(devPtr, width, height, planes, color_planes, MemType::Device);

TRAPS (verified the hard way):

  1. Tensor has NO PtrDims-taking constructor — pass the dimension list.
  2. Tensor's semantics for batch+channels: planes = batch (thread.z), color_planes = channels. TensorSplit writes channel c of plane z at offset z * plane_pitch * color_planes + c * plane_pitch.
  3. TensorT(data, ...) and the 4-arg PtrDims<T3D> constructor leave pitches at ZERO (they are filled on allocation). When wrapping an external pointer for T3D, build the PtrDims and set pitch, plane_pitch, color_planes_pitch manually, then construct the RawPtr<T3D> and pass it to TensorTSplit<T>::build(rawPtr).
  4. Pitch is in BYTES. For tightly-packed external buffers, pitch = width * sizeof(T).

MemType

Device, Host, HostPinned, DeviceAndPinned (mirrored pair with .upload(stream) / .download(stream)). GPU pipelines require Device or DeviceAndPinned memory — CircularTensor enforces this at runtime.

Layout cheat-sheet for DNN interop

wantuseoutput shape
packed HWC batchTensorWrite<T>(batch, H, W, C-packed-in-T)
planar CHW per imageTensorSplit<T>(batch, C, H, W)
planar, C outermostTensorTSplit<T> into TensorT(C, batch, H, W)
read planar back as packedTensorPack<T> / TensorTPack<T>—

Vector pixel types

Channels are encoded in the TYPE: uchar3, float4, etc.

  • VBase<T> = scalar base, cn<T> = channels, VectorType_t<base, n>.
  • Per-channel arithmetic operators are predefined (vector_utils.h).
  • 16-bit types (ushort3, short2) work like the 8/32-bit ones.

External-framework interop (what bindings do)

A torch/cupy CUDA tensor is wrapped without copying:

cpp
Ptr2D<float> in((float*)cuda_ptr, w, h, w * sizeof(float), MemType::Device);
Stream s(reinterpret_cast<cudaStream_t>(framework_stream)); // non-owning

Contiguity is the caller's responsibility (require C-contiguous or read strides into the pitch argument).

Security

  • Security scanPassed, 100 of 100Pattern checks on the skill's files.
  • Model reviewNot runA model review is scheduled for the next rescan.

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

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
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/libraries-openly-fused/fusedkernellibrary/fkl-data-structures/badge)](https://verified-skill.com/skills/libraries-openly-fused/fusedkernellibrary/fkl-data-structures)

Something wrong with this skill or its page? Tell us.