The S&P 500 recently hit a new all-time high, closing at 4,840 on Jan. 19 and officially entering bull market territory. Much of its growth over the last year can be attributed to a boom in artificial intelligence (AI), which has seen many tech stocks skyrocket. The sector has shown no signs of slowing.

Data from Grand View Research shows that the AI market is projected to expand at a compound annual growth rate of 37% until at least 2030, which would see the industry exceed a valuation of $1 trillion before the end of the decade. It's not too late to invest in this budding sector and profit from its long-term development.

So, here are two AI stocks I'm going "all in" on in 2024.

1. Alphabet

Alphabet (GOOG 9.96%) (GOOGL 10.22%) was slightly overlooked last year as rivals Amazon and Microsoft seemed to progress faster in AI. However, the company was merely taking the time to hone its technology as it prepared to make a big splash in the industry in 2024.

Last December, Alphabet unveiled its highly anticipated AI model, Gemini. The new model excels at building generative AI programs with its ability to crunch various forms of data, such as audio, video, and text. The tech giant has said it will release three versions of Gemini, with the most powerful one designed to run data centers and the smallest one able to power smartphones.

Gemini could open the door to many growth opportunities in AI for Alphabet, with the technology to create a Google Search experience closer to OpenAI's ChatGPT, add new AI tools to Google Cloud and Android, offer more efficient advertising, and better track viewing trends on YouTube.

Alongside Gemini, Alphabet announced a new generation of its custom-built AI chips. The Cloud TPU v5p is a tensor processing unit (TPU) designed to train large AI models. It's nearly three times faster than previous versions.

Over the last five years, Alphabet's annual revenue and operating income have risen 75% and 106%. Meanwhile, free cash flow has soared 151% to $77 billion. The company is one of the most reliable tech firms and is only just getting started in AI, which could further boost earnings in the coming years.

NVDA PE Ratio (Forward) Chart

Data by YCharts

Moreover, this chart shows that Alphabet is one of the cheapest AI stocks. The company has the lowest forward price-to-earnings ratio (P/E) and price-to-free cash flow among some of the most prominent names in AI, indicating that its stock offers the most value.

Alphabet has the funds and brand power to go far in AI, making it a screaming buy for me in 2024.

2. Advanced Micro Devices

Chip stocks captivated Wall Street last year, and for good reason. These companies are developing the hardware necessary to train and run AI models, making them well-positioned to see major gains as demand for chips continues to soar.

While Nvidia stole much of the spotlight last year, it is worth considering investing in chipmakers at earlier stages in their AI expansions, as they could have more room to run. Advanced Micro Devices (AMD 2.37%) is an exciting option as it gears up to challenge Nvidia in AI in 2024.

AMD unveiled its MI300X AI graphics processing unit (GPU) last December, announcing that the chip is on par with Nvidia's H100 GPU for training and that it beats the H100 for inference by 10% to 20%. It's already attracting some of tech's biggest players.

In November, Microsoft announced that Azure would become the first cloud platform to use the MI300X to optimize its AI capabilities. Microsoft has a partnership with OpenAI, making the company a powerful partner for AMD. Alongside an agreement with Meta Platforms -- which will see it use the new chips as well -- AMD's future in AI looks bright.

AMD EPS Estimates for Next Fiscal Year Chart

Data by YCharts

This table shows AMD's earnings could hit just over $5 per share by its next fiscal year. That figure, multiplied by the chipmaker's forward P/E of 45, yields a stock price of $239.

If projections are correct, AMD's shares would rise 35% by the end of fiscal 2024, outperforming the S&P 500's increase of 20% over the last 12 months. Alongside massive potential in AI, AMD is one of the most exciting investment opportunities this year.