|
1 | 1 | # TorchDevice Project TODO List
|
2 | 2 |
|
| 3 | +## TorchDevice.py Refactoring |
| 4 | + |
| 5 | +- **Modularize TorchDevice Core Functions** |
| 6 | + - Split the large single-file implementation into logical modules: |
| 7 | + - Core device detection and management |
| 8 | + - CUDA function mocking |
| 9 | + - Stream and Event handling |
| 10 | + - Tensor operations interception |
| 11 | + - PyTorch integration utilities |
| 12 | + - Create proper module structure with appropriate imports |
| 13 | + - Ensure backward compatibility during transition |
| 14 | + |
| 15 | +- **Fix Type Annotations and Linter Errors** |
| 16 | + - Address all the linter errors in TorchDevice.py |
| 17 | + - Add proper type annotations throughout the codebase |
| 18 | + - Fix compatibility with static type checkers |
| 19 | + - Maintain dynamic behavior while improving static analysis |
| 20 | + |
| 21 | +- **Implement CPU Override Functionality** |
| 22 | + - Add mechanism to respect explicit CPU device requests |
| 23 | + - Create policy for when to override vs. when to respect explicit device choices |
| 24 | + - Add configuration option to control redirection behavior |
| 25 | + - Update documenation to explain the new behavior |
| 26 | + |
| 27 | +- **Improve Class Structure** |
| 28 | + - Review inheritance patterns for Stream and Event classes |
| 29 | + - Ensure proper inheritance from PyTorch base classes |
| 30 | + - Consolidate duplicate code in device handling |
| 31 | + - Improve encapsulation of internal state |
| 32 | + |
| 33 | +- **Enhance Error Handling** |
| 34 | + - Add more robust error handling for device operations |
| 35 | + - Provide clearer error messages for device compatibility issues |
| 36 | + - Add fallback mechanisms for unsupported operations |
| 37 | + - Improve debugging information during redirection failures |
| 38 | + |
3 | 39 | ## Logger Improvements
|
4 | 40 |
|
5 | 41 | - **Simplify the Frame Inspection Logic**
|
|
15 | 51 | - **Use Context Managers for Temporary State**
|
16 | 52 | - Identify operations that temporarily modify state
|
17 | 53 | - Implement context managers for these operations
|
18 |
| - - Ensure proper cleanup even in case of exceptions |
| 54 | + - Ensure proper cleanup even in case of exceptions |
| 55 | + |
| 56 | +- **Implement Lazy Formatting for Log Messages** |
| 57 | + - Identify places where f-strings are used for messages that might be filtered out |
| 58 | + - Replace these with format strings that are only evaluated if the message will be logged |
| 59 | + - Verify that the changes don't affect the log output |
| 60 | + - Measure the performance impact of the change |
| 61 | + |
| 62 | +- **Remove Unused Features and Code** |
| 63 | + - Identify unused code or overly complex sections |
| 64 | + - Simplify or remove these sections |
| 65 | + - Verify that the changes don't affect the functionality |
| 66 | + |
| 67 | +## Device Handling Improvements |
| 68 | + |
| 69 | +- **Respect Explicit CPU Device Specifications** |
| 70 | + - Modify TorchDevice to respect explicit CPU device requests |
| 71 | + - Fix failing tests in test_cpu_mps_operations.py due to device redirection |
| 72 | + - Ensure proper handling of operations involving both CPU and accelerated devices |
| 73 | + - Add test cases for explicit CPU operations |
| 74 | + |
| 75 | +## Test Framework Improvements |
| 76 | + |
| 77 | +- **Refine Test Utilities into Proper Modules** |
| 78 | + - Resolve import issues with common.log_diff and common.test_utils |
| 79 | + - Restructure as proper Python modules with __init__.py files |
| 80 | + - Update import paths in all test files |
| 81 | + - Add proper documentation for all test utility functions |
| 82 | + |
| 83 | +- **Enhance Test Discoverability** |
| 84 | + - Improve test organization for better discoverability |
| 85 | + - Add test categorization (e.g., unit tests, integration tests) |
| 86 | + - Create a more flexible test runner with better filtering options |
| 87 | + |
| 88 | +## Documentation |
| 89 | + |
| 90 | +- **Create Developer Documentation** |
| 91 | + - Document the architecture and design decisions |
| 92 | + - Add detailed explanations of key components |
| 93 | + - Provide examples for common development tasks |
| 94 | + - Include troubleshooting guides for common issues |
| 95 | + |
| 96 | +- **Improve API Documentation** |
| 97 | + - Document all public interfaces |
| 98 | + - Add examples for all major features |
| 99 | + - Include type annotations for better IDE support |
0 commit comments