Purpose: This document gives a new agent 100% of the context needed to resume work on this project. Read this FULLY before taking any action. Last Updated: March 16, 2026 (production-hardening continuation) Workspace:
D:\Projects\BitbyBit\custom_gpu_projectOS: Windows, Shell: PowerShell Git: Do NOT push anything to GitHub (user request)
- Project Overview
- Current State — The Numbers
- Complete File Structure
- Architecture — Two Parallel Implementations
- Phase-by-Phase Module Registry
- End-to-End Integrated Pipeline (Phase 16)
- Critical Evaluation — Honest Weaknesses
- Benchmark Results (All Measured from Simulation)
- GPT-2 Functional Model (Software Reference)
- Simulation & Tooling
- Known Bugs & Limitations
- Key Design Decisions & Rationale
- What Was Attempted But Not Completed
- Action Plan (What To Do Next)
- Quick-Start for Next Agent
Canonical metrics notice: The authoritative snapshot is in the latest "Continuation Update — Rectification Closure (Mar 16, 2026)" section near the end of this document. Earlier sections are preserved as historical execution logs and may contain older intermediate numbers.
A fully custom GPU accelerator designed from scratch in Verilog for transformer/LLM inference (GPT-2). The project has evolved through 16 phases from basic compute primitives to a full integrated pipeline with advanced optimizations.
"Building a custom GPU for an AI model for efficient computing and fast computing."
- 76 RTL source files across 8 directories
- 72 testbench files across 10 directories
- 55 modules in the automated test suite
- 301 individual tests, ALL PASSING
- 22 utility scripts (Python + PowerShell + batch)
- 12 documentation files
- 16 development phases completed
| Component | Technology |
|---|---|
| HDL | Verilog-2005 (NOT SystemVerilog) |
| Simulator | Icarus Verilog 12.0 (D:\Tools\iverilog\bin\iverilog.exe) |
| Runner | D:\Tools\iverilog\bin\vvp.exe |
| Waveforms | GTKWave (D:\Tools\iverilog\bin\gtkwave.exe) |
| Scripts | PowerShell, Python 3.14, batch |
| Python env | Conda env exists with torch/transformers (user confirmed) |
| Clock target | 100 MHz FPGA |
================================================================
CUSTOM GPU - FULL TEST SUITE
================================================================
Modules tested : 55
Total PASS : 302
Total FAIL : 0
>>> ALL TESTS PASSED - GPU READY FOR DEPLOYMENT <<<
Every module from P1 through P17 passes. Full output in sim/ directory.
Continuation update (Mar 14, 2026):
- Added unified top-level
rtl/top/gpu_system_top_v2.v+tb/top/gpu_system_top_v2_tb.v - Added
P9 gpu_system_top_v2toscripts/run_tests.py(8/8 PASS) - Fixed
P8 nanogpt_q4_e2egolden mismatch (tb/gpt2/nanogpt_q4_tb.v) and revalidated - Added continuation modules into
scripts/run_all_tests.ps1asP17 - Latest regression snapshots:
python scripts/run_tests.py: 28 modules, 147 PASS, 0 FAILpowershell -ExecutionPolicy Bypass -File .\scripts\run_all_tests.ps1: 55 modules, 282 PASS, 0 FAILfull_model_inference_tb: 5/5 PASS, total inference 353 cycles
- Deep review update (Mar 14, 2026, 8 sub-agents + web baseline cross-check):
- Critical weaknesses were found in GPT-2 output semantics, attention numerical correctness, DMA edge safety, and memory allocator race handling.
- Verification/automation gaps identified (some cocotb/script paths can soft-pass on timeout/error).
- Gap-closure implementation and final status tables are documented in
docs/progress.mdsection 12.5-12.8.
- Swarm re-audit update (Mar 14, 2026, fresh simulation + 8-agent post-fix sweep):
- Fresh reruns confirm:
run_tests.py28 modules, 147 PASS, 0 FAIL andfull_model_inference_tb5/5 PASS, 353 cycles. - Cross-cut revalidation confirms
run_all_tests.ps1snapshot remains 55 modules, 282 PASS, 0 FAIL. - Residual open items were identified and documented in
docs/progress.mdsection 12.9:q4_weight_pipelinequant params currently not applied in MAC pathparallel_softmaxmax-reduction and fixed-4 sum parameterization issuesaxi_weight_memorycommit-time liveWSTRBusage (strobe-latching hazard)optimized_transformer_layercompletion flags are sticky across starts- test runners need strict non-zero exits/timeout hardening for CI-grade guarantees
- Fresh reruns confirm:
- Blocker-closure update (Mar 15, 2026):
- Patched critical review blockers:
- AXI outstanding-response gating (
axi_weight_memory) now blocks AW/W acceptance whileBVALIDis pending. - Runner exit classification fixed (
run_tests.py,run_all_tests.ps1) to fail-close on any failed modules. - PowerShell timeout path hardened to bounded process wait/kill with redirected output capture.
- AXI outstanding-response gating (
- Added AXI backpressure directed test in
axi_weight_memory_tb. - Latest regression snapshots:
python scripts/run_tests.py: 28 modules, 151 PASS, 0 FAILpowershell -ExecutionPolicy Bypass -File .\scripts\run_all_tests.ps1: 55 modules, 285 PASS, 0 FAILfull_model_inference_tb: 5/5 PASS, total inference 353 cycles
- Patched critical review blockers:
- Competition-context update (Mar 15, 2026):
- Added source-backed external baseline scan and phase-loop architecture to
docs/progress.mdsection 12.11. - Primary-source fetch confirms strong external references for FlashAttention/vLLM/GQA/KIVI/Medusa and hosted throughput examples (Groq/Cerebras pages).
- Follow-up fetch found primary Taalas HC1 claim page:
https://taalas.com/the-path-to-ubiquitous-ai/(claims 17K tokens/sec/user on hard-wired Llama 3.1 8B, vendor-reported). - Treat Taalas HC1 numbers as primary-sourced but vendor-measured until independently reproduced.
- Mandatory workflow moving forward per user requirement:
- Implement -> Review Swarm -> Fix Swarm -> Regressions -> Document after every phase.
- Added source-backed external baseline scan and phase-loop architecture to
- Phase1 closure update (Mar 15, 2026):
- Executed full loop with swarm reviews and fix swarms for:
- R8 backpressure/token-ingress robustness in
layer_pipeline_controller - R4 completion pulse semantics/back-to-back start safety in
optimized_transformer_layer - fail-closed CI smoke hardening (
run_tests.py+ newci_fail_closed_smoke.py)
- R8 backpressure/token-ingress robustness in
- Independent re-review swarm verdict: GO for R4, R8, and fail-closed CI scope (no remaining Critical/High findings in reviewed files).
- Latest regression snapshots after closure:
python scripts/run_tests.py: 28 modules, 151 PASS, 0 FAILpowershell -ExecutionPolicy Bypass -File .\scripts\run_all_tests.ps1: 55 modules, 290 PASS, 0 FAILpython scripts/ci_fail_closed_smoke.py: PASS (all negative-path checks)full_model_inference_tb: 5/5 PASS, total inference 353 cycles
- Executed full loop with swarm reviews and fix swarms for:
- Phase2 imprint-mode update (Mar 15, 2026):
- Added optional hardwired embedding profile path for
gpu_system_top_v2:- New module:
rtl/memory/imprinted_embedding_rom.v - Flag map:
cp_compute_flags[0]enable,cp_compute_flags[2:1]profile (01mini,10gemma export-v1) - Added deeper hardwired MINI compute path via
rtl/integration/imprinted_mini_transformer_core.v
- New module:
- Baseline-safe behavior:
- Imprint disabled keeps existing dynamic embedding path unchanged.
- Unsupported imprint profile now rejects fail-closed (
status_error+ completion), with no writeback side-effects.
- Verification expansion:
gpu_system_top_v2_tbextended from 8/8 to 13/13 with directed mini/gemma profile checks, interleaved multi-run speed stability checks, odd-byte rejection checks, and explicit post-error recovery checks.- AXI task timeout handling hardened to hard-fail (
$fatal) to avoid false-pass behavior.
- Review loop outcome:
- Initial review NO-GO due TB timeout fail-open.
- Fix + re-review verdict: GO (no remaining Critical/High in scope).
- Final closure re-review after added reject/recovery hardening: GO.
- Latest regression snapshots after hardwired + warning-closure patches:
python scripts/run_tests.py: 28 modules, 156 PASS, 0 FAILpowershell -ExecutionPolicy Bypass -File .\scripts\run_all_tests.ps1: 55 modules, 295 PASS, 0 FAILfull_model_inference_tb: 5/5 PASS, total inference 353 cycles
- Speed comparison rerun (measured @100MHz, review-safe methodology):
gpu_system_top_v2baseline MATMUL path: 35 cycles (350 ns, ~2.86M cmds/s)gpu_system_top_v2MINI imprint profile: 20 cycles (200 ns, 5.00M cmds/s)gpu_system_top_v2GEMMA exported profile: 35 cycles (350 ns, ~2.86M cmds/s)- MINI hardwired uplift: 1.75x lower command latency vs baseline.
- Added optional hardwired embedding profile path for
- Phase3 P1 swarm closure + rigorous benchmark update (Mar 15, 2026):
- Closed high-impact P1 blockers in scoped files:
- fail-closed TB summary enforcement (
$fatalon aggregate failures/timeouts) - unsupported imprint profile reject path
parallel_softmaxoverflow-safe diff handlingq4_weight_pipelinesigned activation + 32-bit accumulator hardeningsystolic_arraysigned INT4 consistency + valid pipeline robustness- deterministic scratchpad dual-write collision policy + directed TB
- top-level DMA ext->local 32->16 split-write adapter + odd-byte DMA reject guard
- fail-closed TB summary enforcement (
gpu_system_top_v2_tbexpanded to 15/15 PASS with new directed checks:- odd-byte DMA rejection
- unsupported imprint profile rejection
- Latest regression snapshots:
python scripts/run_tests.py: 34 modules, 199 PASS, 0 FAILpowershell -ExecutionPolicy Bypass -File .\scripts\run_all_tests.ps1: 55 modules, 308 PASS, 0 FAILpython scripts/ci_fail_closed_smoke.py: PASS
- Current measured benchmark snapshot:
gpu_system_top_v2_tb: baseline 35 / mini 20 / gemma 35 cyclesend_to_end_pipeline_tb: 12/12 PASS, 26 cyclesfull_model_inference_tb: 5/5 PASS, 358 cycles, ~279,329 tok/s (MEDUSA effective ~837,988 tok/s)integration_speed_benchmark_tb: 9/9 PASS (done-pulse capture and fail-closed summary hardened)
- Closed high-impact P1 blockers in scoped files:
- Phase3 completion update (Mar 15, 2026):
- Closed
phase3-integration-speed-closure:tb/integration/integration_speed_benchmark_tb.vnow captures single-cycle done pulses correctly for GQA/KVQ/Compression benches.- Benchmark summary now fails closed (
$fatal) on aggregate mismatch or timeout. - Latest measured result: 9/9 PASS.
- Closed
phase3-gemma-real-export:- Added
scripts/export_gemma3_imprint.pyto generate ROM-ready Gemma imprint assets (token_emb,pos_emb,token_map,manifest). rtl/memory/imprinted_embedding_rom.vprofile2'b10now consumes exported ROM images (weights/imprint/gemma3_270m_*) instead of deterministic bootstrap formulas.tb/top/gpu_system_top_v2_tb.vupdated to validate exported ROM-backed GEMMA vectors.
- Added
- Closed
phase3-benchmark-proof-pack:- Added
scripts/build_phase3_benchmark_proof_pack.py. - Generated reproducible artifacts:
sim/phase3_benchmark_proof_pack.jsonsim/phase3_benchmark_proof_pack.csv- source logs:
sim/phase3_*_bench.log
- Added
- Closed
- Phase4 remediation update (Mar 15, 2026):
- Closed audit-wave critical script/demo gaps:
scripts/run_demo.ps1migrated to a compatibility wrapper overscripts/demo_day.ps1(maintained bench set).scripts/run_all_tests.ps1now resolves tool paths viaBITBYBIT_IVERILOG/BITBYBIT_VVPwith PATH fallback.scripts/run_cosim.py,scripts/run_scaled_cosim.py, andscripts/run_sentence_cosim.pynow use the same env-aware tool resolution.
- Closed KV quantization correctness/oracle gap:
rtl/memory/kv_cache_quantizer.vswitched to rounded divide-by-scale quantization with explicit[0..15]clamp.tb/memory/kv_cache_quantizer_tb.vstrengthened with roundtrip-error and monotonic-bin assertions; fail-closed timeout/summary.
- Latest regression snapshots after these remediations:
python scripts/ci_fail_closed_smoke.py: PASSpython scripts/run_tests.py: 28 modules, 159 PASS, 0 FAILpowershell -ExecutionPolicy Bypass -File .\scripts\run_all_tests.ps1: 55 modules, 301 PASS, 0 FAILpowershell -ExecutionPolicy Bypass -File .\scripts\run_demo.ps1 -Mode compare: PASS
- Closed audit-wave critical script/demo gaps:
- Phase5 web-swarm architecture hardening update (Mar 15, 2026):
- Swarm-guided gap closure implemented:
optimized_transformer_layertail-stage overlap (KV quant + activation compression launched in parallel).prefetch_engineDMA-done latch hardening forWAIT_PREFETCHrace resistance.prefetch_engine_tbnow includes directedlayer_done + dma_donesame-window race test.gpu_system_top_v2_tbspeed guard threshold adjusted to robust margin after baseline-latency improvement.demo_day.ps1now supports workload-matrix paired measured runs by default with run-bundle JSON (sim/compare_summary_latest.json).build_phase3_benchmark_proof_pack.pynow ingests paired compare summary and emits mean/min/max speedup statistics.
- Deep-hardwiring continuation closure (Mar 16, 2026):
parallel_softmax.vupgraded to LUT+reciprocal normalization path (exp_lut_256+recip_lut_256) with stable sum/order behavior.optimized_transformer_layer.vstage handoff bubble states removed for immediate stage-to-stage launch (RoPE->GQA->SM->GELU), preserving parallel tail.gpu_system_top_v2.vnow includes optional feature-gated prefetch/scheduler integration with shared DMA owner arbitration and CP-safe done routing.run_demo.ps1wrapper now forwards-WorkloadMode/-WarmupRuns/-MeasuredRunsand demo canonical measured logs are emitted UTF-8 for proof-pack parse reliability.
- Latest regression snapshots after hardening:
python scripts/ci_fail_closed_smoke.py: PASSpython scripts/run_tests.py: 34 modules, 195 PASS, 0 FAIL (coverage-expanded)powershell -ExecutionPolicy Bypass -File .\scripts\run_all_tests.ps1: 55 modules, 302 PASS, 0 FAIL
- Latest measured performance snapshot:
end_to_end_pipeline_tb: 26 cycles (from 29)gpu_system_top_v2_tbbaseline/MINI/GEMMA: 35 / 20 / 35 cyclesfull_model_inference_tb: 358 cycles, ~279,329 tok/s (MEDUSA effective ~837,988 tok/s)full_model_inference_imprint_tb: 112 cycles, ~892,857 tok/s- base-vs-imprint measured uplift: 3.1964x
- Swarm-guided gap closure implemented:
TOTAL INFERENCE: 358 cycles = 3,580 ns = 3.58 μs @ 100 MHz
Token throughput: ~279,329 tokens/second
With MEDUSA 3-head: ~837,988 effective tokens/second
This is a REAL end-to-end number — Token ID 5 entered the embedding, flowed through all 12 transformer layers, and produced MEDUSA predictions. Output in sim/model_out.txt.
| Metric | Base full-model path | Taalas-inspired MINI imprint path |
|---|---|---|
| Total inference cycles/token | 358 | 112 |
| Latency/token | 3.580 us | 1.120 us |
| Tokens/second | 279,329 tok/s | 892,857 tok/s |
| MEDUSA effective throughput | 837,988 tok/s | 2,678,571 tok/s |
Measured full-model uplift (same 12-layer emulation setup): 3.20x.
Evidence logs:
sim/measured_full_model_base.logsim/measured_full_model_imprint.logsim/measured_gpu_system_top_v2_bench.log
D:\Projects\BitbyBit\custom_gpu_project\
│
├── HANDOFF.md # THIS FILE
├── CLAUDE.md # Gemini/Claude project context
├── cosim_output.txt # Previous cosim run (dim=4)
├── cosim_report.txt # Sentence cosim report (dim=4)
├── cosim_report_dim64.txt # Scaled cosim report (dim=64)
├── cosim.vcd # VCD waveform from cosim
│
├── rtl/
│ ├── primitives/ # Phase 1: Core compute (9 files)
│ │ ├── zero_detect_mult.v # Signed 8-bit multiply with zero-skip
│ │ ├── variable_precision_alu.v # 4/8/16-bit parallel signed ALU
│ │ ├── sparse_memory_ctrl.v # Direct-mapped sparse memory
│ │ ├── fused_dequantizer.v # INT4 → signed INT8
│ │ ├── gpu_core.v # N-lane pipelined compute core (KEY)
│ │ ├── gpu_multicore.v # Multi-core wrapper
│ │ ├── gpu_top.v # Original FSM pipeline
│ │ ├── gpu_top_pipelined.v # 5-stage pipeline
│ │ └── gpu_top_integrated.v # 4-wide pipeline
│ │
│ ├── compute/ # Phases 2,8,9,10,11,13,15 (29 files)
│ │ ├── mac_unit.v # Multiply-accumulate
│ │ ├── systolic_array.v # NxN PE mesh, weight-stationary
│ │ ├── gelu_activation.v # GELU via LUT
│ │ ├── gelu_lut_256.v # 256-entry GELU lookup table
│ │ ├── softmax_unit.v # Softmax: max-sub + exp LUT + normalize
│ │ ├── exp_lut_256.v # 256-entry exp() LUT
│ │ ├── inv_sqrt_lut_256.v # 256-entry 1/sqrt(x) LUT
│ │ ├── recip_lut_256.v # Reciprocal LUT
│ │ ├── bf16_multiply.v # BF16 multiplier (not in main path)
│ │ ├── int4_pack_unit.v # INT4 pack/unpack
│ │ ├── tiled_matmul.v # Tile controller for large matrices
│ │ ├── online_softmax.v # Phase 8: Streaming softmax (saves memory)
│ │ ├── online_softmax_unit.v # Online softmax helper
│ │ ├── sparsity_decoder_2_4.v # Phase 8: NVIDIA 2:4 structured sparsity
│ │ ├── sparsity_encoder.v # Sparsity encoder
│ │ ├── activation_compressor.v # Phase 8: 16→8bit activation compression
│ │ ├── sparse_pe.v # Sparse processing element
│ │ ├── block_dequantizer.v # Block dequantization
│ │ ├── w4a8_decompressor.v # Phase 9: W4A8 mixed precision
│ │ ├── moe_router.v # Phase 9: Mixture of Experts router
│ │ ├── speculative_decode_engine.v # Phase 10: Speculative decoding
│ │ ├── mixed_precision_decompressor.v # Phase 11: Mixed precision
│ │ ├── q4_weight_pipeline.v # Phase 11: INT4 weight pipeline
│ │ ├── ternary_mac_engine.v # Phase 13: BitNet 1.58b ternary MAC
│ │ ├── ternary_mac_unit.v # Ternary MAC unit
│ │ ├── ternary_weight_decoder.v # Ternary weight decoder
│ │ ├── medusa_head_predictor.v # Phase 13: MEDUSA draft prediction
│ │ ├── simd_ternary_engine.v # Phase 15: 4-wide SIMD ternary (4.8× faster)
│ │ └── parallel_softmax.v # Phase 15: Parallel softmax (6.2× faster)
│ │
│ ├── transformer/ # Phase 3,13: Transformer blocks (9 files)
│ │ ├── layer_norm.v # LayerNorm (gamma/beta)
│ │ ├── linear_layer.v # Dense y = Wx + b
│ │ ├── attention_unit.v # Multi-head attention with KV cache
│ │ ├── ffn_block.v # FFN: Linear → GELU → Linear
│ │ ├── accelerated_attention.v # KV-cached attention
│ │ ├── accelerated_linear_layer.v # Linear for accelerated engine
│ │ ├── accelerated_transformer_block.v # Full accelerated block
│ │ ├── rope_encoder.v # Phase 13: Rotary Position Encoding
│ │ └── grouped_query_attention.v # Phase 13: GQA (shared KV heads)
│ │
│ ├── gpt2/ # Phase 4: Full inference engine (4 files)
│ │ ├── embedding_lookup.v # Token + position embedding
│ │ ├── transformer_block.v # Full decoder block
│ │ ├── gpt2_engine.v # Original GPT-2 engine
│ │ └── accelerated_gpt2_engine.v # Accelerated with zero-skip + KV cache
│ │
│ ├── memory/ # Phases 5,10,13,14: Memory (12 files)
│ │ ├── axi_weight_memory.v # AXI4-Lite slave SRAM
│ │ ├── dma_engine.v # AXI4 master DMA
│ │ ├── scratchpad.v # Dual-port SRAM
│ │ ├── sparse_memory_ctrl_wide.v # Wide sparse memory
│ │ ├── kv_cache_quantizer.v # Phase 13: KV cache INT4 quantization
│ │ ├── kv_page_table.v # KV page table
│ │ ├── page_allocator.v # Page allocator
│ │ ├── paged_attention_mmu.v # Phase 10: PagedAttention MMU
│ │ ├── prefetch_engine.v # Phase 13: Weight prefetcher
│ │ ├── weight_double_buffer.v # Phase 8: Double buffer for weights
│ │ ├── multibank_sram_controller.v # Phase 14: AMD 3D V-Cache inspired
│ │ ├── compute_in_sram.v # Phase 14: Near-memory computing
│ │ └── hbm_controller.v # Phase 14: HBM interface (800 GB/s+)
│ │
│ ├── control/ # Phase 15: Control (1 file)
│ │ └── layer_pipeline_controller.v # Phase 15: 5-stage layer pipelining
│ │
│ ├── top/ # Phase 6,7: System top (5 files)
│ │ ├── command_processor.v # FIFO command queue (8 opcodes)
│ │ ├── gpu_config_regs.v # AXI4-Lite config registers
│ │ ├── perf_counters.v # 8 hardware performance counters
│ │ ├── reset_synchronizer.v # 2-FF async-to-sync reset
│ │ └── gpu_system_top.v # Phase 7: Full system wrapper
│ │
│ └── integration/ # Phase 16: End-to-end (1 file)
│ └── optimized_transformer_layer.v # REAL integrated 6-stage pipeline
│
├── tb/ # Testbenches (72 files across 10 dirs)
│ ├── integration/ # Phase 16 + benchmarks
│ │ ├── end_to_end_pipeline_tb.v # 6-stage E2E pipeline test
│ │ ├── full_model_inference_tb.v # 12-layer GPT-2 inference test
│ │ ├── base_vs_optimized_benchmark_tb.v
│ │ ├── full_integration_vs_base_tb.v
│ │ ├── integration_speed_benchmark_tb.v
│ │ └── combined_improvements_tb.v
│ └── [other dirs mirror rtl/ structure]
│
├── scripts/ # 22 scripts
│ ├── run_all_tests.ps1 # MASTER test runner (runs all 51 modules)
│ ├── functional_model_gpt2.py # Python GPT-2 functional model
│ ├── chat_gpt2.py # Interactive GPT-2 chat (NumPy)
│ ├── chat_opt.py # Interactive OPT-125M chat
│ ├── run_cosim.py # Python-Verilog cosim (dim=4)
│ ├── run_scaled_cosim.py # Scaled cosim (dim=64)
│ ├── run_sentence_cosim.py # Sentence-level cosim
│ ├── extract_gpt2_weights.py # Downloads GPT-2 from HuggingFace
│ ├── compare_inference.py # Compare GPU vs CPU
│ ├── benchmark_throughput.py # Throughput benchmarking
│ └── [+ 12 more utility scripts]
│
├── docs/ # 13 Documentation
- `docs/Website_Reference.md`: Truthful, verified claims for the Science Fest website.
- `docs/BitbyBit_Complete_Guide.md`: Detailed technical guide on the architecture.
- `docs/hardware_improvements_research.md`: Research on the implemented P0/P1 hardware improvements.
- `docs/BitbyBit_Architecture_Whitepaper.md`: **[NEW]** Professional-grade launch whitepaper detailing the entire GPU microarchitecture and hardware innovations, including a comprehensive Mermaid diagram.
- `docs/Detailed_Architecture_Diagrams.md`: **[NEW]** Component-level detailed Mermaid diagrams covering the Datapath, Memory Subsystem, and Hardware Accelerators.
│ ├── Simulation_Commands.md # All individual sim commands
│ ├── architecture.md # Architecture diagrams
│ ├── system_architecture.md # Post-audit system architecture
│ └── [+ 5 more docs]
│
├── sim/ # Compiled binaries + output files
│ ├── model_out.txt # Full 12-layer model inference output
│ ├── e2e_out.txt # End-to-end pipeline output
│ ├── simd_out.txt # SIMD ternary results
│ ├── parsm_out.txt # Parallel softmax results
│ ├── pipe_out.txt # Pipeline controller results
│ └── [+ many more compiled test outputs]
│
├── model/ # Model-related files
├── weights/ # Model weight caches
│ ├── cache/ # Downloaded model caches
│ ├── gpt2_dim64/ # Extracted dim=64 weights
│ └── gpt2_real/ # Real GPT-2 weights
│
└── website/ # Project showcase website
├── index.html
├── css/, js/, assets/
Implementation A — "Original" (Phases 1-7):
Token ID → [Embedding] → [LayerNorm → Attention → Residual → LayerNorm → FFN → Residual] × N → [Norm] → [Argmax] → Token
Uses: gpt2_engine.v, transformer_block.v, attention_unit.v, ffn_block.v, layer_norm.v, softmax_unit.v, gelu_activation.v
Primary demo: accelerated_gpt2_engine.v with zero-skip + KV cache
Implementation B — "Optimized" (Phases 8-16):
Token ID → [Embedding] → [RoPE → GQA → Parallel Softmax → GELU → KV INT4 Quantize → Activation Compress] × 12 → [MEDUSA] → 3 Token Predictions
Uses: optimized_transformer_layer.v integrating 6 modules into a real pipeline
Primary demo: full_model_inference_tb.v — full 12-layer GPT-2 inference
| Feature | Implementation |
|---|---|
| Arithmetic | Q8.8 signed fixed-point (16-bit) |
| Multiply | Zero-skip when either operand = 0 |
| BitNet | Ternary {-1, 0, +1} — zero multipliers needed |
| Pipeline | 5-stage: FETCH → DEQUANT → ZERO_CHECK → ALU → WRITEBACK |
| Position Encoding | Hardware RoPE (64-entry cos/sin LUT) |
| Attention | GQA: 4Q heads share 2KV heads (50% KV memory saved) |
| KV Cache | INT4 quantized (4× memory reduction) |
| Activations | 8-bit compressed (2× bandwidth reduction) |
| Softmax | Parallel across all elements simultaneously |
| Draft Decoding | MEDUSA 3-head prediction |
| Memory | Multi-bank SRAM (4× bandwidth), HBM interface (800 GB/s) |
| Near-Memory | Compute-In-SRAM for BitNet ops |
| Scaling | Parameterized: DIM, NUM_HEADS, LANES, etc. |
| Module | Tests | Description |
|---|---|---|
zero_detect_mult |
7/7 ✅ | Signed 8-bit multiply with zero-skip bypass |
variable_precision_alu |
9/9 ✅ | 4/8/16-bit parallel signed ALU |
sparse_memory_ctrl |
6/6 ✅ | Direct-mapped sparse memory |
fused_dequantizer |
8/8 ✅ | INT4 → signed INT8 with scale/offset |
gpu_top |
5/5 ✅ | Original FSM pipeline (4-module chain) |
| Module | Tests | Description |
|---|---|---|
mac_unit |
8/8 ✅ | Multiply-accumulate with acc_clear |
systolic_array |
3/3 ✅ | NxN PE mesh, weight-stationary, zero-skip |
gelu_activation |
9/9 ✅ | GELU via 256-entry LUT |
softmax_unit |
5/5 ✅ | Max-subtract + exp LUT + reciprocal normalize |
| Module | Tests | Description |
|---|---|---|
layer_norm |
3/3 ✅ | LayerNorm with inv_sqrt LUT (gamma/beta) |
linear_layer |
2/2 ✅ | Dense y = Wx + b |
attention_unit |
2/2 ✅ | Multi-head attention with KV cache |
ffn_block |
1/1 ✅ | FFN: Linear → GELU → Linear |
| Module | Tests | Description |
|---|---|---|
embedding_lookup |
2/2 ✅ | Token + position embedding ROM |
gpt2_engine_FULL |
1/1 ✅ | Original GPT-2 engine |
accel_gpt2_engine |
3/3 ✅ | Accelerated with zero-skip + KV cache |
| Module | Tests | Description |
|---|---|---|
axi_weight_memory |
4/4 ✅ | AXI4-Lite slave SRAM with parity |
dma_engine |
4/4 ✅ | AXI4 master DMA for bulk transfers |
scratchpad |
5/5 ✅ | Dual-port SRAM for activations |
| Module | Tests | Description |
|---|---|---|
command_processor |
6/6 ✅ | FIFO command queue (8 opcodes) |
perf_counters |
11/11 ✅ | 8 hardware performance counters |
gpu_config_regs |
8/8 ✅ | AXI4-Lite configuration registers |
reset_synchronizer |
5/5 ✅ | 2-FF async-to-sync reset |
| Module | Tests | Description |
|---|---|---|
gpu_system_top |
8/8 ✅ | Full system wrapper (all modules wired) |
| Module | Tests | Description |
|---|---|---|
online_softmax |
6/6 ✅ | Streaming softmax (saves memory, O(1) extra) |
sparsity_decoder_2_4 |
6/6 ✅ | NVIDIA 2:4 structured sparsity decode |
activation_compressor |
5/5 ✅ | 16→8bit activation compression |
weight_double_buffer |
5/5 ✅ | Ping-pong weight buffer (hides latency) |
parallel_attention |
5/5 ✅ | Multi-head parallel attention |
token_scheduler |
4/4 ✅ | Token scheduling for batched inference |
power_management_unit |
6/6 ✅ | Clock gating + DVFS power control |
| Module | Tests | Description |
|---|---|---|
w4a8_decompressor |
4/4 ✅ | W4A8 weight-4bit activation-8bit decompression |
moe_router |
4/4 ✅ | Mixture-of-Experts top-K router |
| Module | Tests | Description |
|---|---|---|
speculative_decode_engine |
5/5 ✅ | Speculative decoding with draft-verify |
paged_attention_mmu |
6/6 ✅ | vLLM-style paged attention memory management |
| Module | Tests | Description |
|---|---|---|
flash_attention_unit |
5/5 ✅ | Tiled attention (FlashAttention-inspired) |
mixed_precision_decompressor |
5/5 ✅ | Multi-format decompression |
q4_weight_pipeline |
4/4 ✅ | INT4 weight streaming pipeline |
| Module | Tests | Description |
|---|---|---|
ternary_mac_engine |
5/5 ✅ | BitNet 1.58b — ternary {-1,0,+1}, ZERO multipliers |
rope_encoder |
4/4 ✅ | RoPE — hardware rotary position encoding |
grouped_query_attention |
4/4 ✅ | GQA — shared KV heads (50% KV memory saved) |
kv_cache_quantizer |
4/4 ✅ | INT4 KV cache — 4× memory reduction |
medusa_head_predictor |
4/4 ✅ | MEDUSA — 3-head draft token prediction |
prefetch_engine |
4/4 ✅ | Weight prefetcher (hides memory latency) |
| Module | Tests | Description |
|---|---|---|
multibank_sram_controller |
5/5 ✅ | AMD 3D V-Cache inspired, N parallel banks |
compute_in_sram |
5/5 ✅ | Near-memory BitNet ops (PIM) |
hbm_controller |
5/5 ✅ | HBM2/3 multi-channel interface (800 GB/s+) |
| Module | Tests | Description |
|---|---|---|
simd_ternary_engine |
5/5 ✅ | 4-wide SIMD ternary — 4 cycles (4.8× faster) |
parallel_softmax |
5/5 ✅ | All elements parallel — 4 cycles (6.2× faster) |
layer_pipeline_controller |
5/5 ✅ | 5-stage overlap — 3× throughput |
| Module | Tests | Description |
|---|---|---|
optimized_transformer_layer |
5/5 ✅ | REAL 6-stage integrated pipeline |
| full_model_inference_tb | 5/5 ✅ | 12-layer GPT-2 running end-to-end |
The #1 weakness identified in the critical evaluation: modules were islands with no real data flow between them. Phase 16 fixed this.
Token Embedding
│
▼
[Stage 1: RoPE Encoder] ─── 8 cycles
│ rotated Q, K vectors
▼
[Stage 2: GQA Attention] ─── 2 cycles
│ attention scores (4Q → 2KV shared)
▼
[Stage 3: Parallel Softmax] ─── 8 cycles
│ normalized probabilities
▼
[Stage 4: GELU Activation] ─── 3 cycles
│ activated FFN values
▼
[Stage 5: KV Cache INT4 Quantize] ─── 3 cycles
│ compressed cache + GELU output
▼
[Stage 6: Activation Compress] ─── 3 cycles
│ 8-bit compressed output
▼
Layer Output → feeds into next layer
Every wire is connected. Output of RoPE goes into GQA input. GQA scores go into Softmax input. Etc.
- Loads token embeddings (16 vocab × 8 dim)
- Loads position embeddings (8 positions × 8 dim)
- Loads MEDUSA head weights (3 heads × 8 dim)
- Embeds token ID 5 at position 2 →
[300, 340, 380, 420, 460, 500, 540, 580] - Runs through 12 transformer layers (each reusing
optimized_transformer_layer) - Feeds output to MEDUSA for 3-head draft prediction
- Measures everything from simulation
Input: Token ID 5 → emb = [300, 340, 380, 420, ...]
After L1: [227, 391, 189, 3780, ...]
After L6: [-201, 402, -6066, 3780, ...]
After L12: [-448, -37, -10879, 3780, ...]
Output: 3 predicted tokens from MEDUSA
A brutally honest assessment was performed. Full details in agent artifacts (critical_evaluation.md).
1. Inflated "1024× Memory Efficiency" Claim
- Multiplied improvements across different hierarchy levels (GQA × INT4 × Compress × SRAM × HBM)
- These aren't multiplicative — they're at different bottleneck points
- Realistic combined improvement: ~8-32×, not 1024×
- Fix: Report per-level: "4× KV memory, 4× SRAM bandwidth, 16× off-chip bandwidth"
2. Integration Gap (PARTIALLY FIXED)
- Phase 16 created
optimized_transformer_layer.vwiring 6 modules together full_model_inference_tb.vruns 12-layer end-to-end- BUT:
gpu_system_top.v(Phase 7) still doesn't use ANY Phase 8-16 features - The command processor / DMA / AXI path is disconnected from the optimized pipeline
3. Energy Claims Are Unproven
- "~100× energy savings", "95% reduction" — numbers from papers, not synthesis
- Zero synthesis results (no Yosys, no gate counts, no power)
- The "95% energy" is a hardcoded constant in RTL
- Fix: Run Yosys synthesis, get real numbers
4. Several Modules Are Oversimplified
- GQA: dot products only, no full V projection
- MEDUSA: linear prediction, no tree attention
- RoPE: 64-entry LUT (production needs 512+)
- FlashAttention: basic tiling, not full algorithm
- Fix: Be honest about scope — "proof-of-concept kernels"
5. Some Benchmark Numbers Were Estimated
- "Naive softmax = 16 cy", "DDR4 = 16 cy" — not simulated
- Fix: Phase 16 pipeline numbers ARE real (measured from simulation)
6. "Novel" Is Overstated
- Individual techniques (BitNet, RoPE, GQA, MEDUSA) are published work
- What IS novel: the combination of BitNet + Compute-In-SRAM + multi-bank SRAM
- Fix: Frame as "novel integration of SOTA techniques"
- 76 synthesizable Verilog modules — substantial engineering
- 255 passing tests — excellent coverage
- Full 12-layer GPT-2 end-to-end inference — few projects attempt this
- BitNet + PIM combination — genuinely interesting
- Comprehensive documentation — every module has references
- Real simulation — using Icarus Verilog, not just diagrams
Stage Cycles Time @100MHz
1. RoPE Encoding 8 cy 80 ns
2. GQA Attention 3 cy 30 ns
3. Parallel Softmax 8 cy 80 ns
4. GELU Activation 3 cy 30 ns
5. KV Cache Quantize 3 cy 30 ns
6. Activation Compress 3 cy 30 ns
TOTAL per layer 29 cy 290 ns
Embedding Lookup: 2 cy 20 ns
12× Transformer Layers: 348 cy 3,480 ns
MEDUSA Prediction: 3 cy 30 ns
TOTAL INFERENCE: 430 cy 4,300 ns = 4.30 μs
| Module | Old Speed | New Speed | Improvement |
|---|---|---|---|
| SIMD Ternary (compute) | 19 cycles | 4 cycles | 4.8× faster |
| Parallel Softmax | 25 cycles | 4 cycles | 6.2× faster |
| Layer Pipeline | 18 cy/token | 6 cy/token | 3× throughput |
- ~232,558 tokens/second at 100 MHz FPGA
- ~697,674 effective tokens/sec with MEDUSA 3-head draft decoding
Validate that our pipeline architecture works at real GPT-2 scale (768-dim, 12 layers, 50K vocab) with trained weights. This is standard chip-design practice.
- Implements all 7 pipeline stages in Python (matching RTL)
- Loads real GPT-2 weights from HuggingFace
transformers - Applies our GQA optimization (12 Q heads → 6 KV heads)
- Runs KV cache INT4 quantization on every layer
- Runs activation compression on every layer
- Generates text autoregressively
- Python 3.14 is available but
torchnot installed in default env - User confirmed they have a conda environment with torch/transformers
- Conda was not in PATH — needs
conda activate <env_name>before running - The Langflow venv at
C:\Users\parshu\AppData\Local\com.LangflowDesktop\.langflow-venv\hastorch 2.9.1+cpubut using it is fragile
# Activate conda env (user needs to provide env name)
conda activate <env_name>
python scripts/functional_model_gpt2.pyWhen run, it will generate real English text using our pipeline architecture, proving the hardware design would work at GPT-2 scale.
cd D:\Projects\BitbyBit\custom_gpu_project
powershell -ExecutionPolicy Bypass -File .\scripts\run_all_tests.ps1# Pattern: iverilog -o sim/OUTPUT [RTL_FILES...] [TB_FILE] ; vvp sim/OUTPUT
# Example: SIMD Ternary Engine
D:\Tools\iverilog\bin\iverilog.exe -o sim/simd_test rtl/compute/simd_ternary_engine.v tb/compute/simd_ternary_engine_tb.v
D:\Tools\iverilog\bin\vvp.exe sim/simd_test
# Example: Full model inference (needs 8 modules)
D:\Tools\iverilog\bin\iverilog.exe -o sim/model_test `
rtl/gpt2/embedding_lookup.v `
rtl/transformer/rope_encoder.v `
rtl/transformer/grouped_query_attention.v `
rtl/compute/parallel_softmax.v `
rtl/compute/gelu_activation.v `
rtl/compute/gelu_lut_256.v `
rtl/memory/kv_cache_quantizer.v `
rtl/compute/activation_compressor.v `
rtl/integration/optimized_transformer_layer.v `
rtl/compute/medusa_head_predictor.v `
tb/integration/full_model_inference_tb.v
D:\Tools\iverilog\bin\vvp.exe sim/model_testpython scripts/chat_gpt2.py # GPT-2 chat
python scripts/chat_opt.py --relu-mode all # OPT-125M (better sparsity demo)python scripts/run_cosim.py --token 5 # dim=4
python scripts/run_scaled_cosim.py --sentence "hello" --dim 64 # dim=64zero_detect_mult_tb.v— fixed unsigned/signed mismatch (was 5/7, now 7/7)variable_precision_alu_tb.v— fixed expected value for -1×-1 (was 5/6, now 6/6)fused_dequantizer_tb.v— fixed overflow clamp expectations (was 6/8, now 8/8)gelu_activation_tb.v— added missing LUT dependency (was compile fail)softmax_unit_tb.v— added missing exp_lut dependencylayer_norm_tb.v— added missing inv_sqrt_lut dependencysimd_ternary_engine— fixed stale lane_sum in DONE_ST, reg→wire for assignparallel_softmax— fixed exp_sum accumulation (non-blocking in loop), normalization divisionlayer_pipeline_controller— rewrote for Verilog-2005 (was SystemVerilog)
- Verilog-2005 only — Icarus Verilog doesn't support SystemVerilog. All code must avoid: unpacked array ports, variable declarations in unnamed blocks, etc.
- dim=64 cosim accuracy — Verilog produces near-zero logits at dim=64 (dim=4 works fine). Likely Q8.8 accumulator overflow or weight loading issue.
gpu_system_top.vis disconnected — Phase 7 top-level doesn't use Phase 8-16 features. Two parallel implementations exist but aren't unified.- No FPGA synthesis — all simulation only. No gate counts, timing, or power reports.
- Functional model not yet run — Python torch environment issue (conda not in PATH).
| Decision | Rationale |
|---|---|
| Q8.8 fixed-point | 16-bit gives good precision while fitting in FPGA BRAMs |
| BitNet 1.58b ternary | Eliminates ALL multipliers — add/subtract/skip only |
| GQA over MHA | 50% KV memory savings, minimal accuracy loss |
| RoPE over learned PE | Better extrapolation, no learned parameters needed |
| INT4 KV cache | 4× memory reduction for long sequences |
| Compute-In-SRAM | Eliminates data movement for ternary ops (BitNet sweet spot) |
| MEDUSA over beam search | 3× effective throughput with draft prediction |
| Verilog-2005 | Maximum compatibility with Icarus Verilog for free simulation |
| 256-entry LUTs | Replace exp/GELU/inv_sqrt math with lookups (low area, 1-cycle latency) |
| Parameterized modules | Same RTL works at dim=4 (test) through dim=768 (production) |
- Created
functional_model_gpt2.pyimplementing exact pipeline in Python - Could not run: torch not in default Python, conda not in PATH
- User confirmed conda env exists but session ended before resolution
- Next step: Find conda env name, activate it, run the script
- User asked "can we load GPT-2 itself?"
- Answer: NO at current scale (8-dim vs 768-dim, 16 vocab vs 50K)
- Would require: scaling parameters, adding residual connections, proper FFN, real synthesis
- The functional model approach was chosen as the practical alternative
- Was discussed but not implemented in Verilog
- The
full_model_inference_tb.vdoes single-token inference but doesn't feed back - Could be extended to feed MEDUSA predictions back as input
- Find conda environment name and activate it
- Run
python scripts/functional_model_gpt2.py - Verify real English text generation through our pipeline architecture
- Record throughput metrics
- [DONE Mar 14] Create
rtl/top/gpu_system_top_v2.vintegrating Phase 8-16 compute path with the Phase 7 system wrapper - [DONE Mar 14] Wire: command_processor → optimized_transformer_layer → DMA/AXI path
- [DONE Mar 14] Validate coherence with
tb/top/gpu_system_top_v2_tb.v(8/8 PASS)
- Install Yosys:
winget install yosysor download - Synthesize key modules to get gate counts
- Compare BitNet MAC gate count vs standard MAC
- Get real area/power numbers (replaces paper citations)
- Extend
full_model_inference_tb.vto feed MEDUSA predictions back - Generate a sequence of tokens autoregressively
- Demonstrate the full generation loop on hardware
- Update
docs/progress.mdwith Phases 14-16 - Update
docs/BitbyBit_Complete_Guide.mdwith latest results - Revise efficiency claims per critical evaluation feedback
- Update Judge Q&A with honest answers about limitations
- Closed the pending swarm-rectification pass across attention semantics, DMA/control watchdogs, MEDUSA accounting, MMU race handling, benchmark provenance, and hardcoded benchmark defaults.
- Key RTL fixes:
grouped_query_attention: added value path (attention_values) and score scaling policy.optimized_transformer_layer: head-diverse mapping + softmax-weighted value flow + stage watchdog fail-closed.dma_engine: AXI read-response error handling + watchdog timeout +errorpulse.command_processor: watchdog timeout +error_outpulse.prefetch_engine: fail-closed watchdog +errorpulse.paged_attention_mmu: deterministic fail-closed handling for concurrent alloc/free.medusa_head_predictor: fixed accepted-count/total-accepted accounting.simd_ternary_engine: corrected add/sub/skip stats accumulation.- top-levels now surface command/DMA/prefetch error pulses into status paths.
gpu_system_topnow adapts 32-bit DMA beats into deterministic split 16-bit scratchpad writes (removes truncation/data-loss risk).
- Benchmark/provenance hardening:
demo_day.ps1now supports parameterized token/position spaces and enforces unique matrix workloads.run_demo.ps1forwards workload bounds.build_phase3_benchmark_proof_pack.pyvalidates paired summary schema and sample counts before generating artifacts.
python scripts/run_tests.py-> 34 modules, 200 PASS, 0 FAILpowershell -ExecutionPolicy Bypass -File .\scripts\run_all_tests.ps1-> 55 modules, 309 PASS, 0 FAILpython scripts/ci_fail_closed_smoke.py-> PASSpowershell -ExecutionPolicy Bypass -File .\scripts\run_demo.ps1 -Mode compare -WorkloadMode matrix -WarmupRuns 1 -MeasuredRuns 1 -TokenSpace 16 -PositionSpace 8-> PASS
gpu_system_top_v2_tbbaseline/MINI/GEMMA: 35 / 20 / 35 cyclesfull_model_inference_tb: 358 cycles, ~279,329 tok/s (MEDUSA effective ~837,988 tok/s)full_model_inference_imprint_tb: 112 cycles, ~892,857 tok/s (MEDUSA effective ~2,678,571 tok/s)- Measured base-vs-imprint full-model speedup: 3.1964x
- Closed the remaining rigorous-benchmark blocker in
scripts/demo_day.ps1: version metadata capture no longer fails compare runs under strict native-command error handling. - Re-ran rigorous single-workload compare with recommended budget:
powershell -ExecutionPolicy Bypass -File .\scripts\run_demo.ps1 -Mode compare -WorkloadMode single -WarmupRuns 3 -MeasuredRuns 10-> PASS
- Verified benchmark metadata closure:
sim/compare_summary_latest.jsonnow includes bothsystem_environmentandfile_integrity.- Current compare run id:
20260316-234506.
- Regenerated benchmark evidence pack:
python scripts/build_phase3_benchmark_proof_pack.pysim/phase3_benchmark_proof_pack.jsonandsim/phase3_benchmark_proof_pack.csvupdated to latest run id.
sim/audit_sys_v2.log: 11 warningssim/audit_sys.log: 1 warningsim/audit_full_model.log: 5 warnings- Aggregate focused warning count: 17 (down from prior 18 in this closure pass).
timescaleinheritance warnings: 0 after adding explicit`timescale 1ns / 1pstortl/gpt2/embedding_lookup.v.
- Closed warning-debt cleanup on focused production targets:
sim/audit_sys_v2.log: 0sim/audit_sys.log: 0sim/audit_full_model.log: 0- Aggregate focused warnings: 0
- Hardened benchmark determinism/provenance validation:
scripts/build_phase3_benchmark_proof_pack.pynow requiressystem_environmentandfile_integrity, validates per-workload measured sample parity, enforces unique(workload_index, run_index)tuples, and checks positive throughput/medusa fields.- Negative fail-closed check confirmed malformed sample counts are rejected.
- Added canonical one-command demo packaging:
- New:
scripts/run_production_demo.ps1(runsrun_demo+ regenerates proof pack artifacts). scripts/run_demo.ps1defaults aligned to rigorous recommendations (WarmupRuns=3,MeasuredRuns=10).
- New:
- Captured synthesis-readiness snapshot:
sim/synthesis_readiness_snapshot.txt- Tool availability in this environment:
yosys=False,vivado=False,quartus=False(compile-readiness checks pass for key tops).
python scripts/ci_fail_closed_smoke.py-> PASSpython scripts/run_tests.py-> 34 modules, 200 PASS, 0 FAILpowershell -ExecutionPolicy Bypass -File .\scripts\run_all_tests.ps1-> 55 modules, 309 PASS, 0 FAILpowershell -ExecutionPolicy Bypass -File .\scripts\run_demo.ps1 -Mode compare -WorkloadMode matrix -WarmupRuns 3 -MeasuredRuns 10 -TokenSpace 16 -PositionSpace 8-> PASSpython scripts/build_phase3_benchmark_proof_pack.py-> PASS
sim/compare_summary_latest.jsonrun_id: 20260317-225449workload_mode: matrixworkloads: 3measured_runs: 10samples: 30system_environment: presentfile_integrity: present
sim/phase3_benchmark_proof_pack.json- paired row
run_id: 20260317-235408
- paired row
- Yosys tooling install status: completed via conda env fallback
- Direct
winget/chocopackage routes remained unavailable for native Windows Yosys. - Installed
yowasp-yosysin dedicated conda env:yosys-tools. - Verified command:
D:\Anaconda\Scripts\conda.exe run -n yosys-tools yowasp-yosys -V
- Updated synthesis snapshot (
sim/synthesis_readiness_snapshot.txt) now records:yosys_provider=yowasp-yosyscompile_check.exp_lut_256=Truecompile_check.parallel_softmax=Truecompile_check.gpu_system_top_v2=True
- Direct
- Benchmark methodology upgrade implemented:
scripts/demo_day.ps1now supports:-WorkloadCount(matrix workload breadth),-WorkloadSeed(reproducible workload selection),- seeded unique workload generation with deterministic fallback scan,
- workload coverage and diversity metadata in
run_quality.
scripts/run_demo.ps1forwards the new knobs.scripts/run_production_demo.ps1supports the same knobs (defaults tuned for broader coverage than single-point runs).scripts/build_phase3_benchmark_proof_pack.pyvalidation now fail-closes on:- missing workload/provenance metadata,
- per-workload measured sample parity mismatches,
- duplicate
(workload_index, run_index)tuples, - missing/non-positive throughput fields.
- Measured benchmark snapshot after upgrade (all simulation-measured):
run_demo.ps1 -Mode compare -WorkloadMode matrix -WarmupRuns 3 -MeasuredRuns 10 -WorkloadCount 8 -WorkloadSeed 20260317sim/compare_summary_latest.json:run_id: 20260317-235408workloads: 8measured samples: 80workload coverage: 6.25% of token/position space- mean speedup: 3.1964x
sim/phase3_benchmark_proof_pack.jsonpaired row aligned to run20260317-235408.
# 1. Navigate to project
cd D:\Projects\BitbyBit\custom_gpu_project
# 2. Run full test suite (current snapshot: 55 modules, 309 PASS, 0 failures)
powershell -ExecutionPolicy Bypass -File .\scripts\run_all_tests.ps1
# 3. Run canonical production demo flow (top + compare + proof-pack refresh)
powershell -ExecutionPolicy Bypass -File .\scripts\run_production_demo.ps1
# 3b. Stronger reproducible benchmark sweep (broader matrix coverage)
powershell -ExecutionPolicy Bypass -File .\scripts\run_production_demo.ps1 `
-WorkloadMode matrix -WarmupRuns 3 -MeasuredRuns 10 `
-WorkloadCount 8 -WorkloadSeed 20260317
# 4. Run the key end-to-end model inference test
D:\Tools\iverilog\bin\iverilog.exe -o sim/model_test `
rtl/gpt2/embedding_lookup.v `
rtl/transformer/rope_encoder.v `
rtl/transformer/grouped_query_attention.v `
rtl/compute/parallel_softmax.v `
rtl/compute/gelu_activation.v `
rtl/compute/gelu_lut_256.v `
rtl/memory/kv_cache_quantizer.v `
rtl/compute/activation_compressor.v `
rtl/integration/optimized_transformer_layer.v `
rtl/compute/medusa_head_predictor.v `
tb/integration/full_model_inference_tb.v
D:\Tools\iverilog\bin\vvp.exe sim/model_test
# 5. Read CLAUDE.md for additional project context
# 6. Read docs/Simulation_Commands.md for all individual test commands
# 7. Check critical_evaluation findings before making claims- Do NOT push to GitHub (user request)
- Do NOT use SystemVerilog features — Icarus Verilog only supports Verilog-2005
- Do NOT make up benchmark numbers — all metrics must come from
vvpsimulation output - Do NOT overclaim — read the critical evaluation before writing any claims
End of handoff document. Last verified: 55 modules, 309 tests, 0 failures. Full model inference: 358 cycles @ 100 MHz.