You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 710b032
Browse filesBrowse the repository at this point in the historyBrowse files
This pull request enhances the cross-platform detection and reporting of
available RAM in the `mobius.preflight` module. It introduces
platform-specific implementations for Windows, macOS, and Linux,
improves test coverage for these changes, and updates related tests to
use the new probing mechanism. Additionally, it includes a small fix in
a build graph test to ensure node ordering is validated.
**Improvements to RAM detection and reporting:**
* Added platform-specific functions for detecting available RAM:
`_windows_available_ram_bytes` for Windows,
`_darwin_available_ram_bytes` for macOS, `_proc_available_ram_bytes` for
Linux, and a fallback using `os.sysconf` when necessary. The new
`_probe_available_ram` function selects the best available method and
returns both the value and its source.
(`[[1]](diffhunk://#diff-9bc6af1f2ebeb847e186fe5570e6ac0d76b0343bf9eb51e0fbd9f2e2c5cfa15aL462-R492)`,
`[[2]](diffhunk://#diff-9bc6af1f2ebeb847e186fe5570e6ac0d76b0343bf9eb51e0fbd9f2e2c5cfa15aR502-R561)`)
* Updated `check_ram` to use the new `_probe_available_ram` function,
improving reporting by including the source of the RAM measurement.
(`[src/mobius/preflight.pyL486-R582](diffhunk://#diff-9bc6af1f2ebeb847e186fe5570e6ac0d76b0343bf9eb51e0fbd9f2e2c5cfa15aL486-R582)`)
**Testing and test utilities:**
* Added comprehensive tests for the new RAM detection logic, including
platform-specific probes, fallback mechanisms, and parsing of macOS
`vm_stat` output. Existing tests now monkeypatch `_probe_available_ram`
instead of `_available_ram_bytes`.
(`[[1]](diffhunk://#diff-f86b6f1c3e1afc379705d505194294a8ecc9896b48259c164b776eb3f1b34f59R199-R236)`,
`[[2]](diffhunk://#diff-f86b6f1c3e1afc379705d505194294a8ecc9896b48259c164b776eb3f1b34f59L219-R257)`,
`[[3]](diffhunk://#diff-f86b6f1c3e1afc379705d505194294a8ecc9896b48259c164b776eb3f1b34f59L230-R276)`,
`[[4]](diffhunk://#diff-f86b6f1c3e1afc379705d505194294a8ecc9896b48259c164b776eb3f1b34f59L248-R286)`,
`[[5]](diffhunk://#diff-f86b6f1c3e1afc379705d505194294a8ecc9896b48259c164b776eb3f1b34f59L272-R310)`,
`[[6]](diffhunk://#diff-f86b6f1c3e1afc379705d505194294a8ecc9896b48259c164b776eb3f1b34f59L291-R329)`,
`[[7]](diffhunk://#diff-f86b6f1c3e1afc379705d505194294a8ecc9896b48259c164b776eb3f1b34f59L306-R344)`,
`[[8]](diffhunk://#diff-f86b6f1c3e1afc379705d505194294a8ecc9896b48259c164b776eb3f1b34f59L328-R366)`)
**General codebase improvements:**
* Added missing imports (`ctypes`, `wintypes`, `re`, `subprocess`,
`sys`) to support the new platform-specific RAM detection logic.
(`[src/mobius/preflight.pyR41-R52](diffhunk://#diff-9bc6af1f2ebeb847e186fe5570e6ac0d76b0343bf9eb51e0fbd9f2e2c5cfa15aR41-R52)`)
* In `_should_inline`, ensured the model graph is sorted after rewrites
to maintain correct producer-consumer ordering.
(`[src/mobius/_optimizations.pyR707-R709](diffhunk://#diff-0e0781be69f6ae96d51801d3a2ba76bdb7220c897d668aae0282064c2962e8a2R707-R709)`)
**Build/test validation:**
* In `tests/build_graph_test.py`, switched to using `build_from_module`
for clarity and added an explicit check that ensures node producers in
the vision encoder graph are ordered before their consumers.
(`[[1]](diffhunk://#diff-e3747952023a0b5f01abf736f1c02d1cc314598012d2eb94b7e2dfa8405c9271L1235-R1235)`,
`[[2]](diffhunk://#diff-e3747952023a0b5f01abf736f1c02d1cc314598012d2eb94b7e2dfa8405c9271R1247-R1254)`)
---------
Signed-off-by: Justin Chu <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: Justin Chu <[email protected]>
Co-authored-by: Copilot App <[email protected]>
0 commit comments