Skip to content

Conversation

@louiswang524
Copy link
Contributor

Summary

  • Improve error handling in Engine initialization
  • Add better error messages for debugging
  • Fix page_size configuration usage
  • Add documentation for helper functions

Changes

  1. Error Handling Improvements:

    • Replace assert not torch.cuda.is_initialized() with proper RuntimeError exception
    • Replace assert for insufficient memory with detailed ValueError message including:
      • Available memory information
      • Memory per page calculation
      • Suggestions for configuration adjustments
  2. Configuration Fix:

    • Use config.page_size instead of hardcoded 1 in Context initialization (line 79)
    • Note: page_size=1 is still the only supported value (enforced in core.py), but this makes the code consistent
  3. Documentation:

    • Add docstring to _align_up_32() explaining 128-byte alignment purpose
    • Add return type hint to Engine.__init__()

Testing

  • Existing tests should pass
  • Better error messages will help users diagnose memory issues

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