Balancing Efficiency and Flexibility for DNN Acceleration