Skip to content

Dev228-afk/GPUValidate

Repository files navigation

GPUValidate

CI Status C++20 Python 3.11+ License

Deterministic Functional and Pipeline-Accurate SIMT Simulator

GPUValidate is a deterministic simulator for a documented synthetic 32-bit SIMT accelerator named GV-SIM32. It allows developers to compile and simulate bespoke workloads through a native instruction set (GVASM) while gathering rich execution metrics.

It provides two distinct execution modes:

  1. Functional Mode — Validates architectural correctness with bit-accurate integer semantics, global/shared/local memory layouts, predicated lane execution, and deterministic thread scheduling.
  2. Timing Mode — Introduces a cycle-stepped abstract pipeline simulating real hardware limitations. Features fetch, decode, issue, execution, memory, and writeback stages, tracking dependency scoreboarding, occupancy modeling, shared-memory bank conflicts, and partitioned global-memory contention.

Warning

Important: GV-SIM32 is a synthetic architecture designed for education, validation, and performance-modeling demonstrations. GPUValidate does not simulate NVIDIA, AMD, Intel, Cerebras, CUDA, PTX, SASS, or any proprietary commercial hardware. It does not claim cycle accuracy against real GPU silicon or RTL equivalence.


🌟 Key Features

  • Custom Synthetic ISA (GVASM): Execute MOV, ALU operations (ADD, MUL, MAX), control flow (BRA), synchronization (BAR.SYNC), and precise memory stores/loads.
  • Complex Memory Hierarchy:
    • Global Memory (shared by all threads with transactional coalescing across lanes)
    • Shared Memory (per-block memory featuring banking conflicts)
    • Local Memory (per-lane private scratchpad)
  • Precise Execution Tracking: Generates highly deterministic metrics and traces down to the cycle for detailed pipeline visualisations.
  • Scoreboarding: Built-in Register RAW (Read-After-Write) and WAW (Write-After-Write) hazards tracking.
  • Predication: Full hardware-level masking of lanes via SETP evaluating instructions dynamically.
  • Comprehensive Testing Suite: Python differential oracle runner and C++ GTest regression suite (over 600+ generated test cases).

🏗️ Architecture Overview

The system simulates a fully functioning GPU partitioned into several cores, each capable of resident blocks and independent warps:

flowchart TD
    subgraph Device [GV-SIM32 Device]
        direction TB
        
        subgraph Cores [Compute Cores]
            direction LR
            C0[Core 0<br/>Max Warps: 32]
            C1[Core 1<br/>Max Warps: 32]
            C2[Core n<br/>Max Warps: 32]
        end

        subgraph Interconnect [Cross-Core Interconnect]
            direction LR
            M0((Part 0))
            M1((Part 1))
            M2((Part 2))
            M3((Part 3))
        end

        Cores --> Interconnect
        
        subgraph GlobalMem [Global Memory]
            direction LR
            GM0[(Bank 0)]
            GM1[(Bank 1)]
            GM2[(Bank 2)]
            GM3[(Bank 3)]
        end
        
        Interconnect --> GlobalMem
    end
Loading

Core Pipeline Architecture (Timing Mode)

flowchart LR
    F[Fetch] --> D[Decode]
    D --> I[Issue/Scoreboard]
    I --> ALU[ALU Exec]
    I --> MEM[Memory Exec]
    I --> BR[Branch Exec]
    
    ALU --> WB[Writeback]
    MEM --> WB
    BR --> WB
Loading

🚀 Quick Start

Building from Source

Ensure you have CMake 3.20+ and a C++20 compliant compiler (GCC 11+ or Clang 14+).

# Configure the project
cmake -B build -DCMAKE_BUILD_TYPE=Debug

# Build the executable
cmake --build build -j

# Run the unit tests
cd build && ctest --output-on-failure

Running Simulations

Simulations accept GVASM source files and a series of JSON configurations mapping grids, block sizes, initial states, and execution properties.

# Functional run (Emits state output arrays)
./build/bin/gpuvalidate run workloads/vector_add.gvasm \
  --mode functional \
  --launch workloads/vector_add.launch.json \
  --initial-memory workloads/vector_add.memory.json \
  --state-output functional_state.json

# Timing run (Emits hardware performance metrics)
./build/bin/gpuvalidate run workloads/vector_add.gvasm \
  --mode timing \
  --launch workloads/vector_add.launch.json \
  --initial-memory workloads/vector_add.memory.json \
  --metrics timing_metrics.json

📊 Analytical Sweeps

The project includes Python tooling to generate wide performance sweeps iteratively testing multiple hardware permutations (Cores vs IPC, ALUs vs Latency, etc.):

pip install -r python/requirements.txt

# Run a configured sweep (generating metrics CSV)
python -m gpuvalidate.run_sweep

# Plot resulting CSV sweeps to graphical visualizations
python -m gpuvalidate.plot_results

📖 Model Scope

See docs/MODEL_SCOPE.md for the complete list of included and excluded behaviors, and docs/EDGE_CASES.md for observed edge-cases uncovered during testing.

📄 License

GPUValidate is distributed under the MIT License.

About

A deterministic functional and cycle-stepped pipeline-accurate SIMT GPU architecture simulator modeling the synthetic GV-SIM32 ISA.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages