Chip stocks climbed higher on Tuesday on a surge of optimism over a possible trade deal between the U.S. and China. 

President Trump wrote in a tweet that he and China's President Xi Jinping will meet next week at the G20 summit in Japan, and that the two had "a very good telephone conversation" ahead of the summit, which begins on Jun. 28. 

Stocks overall were rising on the news Tuesday, but the chip sector -- among the most vulnerable to trade uncertainties because of extensive China exposure -- was getting a major boost. 

Shares of Nvidia (NVDA) - Get Report were up 5.3% after the chipmaker announced a partnership with Volvo to develop autonomous trucks using Nvidia's autonomous driving platform, called Drive. 

The Philadelphia Semiconductor index, which tracks chip and chip equipment stocks, was trading 4% higher on Tuesday. 

Likewise, major chipmakers rallied on the trade news, including AMD (AMD) - Get Report  (up 3.9%), Qorvo (QRVO) - Get Report (up 5%), Skyworks (SWKS) - Get Report (up 4.3%), Micron (MU) - Get Report  (up 5%), NXP (NXPI) - Get Report (up 5%), Intel (INTC) - Get Report (up 3.2%) and Broadcom (AVGO) - Get Report (up 4.8%).

Trade turbulence, a U.S. ban of Huawei products and other macro factors have beleaguered the chip sector over the past few weeks.

On an earnings call last week, Broadcom CEO Hock Tan issued a grim outlook that dragged down the rest of the sector.

"It is clear that the U.S./China trade conflict, including the Huawei export ban, is creating economic and political uncertainty and reducing visibility for our global OEM customers," Han told investors on Jun. 14.

Nvidia is a holding in Jim Cramer's Action Alerts PLUS member club. Want to be alerted before Jim Cramer buys or sells NVDA, MSFT, AAPL or GOOGL? Learn more now.