-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy path.coderabbit.yaml
More file actions
269 lines (259 loc) · 14 KB
/
Copy path.coderabbit.yaml
File metadata and controls
269 lines (259 loc) · 14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
# CodeRabbit configuration for Eigen.
# Schema: https://docs.coderabbit.ai/reference/configuration
#
# Eigen is a header-only C++14 template library, GitLab-hosted, with a strict
# ABI policy and several major downstream consumers (notably TensorFlow). The
# settings below favor signal over volume: chill profile, minimal noise on
# auto-generated docs and vendored Fortran, and explicit guidance for the
# template-heavy core.
language: en-US
# CodeRabbit caps tone_instructions at 250 chars. Keep the essential
# focus areas here; the full reviewer guidance (provenance discipline,
# numerical-tolerance policy, GPU caveats, etc.) lives in AGENTS.md
# and is loaded via knowledge_base.code_guidelines.filePatterns below.
tone_instructions: >-
Eigen, header-only C++14. Focus: correctness, numerical accuracy
(LAPACK-level; flag regressions), ABI, performance, template pitfalls,
missing tests, uncited published algorithms (LAPACK, LAWN, Higham,
Golub & van Loan). Skip style nits and C++17+.
early_access: false
enable_free_tier: true
# Pull repo-level reviewer guidance from AGENTS.md (the agent-facing
# condensation of CONTRIBUTING + wiki). Set explicitly because the
# default filePatterns list may be inactive when no patterns are
# specified by the user.
knowledge_base:
code_guidelines:
enabled: true
filePatterns:
- "AGENTS.md"
reviews:
profile: chill
request_changes_workflow: false
# Trim down the noise in the auto-posted comment: drop sections that don't
# carry weight on a numerics-heavy template library. Keep the walkthrough
# (file-by-file summary) but skip the high-level summary, the changed-files
# overview, and don't collapse the walkthrough so reviewers see it expanded.
high_level_summary: false
high_level_summary_in_walkthrough: false
poem: false
review_status: true
collapse_walkthrough: false
changed_files_summary: false
enable_prompt_for_ai_agents: true
sequence_diagrams: false
estimate_code_review_effort: false
assess_linked_issues: false
related_issues: false
related_prs: false
suggested_labels: false
suggested_reviewers: false
in_progress_fortune: false
pre_merge_checks:
# Eigen is a header-only template library where docstring coverage
# has limited value; the docstrings precheck adds noise without signal.
docstrings:
mode: off
auto_review:
enabled: true
drafts: false
# Eigen MRs often see many WIP pushes; reviewing every push burns the
# per-developer hourly rate limit on the free/OSS tier. Review the first
# diff only; further reviews can be requested with `@coderabbitai review`.
auto_incremental_review: false
base_branches:
- master
path_filters:
- "!doc/snippets/**"
- "!doc/examples/**"
- "!lapack/*.f"
- "!blas/testing/**"
- "!**/*.png"
- "!**/*.bin"
- "!**/*.svg"
- "!**/*.pdf"
path_instructions:
- path: "**"
instructions: |
Repo-wide conventions (apply across all paths):
- **SPDX / REUSE.** Every new source file (`.h`, `.cpp`, `.cu`,
`.inc`, `.cmake`, `CMakeLists.txt`, etc.) must carry the
standard Eigen MPL-2.0 SPDX + copyright header inline. The
`checkformat:reuse` CI job (`reuse lint`) blocks otherwise.
Files that can't carry inline headers (top-level docs,
generated/templated files, binary assets) are covered by
path-based annotations in `REUSE.toml` — add the path there
if creating one.
- **GitLab is upstream**; the GitHub mirror is read-only. Do
not suggest opening PRs / pushing to GitHub.
- **Commit messages** follow `Category: Short description`
(e.g. `GPU: Fix special-function test coverage`).
- path: "Eigen/src/**"
instructions: |
Eigen is a header-only C++14 template library with a strict ABI policy.
- **Numerical accuracy is a top priority.** Eigen targets accuracy
comparable to established numerical libraries such as LAPACK. Flag
any change that may degrade accuracy, condition handling, stability
under near-singular / ill-conditioned inputs, or behavior near
subnormals, infinities, NaNs, or extreme exponents. In general,
do not trade accuracy for speed.
- **Acceptable accuracy tradeoff on regular inputs only.** A faster
algorithm whose worst-case error on regular inputs is bounded to
a few ULPs by a principled analysis may be acceptable. Surface
the tradeoff and the bound clearly so a human reviewer can judge;
do not auto-approve or auto-reject these. **Special-value handling
is not subject to the few-ULP tradeoff** — IEEE-754 entities (NaN,
±0, ±∞, subnormals) and standard-library edge cases (e.g. `log(0)`,
`pow(0, 0)`) must match the cppreference / IEEE 754 spec exactly.
- **Numerical changes require numerical tests.** Any new numerical
algorithm, kernel, or accuracy-sensitive change MUST come with
tests that exercise its accuracy claims: random ill-conditioned
inputs across a range of condition numbers, edge values, and
matrices structured for the algorithm (Hilbert, Vandermonde,
Pascal, Wilkinson's W, Frank, Lehmer, KMS / Toeplitz, banded,
rank-deficient, defective / near-defective Jordan blocks,
positive-definite-but-barely — MATLAB's `gallery()` is the
standard catalog; Higham's *Accuracy and Stability of Numerical
Algorithms* / *Functions of Matrices* and Golub & van Loan are
the references). For routines with a
LAPACK counterpart, match LAPACK's TESTING/ category coverage as
the bar. Quantify accuracy in ULPs against a scalar reference,
not just relative error. Sollya / MPFR are the standard tools
for ground-truth and polynomial generation; prefer in-C++ MPFR
verification over a Python reference. If such tests are missing,
request them.
- **Performance-sensitive changes ship with a benchmark** under
`benchmarks/` or `unsupported/benchmarks/`. Don't defer to a
follow-up MR.
- **Preserve `EIGEN_DEVICE_FUNC`.** It is pervasive on coefficient-
level methods so the same code compiles for host and CUDA / HIP /
SYCL device. Dropping it silently breaks GPU builds and is rarely
caught locally — flag any removal or omission on new methods.
- **Header-only contract.** Never include from `Eigen/src/...` (or
`unsupported/Eigen/src/...`) directly; reach implementation via
the umbrella module headers (`Eigen/Core`, `Eigen/Dense`, …).
`InternalHeaderCheck.h` makes direct internal includes a hard
error. Old internal headers do not get backward-compatibility
forwarding shims when moved/renamed; only the public umbrella
headers do.
- **Aliasing in fast paths.** Aliasing safety is not a uniform
invariant. The standard product path inserts an auto-temporary
so `mat = mat * mat` is safe, but optimized fast paths that
bypass the general assignment machinery have historically
introduced aliasing bugs. When a change modifies or adds such a
fast path, check whether LHS/RHS aliasing is handled and prefer
falling back to the general path when in doubt.
- Treat the public API surface as frozen: do not propose renames or
signature changes for non-internal types.
- Performance and inlining matter; flag possible regressions in hot
paths (products, packet kernels, evaluators, decompositions).
- Watch for accidental allocations in templates that should be
allocation-free.
- C++14 is the minimum; do not suggest C++17+ features. (A migration
to C++17 is planned on a separate branch; until it lands on master,
new code must compile under C++14.)
- **Skip "modernize" advice.** Do not propose `modernize-*` or
`cppcoreguidelines-*` clang-tidy fixes; do not suggest replacing
`EIGEN_STRONG_INLINE` with `inline`; do not propose reordering
internal includes (`SortIncludes: false` is intentional); and do
not "fix" Eigen's macro indentation (`.clang-format` registers
Eigen macros as `StatementMacros` / `AttributeMacros`).
Style is `clang-format-17` exactly — the CI diff is authoritative.
- **Assertions.** Prefer `eigen_assert` (and
`eigen_internal_assert` for internal-only invariants) over raw
`assert` for runtime preconditions; prefer `EIGEN_STATIC_ASSERT`
over plain `static_assert` for compile-time conditions.
- path: "Eigen/src/Core/arch/**"
instructions: |
Per-architecture packet math (SIMD vectorization) backends. In
addition to the general `Eigen/src/**` rules:
- **Guard intrinsics by ISA macro.** Each intrinsic must be wrapped
in its own `EIGEN_VECTORIZE_*` `#ifdef` — being inside `arch/AVX/`
does not imply AVX2 / FMA / AVX-512 are available. Wrap AVX2 in
`EIGEN_VECTORIZE_AVX2`, FMA in `EIGEN_VECTORIZE_FMA`, AVX-512DQ
in `EIGEN_VECTORIZE_AVX512DQ`, etc., and provide a fallback for
the un-guarded path. Same discipline applies on NEON
(`EIGEN_VECTORIZE_NEON_FP16`), VSX (`EIGEN_VECTORIZE_VSX`), etc.
Missing guards typically compile fine on the developer's machine
and break CI on narrower ISA targets — flag any unguarded
intrinsic.
- **Backend symmetry.** New packet operations should be specialized
across **every** backend that supports the type, with
`arch/Default/` providing scalar fallbacks. A missing or divergent
backend specialization usually shows up first in
`test/packetmath.cpp` or `unsupported/test/special_packetmath.cpp`
— flag PRs that add a packet op in one backend without the others.
- path: "{Eigen/ThreadPool,Eigen/src/ThreadPool/**}"
instructions: |
Eigen's work-stealing thread pool — umbrella header `Eigen/ThreadPool`
with sources under `Eigen/src/ThreadPool/` (`NonBlockingThreadPool`,
`RunQueue`, `EventCount`, `ForkJoin`, `CoreThreadPoolDevice`). Backs
`EIGEN_GEMM_THREADPOOL` and the Tensor module's `ThreadPoolDevice`.
Originally developed for TensorFlow and still depended on there —
signatures, semantics, and performance are load-bearing. Apply the
same caution as the Tensor module: prefer additive changes, keep
header layout stable, and call out behavior changes prominently.
- path: "test/**"
instructions: |
Tests use Eigen's custom framework defined in `test/main.h`:
`VERIFY_*` assertions, `CALL_SUBTEST_N` / `EIGEN_TEST_PART_N` to
split one `.cpp` into N per-shard executables, and
`EIGEN_DECLARE_TEST(<name>) { ... }` as the entry point.
`EIGEN_REPEAT` / `EIGEN_SEED` are runtime env vars, not the shard
mechanism. Do not suggest restructuring the harness, switching to
gtest assertions, or deduplicating shards. Numerical-tolerance
comparisons (`VERIFY_IS_APPROX`) are deliberate; do not push for
exact equality. Tests may be long and procedural.
**In-flight migration to Google Test:**
[MR 2159](https://gitlab.com/libeigen/eigen/-/merge_requests/2159)
replaces `EIGEN_DECLARE_TEST` / `CALL_SUBTEST_N` with gtest
`TEST` / `TYPED_TEST` while bridging `VERIFY_*` to gtest
expectations; once it lands, the "do not switch to gtest" rule
flips for new tests.
- path: "unsupported/Eigen/**"
instructions: |
"Unsupported" here means looser API-stability guarantees, **not**
low-traffic or low-stakes. The Tensor module
(`unsupported/Eigen/Tensor`, sources under
`unsupported/Eigen/src/Tensor/`) is TensorFlow's core compute
backend; treat its signatures, header layout, semantics, and
performance on contraction / reduction / morphing kernels as
load-bearing. Prefer additive changes, keep header paths stable,
and call out behavior changes prominently. Other modules
(`TensorSymmetry`, `AutoDiff`, `Polynomials`, `MatrixFunctions`,
`NNLS`, `FFT`, `GPU`, `Splines`, `NumericalDiff`,
`IterativeSolvers`) are genuinely more permissive but should still
preserve their public API. `unsupported/Eigen/CXX11/` is backward-
compatibility forwarding shims only — do not place new headers
there.
- path: "unsupported/Eigen/src/GPU/**"
instructions: |
Host-side dispatch to NVIDIA libraries (cuBLAS / cuSOLVER / cuFFT /
cuSPARSE / cuDSS) on device-resident operands (`gpu::DeviceMatrix`).
This is **not** an expression-template layer — every supported
expression maps to a single library call, and `DeviceMatrix` does
not inherit from `MatrixBase`. Do not suggest reshaping it into an
expression-template system. Tests are deliberately compiled as
`.cpp` (not `.cu`) so NVCC does not instantiate Eigen CPU packet
ops for CUDA vector types — do not propose moving them to `.cu`.
- path: "blas/**"
instructions: |
These are Reference BLAS API wrappers around Eigen. Match the BLAS
standard exactly; do not suggest deviating from netlib semantics.
- path: "lapack/**"
instructions: |
The .f sources are vendored netlib LAPACK reference; do not review
them. The C++ wrappers should faithfully implement the LAPACK
contract.
- path: "ci/**"
instructions: |
GitLab CI configuration. Be conservative -- do not suggest
restructuring the existing job graph or changing runner tags without
strong reason.
- path: "benchmarks/**"
instructions: |
Microbenchmarks built against Google Benchmark. Clarity matters less
than realistic measurement; flag only correctness or measurement
methodology issues, not style.
chat:
auto_reply: true