Skip to content

Centralize build flags into cactus_flags; shrink libs - #735

Merged
HenryNdubuaku merged 1 commit into
mainfrom
compilation-flags
Jun 17, 2026
Merged

Centralize build flags into cactus_flags; shrink libs#735
HenryNdubuaku merged 1 commit into
mainfrom
compilation-flags

Conversation

@jakmro

@jakmro jakmro commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

Signed-off-by: jakmro <kubamroz124@gmail.com>
Copilot AI review requested due to automatic review settings June 17, 2026 02:22

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_EXPORT so 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 sysctl helper).

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(
@HenryNdubuaku
HenryNdubuaku merged commit 07d8297 into main Jun 17, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants