@@ -245,6 +245,134 @@ Instructions for adding support for new models: [HOWTO-add-model.md](docs/develo
245245| [ CANN] ( docs/build.md#cann ) | Ascend NPU |
246246| [ OpenCL] ( docs/backend/OPENCL.md ) | Adreno GPU |
247247
248+ ## Software architecture
249+
250+ ``` mermaid
251+
252+ block-beta
253+ columns 1
254+
255+ block:llamacpp
256+ llamacpp["llama_cpp"]
257+ style llamacpp fill:#3c3,color:#000,stroke:#000
258+ end
259+
260+ block:ggml_backend
261+ ggml_backend["GGML backend subsystem"]
262+ style ggml_backend fill:#3c3,color:#000,stroke:#000
263+
264+ block:ggmlbackends
265+ ggml_cpu["ggml-cpu"]
266+ ggml_metal["ggml-metal"]
267+ ggml_sycl["ggml-sycl"]
268+ ggml_cuda["ggml-cuda"]
269+ ggml_hip["ggml-hip"]
270+ ggml_vulkan["ggml-vulkan"]
271+ ggml_cann["ggml-cann"]
272+ ggml_opencl["ggml-opencl"]
273+ ggml_qnn["ggml-qnn"]
274+ ggml_nnpa["ggml-nnpa"]
275+ ggml_ane["ggml-ane"]
276+
277+ style ggml_cpu fill:#888,color:#000,stroke:#000
278+ style ggml_metal fill:#888,color:#000,stroke:#000
279+ style ggml_sycl fill:#888,color:#000,stroke:#000
280+ style ggml_cuda fill:#888,color:#000,stroke:#000
281+ style ggml_hip fill:#888,color:#000,stroke:#000
282+ style ggml_vulkan fill:#888,color:#000,stroke:#000
283+ style ggml_cann fill:#888,color:#000,stroke:#000
284+
285+ style ggml_opencl fill:#cc3,color:#000,stroke:#000
286+ style ggml_qnn fill:#cc3,color:#000,stroke:#000
287+ style ggml_ane fill:#fff,color:#000,stroke:#f00,stroke-width:2,stroke-dasharray:5
288+ style ggml_nnpa fill:#cc3,color:#000,stroke:#000
289+ end
290+ end
291+
292+ block:ggml_pal
293+ ggml_pal["Platform Abstraction Layer"]
294+ style ggml_pal fill:#c33,color:#000,stroke:#000
295+ end
296+
297+ block:ggml_backendsubsystem
298+ ggml_backendsubsystem["GGML backend subsystem"]
299+ style ggml_backendsubsystem fill:#3c3,color:#000,stroke:#000
300+ end
301+
302+ block:group1:2
303+ columns 2
304+ block:ggml_tensor
305+ ggml_tensor["GGML tensor"]
306+ style ggml_tensor fill:#3c3,color:#000,stroke:#000
307+ end
308+
309+ block:ggml_cgraph
310+ ggml_cgraph["GGML cgraph"]
311+ style ggml_cgraph fill:#3c3,color:#000,stroke:#000
312+ end
313+ end
314+
315+ block:OS
316+ Windows
317+ Linux
318+ Android
319+ QNX
320+ IBM_z/OS
321+ end
322+
323+ block:hardware_vendors
324+ Intel
325+ AMD
326+ Apple
327+ Nvidia
328+ Huawei
329+ Loongson
330+ Qualcomm
331+ IBM
332+
333+ ggml_metal --> Apple
334+ ggml_cuda --> Nvidia
335+ ggml_hip --> AMD
336+ ggml_cann --> Huawei
337+ ggml_sycl --> Intel
338+ ggml_opencl --> Qualcomm
339+ ggml_qnn --> Qualcomm
340+ ggml_ane --> Apple
341+ ggml_nnpa --> IBM
342+ end
343+
344+ block:hardware_types
345+ CPU
346+ GPU
347+ NPU
348+ end
349+
350+ block:hardware_archs
351+ x86
352+ arm
353+ risc
354+ dsp
355+ loongson
356+ end
357+ ```
358+
359+
360+
361+ ``` mermaid
362+ %%{init: {"flowchart": {"htmlLabels": false, 'nodeSpacing': 30, 'rankSpacing': 30}} }%%
363+ flowchart LR
364+ classDef EXIST fill:#888,color:#000,stroke:#000
365+ classDef DONE fill:#3c3,color:#000,stroke:#000
366+ classDef WIP fill:#cc3,color:#000,stroke:#000
367+ classDef TODO fill:#c33,color:#000,stroke:#000
368+ classDef NEW fill:#fff,color:#000,stroke:#f00,stroke-width:2,stroke-dasharray:5
369+ subgraph Legend
370+ direction LR
371+ EXIST:::EXIST ~~~ TODO:::TODO ~~~ WIP:::WIP ~~~ DONE:::DONE ~~~ NEW:::NEW
372+ end
373+ ```
374+
375+
248376## Building the project
249377
250378The main product of this project is the ` llama ` library. Its C-style interface can be found in [ include/llama.h] ( include/llama.h ) .
0 commit comments