Which is more important to get into top CS PhD program: High GPA or industry R&D project experience? As a computer science undergraduate I'll only be allowed to start a research project/ publication in the 3rd and 4th year at our university. I am in my 1st year 1st semester and got the chance to join R&amp;D project firm. But I noticed that it is slightly hindering my GPA (assignments etc.). 

When applying to a CS PhD program is it more beneficial to maintain a high GPA or do R&amp;D industrial projects for 1st and 2nd year(mostly image processing based) until I get to start research publications?

Edit - I am talking about a GPA difference of around 3.6/3.7 to at least 3.8.
I forgot to mention that I may be able to join few research publications (probably nothing that can be regarded as high quality research though) if I continue to work at the R&amp;D firm.
Neither.

Top CS PhD progams are looking for strong evidence of future potential as an independent researcher.  Everything else is secondary. Recommendation letters that speak directly to your research potential, in personal, technical, and credible detail, with direct comparisons with other students they have mentored who have gone on to strong PhD programs, will serve you far better than either a perfect GPA or industry internships or even both.  Strong research results are even better.

A better way to way to ask this question is...


  Which is more important for finding a strong, supportive mentor and a fruitful topic for undergraduate research: high GPA or industry internships?


But even this is missing the mark. It's not your GPA that you want to maximize, but rather (1) your mastery of the material, and (2) your interactions with faculty.  A recommendation letter that says nothing but "My class was hard; Oshan got an A." is utterly useless. (We call them DWIC letters, for "Did Well In Class".)

Similarly, industry interships are only useful if they provide you with opportunities for intellectual creativity, or leverage for getting into a specific research project that you care about.  In particular, unless you actually care enough about image processing to want to do research on it, an internship doing image processing is just spinning your wheels.

The most important advice I can give is to talk to your potential research mentors as soon as possible. Ask them what they look for in potential undergraduate researchers. (They might say "a high GPA" or "industry internships", and then you have your answer.)  Ask them about their track record in placing students in top PhD programs.  Ask them what they would expect you to justify a strong recommendation letter. Ask them what sort of research they do, and how to get involved.  If they don't have time to work with you ask for pointers to interesting papers to read, problems to think about, projects to work on on your own.  Do not wait for permission; just start knocking on doors. Today.