Conversation
…g GLM-5.1 MoE crash" This reverts commit 14f267b.
There was a problem hiding this comment.
Pull request overview
Reverts the prior change that removed a load-length bounds check in the Metal SSDStreamer, restoring the guard that throws when a requested read exceeds the configured buffer capacity.
Changes:
- Re-introduce
length > buffer_size_bytes_validation inSSDStreamer::load_sync. - Throw
std::invalid_argumentwhen the read exceeds the configured capacity.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if (length > buffer_size_bytes_) { | ||
| throw std::invalid_argument("[SSDStreamer] Load length exceeds Pinned Buffer capacity."); | ||
| } |
There was a problem hiding this comment.
This throws std::invalid_argument, but this translation unit doesn’t include <stdexcept>. It currently relies on transitive includes for std::runtime_error/std::invalid_argument, which is non-portable and can break builds if includes change. Add an explicit #include <stdexcept> (or the project’s preferred exception header) in this file or the corresponding header.
| // The StreamBuffer pool was removed in favor of caller-provided unified memory, | ||
| // so we no longer bounds-check the length against an initial buffer size. | ||
| if (length > buffer_size_bytes_) { | ||
| throw std::invalid_argument("[SSDStreamer] Load length exceeds Pinned Buffer capacity."); |
There was a problem hiding this comment.
The new exception message doesn’t include the actual length requested or the configured buffer_size_bytes_ limit, which makes diagnosing MoE/streaming crashes harder in production logs. Consider including both values (and possibly the offset) in the message so callers can quickly see what exceeded what.
| throw std::invalid_argument("[SSDStreamer] Load length exceeds Pinned Buffer capacity."); | |
| throw std::invalid_argument( | |
| "[SSDStreamer] Load length exceeds Pinned Buffer capacity: requested length=" + | |
| std::to_string(length) + | |
| ", buffer_size_bytes_=" + std::to_string(buffer_size_bytes_) + | |
| ", byte_offset=" + std::to_string(static_cast<long long>(byte_offset))); |
Reverting unfinished GLM 5.1 work from main