honor maximum number of outer engines when trying to optimize stack layout