Speeding up my logsumexp function

Is the gensym problem related to this error too? I thought ReverseDiff doesn’t support vreduce. Is there anyway to speed up maximum