Group AI backend file-scope statics into named structs#21079
Merged
TurboGit merged 1 commit intoMay 20, 2026
Conversation
Member
|
@andriiryzhkov : There is conflicts to be resolved. TIA. |
51ff011 to
6e74e24
Compare
Collaborator
Author
|
@TurboGit : Conflicts resolved. |
TurboGit
reviewed
May 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Small maintenance pass on
src/ai/backend_onnx.c. No behavior change.The file had 10 individual file-scope statics – ORT runtime, init guards, loaded module/version, and the at-load conf-snapshot variables. Regrouped into two named anonymous-struct singletons (
g_ort,g_conf_snapshot) and addeddt_ai_backend_cleanup_globals()to free the heap members at shutdown.Why not move them to
darktable.ai_backendThe obvious alternative – hang them off
darktable_tnext todarktable.ai_registry– was prototyped and walked back.src/ai/is built as a separate static archive with a deliberately minimal include surface. Reaching intodarktable.ai_backendrequirescommon/darktable.h, which couples the AI library to the layout ofdarktable_t. That layout depends on conditional flags likeUSE_LUA(the inlinedt_lua_state_tis 4 bytes off, ~168 bytes on) and everything under#ifdef HAVE_AI. Any flag drift between the main build and the AI library produces silent ABI mismatches at field offsets.Keeping the singletons file-local in
backend_onnx.ckeeps the AI library boundary clean: nodarktable_tknowledge, no flag propagation. We lose per-instance lifecycle, but we always wanted exactly one ORT per process.