Co-designing algorithms and computer architecture