Skip to content

Use the CoreML cache as its compilation working directory#161

Draft
MaxHalford wants to merge 1 commit into
lightonai:mainfrom
MaxHalford:agent/coreml-working-directory
Draft

Use the CoreML cache as its compilation working directory#161
MaxHalford wants to merge 1 commit into
lightonai:mainfrom
MaxHalford:agent/coreml-working-directory

Conversation

@MaxHalford

Copy link
Copy Markdown

What changed

  • resolve the effective CoreML cache directory at colgrep startup
  • create it before model loading
  • use it for both ModelCacheDirectory and the process TMPDIR
  • perform this setup before the global Rayon worker pool starts

Root cause

CoreML cold compilation uses TMPDIR for intermediate work even when ONNX Runtime has a persistent ModelCacheDirectory.

In a macOS Seatbelt workspace, ordinary file writability is not sufficient for CoreML's compilation service:

  • default /var/folders/.../T: process writes succeeded, CoreML compilation failed
  • canonical /private/var/folders/.../T: CoreML compilation failed
  • /private/tmp: CoreML compilation failed
  • a directory covered by the workspace sandbox extension: CoreML compilation succeeded
  • colgrep's writable CoreML cache directory: CoreML compilation succeeded

After an external cold compile populated the model cache, sandboxed loads also succeeded. This isolated the failure to CoreML's intermediate compilation path rather than model download, cache lookup, ONNX Runtime loading, repository indexing, or inference.

Why this fix

The configured CoreML cache is already intended to be a stable writable location for compiled model artifacts. Reusing it as CoreML's working directory keeps cold compilation on an accessible path and preserves CoreML execution. There is no CPU fallback.

Validation

  • cargo test -p colgrep --features coreml --lib (673 passed, 1 ignored)
  • cargo clippy -p colgrep --features coreml --all-targets -- -D warnings
  • cold-cache --force-gpu smoke test in the failing Seatbelt workspace succeeded on CoreML without an external TMPDIR override

The implementation and this description were prepared with OpenAI Codex. The commit includes a Co-authored-by trailer.

Co-authored-by: OpenAI Codex <noreply@openai.com>
@MaxHalford

Copy link
Copy Markdown
Author

Disclaimer: This is completely vibe coded PR, following an issue we noticed with @raphaelsty, while installing colgrep in person on my laptop.

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.

1 participant