Toward Cross-Layer Energy Optimizations in Machine Learning Systems