When developing the equation for gravitational potential energy, why is it necessary to assume that the mass is rising at a constant speed?

Constant speed implies no net force, no net acceleration, no energy going to increase Kinetic energy.