Skip to content
Skills Library
Programming · Building & coding

hls-line-buffer

/hls-line-buffer

Fill the HLS line-buffer and window-buffer gap for stencil kernels, including TOTAL_ITER drain and verification. Use when generated buffer code misses the drain or the check.

Licence
MIT
Last repository change
23.10.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
2
Scripts
0
HTML comments
1
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 23.10.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What to check before installing
  • SKILL.md zawiera komentarze HTML (1). Nie widać ich w podglądzie Markdown, a model je czyta.

What it does and when to use it

Fill the HLS line-buffer and window-buffer gap for stencil kernels, including TOTAL_ITER drain and verification. Use when generated buffer code misses the drain or the check.

Original author description

Fill the HLS line-buffer and window-buffer gap for stencil kernels, including TOTAL_ITER drain and verification. Use when generated buffer code misses the drain or the check.

How it works

  1. 1 — Run for TOTALITER, not ROWS x COLS
  2. 2 — Verify the LLM applied step 1 correctly
Original SKILL.md headings · 41 lines, 314 words
SKILL.md preview
---
name: hls-line-buffer
description: Fill the HLS line-buffer and window-buffer gap for stencil kernels, including TOTAL_ITER drain and verification. Use when generated buffer code misses the drain or the check.
license: MIT
metadata:
  author: "Sai Akhil Ayyagari"
  version: "1.0.0"
---
<!--
Copyright (C) 2026, Advanced Micro Devices, Inc. All rights reserved.
SPDX-License-Identifier: MIT
-->
# HLS Line Buffer

The LLM can generate a line buffer and window buffer structure on its own. This guide fills the gap on what it consistently gets wrong.

**Before generating code, understand the flow below, then produce code that matches it.**

**Constants** (derive before writing code):
- `KRAD = KSIZE / 2` — kernel radius (e.g. KSIZE=15 -> KRAD=7)
- `NLB = KSIZE - 1` — number of line buffer rows
- `WARMUP = KRAD * COLS + KRAD` — iterations before first valid output pixel
- `TOTAL_ITER = ROWS * COLS + WARMUP` — total loop iterations

---

## 1 — Run for TOTAL_ITER, not ROWS x COLS

After the last image pixel, the line buffer still holds KRAD rows of real data that have never been centered in the window. Without extra iterations those rows are never output.

Fix: run the compute loop for TOTAL_ITER iterations. Read the actual pixel from the stream when `n < ROWS * COLS`, otherwise use zero — all in one loop:

```cpp
U8 pixel = (n < num_pixels) ? pixel_stream.read() : 0;
```

The zeros flush the last rows through so every pixel gets centered and output. Use **one loop** — not two separate loops (two loops add an FSM transition and cost ~16 cycles).

---

## 2 — Verify the LLM applied step 1 correctly

Check these before running csim/cosim:

- `TOTAL_ITER = ROWS * COLS + WARMUP` — not just `ROWS * COLS`
- `WARMUP = KRAD * COLS + KRAD` — uses the same COLS as col_ptr wrapping (if col_ptr wraps at COLS_POW2, WARMUP must also use COLS_POW2)
- Zero tail is inline in the loop (`n < num_pixels` ternary), not a second loop
- Output is gated on `n >= WARMUP` — no output written during warmup
Files in this package (2)
  • SKILL.md 2 KB
  • skill-card.md 1 KB

Versions

The database has no other skills named hls-line-buffer.

Database snapshot: 13.11.2026 · package version b777f0d54b71 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100stencil
    Use this skill when the user says 'Stencil', 'Stencil.js', 'Stencil component', 'Stencil web component', 'Stencil setup', 'Stencil compiler', 'Stencil design system', 'web component compiler', or when building reusable web components with Stencil. This skill enforces: Stencil…
  • 100hls-c2rtl
    Translate C / C++ / SystemC algorithmic descriptions into synthesizable RTL via High-Level Synthesis. Use when the user says "HLS", "C to RTL", "C++ to Verilog", "Vitis HLS", "Catapult", "XLS", "algorithmic design", or provides a reference implementation in software and asks for hardware.
  • 100hls
    High-Level Synthesis — C/C++ algorithm analysis, HLS directive optimisation, synthesis execution, and co-simulation verification. Use when converting C/C++ to synthesisable RTL, optimising for latency/throughput/area targets using pragmas, or verifying that generated RTL matches the golden C model.
  • 100bc-stencil
    Build BigCommerce Stencil themes — Handlebars templates, front matter, theme objects, SCSS, JavaScript modules, config.json, schema.json, and Stencil CLI. Use when creating or customizing BigCommerce storefront themes.
  • 90esp32-zero-copy-buffer-ownership
    Use when designing, reviewing, debugging or validating zero copy buffer ownership for ESP32 firmware; apply target-specific constraints, failure analysis and measurable verification before release.
  • 100esp32-dma-buffer-placement
    Use when reviewing or implementing esp32 dma buffer placement on an ESP32 target., including target-specific constraints and repeatable validation steps.

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.