Guidance for AI coding agents working in the ZenDNN repository. This file captures always-useful context about the repo and its architecture, and points to specialized agent skills for detailed, step-by-step workflows. Read this first; follow a skill when your task matches one below.
ZenDNN (Zen Deep Neural Network Library) accelerates deep learning
inference on AMD CPUs. This repository builds the standalone native library
zendnnl — a redesigned, re-architected successor to ZenDNN_legacy.
- ZenDNN's performance-first interface is the Low Overhead API (LowOHA):
direct, function-based entry points (e.g.
matmul_direct,group_matmul_direct,reorder_direct) operating on raw pointers with minimal per-call overhead. It is complemented by a modular, object-oriented Tensor Operator API. - ZenDNN is a library, not an application. It is consumed by inference frameworks through plugins (see Consumers / plugins) and can also be linked directly into serving stacks.
- ZenDNN can optionally plug in alternate backends (oneDNN, LibXSMM, parlooper,
FBGEMM) but also builds "zendnn-only" with those off. Note that zendnn-only
is not dependency-free: AOCL DLP is the GEMM library
zendnnllinks against and stays enabled.
For a deeper architecture overview see docs/zendnnl_architecture.md; for the
public overview see README.md.
ZenDNN
|- CMakeLists.txt : top-level CMake entry point.
|- cmake/ : CMake modules (dependency defaults, project options,
| ExternalProject wiring).
|- zendnnl/ : the library source.
| |- src/
| | |- common : high-level library utilities.
| | |- memory : tensor_t class, storage, quantization, options.
| | |- lowoha_operators: direct low-overhead operators (LowOHA path):
| | | matmul, reorder, normalization, sdpa, softmax, pooling.
| | |- operators : object-oriented Tensor Operator API.
| | |- gtests : GoogleTest files.
|- benchdnn/ : benchmarking utility for ZenDNN operators.
|- examples/ : tutorial examples using the ZenDNN API.
|- dependencies/ : third-party dependency download/build.
|- docs/ : architecture, build, and logging documentation.
|- scripts/ : supporting shell scripts.
|- tools/, fwk/ : additional tooling.
|- .claude/skills/ : agent skills (see below).
- CMake (>= 3.26) drives the whole build. Optional backend dependencies are
controlled by
ZENDNNL_DEPENDS_*flags defined incmake/ZenDnnlDependenciesDefaults.cmake. The five toggles areAOCLDLP,ONEDNN,LIBXSMM,PARLOOPERandFBGEMM; defaults vary (PARLOOPERis OFF, the rest ON), so pass each one explicitly rather than assuming.AOCLDLPis a toggle but not a choice:zendnnllinks AOCL DLP directly, so a build with it OFF is broken rather than lean.AOCLUTILSandJSONare forced ON by the cmake and are not user-controllable. There is noAMDBLIStoggle — passing-DZENDNNL_DEPENDS_AMDBLIS=...is silently ignored. cmake/ZenDnnlProjectOptions.cmakesets the install prefix to<ZenDNN>/build/install, so no-DCMAKE_INSTALL_PREFIXis needed.- The top-level
CMakeLists.txtaddszendnnlviaExternalProject_ADD(cmake/ExternProjZENDNNL.cmake); thealltarget both builds and installs intobuild/install/zendnnl— there is no separate install step. - ZenDNN downloads and builds its dependencies during its own build, and forwards them to downstream consumers, so a consumer does not have to resolve ZenDNN's dependencies itself.
For the detailed and authoritative build workflow, use the build-zendnn
skill rather than reconstructing commands by hand.
ZenDNN is designed to be used through framework plugins and integrations rather than standalone:
- zentf — TensorFlow Plugin (
ZenDNN_TensorFlow_Plugin): integrates ZenDNN into TensorFlow so TF inference can dispatch supported ops to ZenDNN kernels on AMD CPUs. It consumes thezendnnllibrary produced by this repo. For supported TensorFlow/Python versions and install instructions, see the public zentf README (linked from this repo'sREADME.md). Architectural specifics of the plugin itself live in the zentf repository, not here — treat that repo as the source of truth for zentf internals. - zentorch — PyTorch Plugin (
ZenDNN_PyTorch_Plugin): integrates ZenDNN into PyTorch. zentorch vendors this ZenDNN repo as athird_party/ZenDNNsubmodule and builds the ZenDNN backend via thebuild-zendnnskill (the single source of truth for the ZenDNN backend build steps). - Direct vLLM (CPU) integration: vLLM's CPU extension can compile upstream
oneDNN (
uxlfoundation/oneDNN, whosemaincarries the opt-in zen64 ZenDNN backend) and link the standalone ZenDNN native library directly (no zentorch). This path is enabled only when both the oneDNN source dir (FETCHCONTENT_SOURCE_DIR_ONEDNN) and the ZenDNN dir (ZENDNN_DIR) are provided at build time. The vLLM-side wiring is not yet upstream, so it is carried as a patch bundled with thebuild-vllm-onednn-zendnnskill. See that skill.
Specialized, step-by-step workflows live under .claude/skills/. When a task
matches one of these, follow the skill — it is the authoritative,
stop-on-failure procedure. Do not duplicate or paraphrase its commands here.
-
build-zendnn—.claude/skills/build-zendnn/SKILL.mdBuild the standalone ZenDNN native library (zendnnl) from a chosen git ref with the alternate backends OFF (no oneDNN, LibXSMM, parlooper, FBGEMM), keeping AOCL DLP. Produces thebuild/install/zendnnlinstall tree (exported asZENDBUILDPATH) that downstream consumers (zentorch, vLLM) point at. This is the single source of truth for the ZenDNN backend build. Inputs: ZenDNN git ref (branch/tag/PR; defaultmain) and ZenDNN dir (default this repo). -
build-vllm-onednn-zendnn—.claude/skills/build-vllm-onednn-zendnn/SKILL.mdBuild vLLM (CPU) end-to-end with the upstream oneDNN + ZenDNN (zen64) backend via direct integration (no zentorch). Orchestrates thebuild-zendnnskill for the native lib, upstream oneDNN source prep, a conda build env, the vLLM wheel build, and two-tier (build-time + runtime) verification. Inputs: repo root, vLLM repo/ref, ZenDNN ref, oneDNN dir, and build method.
Each skill ships its flowchart as a standalone .mmd file next to its
SKILL.md — build-zendnn/build-zendnn-flow.mmd and
build-vllm-onednn-zendnn/build-vllm-onednn-zendnn-flow.mmd. Those diagrams are
the end-to-end decision flow, with build-zendnn as the reusable Stage 1
sub-flow of the vLLM build.
Both build skills enforce a strict stop-on-failure policy: if any command fails, stop and report the failing step, the exact command, and the first real error line — do not auto-retry, auto-fix, or continue on your own. Honor that policy when executing these workflows.
- Keep documentation factual: do not invent APIs, flags, or version numbers.
- Prefer editing existing files over creating new ones.
- Commit messages describe only the change — no AI/tool attribution.