CNBC's Jim Cramer said on Thursday that Advanced Micro Devices is a good long-term buy.

The "Mad Money" host credited the company's CEO, Lisa Su, for its revival.

"I think it's fair to say that Su saved AMD from the garbage heap and brought it back to life by fixing the balance sheet and now she has the whole semi-conductor company humming with its gross margin expanding and its earnings on the rise," Cramer said.

He might be right. Consider this: When Su took over as CEO in late 2014, the then-flailing company was near bankruptcy and had competition in several areas. Intel was the leader in personal computers, including notebooks and desktops. Nvidia had the market cornered in graphics processing units, such as gaming software, data centers and cryptocurrency mining.

Shares of Advanced Micro Devices cost $2 apiece at the end of 2015. Today, it's closer to $10. Even better, the California-based company racked up $1.65 billion in sales this quarter — a 40 percent increase year over year. The computing and graphics segment had a $138 million profit compared with a $21 million loss from a few years ago.

Cramer pointed out that today, many of the big-name personal computer companies such as Dell, HP and Lenovo use AMD products. The company's Radeon chips are popular among gamers as well. In addition, cryptocurrency and mining cards account for about 10 percent of the business.

"And this gutsy CEO had to do it all with a company that had a tattered balance sheet and a somewhat tarnished reputation; a totally daunting task," he said.

"My conclusion after listening to the [post-earnings conference] call and speaking to Su? I think the stock's a buy for the long term. That's a tremendous achievement," said the Mad Money host.