Centralize build flags into cactus_flags; shrink libs - #735
Merged
Conversation
Signed-off-by: jakmro <kubamroz124@gmail.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR centralizes compilation/linker size-optimization flags into a new cactus_flags CMake interface library, and then fixes a few symbol-visibility regressions by explicitly exporting select FFI entrypoints (likely needed after enabling -fvisibility=hidden and aggressive dead-stripping/LTO).
Changes:
- Add
cactus_flags(INTERFACE) to consolidate-O3, visibility, sectioning, LTO, and dead-stripping / GC-sections flags; link it into kernels and top-level shared outputs (Apple framework + engine shared). - Update a few FFI functions to use
CACTUS_FFI_EXPORTso they remain available to consumers after visibility/stripping changes. - Minor platform-guard cleanup (Accelerate thresholds only defined on Apple; remove redundant FP16 conversion wrappers; tighten Apple-only
sysctlhelper).
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
cactus-kernels/src/lstm.cpp |
Removes redundant inline FP16/FP32 conversion wrappers; calls shared conversion helpers directly. |
cactus-kernels/src/conv.cpp |
Guards Accelerate-specific thresholds behind __APPLE__ to keep non-Apple builds clean. |
cactus-kernels/CMakeLists.txt |
Introduces cactus_flags interface target and applies it to kernels to centralize optimization/size flags. |
cactus-graph/src/graph_ffi.cpp |
Exports additional graph FFI entrypoints with CACTUS_FFI_EXPORT to preserve symbol visibility. |
cactus-engine/src/transcribe.cpp |
Exports cactus_preprocess_audio_features via CACTUS_FFI_EXPORT. |
cactus-engine/src/telemetry_impl.cpp |
Makes sysctl_string Apple-only and removes an unused UUID helper. |
cactus-engine/CMakeLists.txt |
Links cactus_flags into cactus_engine_shared for consistent size/visibility behavior. |
apple/CMakeLists.txt |
Links cactus_flags into the Apple framework and removes duplicate strip/LTO flags from link options. |
android/CMakeLists.txt |
Removes duplicated JNI link/compile flags, relying on transitive cactus_flags where applicable. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| } | ||
|
|
||
| int cactus_graph_clamp(cactus_graph_t graph, cactus_node_t input, float lo, float hi, cactus_node_t* out) { | ||
| CACTUS_FFI_EXPORT int cactus_graph_clamp(cactus_graph_t graph, cactus_node_t input, float lo, float hi, cactus_node_t* out) { |
| } | ||
|
|
||
| int cactus_graph_dense_mlp_tq_fused(cactus_graph_t graph, cactus_node_t hidden, cactus_node_t gate_weight, cactus_node_t up_weight, cactus_node_t down_weight, float product_scale, cactus_node_t* out) { | ||
| CACTUS_FFI_EXPORT int cactus_graph_dense_mlp_tq_fused(cactus_graph_t graph, cactus_node_t hidden, cactus_node_t gate_weight, cactus_node_t up_weight, cactus_node_t down_weight, float product_scale, cactus_node_t* out) { |
| extern "C" { | ||
|
|
||
| int cactus_preprocess_audio_features( | ||
| CACTUS_FFI_EXPORT int cactus_preprocess_audio_features( |
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.
No description provided.