Skip to content

Commit a9f79ed

Browse files
committed
Update CMake guidance for the extension helper in #3111
New extensions call build_dpnp_pybind11_ext instead of copying an existing CMakeLists.txt, and request -fno-sycl-id-queries-fit-in-int with its LARGE_RANGES option.
1 parent 0c194c3 commit a9f79ed

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎dpnp/backend/AGENTS.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
3. Register `init_<name>(m)` in `extensions/ufunc/elementwise_functions/common.cpp` and add the source to `_elementwise_sources` in `extensions/ufunc/CMakeLists.txt`.
1515
4. Wrap it in Python (see `dpnp/AGENTS.md`).
1616

17-
A new extension copies an existing extension's `CMakeLists.txt` (there is no helper function), keeps `add_dependencies(<module> _usmarray)`, and is added with `add_subdirectory` in `dpnp/CMakeLists.txt`.
17+
A new extension's `CMakeLists.txt` lists its sources and calls `build_dpnp_pybind11_ext(<module> <install dir> SOURCES ... [INCLUDE_DIRS ...] [LARGE_RANGES])` from `dpnp/CMakeLists.txt`, which sets the options all extensions share; only oneMKL/oneMath linking stays in the extension. Add it with `add_subdirectory` in `dpnp/CMakeLists.txt`, and put an option every extension needs into the helper, not into one extension.
1818

1919
## Rules for Changes
2020
These also apply to `dpnp/tensor/libtensor/`.
@@ -26,7 +26,7 @@ These also apply to `dpnp/tensor/libtensor/`.
2626
- Guard double, complex<double> and half with `dpnp::tensor::type_utils::validate_type_for_device<T>(q)`; don't use double literals or casts in kernels that must run without fp64.
2727
- `blas`, `fft`, `lapack` and `sparse` build against either oneMKL or oneMath (`USE_ONEMATH`); `vm` is oneMKL-only and reports availability through `_is_available()`.
2828
- Release the GIL around blocking oneMKL calls (`py::gil_scoped_release`).
29-
- A module that may launch more than `INT_MAX` work-items needs `-fno-sycl-id-queries-fit-in-int` in both `target_compile_options` and `target_link_options` (DPC++ 2026.2 and later check it at link time).
29+
- An extension whose kernels may be launched over more than `INT_MAX` work-items passes `LARGE_RANGES` to `build_dpnp_pybind11_ext`, which adds `-fno-sycl-id-queries-fit-in-int` at compile and link time (DPC++ 2026.2 and later need it at link time). Outside the helper (`dpnp_backend_c`, `dpnp/tensor`) pass it to both `target_compile_options` and `target_link_options`.
3030
- clang-format 23 formats C++ (`.clang-format`: LLVM base, 4-space indent, 80 columns); gersemi formats CMake at 88 columns, except `cmake/Modules/`.
3131

3232
## Build

0 commit comments

Comments
 (0)