Name Date Size #Lines LOC

..--

gen/H25-Apr-2025-13188

.gitignoreH A D25-Apr-202520 32

README.mdH A D25-Apr-20251.6 KiB3622

gen_loader.pyH A D25-Apr-20251.6 KiB4424

gen_print_layer.pyH A D25-Apr-20251.6 KiB4424

icd_dispatch_generated.c.makoH A D25-Apr-202513.8 KiB490466

icd_print_layer_generated.c.makoH A D25-Apr-202513.5 KiB311289

README.md

1# OpenCL ICD Loader Code Generation
2
3## Introduction
4
5In order to ease maintenance and enable faster development of related OpenCL ICD loader features, the OpenCL ICD loader API dispatch functions are generated from the OpenCL XML machine readable grammar.
6
7## Dependencies
8
9The API dispatch functions are generated using Python [Mako Templates](https://www.makotemplates.org/).
10
11In most cases, after installing Python for your platform, Mako may be installed using:
12
13```sh
14$ pip install Mako
15```
16
17## Making Changes
18
19Most changes only require modifications to the Mako templates.
20Small changes modifying syntax or layout are simple and straightforward.
21Occasionally more complicated changes will be required, say when a new API is added that is unlike any previous API, but this should be rare.
22
23The Python script should only need to be modified if additional information needs to be propagated from the XML file into the Mako template itself.
24
25## Generating Files
26
27Files for the OpenCL ICD loader, or the test layer, may be generated by executing the scripts `gen_loader.py`, or `gen_print_layer.py`, respectively.
28
29The script requires the `cl.xml` machine readable grammar.
30By default, the script searches for `cl.xml` in the current directory.
31The latest version of `cl.xml` may be found in the Khronos OpenCL-Docs repo [here](https://github.com/KhronosGroup/OpenCL-Docs/blob/main/xml/cl.xml).
32
33The output from the script is placed in the current directory by default, to allow easy comparisons between the generated files and the current files.
34After the generated files are evaluated, they should be manually copied into the source tree.
35These steps may be automated in the future.
36