(Bloomberg) — A rally in shares tied to artificial intelligence helped Asia’s stock benchmark wipe out losses sparked by the Iran war and climb back to an all-time high.

Most Read from Bloomberg

The MSCI Asia Pacific Index jumped as much as 2.3% on Monday, the most since April 8, before paring some gains. Tech-heavy benchmarks in South Korea and Taiwan surged more than 4.5% each. The moves came after the S&P 500 Index extended a record-breaking streak Friday to mark a fifth week of gains, following solid earnings from tech mega caps.

The AI theme — a dominant feature of markets before the outbreak of the Middle East conflict — has returned to the forefront as last month’s ceasefire agreement between the US and Iran calmed investor nerves. Asia’s benchmark surged more than 13% in April, erasing almost all of the declines suffered in March. It is up 15% so far this year.

President Donald Trump said over the weekend that the US will begin guiding some neutral ships trapped in the Persian Gulf out through the Strait of Hormuz starting Monday.

Asia has emerged as a key pillar of the AI boom, pairing its dominance in semiconductor manufacturing with rapidly expanding data infrastructure. At the heart of it are three companies that provide essential hardware for AI: Taiwan Semiconductor Manufacturing Co., the world’s largest chip foundry, and South Korea’s leading memory makers Samsung Electronics Co. and SK Hynix Inc.

Shares of SK Hynix soared nearly 13% on Monday to a record, while TSMC’s jumped 6.6% to their all-time high. Samsung’s stock also jumped more than 5% to a record. Markets in mainland China and Japan were among those shut for holidays.

The AI-led surge is masking underlying strains in the broader Asian market, while creating a significant divergence in performance across the region’s equities. While North Asian markets like Korea and Taiwan are riding the rally, South and Southeast Asian peers such as energy-reliant India, Indonesia and the Philippines have lagged amid concern that the war-led spike in oil prices will fuel inflation and weigh on external balances.

Markets like South Korea are currently performing well because of this AI-driven trade or hype, Dilin Wu, a research strategist at Pepperstone Group, said in a Bloomberg TV interview. “I would be cautiously optimistic on the Asian market in general,” as the geopolitical uncertainty and high oil prices may be a constraint to equities, she said.