The Design and Implementation of a Bytecode for Optimization on Heterogeneous Systems