After a market slowdown in 2022, the chip industry is booming again, with leaders like Nvidia (NVDA -2.61%) and Advanced Micro Devices (AMD -2.69%) well positioned to profit significantly. Advances in artificial intelligence (AI), cloud computing, and even gaming have driven up demand for chips. As a result, adding a semiconductor stock to your portfolio could offer consistent growth over the long term. 

Nvidia and AMD are both compelling options, with their chips powering some of the world's leading technology. However, if you only have room to add one to your portfolio, you'll need to know the better buy. 

Let's take a look at whether your money is better off with Nvidia or AMD.

Nvidia: A growing lead in AI

Nvidia's shares skyrocketed 94% in 2023, with its growing position in AI making it an increasingly attractive buy. The launch of OpenAI's ChatGPT last November kicked off an AI race where countless companies rushed to join the market, striving to get a piece of the $208 billion industry. Considering the market is projected to hit $1.8 trillion by 2030, it's no surprise so many tech companies pivoted their businesses toward AI development. 

Nvidia's stock soared thanks to its powerful chips, which become the go-to for developing AI software. The company is the primary supplier of graphics processing units (GPUs) to ChatGPT, which used about 20,000 units in 2020. Meanwhile, research from TrendForce states that figure could soon rise to 30,000 as the platform readies for commercialization.

In addition to ChatGPT, increased competition is likely to send GPU demand soaring, with Nvidia able to supply its chips to the entire market. After hits to Nvidia's consumer GPU sales last year amid PC market declines, the company's pivot to AI could massively pay off over the long term. 

Moreover, as AI technology advances, Nvidia's hardware has vast potential in several markets, from autonomous vehicles to cloud computing. 

Advanced Micro Devices: The go-to for custom chips 

While Nvidia is dominating it in AI, Advanced Micro Devices is home to a booming custom chip business. The company's system on a chip (SoC) provides the graphics and processing power to a growing number of devices, including Sony's PlayStation 5, Microsoft's Xbox Series X|S, and several handheld devices. 

Meanwhile, AMD's acquisition of Xilinx last year enabled its embedded business to soar, with the segment's revenue rising more than 1,700% in its fiscal 2022. Xilinx's strength is producing specialized processors, which allowed AMD to branch out to markets such as aerospace and defense, space technology, industrial, and AI. 

AMD's already varied business has also seen it become crucial to the cloud market. The company's data center chips power leading platforms such as Microsoft's Azure, Alphabet's Google Cloud, and Oracle.

AMD's chips have penetrated multiple areas of tech, strengthening its business and allowing it to lean on different segments amid short-term headwinds.

Is Nvidia or AMD the better buy?

Nvidia and AMD both have vast potential in different tech markets, which could see their stocks skyrocket over the long term. However, Nvidia's more significant stock rise this year has made its shares more expensive than AMD's for now. The chart below shows that Nvidia's forward price-to-earnings (P/E) ratio is far higher than AMD's. 

NVDA PE Ratio (Forward) Chart

Data by YCharts

While AMD's forward P/E isn't exactly cheap, its stock still offers far more value than Nvidia's. 

Additionally, AMD's price/earnings-to-growth (PEG) ratio of 0.1 compared to Nvidia's 0.4 suggests AMD's projected stock growth will likely offer more significant gains than Nvidia's.

AMD may not have the lead in AI. However, its diverse business and potent chips make it a bargain buy right now and a better investment than Nvidia.