# tongkaio/cuda_kernel_samples architecture

> Architecture diagram of the GitHub repository tongkaio/cuda_kernel_samples, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/tongkaio/cuda_kernel_samples
- Repository: https://github.com/tongkaio/cuda_kernel_samples

## Overview

CUDA_Kernel_Samples is an educational collection of CUDA operator implementations and optimization examples, not a single application pipeline. The principal workflow is a learner consulting the guide, choosing an operator, and studying its implementations and GPU concepts. The README identifies elementwise, GEMV, reduction, SGEMM, transpose, and introductory examples; source excerpts do not show runtime call relationships among them, so the graph represents documented navigation rather than inferred execution flow.

Main entry points: [`README.md`](https://github.com/tongkaio/cuda_kernel_samples/blob/master/README.md) (Operator Guide), [`example`](https://github.com/tongkaio/cuda_kernel_samples/tree/master/example) (CUDA Examples), [`elementwise/add.cu`](https://github.com/tongkaio/cuda_kernel_samples/blob/master/elementwise/add.cu) (Elementwise Add), [`reduce/sum/sum.cu`](https://github.com/tongkaio/cuda_kernel_samples/blob/master/reduce/sum/sum.cu) (Sum Reduction)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_guide["Learning Guide"]
  node_guide_doc["Operator Guide<br/>[README.md]"]
end

subgraph group_basics["CUDA Basics"]
  node_examples["CUDA Examples"]
  node_elementwise["Elementwise Add<br/>[add.cu]"]
end

subgraph group_reductions["Reduction Operators"]
  node_sum["Sum Reduction<br/>[sum.cu]"]
  node_max["Max Reduction<br/>[max.cu]"]
  node_softmax["Softmax<br/>[softmax.cu]"]
  node_softmax_matrix["Matrix Softmax<br/>[softmax_matrix.cu]"]
end

subgraph group_matrix["Matrix Operators"]
  node_gemv["SGEMV<br/>[sgemv_k32.cu]"]
  node_sgemm["SGEMM<br/>[main.cu]"]
  node_transpose["Transpose<br/>[transpose.cu]"]
end

node_learner(("Learner"))

node_learner -->|"consults"| node_guide_doc
node_guide_doc -->|"introduces"| node_examples
node_guide_doc -->|"describes"| node_elementwise
node_guide_doc -->|"catalogs"| node_gemv
node_guide_doc -->|"describes"| node_sum
node_guide_doc -->|"catalogs"| node_max
node_guide_doc -->|"describes"| node_softmax
node_guide_doc -->|"catalogs"| node_softmax_matrix
node_guide_doc -->|"describes"| node_sgemm
node_guide_doc -->|"describes"| node_transpose

click node_guide_doc "https://github.com/tongkaio/cuda_kernel_samples/blob/master/README.md"
click node_examples "https://github.com/tongkaio/cuda_kernel_samples/tree/master/example"
click node_elementwise "https://github.com/tongkaio/cuda_kernel_samples/blob/master/elementwise/add.cu"
click node_gemv "https://github.com/tongkaio/cuda_kernel_samples/blob/master/gemv/sgemv_k32.cu"
click node_sum "https://github.com/tongkaio/cuda_kernel_samples/blob/master/reduce/sum/sum.cu"
click node_max "https://github.com/tongkaio/cuda_kernel_samples/blob/master/reduce/max/max.cu"
click node_softmax "https://github.com/tongkaio/cuda_kernel_samples/blob/master/reduce/softmax/softmax.cu"
click node_softmax_matrix "https://github.com/tongkaio/cuda_kernel_samples/blob/master/reduce/softmax_matrix/softmax_matrix.cu"
click node_sgemm "https://github.com/tongkaio/cuda_kernel_samples/blob/master/sgemm/main.cu"
click node_transpose "https://github.com/tongkaio/cuda_kernel_samples/blob/master/transpose/transpose.cu"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_guide_doc toneBlue
class node_examples,node_elementwise toneAmber
class node_sum,node_max,node_softmax,node_softmax_matrix toneMint
class node_gemv,node_sgemm,node_transpose toneRose
class node_learner toneIndigo
```

## Components

### Learning Guide

- [Operator Guide](https://github.com/tongkaio/cuda_kernel_samples/blob/master/README.md): `README.md`

### CUDA Basics

- [CUDA Examples](https://github.com/tongkaio/cuda_kernel_samples/tree/master/example): `example`
- [Elementwise Add](https://github.com/tongkaio/cuda_kernel_samples/blob/master/elementwise/add.cu): `elementwise/add.cu`

### Reduction Operators

- [Sum Reduction](https://github.com/tongkaio/cuda_kernel_samples/blob/master/reduce/sum/sum.cu): `reduce/sum/sum.cu`
- [Max Reduction](https://github.com/tongkaio/cuda_kernel_samples/blob/master/reduce/max/max.cu): `reduce/max/max.cu`
- [Softmax](https://github.com/tongkaio/cuda_kernel_samples/blob/master/reduce/softmax/softmax.cu): `reduce/softmax/softmax.cu`
- [Matrix Softmax](https://github.com/tongkaio/cuda_kernel_samples/blob/master/reduce/softmax_matrix/softmax_matrix.cu): `reduce/softmax_matrix/softmax_matrix.cu`

### Matrix Operators

- [SGEMV](https://github.com/tongkaio/cuda_kernel_samples/blob/master/gemv/sgemv_k32.cu): `gemv/sgemv_k32.cu`
- [SGEMM](https://github.com/tongkaio/cuda_kernel_samples/blob/master/sgemm/main.cu): `sgemm/main.cu`
- [Transpose](https://github.com/tongkaio/cuda_kernel_samples/blob/master/transpose/transpose.cu): `transpose/transpose.cu`

### Other components

- **Learner**

## Connections

- Learner → Operator Guide: consults (evidence: `README.md`)
- Operator Guide → CUDA Examples: introduces (evidence: `README.md`)
- Operator Guide → Elementwise Add: describes (evidence: `README.md`)
- Operator Guide → SGEMV: catalogs (evidence: `README.md`)
- Operator Guide → Sum Reduction: describes (evidence: `README.md`)
- Operator Guide → Max Reduction: catalogs (evidence: `README.md`)
- Operator Guide → Softmax: describes (evidence: `README.md`)
- Operator Guide → Matrix Softmax: catalogs (evidence: `README.md`)
- Operator Guide → SGEMM: describes (evidence: `README.md`)
- Operator Guide → Transpose: describes (evidence: `README.md`)
