Cross-Stack Co-Design for Efficient and Adaptable Hardware Acceleration