junrushao1994 edited a comment on pull request #9842: URL: https://github.com/apache/tvm/pull/9842#issuecomment-1006043347
Hey @d-smirnov for this PR! Iterator invalidation is a problem that exists for multiple languages, and a general rule of thumb is to avoid modifying a container when iterating it - even though STL impl guarantees that for associative containers, inserting a new element doesn't invalidate iterators that point to existing elements. I personally got bitten by this issue once in the past year, and thus am supportive of more careful checks. However, runtime check is neither sufficient (consider the multi-threaded case) nor efficient (incur runtime overhead). Therefore, I was wondering if you might want to update this PR with the following changes: - Add similar checks for `Array` - Macro-guard the checks so that it only exists in debug build - Use atomic counter and atomic comparison -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
