When Jack Sparrow gives away his compass and releases the Silent Mary from Devil's Triangle, Captain Salazar immediately knows that Sparrow has given away the compass.
How does he know about Jack's compass and it's link to his curse?
Its possible that Salazar could be aware of the compass long before he went to the Devil's Triangle. Salazar also sees the compass in Sparrow's hand while his ship is being wrecked. That explains why Salazar immediately knew that Sparrow has given away the compass that led to the end of his curse.
It's not like Salazar and his crew are completely isolated there. We know that occasionally other ships arrive there, and are then attacked by Salazar and his crew. And he always leaves a man alive to tell the tale (why he expects a single man to routinely survive the return journey, I don't know). All he has to do before letting them go (or killing them) is to interrogate them to learn more about exactly how he got trapped in there and by whom. We see him do this with Barbossa, even. Other pirates and sailors do seem to know about Jack to some degree. Enough years, enough pirates squealing to save their lives, and bingo bango, you piece together names, mysteriously prominent compasses, etc.