Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions mlx/backend/metal/make_compiled_preamble.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,10 @@ mkdir -p "$OUTPUT_DIR"
CCC="xcrun -sdk macosx metal -x metal"
HDRS=$( $CCC -I"$SRC_DIR" -I"$JIT_INCLUDES" -DMLX_METAL_JIT -E -P -CC -C -H "$INPUT_FILE" $CFLAGS -w 2>&1 1>/dev/null )

# Remove any included system frameworks (for MetalPerformancePrimitive headers)
HDRS=$(echo "$HDRS" | grep -v "Xcode")
# Filter to only keep valid -H output lines (dots followed by absolute path)
# This removes compiler error/warning messages and other unexpected output
# Also remove system framework paths (Xcode paths for MetalPerformancePrimitives, etc.)
HDRS=$(echo "$HDRS" | grep -E "^\.+ /" | grep -v "Xcode")

# Use the header depth to sort the files in order of inclusion
declare -a HDRS_LIST=($HDRS)
Expand Down