본문으로 건너뛰기

Testing and CI

TinyLoop validation currently has three layers:

  1. CUDA-side unit tests
  2. generation and parity regressions
  3. self-hosted CUDA CI wiring

CTest Coverage

Current tests include:

TestPurpose
tinyloop.test_int2_kernelINT2 kernel correctness
tinyloop.test_opsLayerNorm, residual, embedding, and fused op coverage
tinyloop.test_attentionAttention correctness including production-shape prefill check
tinyloop.test_kv_cacheKV-cache helper correctness
tinyloop.test_fp16_gemmFP16 GEMM correctness
tinyloop.test_decode_parityHidden/logit parity between cached and uncached decode
tinyloop.test_generate_regressionRaw-byte CLI generation parity
tinyloop.test_generate_tokenizer_regressionTokenizer-aware Python generation parity
tinyloop.test_generate_eval_sliceSmall eval-slice parity coverage
tinyloop.test_speculative_greedy_regressionSpeculative greedy parity
tinyloop.test_speculative_sampling_regressionSpeculative sampling parity
tinyloop.test_prefix_cache_regressionPrefix-cache parity
tinyloop.test_int4_kernelINT4 kernel correctness
tinyloop.test_ropeRoPE kernel parity (prefill, decode, V-slice invariance)
tinyloop.test_gqaGQA attention (MHA parity, fewer KV heads, cached decode, cache append)
tinyloop.test_fused_ln_qkvFused LN+QKV kernel parity and norm output
tinyloop.test_variable_l_parityVariable-L logit-lens parity at L=16
tinyloop.test_memory_leak5-cycle load/unload GPU memory growth detection
tinyloop.test_fuzzRandom seq_len/L/tokens fuzzing (50 iterations)
tinyloop.test_kv_cache_regression27-point cached-vs-uncached multi-token parity sweep
tinyloop.test_constrained_decodingRegex/choice/JSON-shape grammar-constrained generation
tinyloop.test_paged_attentionPaged KV pool, page table, paged vs contiguous parity

Tooling:

ToolPurpose
tools/perf_regression.pyBenchmark baseline/compare with regression threshold
tools/trace_to_chrome.pyCUDA profile → chrome://tracing JSON visualization
tools/trace_tokens.pyToken trajectory — argmax flips across loop iterations
tools/convert.pyUnified PyTorch → .tinyloop converter

Local Commands

Run the suite:

ctest --test-dir tinyloop/build --output-on-failure

Run with a model artifact:

TINYLOOP_TEST_MODEL_PATH=/absolute/path/to/model.tinyloop \
ctest --test-dir tinyloop/build --output-on-failure

Skip Semantics

Model-dependent tests use skip code 77 when prerequisites are missing.

That means:

  • missing model artifacts do not poison the whole test run
  • missing Python binding support does not turn optional tests into false failures

Python-Dependent Regressions

The tokenizer-aware and eval-oriented regressions require:

  • pybind11
  • Python module build support
  • numpy
  • transformers
  • sometimes datasets

If those are unavailable, the tests skip cleanly.

Direct Regression Scripts

Run the raw-byte CLI regression:

TINYLOOP_TEST_BINARY=/path/to/tinyloop \
TINYLOOP_TEST_MODEL_PATH=/path/to/model.tinyloop \
python tinyloop/tests/test_generate_regression.py

Run tokenizer-aware parity:

TINYLOOP_TEST_BUILD_DIR=/path/to/tinyloop/build \
TINYLOOP_TEST_MODEL_PATH=/path/to/model.tinyloop \
python tinyloop/tests/test_generate_tokenizer_regression.py

Run prefix-cache parity:

TINYLOOP_TEST_BUILD_DIR=/path/to/tinyloop/build \
TINYLOOP_TEST_MODEL_PATH=/path/to/model.tinyloop \
python tinyloop/tests/test_prefix_cache_regression.py

Microbenchmarks

bench_hot_ops is not just a convenience binary. It is the fastest way to verify hot-path changes in:

  • QKV projection
  • attention output projection
  • prefill attention
  • cached decode attention
  • SwiGLU
  • down projection
  • head projection

GitHub Actions

The repository includes a self-hosted CUDA workflow:

.github/workflows/cuda-ci.yml

It currently:

  • installs Python dependencies
  • configures the build
  • builds the project
  • runs CTest

What CI Still Does Not Do

Current CI does not yet provide:

  • automated performance regression tracking
  • multiple GPU-family coverage
  • release artifact generation
  • end-to-end serving tests

Those are still roadmap items, not present guarantees.