The gamut volume of ProPhoto RGB is 2.5 million and that of an Epson 4900 printer using Ilford Gold Fibre Silk paper (the widest gamut I have achieved with a printer) is 977,000; therefore to the extent the image file has values reaching somewhere in ProPhoto space beyond the gamut volume of the printer profile, there will be gamut compression, the nature of which depending on the Rendering Intent. As for the internal algorithms, my understanding is that there are two profiles at play - the colour space embedded in the image file and the printer profile. The two talk to each other through the Profile Connection Space in the operating system's Colour Management System and this talking is done using L*a*b* values. We work the image in RGB, it gets translated under the hood into L*a*b*, then connects to L*a*b* values in the printer profile, which then get translated into RGB values that the printer space can accommodate, the manner depending on the Rendering Intent. The printer driver than takes those RGB values and converts them into the colours of the inks (CMYK plus others depending) that will be used in print.