intermediate commit on extracting common code in barretts + auto-selecting _gs kernels