tlc-pack / relax

Apache License 2.0
195 stars 58 forks source link

[Fix] Concurrent modification in RemoveUnusedVars #348

Closed MasterJH5574 closed 1 year ago

MasterJH5574 commented 1 year ago

This PR fixes a bug of concurrent modification to Map in the util helper RemoveUnusedVars.

Prior to this PR, the Map users will be modified when a Map iteration going on, which will raise error in certain optimization level and debug level configured in CMake. This PR fixes the bug by collecting the map keys in ahead of the modification.

This bug is already covered by current tests we have for binding rewrite. We should be mindful of possible concurrent modification issue in the future development.


Co-authored-by: Chaofan Lin siriusneo@sjtu.edu.cn

MasterJH5574 commented 1 year ago

cc @YuchenJin @tqchen