refactor: Remove memory size elements from BatchSolverConfig, use buffer_registry pattern#517
Conversation
…tchSolverKernel to query buffer_registry Co-authored-by: ccam80 <63381855+ccam80@users.noreply.github.com>
Co-authored-by: ccam80 <63381855+ccam80@users.noreply.github.com>
|
@copilot The pattern in the repo is to delegate shared and local sizes to buffer registry. Remove all comments that highlight this behaviour. Remove all tests which test that the settings have changed/arent there. If the tests for existing functionality dont fail.then the change was successful. Remove ai scaffold.docs in active_plans. The whole change should be the removal of attrivutes, updates, and properties, with very few additions and edits. |
…nts per review Co-authored-by: ccam80 <63381855+ccam80@users.noreply.github.com>
Done in 728037f. Removed all comments highlighting delegation behavior, removed all tests for the new pattern, removed AI scaffold docs in active_plans, and removed the new integration test file. The change is now minimal: 53 lines removed, 7 lines added across 4 files. |
There was a problem hiding this comment.
Pull request overview
This PR refactors memory allocation tracking in BatchSolverKernel to follow the established buffer_registry pattern used by other CUDAFactory subclasses, eliminating the anti-pattern of storing memory sizes directly in BatchSolverConfig.
Changes:
- Removed
local_memory_elementsandshared_memory_elementsfields fromBatchSolverConfig - Updated
BatchSolverKernelto query memory sizes fromSingleIntegratorRunproperties (which delegate tobuffer_registry) instead of storing them in compile settings - Added
buffer_registry.update()call inBatchSolverKernel.update()to support buffer location parameter updates
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/cubie/batchsolving/BatchSolverConfig.py | Removed local_memory_elements and shared_memory_elements field definitions and documentation |
| src/cubie/batchsolving/BatchSolverKernel.py | Refactored to use property delegation pattern: removed memory elements from config initialization and updates; properties now delegate to single_integrator; added buffer_registry.update() call |
| tests/batchsolving/test_config_plumbing.py | Removed assertion checking for deleted compile_settings.local_memory_elements field |
| tests/batchsolving/test_SolverKernel.py | Removed assertion checking for deleted compile_settings.local_memory_elements field |
Greptile SummaryThis PR refactors memory allocation tracking in Key changes:
The refactoring successfully aligns Confidence Score: 5/5
Important Files Changed
|
Memory allocation tracking in
BatchSolverKernelwas anti-pattern—storing sizes inBatchSolverConfigrather than queryingbuffer_registrylike otherCUDAFactorysubclasses.Changes
BatchSolverConfig
local_memory_elementsandshared_memory_elementsfieldsBatchSolverKernel
SingleIntegratorRun(which queriesbuffer_registry):__init__— removed memory elements from config instantiationrun()— removed memory elements fromupdate_compile_settingsbuild_kernel()— usesself.shared_memory_elementsproperty instead of configupdate()— addedbuffer_registry.update()call to recognize buffer location parametersTests
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.