When you are arrested, someone at the police department or the district attorney's office decides what your charges will be. Usually in an 8 gram case the district attorney's office is involved. You can be charged with anything that suits the district attorney, but at the preliminary hearing, the judge should determine what if any charges should proceed to trial.
In general, the district attorney only charges possession with the intent to deliver (pwid) in certain scenarios: 1. observed sales; 2. believed sales; 3. quantity; 4. social sharing. I have seen all of these many times.
Your situation is quantity. I get more questions about mandatory sentencing in regard to quantity then for any other type of possession with the intent to deliver (pwid) charge. In general, if the district attorney can show that the amount of narcotics with your possessed was too great for any single individual to consume, they can charge possession with the intent to deliver. At trial, I often see the district attorney call an expert witness to explain why they think large quantity equals possession with the intent to deliver.
In regard to the mandatory, you are correct: the mandatory only applies to possession with the intent to deliver (pwid) not knowing and intentional possession (k&i). Based on my experience and and based on the way you said that your lawyer told you it was a mandoatory, I am confident to say that with 8 grams, you have been charged with possession with the intent to deliver (pwid).
As far as the mandatory being three to six instead of one to three, that is because you have a prior conviction for possession with the intent to deliver. If you do not have a prior conviction, your lawyer is mistaken.