As usual, it depends. First, always test your pencil to make sure it will come off when you are finished. A pencil that comes off on one fabric, may not come off on another.
The easiest time to mark a quilt is before it is sandwiched, so if you know what you will be quilting then you should mark the whole quilt. Of course, it would be a waste of time to mark the whole quilt if you are using something that will come off before you are finished, like air-erasable marker or chalk. Then you should mark as you go. I usually don't decide what I'm quilting ahead of time so I generally mark as I go.