You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Code snippet of the generated header file ``include/oneapi/math/blas/detail/newlib/onemath_blas_newlib.hpp``
43
+
Example header file ``include/oneapi/math/blas/detail/newlib/onemath_blas_newlib.hpp``
52
44
53
45
.. code-block:: cpp
54
46
@@ -61,18 +53,9 @@ Code snippet of the generated header file ``include/oneapi/math/blas/detail/newl
61
53
62
54
63
55
64
-
**Compile-time Dispatching Interface Example**: command to generate the compile-time dispatching interface template instantiations for ``newlib`` and supported device ``newdevice``
65
-
66
-
.. code-block:: bash
67
-
68
-
python scripts/generate_ct_instant.py include/oneapi/math/blas/detail/blas_ct_templates.hpp \ # Base header file
include/oneapi/math/blas/detail/newlib/onemath_blas_newlib.hpp \ # Header file with declaration of entry points to wrappers
71
-
newlib \ # Library name
72
-
newdevice \ # Backend name
73
-
oneapi::math::newlib # Wrappers namespace
56
+
**Compile-time Dispatching Interface Example**:
74
57
75
-
Code snippet of the generated header file ``include/oneapi/math/blas/detail/newlib/blas_ct.hpp``
58
+
Example of the compile-time dispatching interface template instantiations for ``newlib`` and supported device ``newdevice`` in ``include/oneapi/math/blas/detail/newlib/blas_ct.hpp``.
76
59
77
60
.. code-block:: cpp
78
61
@@ -179,9 +162,9 @@ To integrate the new third-party library to a oneMath header-based part, followi
179
162
+ if (queue.is_host())
180
163
+ device_id=device::newdevice;
181
164
182
-
* ``include/oneapi/math/blas.hpp``: include the generated header file for the compile-time dispatching interface (see `oneMath Usage Models <../README.md#supported-usage-models>`_)
165
+
* ``include/oneapi/math/blas.hpp``: include the created header file for the compile-time dispatching interface (see `oneMath Usage Models <../README.md#supported-usage-models>`_)
183
166
184
-
**Example**: add ``include/oneapi/math/blas/detail/newlib/blas_ct.hpp`` generated at the `1. Create Header Files`_ step
167
+
**Example**: add ``include/oneapi/math/blas/detail/newlib/blas_ct.hpp`` created at the `1. Create Header Files`_ step
185
168
186
169
.. code-block:: diff
187
170
@@ -190,7 +173,7 @@ To integrate the new third-party library to a oneMath header-based part, followi
The new files generated at the `1. Create Header Files`_ step result in the following updated structure of the BLAS domain header files.
176
+
The new files created at the `1. Create Header Files`_ step result in the following updated structure of the BLAS domain header files.
194
177
195
178
.. code-block:: diff
196
179
@@ -215,7 +198,7 @@ The new files generated at the `1. Create Header Files`_ step result in the foll
215
198
<other backends>/
216
199
<other domains>/
217
200
218
-
.. _generate_wrappers_and_cmake:
201
+
.. _create_wrappers_and_cmake:
219
202
220
203
3. Create Wrappers
221
204
------------------
@@ -240,24 +223,13 @@ All wrappers and dispatcher library implementations are in the ``src`` directory
240
223
241
224
Each backend library should contain a table of all functions from the chosen domain.
242
225
243
-
``scripts/generate_wrappers.py`` can help to generate wrappers with the "Not implemented" exception for all functions based on the provided header file.
226
+
**Example**: Create wrappers for ``newlib`` based on the header files created and integrated previously, and enable only one ``asum`` function
244
227
245
-
You can modify wrappers generated with this script to enable third-party library functionality.
246
-
247
-
**Example**: generate wrappers for ``newlib`` based on the header files generated and integrated previously, and enable only one ``asum`` function
248
-
249
-
The command below generates two new files:
228
+
Create two new files:
250
229
251
230
* ``src/blas/backends/newlib/newlib_wrappers.cpp`` - DPC++ wrappers for all functions from ``include/oneapi/math/blas/detail/newlib/onemath_blas_newlib.hpp``
252
231
* ``src/blas/backends/newlib/newlib_wrappers_table_dyn.cpp`` - structure of symbols for run-time dispatcher (in the same location as wrappers), suffix ``_dyn`` indicates that this file is required for dynamic library only.
253
232
254
-
.. code-block:: bash
255
-
256
-
python scripts/generate_wrappers.py include/oneapi/math/blas/detail/newlib/onemath_blas_newlib.hpp \ # Base header file
257
-
src/blas/function_table.hpp \ # Declaration for structure of symbols
You can then modify ``src/blas/backends/newlib/newlib_wrappers.cpp`` to enable the C function ``newlib_sasum`` from the third-party library ``libnewlib.so``.
262
234
263
235
To enable this function:
@@ -374,19 +346,11 @@ Here is the list of files that should be created/updated to integrate the new wr
374
346
375
347
* Create the ``src/<domain>/backends/<new_directory>/CMakeList.txt`` cmake config file to specify how to build the backend layer for the new third-party library.
376
348
377
-
``scripts/generate_cmake.py`` can help to generate the initial ``src/<domain>/backends/<new_directory>/CMakeList.txt`` config file automatically for all files in the directory.
378
-
Note: all source files with the ``_dyn`` suffix are added to build if the target is a dynamic library only.
379
-
380
-
**Example**: command to generate the cmake config file for the ``src/blas/backends/newlib`` directory
381
-
382
-
.. code-block:: bash
349
+
Check existing backends as a reference to create ``cmake/FindXXX.cmake`` file.
383
350
384
-
python scripts/generate_cmake.py src/blas/backends/newlib \ # Full path to the directory
385
-
newlib # Library name
351
+
You should update the config file with information about the new ``cmake/FindXXX.cmake`` file and instructions about how to link with the third-party library.
386
352
387
-
You should manually update the generated config file with information about the new ``cmake/FindXXX.cmake`` file and instructions about how to link with the third-party library.
388
-
389
-
**Example**: update the generated ``src/blas/backends/newlib/CMakeLists.txt`` file
353
+
**Example**: update the ``src/blas/backends/newlib/CMakeLists.txt`` file
0 commit comments