Application-Driven Cross-Layer Optimizations For Cpu-Fpga Heterogeneous Systems