By Benjamin Pimentel

The tech sector managed to squeeze out a tiny gain Wednesday as chip shares rose after Gartner Inc. forecast a smaller-than-expected revenue decline for the year.

The Nasdaq Composite Index (RIXF) added 0.1% to close at 2,024 in a volatile trading session.

The Morgan Stanley High Tech 35 Index (MSH) also battled back from the red to close with a 0.25% gain. The Philadelphia Semiconductor Index (SOX) rose 0.8%

As revised, Gartner sees the sector's revenue totaling $212 billion for 2009, down 17.1% on the year. Its prior projection had been for a 22.4% decline.

"The semiconductor market has performed better than expected, as was evident when second-quarter semiconductor revenue increased 17% in sequential sales," according to Gartner Vice President Bryan Lewis.

Shares of Intel Corp. (INTC) traded up 1.7%, while Advanced Micro Devices Inc. (AMD) was up 1% and Nvidia Corp. (NVDA) rose 1.2%.

The tech sector also got a lift from gains in shares of Palm Inc. (PALM), Rambus Inc. (RMBS) and Salesforce.com (CRM)

But the group was weighed down by losses in shares of bellwethers including Cisco Systems Inc. (CSCO), Google Inc. (GOOG) and Hewlett-Packard Co. (HPQ)