gpulib: add some missed sync and flush