CARVIEW |
Select Language
HTTP/2 200
date: Sun, 27 Jul 2025 12:17:33 GMT
content-type: text/html; charset=utf-8
vary: X-PJAX, X-PJAX-Container, Turbo-Visit, Turbo-Frame, X-Requested-With,Accept-Encoding, Accept, X-Requested-With
x-repository-download: git clone https://github.com/opencv/opencv.git
etag: W/"50dcc8f528b8303c600a59c170187a83"
cache-control: max-age=0, private, must-revalidate
strict-transport-security: max-age=31536000; includeSubdomains; preload
x-frame-options: deny
x-content-type-options: nosniff
x-xss-protection: 0
referrer-policy: no-referrer-when-downgrade
content-security-policy: default-src 'none'; base-uri 'self'; child-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/; connect-src 'self' uploads.github.com www.githubstatus.com collector.github.com raw.githubusercontent.com api.github.com github-cloud.s3.amazonaws.com github-production-repository-file-5c1aeb.s3.amazonaws.com github-production-upload-manifest-file-7fdce7.s3.amazonaws.com github-production-user-asset-6210df.s3.amazonaws.com *.rel.tunnels.api.visualstudio.com wss://*.rel.tunnels.api.visualstudio.com objects-origin.githubusercontent.com copilot-proxy.githubusercontent.com proxy.individual.githubcopilot.com proxy.business.githubcopilot.com proxy.enterprise.githubcopilot.com *.actions.githubusercontent.com wss://*.actions.githubusercontent.com productionresultssa0.blob.core.windows.net/ productionresultssa1.blob.core.windows.net/ productionresultssa2.blob.core.windows.net/ productionresultssa3.blob.core.windows.net/ productionresultssa4.blob.core.windows.net/ productionresultssa5.blob.core.windows.net/ productionresultssa6.blob.core.windows.net/ productionresultssa7.blob.core.windows.net/ productionresultssa8.blob.core.windows.net/ productionresultssa9.blob.core.windows.net/ productionresultssa10.blob.core.windows.net/ productionresultssa11.blob.core.windows.net/ productionresultssa12.blob.core.windows.net/ productionresultssa13.blob.core.windows.net/ productionresultssa14.blob.core.windows.net/ productionresultssa15.blob.core.windows.net/ productionresultssa16.blob.core.windows.net/ productionresultssa17.blob.core.windows.net/ productionresultssa18.blob.core.windows.net/ productionresultssa19.blob.core.windows.net/ github-production-repository-image-32fea6.s3.amazonaws.com github-production-release-asset-2e65be.s3.amazonaws.com insights.github.com wss://alive.github.com api.githubcopilot.com api.individual.githubcopilot.com api.business.githubcopilot.com api.enterprise.githubcopilot.com; font-src github.githubassets.com; form-action 'self' github.com gist.github.com copilot-workspace.githubnext.com objects-origin.githubusercontent.com; frame-ancestors 'none'; frame-src viewscreen.githubusercontent.com notebooks.githubusercontent.com; img-src 'self' data: blob: github.githubassets.com media.githubusercontent.com camo.githubusercontent.com identicons.github.com avatars.githubusercontent.com private-avatars.githubusercontent.com github-cloud.s3.amazonaws.com objects.githubusercontent.com release-assets.githubusercontent.com secured-user-images.githubusercontent.com/ user-images.githubusercontent.com/ private-user-images.githubusercontent.com opengraph.githubassets.com copilotprodattachments.blob.core.windows.net/github-production-copilot-attachments/ github-production-user-asset-6210df.s3.amazonaws.com customer-stories-feed.github.com spotlights-feed.github.com objects-origin.githubusercontent.com *.githubusercontent.com; manifest-src 'self'; media-src github.com user-images.githubusercontent.com/ secured-user-images.githubusercontent.com/ private-user-images.githubusercontent.com github-production-user-asset-6210df.s3.amazonaws.com gist.github.com; script-src github.githubassets.com; style-src 'unsafe-inline' github.githubassets.com; upgrade-insecure-requests; worker-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/
server: github.com
content-encoding: gzip
accept-ranges: bytes
set-cookie: _gh_sess=Me8ppA%2FhK%2F%2FlbsNbcgBo5w6UgzXppGIhFzJMGqSIuqUqT3uSC5tiK%2B0xR%2FPtNoOjJO9Wbvi6BL1S0KJBE4fJ49TqHKZo6bLJfCvanCwKF6FUj7oALrMhN6ZZVKFXuP8uvbNSkmXpOuYc%2FS6HjaAnsCXTMLEKjuwcw07Icyiai5PI6r3x%2BfMWVrHTKgWqx2tp%2F35%2FnsR2Z33mZcWZYDBNK43fChMJqsNpLwE%2BL9fwU8iszHYc5exaQnwNWLMSOW9NaAgeaTem5xpZvhyPdmg%2BqQ%3D%3D--h7nArQSYe3ZRz0M%2F--0ud7LlyktsU5CDble1ReRA%3D%3D; Path=/; HttpOnly; Secure; SameSite=Lax
set-cookie: _octo=GH1.1.1956229438.1753618652; Path=/; Domain=github.com; Expires=Mon, 27 Jul 2026 12:17:32 GMT; Secure; SameSite=Lax
set-cookie: logged_in=no; Path=/; Domain=github.com; Expires=Mon, 27 Jul 2026 12:17:32 GMT; HttpOnly; Secure; SameSite=Lax
x-github-request-id: D368:32A0BD:49E406:62C4F6:688618DC
Merge pull request #25901 from mshabunin:fix-riscv-aarch-baseline · opencv/opencv@4c81e17 · GitHub
Copy file name to clipboardExpand all lines: cmake/OpenCVCompilerOptimizations.cmake
Copy file name to clipboardExpand all lines: cmake/OpenCVCompilerOptions.cmake
Copy file name to clipboardExpand all lines: cmake/OpenCVMinDepVersions.cmake
Copy file name to clipboard
Copy file name to clipboardExpand all lines: platforms/linux/arm.toolchain.cmake
Copy file name to clipboard
Copy file name to clipboard
Copy file name to clipboardExpand all lines: platforms/linux/riscv64-andes-gcc.toolchain.cmake
Copy file name to clipboardExpand all lines: platforms/linux/riscv64-clang.toolchain.cmake
Skip to content
Navigation Menu
{{ message }}
-
-
Notifications
You must be signed in to change notification settings - Fork 56.2k
Commit 4c81e17
authored
Merge pull request #25901 from mshabunin:fix-riscv-aarch-baseline
RISC-V/AArch64: disable CPU features detection #25901
This PR is the first step in fixing current issues with NEON/RVV, FP16, BF16 and other CPU features on AArch64 and RISC-V platforms.
On AArch64 and RISC-V platforms we usually have the platform set by default in the toolchain when we compile it or in the cmake toolchain file or in CMAKE_CXX_FLAGS by user. Then, there are two ways to set platform options: a) "-mcpu=<some_cpu>" ; b) "-march=<arch description>" (e.g. "rv64gcv"). Furthermore, there are no similar "levels" of optimizations as for x86_64, instead we have features (RVV, FP16,...) which can be enabled or disabled. So, for example, if a user has "rv64gc" set by the toolchain and we want to enable RVV. Then we need to somehow parse their current feature set and append "v" (vector optimizations) to this string. This task is quite hard and the whole procedure is prone to errors.
I propose to use "CPU_BASELINE=DETECT" by default on AArch64 and RISC-V platforms. And somehow remove other features or make them read-only/detect-only, so that OpenCV wouldn't add any extra "-march" flags to the default configuration. We would rely only on the flags provided by the compiler and cmake toolchain file. We can have some predefined configurations in our cmake toolchain files.
Changes made by this PR:
- `CMakeLists.txt`:
- use `CMAKE_CROSSCOMPILING` instead of `CMAKE_TOOLCHAIN_FILE` to detect cross-compilation. This might be useful in cases of native compilation with a toolchain file
- removed obsolete variables `ENABLE_NEON` and `ENABLE_VFPV3`, the first one have been turned ON by default on AArch64 platform which caused setting `CPU_BASELINE=NEON`
- raise minimum cmake version allowed to 3.7 to allow using `CMAKE_CXX_FLAGS_INIT` in toolchain files
- added separate files with arch flags for native compilation on AArch64 and RISC-V, these files will be used in our toolchain files and in regular cmake
- use `DETECT` as default value for `CPU_BASELINE` also allow `NATIVE`, warn user if other values were used (only for AArch64 and RISC-V)
- for each feature listed in `CPU_DISPATCH` check if corresponding `CPU_${opt}_FLAGS_ON` has been provided, warn user if it is empty (only for AArch64 and RISC-V)
- use `CPU_BASELINE_DISABLE` variable to actually turn off macros responsible for corresponding features even if they are enabled by compiler
- removed Aarch64 feature merge procedure (it didn't support `-mcpu` and built-in `-march`)
- reworked AArch64 and two RISC-V cmake toolchain files (does not affect Android/OSX/iOS/Win):
- use `CMAKE_CXX_FLAGS_INIT` to set compiler flags
- use variables `ENABLE_BF16`, `ENABLE_DOTPROD`, `ENABLE_RVV`, `ENABLE_FP16` to control `-march`
- AArch64: removed other compiler and linker flags
- `-fdata-sections`, `-fsigned-char`, `-Wl,--no-undefined`, `-Wl,--gc-sections` - already set by OpenCV
- `-Wa,--noexecstack`, `-Wl,-z,noexecstack`, `-Wl,-z,relro`, `-Wl,-z,now` - can be enabled by OpenCV via `ENABLE_HARDENING`
- `-Wno-psabi` - this option used to disable some warnings on older ARM platforms, shouldn't harm
- ARM: removed same common flags as for AArch64, but left `-mthumb` and `--fix-cortex-a8`, `-z nocopyreloc`1 parent 85923c8 commit 4c81e17Copy full SHA for 4c81e17
File tree
Expand file treeCollapse file tree
11 files changed
+115
-81
lines changedFilter options
- cmake
- platforms
- platforms/linux
Expand file treeCollapse file tree
11 files changed
+115
-81
lines changed+1-5Lines changed: 1 addition & 5 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
145 | 145 |
| |
146 | 146 |
| |
147 | 147 |
| |
148 |
| - | |
| 148 | + | |
149 | 149 |
| |
150 | 150 |
| |
151 | 151 |
| |
| |||
513 | 513 |
| |
514 | 514 |
| |
515 | 515 |
| |
516 |
| - | |
517 |
| - | |
518 |
| - | |
519 |
| - | |
520 | 516 |
| |
521 | 517 |
| |
522 | 518 |
| |
|
cmake/OpenCVCompilerOptimizations.cmake
Copy file name to clipboardExpand all lines: cmake/OpenCVCompilerOptimizations.cmake+35-37Lines changed: 35 additions & 37 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
104 | 104 |
| |
105 | 105 |
| |
106 | 106 |
| |
107 |
| - | |
| 107 | + | |
108 | 108 |
| |
109 | 109 |
| |
110 | 110 |
| |
| |||
170 | 170 |
| |
171 | 171 |
| |
172 | 172 |
| |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
173 | 194 |
| |
| 195 | + | |
174 | 196 |
| |
175 | 197 |
| |
176 | 198 |
| |
| |||
330 | 352 |
| |
331 | 353 |
| |
332 | 354 |
| |
| 355 | + | |
333 | 356 |
| |
334 | 357 |
| |
335 | 358 |
| |
| |||
347 | 370 |
| |
348 | 371 |
| |
349 | 372 |
| |
350 |
| - | |
351 | 373 |
| |
352 | 374 |
| |
353 | 375 |
| |
| |||
361 | 383 |
| |
362 | 384 |
| |
363 | 385 |
| |
364 |
| - | |
365 | 386 |
| |
| 387 | + | |
366 | 388 |
| |
| 389 | + | |
367 | 390 |
| |
| 391 | + | |
368 | 392 |
| |
369 | 393 |
| |
370 | 394 |
| |
371 | 395 |
| |
| 396 | + | |
372 | 397 |
| |
| 398 | + | |
373 | 399 |
| |
374 | 400 |
| |
375 | 401 |
| |
| |||
390 | 416 |
| |
391 | 417 |
| |
392 | 418 |
| |
393 |
| - | |
394 |
| - | |
395 |
| - | |
396 |
| - | |
397 | 419 |
| |
398 |
| - | |
399 |
| - | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
400 | 423 |
| |
401 | 424 |
| |
| 425 | + | |
402 | 426 |
| |
403 | 427 |
| |
404 | 428 |
| |
| |||
440 | 464 |
| |
441 | 465 |
| |
442 | 466 |
| |
443 |
| - | |
| 467 | + | |
444 | 468 |
| |
445 | 469 |
| |
446 | 470 |
| |
| |||
478 | 502 |
| |
479 | 503 |
| |
480 | 504 |
| |
481 |
| - | |
482 |
| - | |
483 |
| - | |
484 |
| - | |
485 |
| - | |
486 |
| - | |
487 |
| - | |
488 |
| - | |
489 |
| - | |
490 |
| - | |
491 |
| - | |
492 |
| - | |
493 |
| - | |
494 |
| - | |
495 |
| - | |
496 |
| - | |
497 |
| - | |
498 | 505 |
| |
499 | 506 |
| |
500 | 507 |
| |
| |||
577 | 584 |
| |
578 | 585 |
| |
579 | 586 |
| |
580 |
| - | |
| 587 | + | |
581 | 588 |
| |
582 | 589 |
| |
583 | 590 |
| |
| |||
588 | 595 |
| |
589 | 596 |
| |
590 | 597 |
| |
591 |
| - | |
592 |
| - | |
593 |
| - | |
594 |
| - | |
595 |
| - | |
596 |
| - | |
597 |
| - | |
598 |
| - | |
599 |
| - | |
600 | 598 |
| |
601 | 599 |
| |
602 | 600 |
| |
|
cmake/OpenCVCompilerOptions.cmake
Copy file name to clipboardExpand all lines: cmake/OpenCVCompilerOptions.cmake+11Lines changed: 11 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
77 | 77 |
| |
78 | 78 |
| |
79 | 79 |
| |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
80 | 91 |
| |
81 | 92 |
| |
82 | 93 |
| |
|
cmake/OpenCVMinDepVersions.cmake
Copy file name to clipboardExpand all lines: cmake/OpenCVMinDepVersions.cmake+1-1Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1 | 1 |
| |
2 |
| - | |
| 2 | + | |
3 | 3 |
| |
4 | 4 |
| |
5 | 5 |
| |
|
cmake/platforms/OpenCV-Linux.cmake
Copy file name to clipboard+9-1Lines changed: 9 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1 |
| - | |
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + |
platforms/linux/arm.toolchain.cmake
Copy file name to clipboardExpand all lines: platforms/linux/arm.toolchain.cmake+14-23Lines changed: 14 additions & 23 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
48 | 48 |
| |
49 | 49 |
| |
50 | 50 |
| |
51 |
| - | |
52 |
| - | |
53 |
| - | |
54 |
| - | |
55 |
| - | |
56 |
| - | |
57 |
| - | |
58 |
| - | |
59 |
| - | |
60 |
| - | |
61 |
| - | |
62 |
| - | |
63 |
| - | |
64 |
| - | |
65 |
| - | |
66 |
| - | |
67 |
| - | |
68 |
| - | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
69 | 64 |
| |
70 |
| - | |
71 |
| - | |
72 |
| - | |
73 |
| - | |
74 |
| - | |
75 | 65 |
| |
76 | 66 |
| |
| 67 | + | |
77 | 68 |
| |
78 | 69 |
| |
79 | 70 |
| |
|
platforms/linux/flags-aarch64.cmake
Copy file name to clipboard+19Lines changed: 19 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + |
platforms/linux/flags-riscv64.cmake
Copy file name to clipboard+9Lines changed: 9 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + |
platforms/linux/riscv64-andes-gcc.toolchain.cmake
Copy file name to clipboardExpand all lines: platforms/linux/riscv64-andes-gcc.toolchain.cmake+4-8Lines changed: 4 additions & 8 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
10 | 10 |
| |
11 | 11 |
| |
12 | 12 |
| |
13 |
| - | |
14 |
| - | |
15 |
| - | |
16 |
| - | |
17 | 13 |
| |
18 | 14 |
| |
19 |
| - | |
20 |
| - | |
| 15 | + | |
| 16 | + | |
21 | 17 |
| |
22 | 18 |
| |
23 | 19 |
| |
24 |
| - | |
25 |
| - | |
| 20 | + | |
| 21 | + |
platforms/linux/riscv64-clang.toolchain.cmake
Copy file name to clipboardExpand all lines: platforms/linux/riscv64-clang.toolchain.cmake+7-2Lines changed: 7 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
17 | 17 |
| |
18 | 18 |
| |
19 | 19 |
| |
20 |
| - | |
21 |
| - | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
22 | 27 |
| |
23 | 28 |
| |
24 | 29 |
| |
|
You can’t perform that action at this time.
0 commit comments