The PE of the object at infinity (where it can be said to have escaped from the gravitational field of the mass) is zero.
If you know the PE on the surface (a negative value), then you would need to give it that amount of energy to get it to infinity.
If this energy is initially kinetic, then just equate the initial ½mv² of the object to this PE value.
v in this case would be the speed needed to escape.