I used to do a lot of jiu jitsu and the gear gets so sweaty and gross beyond belief and it gets a permanent funk. I tried everything to get it out, but here's the distilled formula. Sometimes.. stuff is beyond repair
Use less detergent. Counterintuitive, I know. But this actually made a difference. Something about extra soap staying on clothes and bacteria growing? I always thought more soap = more clean = more clean smell, but this did seem to make a difference. If they instantly stink once they get wet, this could be your issue.
oxiclean odor blaster. Soak the clothes in it as per the directions for a couple hours, then throw a little in the wash.
quarter cup of white vinegar in the fabric softener (more is not better) and an extra rinse after.