explaingit

t-head/hggc-samples

Analysis updated 2026-05-18

29C++Audience · developerComplexity · 3/5LicenseSetup · hard

TLDR

A collection of example C++ programs showing developers how to use T-Head's HGGC hardware platform and SAIL toolkit.

Mindmap

mindmap
  root((hggc-samples))
    What it does
      Sample programs
      HGGC Runtime API
      SAIL toolkit 2.1
    Tech stack
      C++
      CMake
      Python test script
    Use cases
      Learn HGGC API
      Check device capabilities
      Test toolkit install
    Features shown
      Cooperative Groups
      HGRTC compilation
      Unified Virtual Memory
    Audience
      HGGC developers
      Hardware engineers

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Learn the HGGC Runtime API by reading and running working sample code.

USE CASE 2

Check what capabilities and bandwidth a Zhenwu PPU device supports.

USE CASE 3

See working examples of advanced features like Multi-Device Cooperative Groups and Unified Virtual Memory.

USE CASE 4

Run a full test sweep across all built samples to sanity check a toolkit installation.

What is it built with?

C++CMakePythonMPIOpenMP

How does it compare?

t-head/hggc-samplesalex-shayo/bakkes-mod-installlocalai-org/moss-transcribe.cpp
Stars292929
LanguageC++C++C++
Setup difficultyhardeasymoderate
Complexity3/52/54/5
Audiencedevelopergeneraldeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · hard Time to first run · 1h+

Requires the T-Head SAIL toolkit and compatible Zhenwu PPU hardware to actually run the samples.

Use, modify, and distribute freely, including for commercial purposes, as long as you keep the copyright and license notice.

In plain English

HGGC-Samples is a collection of example programs built for people developing on T-Head's HGGC hardware platform, using the T-Head SAIL toolkit version 2.1. If you work with Zhenwu PPU chips (a kind of processor from T-Head), these samples show you how to use the HGGC Runtime API and related features through working code rather than abstract documentation. The samples are grouped by topic, starting with basic introductory examples for beginners, then moving into utility samples for checking device capabilities and measuring bandwidth. Further groups cover common algorithms and problem-solving techniques, general HGGC features, HGGC platform libraries, and finally performance optimization examples. This structure lets a newcomer start simple and work up to more advanced material at their own pace. To use the repository, you clone it with git or download it as a zip file, then build it with CMake (version 3.20 or later) on Linux, using standard commands like mkdir build, cmake, and make. A Python 3 script called run_tests.py is included so you can run all the built samples at once as a quick sanity check, though the README is clear that this is not a full validation suite and does not test edge cases or measure performance formally. Some samples need extra third-party tools to build or run, such as MPI for communication between processes or OpenMP for multiprocess programming, both of which are commonly available through a Linux package manager. Other samples demonstrate specific HGGC features like Multi-Block Cooperative Groups, Multi-Device Cooperative Groups, a runtime compilation library called HGRTC, Unified Virtual Memory for sharing memory between CPU and PPU, and 16-bit floating point support. The project is maintained by T-Head, a semiconductor company, and is released under the Apache License 2.0.

Copy-paste prompts

Prompt 1
Walk me through building the hggc-samples repository on Linux using CMake step by step.
Prompt 2
Explain what Multi-Block Cooperative Groups and Multi-Device Cooperative Groups do in this HGGC samples repo.
Prompt 3
Help me write a test_args.json config so run_tests.py can run a specific sample with custom arguments.
Prompt 4
Show me how Unified Virtual Memory works based on the samples in this repository.

Frequently asked questions

What is hggc-samples?

A collection of example C++ programs showing developers how to use T-Head's HGGC hardware platform and SAIL toolkit.

What language is hggc-samples written in?

Mainly C++. The stack also includes C++, CMake, Python.

What license does hggc-samples use?

Use, modify, and distribute freely, including for commercial purposes, as long as you keep the copyright and license notice.

How hard is hggc-samples to set up?

Setup difficulty is rated hard, with roughly 1h+ to a first successful run.

Who is hggc-samples for?

Mainly developer.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.