Automatic partitioning for converting stacks