Modern Garmin devices have DEM (Digital Elevation Model) data on board, so if there is a route/course/track whithout integrated elevation data the device can calculate it with the DEM data. The "ascent remaining" data is provided by native datafields, so Garmin just need to provide it to and by the SDK.
How would you know it? Let's say this is my altitude graph (that the watch collected during the run):
/-------\ /B-------
A--/ \----------/
Now when I was at point A and the next waypoint was B, the watch could only know that there's at least altitude(B)-altitude(A) ascent, but it didn't know that I will need to climb up, then down, then up again, so in fact the total ascent between A and B was twice as much.