Rebased with Ningxin's simd_dev_3_24_24 branch.