# uxlfoundation/onednn architecture

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

- Interactive diagram: https://gitdiagram.com/uxlfoundation/onednn
- Repository: https://github.com/uxlfoundation/onednn

## Overview

oneDNN is a cross-platform deep-learning operations library, used by frameworks and applications to accelerate CPU and GPU workloads. The principal flow is client code through the public API to engine-specific execution, using streams and memory; the library also exposes a Graph API for fused operation patterns. The README documents the product capabilities, while the sampled excerpts chiefly show engine, stream, and storage abstractions. Several implementation links are therefore omitted rather than inferred from directory names.

Main entry points: [`src/common/engine.hpp`](https://github.com/uxlfoundation/onednn/blob/main/src/common/engine.hpp) (Engine interface), [`include/oneapi/dnnl/dnnl.h`](https://github.com/uxlfoundation/onednn/blob/main/include/oneapi/dnnl/dnnl.h) (Public API), [`src/gpu/gpu_engine.hpp`](https://github.com/uxlfoundation/onednn/blob/main/src/gpu/gpu_engine.hpp) (GPU engine), [`src/cpu/cpu_engine.hpp`](https://github.com/uxlfoundation/onednn/blob/main/src/cpu/cpu_engine.hpp) (CPU engine)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API and operations"]
  node_public_api["Public API<br/>[dnnl.h]"]
  node_operation_descriptors["Operation descriptors<br/>[opdesc.hpp]"]
  node_primitive_descriptors["Primitive descriptors<br/>[primitive_desc.hpp]"]
  node_primitive_attributes["Primitive attributes<br/>[primitive_attr.cpp]"]
  node_operation_kernels["Deep-learning operations"]
end

subgraph group_runtime["Execution runtime"]
  node_engine["Engine interface<br/>[engine.hpp]"]
  node_engine_impl["Engine implementation<br/>[engine_impl.hpp]"]
  node_engine_identity["Engine identity<br/>[engine_id.hpp]"]
  node_stream["Execution stream<br/>[stream.hpp]"]
  node_stream_impl["Stream implementation<br/>[stream_impl.hpp]"]
  node_memory["Memory objects<br/>[memory.hpp]"]
  node_memory_storage["Memory storage<br/>[memory_storage.hpp]"]
  node_memory_layout["Memory layouts"]
end

subgraph group_cpu["CPU backends"]
  node_cpu_engine["CPU engine<br/>[cpu_engine.hpp]"]
  node_cpu_platform["CPU platform detection<br/>[platform.hpp]"]
  node_cpu_implementations["CPU kernels"]
end

subgraph group_gpu["GPU backends"]
  node_gpu_engine["GPU engine<br/>[gpu_engine.hpp]"]
  node_ocl_engine["OpenCL engine<br/>[engine_impl.hpp]"]
  node_ocl_kernels["Intel GPU kernels<br/>[pipeline.cpp]"]
  node_gpu_reorder["Cross-engine reorder"]
end

subgraph group_graph["Graph execution"]
  node_graph_api["Graph API<br/>[dnnl_graph.h]"]
  node_graph_passes["Graph pass manager<br/>[pass_manager.cpp]"]
end

node_framework(("Framework or app"))

node_framework -->|"calls"| node_public_api
node_public_api -.->|"describes operations"| node_operation_descriptors
node_public_api -.->|"creates primitives"| node_primitive_descriptors
node_public_api -->|"configures attributes"| node_primitive_attributes
node_public_api -->|"may use"| node_graph_api
node_graph_api -.->|"optimizes patterns"| node_graph_passes
node_primitive_descriptors -.->|"selects implementations"| node_operation_kernels
node_engine -->|"delegates to"| node_engine_impl
node_engine -->|"returns identity"| node_engine_identity
node_engine -->|"creates stream"| node_stream_impl
node_stream -->|"uses implementation"| node_stream_impl
node_stream -.->|"executes primitives"| node_memory
node_engine -->|"creates storage"| node_memory_storage
node_memory -->|"uses storage"| node_memory_storage
node_memory -->|"uses layout wrapper"| node_memory_layout
node_cpu_engine -->|"checks capabilities"| node_cpu_platform
node_cpu_engine -->|"implements engine"| node_engine
node_cpu_engine -->|"registers kernels"| node_cpu_implementations
node_gpu_engine -->|"implements engine"| node_engine
node_ocl_engine -->|"extends implementation"| node_engine_impl
node_ocl_engine -->|"uses GPU engine"| node_gpu_engine
node_ocl_kernels -->|"builds kernels"| node_gpu_engine
node_gpu_reorder -->|"uses GPU engine"| node_gpu_engine

click node_public_api "https://github.com/uxlfoundation/onednn/blob/main/include/oneapi/dnnl/dnnl.h"
click node_operation_descriptors "https://github.com/uxlfoundation/onednn/blob/main/src/common/opdesc.hpp"
click node_primitive_descriptors "https://github.com/uxlfoundation/onednn/blob/main/src/common/primitive_desc.hpp"
click node_primitive_attributes "https://github.com/uxlfoundation/onednn/blob/main/src/common/primitive_attr.cpp"
click node_operation_kernels "https://github.com/uxlfoundation/onednn/tree/main/src/common"
click node_graph_api "https://github.com/uxlfoundation/onednn/blob/main/include/oneapi/dnnl/dnnl_graph.h"
click node_graph_passes "https://github.com/uxlfoundation/onednn/blob/main/src/graph/utils/pm/pass_manager.cpp"
click node_engine "https://github.com/uxlfoundation/onednn/blob/main/src/common/engine.hpp"
click node_engine_impl "https://github.com/uxlfoundation/onednn/blob/main/src/common/engine_impl.hpp"
click node_engine_identity "https://github.com/uxlfoundation/onednn/blob/main/src/common/engine_id.hpp"
click node_stream "https://github.com/uxlfoundation/onednn/blob/main/src/common/stream.hpp"
click node_stream_impl "https://github.com/uxlfoundation/onednn/blob/main/src/common/stream_impl.hpp"
click node_memory "https://github.com/uxlfoundation/onednn/blob/main/src/common/memory.hpp"
click node_memory_storage "https://github.com/uxlfoundation/onednn/blob/main/src/common/memory_storage.hpp"
click node_memory_layout "https://github.com/uxlfoundation/onednn/blob/main/src/common/memory_desc_wrapper.hpp"
click node_cpu_engine "https://github.com/uxlfoundation/onednn/blob/main/src/cpu/cpu_engine.hpp"
click node_cpu_platform "https://github.com/uxlfoundation/onednn/blob/main/src/cpu/platform.hpp"
click node_cpu_implementations "https://github.com/uxlfoundation/onednn/tree/main/src/cpu"
click node_gpu_engine "https://github.com/uxlfoundation/onednn/blob/main/src/gpu/gpu_engine.hpp"
click node_ocl_engine "https://github.com/uxlfoundation/onednn/blob/main/src/xpu/ocl/engine_impl.hpp"
click node_ocl_kernels "https://github.com/uxlfoundation/onednn/blob/main/src/gpu/intel/conv/jit/pipeline.cpp"
click node_gpu_reorder "https://github.com/uxlfoundation/onednn/blob/main/src/gpu/generic/cross_engine_reorder.cpp"

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_public_api,node_operation_descriptors,node_primitive_descriptors,node_primitive_attributes,node_operation_kernels toneBlue
class node_engine,node_engine_impl,node_engine_identity,node_stream,node_stream_impl,node_memory,node_memory_storage,node_memory_layout toneAmber
class node_cpu_engine,node_cpu_platform,node_cpu_implementations toneMint
class node_gpu_engine,node_ocl_engine,node_ocl_kernels,node_gpu_reorder toneRose
class node_graph_api,node_graph_passes,node_framework toneIndigo
```

## Components

### API and operations

- [Public API](https://github.com/uxlfoundation/onednn/blob/main/include/oneapi/dnnl/dnnl.h): `include/oneapi/dnnl/dnnl.h`
- [Operation descriptors](https://github.com/uxlfoundation/onednn/blob/main/src/common/opdesc.hpp): `src/common/opdesc.hpp`
- [Primitive descriptors](https://github.com/uxlfoundation/onednn/blob/main/src/common/primitive_desc.hpp): `src/common/primitive_desc.hpp`
- [Primitive attributes](https://github.com/uxlfoundation/onednn/blob/main/src/common/primitive_attr.cpp): `src/common/primitive_attr.cpp`
- [Deep-learning operations](https://github.com/uxlfoundation/onednn/tree/main/src/common): `src/common`

### Execution runtime

- [Engine interface](https://github.com/uxlfoundation/onednn/blob/main/src/common/engine.hpp): `src/common/engine.hpp`
- [Engine implementation](https://github.com/uxlfoundation/onednn/blob/main/src/common/engine_impl.hpp): `src/common/engine_impl.hpp`
- [Engine identity](https://github.com/uxlfoundation/onednn/blob/main/src/common/engine_id.hpp): `src/common/engine_id.hpp`
- [Execution stream](https://github.com/uxlfoundation/onednn/blob/main/src/common/stream.hpp): `src/common/stream.hpp`
- [Stream implementation](https://github.com/uxlfoundation/onednn/blob/main/src/common/stream_impl.hpp): `src/common/stream_impl.hpp`
- [Memory objects](https://github.com/uxlfoundation/onednn/blob/main/src/common/memory.hpp): `src/common/memory.hpp`
- [Memory storage](https://github.com/uxlfoundation/onednn/blob/main/src/common/memory_storage.hpp): `src/common/memory_storage.hpp`
- [Memory layouts](https://github.com/uxlfoundation/onednn/blob/main/src/common/memory_desc_wrapper.hpp): `src/common/memory_desc_wrapper.hpp`

### CPU backends

- [CPU engine](https://github.com/uxlfoundation/onednn/blob/main/src/cpu/cpu_engine.hpp): `src/cpu/cpu_engine.hpp`
- [CPU platform detection](https://github.com/uxlfoundation/onednn/blob/main/src/cpu/platform.hpp): `src/cpu/platform.hpp`
- [CPU kernels](https://github.com/uxlfoundation/onednn/tree/main/src/cpu): `src/cpu`

### GPU backends

- [GPU engine](https://github.com/uxlfoundation/onednn/blob/main/src/gpu/gpu_engine.hpp): `src/gpu/gpu_engine.hpp`
- [OpenCL engine](https://github.com/uxlfoundation/onednn/blob/main/src/xpu/ocl/engine_impl.hpp): `src/xpu/ocl/engine_impl.hpp`
- [Intel GPU kernels](https://github.com/uxlfoundation/onednn/blob/main/src/gpu/intel/conv/jit/pipeline.cpp): `src/gpu/intel/conv/jit/pipeline.cpp`
- [Cross-engine reorder](https://github.com/uxlfoundation/onednn/blob/main/src/gpu/generic/cross_engine_reorder.cpp): `src/gpu/generic/cross_engine_reorder.cpp`

### Graph execution

- [Graph API](https://github.com/uxlfoundation/onednn/blob/main/include/oneapi/dnnl/dnnl_graph.h): `include/oneapi/dnnl/dnnl_graph.h`
- [Graph pass manager](https://github.com/uxlfoundation/onednn/blob/main/src/graph/utils/pm/pass_manager.cpp): `src/graph/utils/pm/pass_manager.cpp`

### Other components

- **Framework or app**

## Connections

- Framework or app → Public API: calls (evidence: `README.md`)
- Public API → Operation descriptors: describes operations
- Public API → Primitive descriptors: creates primitives
- Public API → Primitive attributes: configures attributes (evidence: `include/oneapi/dnnl/dnnl.h`)
- Public API → Graph API: may use (evidence: `README.md`)
- Graph API → Graph pass manager: optimizes patterns
- Primitive descriptors → Deep-learning operations: selects implementations (evidence: `src/common/engine.hpp`)
- Engine interface → Engine implementation: delegates to (evidence: `src/common/engine.hpp`)
- Engine interface → Engine identity: returns identity (evidence: `src/common/engine.hpp`)
- Engine interface → Stream implementation: creates stream (evidence: `src/common/engine.hpp`)
- Execution stream → Stream implementation: uses implementation (evidence: `src/common/stream.hpp`)
- Execution stream → Memory objects: executes primitives
- Engine interface → Memory storage: creates storage (evidence: `src/common/engine.hpp`)
- Memory objects → Memory storage: uses storage (evidence: `src/common/memory.hpp`)
- Memory objects → Memory layouts: uses layout wrapper (evidence: `src/common/memory.hpp`)
- CPU engine → CPU platform detection: checks capabilities (evidence: `src/cpu/cpu_engine.hpp`)
- CPU engine → Engine interface: implements engine (evidence: `src/cpu/cpu_engine.hpp`)
- CPU engine → CPU kernels: registers kernels (evidence: `src/cpu/cpu_engine.hpp`)
- GPU engine → Engine interface: implements engine (evidence: `src/gpu/gpu_engine.hpp`)
- OpenCL engine → Engine implementation: extends implementation (evidence: `src/xpu/ocl/engine_impl.hpp`)
- OpenCL engine → GPU engine: uses GPU engine
- Intel GPU kernels → GPU engine: builds kernels
- Cross-engine reorder → GPU engine: uses GPU engine (evidence: `src/gpu/generic/cross_engine_reorder.cpp`)
