From 2012 through 2016, Advanced Micro Devices (NASDAQ:AMD), the perennial runner-up to Intel (NASDAQ:INTC) in the CPU market and NVIDIA (NASDAQ:NVDA) in the GPU market, accumulated losses totaling $2.8 billion. The last time the company turned an annual profit was in 2011, capping a three-year period of profitability that was preceded by even heavier losses.

With its fourth-quarter report last week, the company is officially back in the black. AMD produced net income of $43 million for the year, a swing of more than a half-billion dollars from 2016. Revenue soared 25% to $5.33 billion thanks to a bevy of new product launches and a helping hand from the ongoing, but possibly collapsing, cryptocurrency bubble.

AMD CEO Lisa Su holding a chip.

AMD CEO Lisa Su. Image source: AMD.

A trifecta of new products

AMD was able to grow revenue by 25% last year because, going into 2017, it wasn't all that competitive in any of its core markets. In the CPU market, its previous-generation Bulldozer architecture was an unmitigated disaster, sporting a massive performance deficit compared to Intel chips. Since the launch of the first Bulldozer chips in 2011, AMD had become an also-ran in the PC CPU market, and its presence in the server CPU market had essentially vanished.

With the launch of its Ryzen PC CPUs and its EPYC server CPUs last year, AMD is now in a far better position. These chips come with trade-offs, and AMD is still at a disadvantage to Intel in terms of single-threaded performance. But there's no denying that the former is back in both markets.

Turning to GPUs, NVIDIA began running away with the market, particularly the high end, starting in 2014. AMD had no answer to NVIDIA's 900 series or 1000 series GPUs, and it continued to have none until August of last year. Vega marked AMD's return to the high-end graphics space. Unfortunately, it wasn't all that great of a product.

AMD's new graphics cards are flying off the shelves, however, thanks to demand from cryptocurrency miners. During the earnings call, CEO Lisa Su estimated that one-third of the sequential revenue growth in the company's core computing and graphics segment was related to cryptocurrencies.

Su didn't provide hard numbers beyond that, and it's difficult to pinpoint cryptocurrency-related revenue since gamers and cryptocurrency miners are buying graphics cards through the same channels. But it's clear that a sizable chunk of AMD's growth is tied to cryptocurrency.

AMD's best long-term growth opportunity may be its EPYC server CPUs. EPYC began rolling out in 2017, but so far it hasn't had much of an impact on AMD's financials. EPYC revenue is included in AMD's enterprise, embedded, and semi-custom segment. Revenue for that segment was flat in 2017, with declining sales of semi-custom game console chips offset by the launch of EPYC. Growth should pick up this year as AMD secures more wins with server OEMs and cloud computing companies.

What's next for AMD

AMD will begin to lap these product launches starting at the end of the first quarter. The first Ryzen chips became available in March, with the rest of the lineup rolling out in subsequent months. EPYC launched in June, and AMD's two Vega-based graphics cards launched in August.

Ryzen will get an update in the second quarter, although performance improvements will be modest since it won't be a full architectural revamp. That will come in 2019, with chips based on the upcoming Zen 2 architecture.

Revenue is expected to land at $1.55 billion in the first quarter, up 32% year over year. As AMD starts to lap its product launches, that growth rate may slow down. If the cryptocurrency bubble pops and takes demand for graphics cards along with it, growth could slow way down.

AMD's turnaround is in full swing, but that doesn't mean the stock will be a winner. Based on its dramatic stock surge in 2016, AMD is currently valued at about $12 billion. That puts the price-to-earnings ratio in the hundreds, using GAAP earnings. Earnings can and likely will grow from here. But even using the average analyst estimate for adjusted earnings for 2019, the forward P/E ratio still sits at about 23. An awful lot of earnings growth is already priced into the stock.

2018 should be a good year for AMD, but there's no guarantee it will be a good year for its stock.

Timothy Green has no position in any of the stocks mentioned. The Motley Fool owns shares of and recommends Nvidia. The Motley Fool recommends Intel. The Motley Fool has a disclosure policy.