Optimizing Tensor Programs on Flexible Storage