There is zero question that the Surge in Iraq functioned well as to reducing violence and giving the nascent post-Saddam Iraq at least a chance to avoid a true civil war, like Baghdad as Beirut in the seventies.
That didn't happen in Iraq, and it may, or may not, be avoided in Kabul and Afghanistan in general, although it is clear that the Surge in Afghanistan didn't work as well as in Iraq, raising the question of why?
The bottom line is local and external conditions were different in ways unfavorable to Afghanistan compared to Iraq, if that doesn't mean the Surge didn't work, or that ultimately Afghanistan will fall back into civil war of the form that had artillery duels in Kabul in the early nineties.
It was that collapse that made Afghanistan a failed state and therefore a safe haven for Bin Laden, and the Surge in Afghanistan certainly made that impossible in the short run, although it is unclear to date to what exact extent it will have proved to be less effective in the long run. It is still possible that our Afghan allies will now see that their lives depend on crushing the insurgency, which mcy or may not focus their efforts more. There is no way ti know that in advance with certainty.
Success is usually relative in a counter-insurgency campaign, especially as to local conditions in Afghanistan where compared to iraq, the hand of the State has always been looser, as to the State having a monopoly on the use fo force recognized as legitimate.
Ammunalad, Daoud, and the Communists all ran into the same problem pursuing very different policies with respect to modernity, and Karzai has proved little different in that regard as to convincing local power structures that it is in their long run self-interest to allow for more centralization, the control of the use of force most especially.
As to external conditions being less favorable, it is fairly obvious that the United States isn't quite as powerful in a relative sense as at the time of the Surge in Iraq, for economic reasons primarily, if also some generalized fatigue, if Great Powers would regret reading too much into that almost certainly.
That made our pursuit of the Surge a little less effective than it might have been, other things equal, and more importantly, made regional and global actors, again other thnngs equal, more likely to try to manipulate things in a more directly unfavorable manner.
So, we don't know what is to happen nest as the Afghan Surge ends, if it was a reasonable policy measure, if in more difficult situation than in Iraq.