Balancing efficiency and flexibility in specialized computing