Microsoft is offering voluntary redundancy to more than a quarter of its global workforce as it pours money into artificial intelligence.