Find a file
2025-04-29 03:37:56 +00:00
Plan Add Plan/phaseI.md 2025-04-28 13:27:43 +00:00
README.md Update README.md 2025-04-29 03:37:56 +00:00

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

  1. C-Based GPU Model (Knowledge Capture): A hardware model in C, driven by PortableGL, to explore GPU architecture and document design insights.
  2. Clash Haskell Model: A functional simulation in Clash Haskell for verification and refinement of the GPU design.
  3. 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 a gpu_state struct, mirroring a hardware clock cycle.
  • Command Buffer: PortableGL submits OpenGL-like commands (e.g., glDrawArrays) to a command buffer in gpu_state, which the tick function processes.
  • Components:
    • gpu_state struct: Holds the GPUs state, including the command buffer, rasterizer state, shader core state, and memory (e.g., framebuffer, vertex buffers).
    • tick function: Advances the GPUs state by processing commands, executing shaders, rasterizing primitives, and updating the framebuffer.
  • Output: Results (e.g., rendered frames) are stored in the gpu_states memory and can be retrieved for verification.