niessner / VoxelHashing

[Siggraph Asia 2013] Large-Scale, Real-Time 3D Reconstruction
Other
670 stars 201 forks source link

Implementation Problem in 'insertHashEntry' #10

Closed theNded closed 4 years ago

theNded commented 7 years ago

I have been reading the code and got confused with the code in insertHashEntry inside VoxelUtilHashSDF.h

To execute an atom operation, the code writes

int prevWeight = 0;
uint* d_hashUI = (uint*)d_hash;
prevWeight = prevWeight = atomicCAS(&d_hashUI[3*idxLastEntryInBucket+1], (uint)FREE_ENTRY, (uint)LOCK_ENTRY);

As far as I concern, this code is aimed at converting the HashEntry* to uint* and lock the offset at the selected entry. However, the struct is 32 bytes long, hence the lock place should be d_hashUI[8 * idxLastEntryInBucket + 4] or d_hashUI[(3 << idxLastEntryInBucket) + 4]

This incorrect lock operation might not significantly influence the result, but could cause minor read-write inconsistency.

theNded commented 4 years ago

Better implementation has been achieved elsewhere. Close the legacy issue.