Step by step testing, it looks like the cpp version of lu
at::Tensor s_lu, pivots, infos;
    std::tie(s_lu, pivots, infos) = at::_lu_with_info(s, true, true);

is slower than the py version
    s_lu, pivots, infos = torch.lu(s, pivot=True, get_infos=True)