Plan | ||
README.md |
GPUResearch
Overview
Welcome to GPUResearch, a project by The Joy of Hardware, Inc., dedicated to exploring the art and science of GPU IP design. While CPU IP design is a well-documented field with extensive literature, GPU IP design remains less charted, with fewer resources available. This repository aims to bridge that gap by capturing the knowledge we gain as we work toward designing a synthesizable GPU IP core in Bluespec Haskell (BH). Our journey begins with a C-based software model, progresses through functional simulation in Clash Haskell, and culminates in a Bluespec implementation ready for FPGA synthesis.
Primary Purpose
Initially, this repository serves as a knowledge base for documenting the lessons, challenges, and insights we uncover while learning how to design a GPU. We aim to create a valuable resource for others interested in GPU architecture, whether for educational, research, or commercial purposes. Over time, we will transition to modeling GPU IP in Clash Haskell and finally implement a synthesizable design in Bluespec.
Project Phases
- C-Based GPU Model (Knowledge Capture): A hardware model in C, driven by PortableGL, to explore GPU architecture and document design insights.
- Clash Haskell Model: A functional simulation in Clash Haskell for verification and refinement of the GPU design.
- Bluespec Haskell Model: A synthesizable hardware design in Bluespec Haskell, targeting FPGA implementation and eventual commercial IP.
Current Status
We are in Phase 1, focusing on a rough sketch of GPU hardware in a C model. Our high-level design revolves around a central tick
function that updates a single gpu_state
struct, simulating the advancement of a hardware clock cycle. PortableGL drives this model by placing commands into a command buffer within the gpu_state
struct and retrieving results (e.g., framebuffer data) from it. This phase is about experimentation and learning, with an emphasis on documenting our findings.
Design Overview (Phase 1)
- Core Concept: The C model simulates GPU behavior using a
tick
function that updates agpu_state
struct, mirroring a hardware clock cycle. - Command Buffer: PortableGL submits OpenGL-like commands (e.g.,
glDrawArrays
) to a command buffer ingpu_state
, which thetick
function processes. - Components:
gpu_state
struct: Holds the GPU’s state, including the command buffer, rasterizer state, shader core state, and memory (e.g., framebuffer, vertex buffers).tick
function: Advances the GPU’s state by processing commands, executing shaders, rasterizing primitives, and updating the framebuffer.
- Output: Results (e.g., rendered frames) are stored in the
gpu_state
’s memory and can be retrieved for verification.