merge device and referer to segments in optimizer