Configuration systems should be designed with modularity and clarity in mind. When creating configuration classes or mechanisms:
// Good practice - clear separation of concerns
class AcceleratorAllocatorConfig {
// Common settings applicable to all accelerators
};
class CUDAAllocatorConfig : public AcceleratorAllocatorConfig {
// CUDA-specific settings
};
device_malloc not cudamalloc)pinned_ for pinned memory settings)Document all configuration options: Each option should have clear documentation explaining its purpose, valid values, and implications.
Design for extensibility: Implement hook mechanisms that allow domain-specific configurations to be integrated with generic ones.
These practices improve maintainability by making configuration systems more intuitive, better documented, and easier to extend for new devices or backends.