D105812 introduced a regression where if a PTR_AND_OBJ entry was mapped on the device, later the OBJ was deallocated and then reallocated at a different address, the Shadow Pointer Map would still contain an entry for the PTR but pointing to the old address. This caused test env/base_ptr_ref_count.c to fail.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
No. If the old entry exists in ShadowPtrMap then UpdateDevPtr will remain false, so no update will take place. This patch changes that condition: if either the entry is not in the map or it exists but contains stale data, an update should be performed.
No, only when the PTR is deallocated is the entry removed from the map. But in env/base_ptr_ref_count.c the PTR is a global declare target pointer, so it stays in the map for the lifetime of the application.
Other than my comment suggestion, LGTM. Thanks.
openmp/libomptarget/src/omptarget.cpp | ||
---|---|---|
569 | Can you extend this comment a bit more to address @tianshilei1992's question? That is, explain that the shadow map entry is added/removed only when the PTR is allocated/deallocated on the device, but TgtPtrVal becomes stale when the OBJ is allocated/deallocated on the device. I found this point confusing as well. |
Can you extend this comment a bit more to address @tianshilei1992's question? That is, explain that the shadow map entry is added/removed only when the PTR is allocated/deallocated on the device, but TgtPtrVal becomes stale when the OBJ is allocated/deallocated on the device. I found this point confusing as well.