If you end up in a specialty that requires either 3 or 4 years of post-graduate training (total), then you will owe three years after residency. If you choose a specialty that is 5 or 6 years, then your GME obligation will be longer than your HPSP commitment. This essentially negates the benefit of the three-year scholarship, as you'll end up serving as long as a 4-year scholarship recipient and you get to have the student loan payments from your non-scholarship year.
The 8-year clock will start when you recommission into the medical corps. If you fulfill your active duty obligation before the 8 years is finished, then you are required to enter a reserve component. Most people will choose the individual ready reserve, unless they are planning going for a reserve retirement. Keep in mind that completely resigning your commission once the 8-year commitment is complete is an assertive act, meaning that an officer in the IRR isn't going to automatically get discharged at the 8 year + 1 day mark. I am reminded of a former colleague of mine, a USMA graduate, who had a classmate who unwittingly neglected to resign from IRR. He was recalled and sent to Iraq, where he was killed.