Skip to content

Commit 3966b9f

Browse files
committed
Add clang build fixes
* Add clang build fixes * Add/fix comments Signed-off-by: Matthew Cong <[email protected]>
1 parent 93549a7 commit 3966b9f

File tree

3 files changed

+23
-18
lines changed

3 files changed

+23
-18
lines changed

nanovdb/nanovdb/cuda/DeviceBuffer.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class DeviceBuffer
4141

4242
/// @brief Initialize buffer
4343
/// @param size byte size of buffer to be initialized
44-
/// @param host If true buffer is initialized only on the host/CPU, else on the device/GPU
44+
/// @param device id of the device on which to initialize the buffer
4545
/// @note All existing buffers are first cleared
4646
/// @warning size is expected to be non-zero. Use clear() clear buffer!
4747
void init(uint64_t size, int device, cudaStream_t stream);
@@ -152,6 +152,11 @@ class DeviceBuffer
152152
/// @return An instance of this class using move semantics
153153
static DeviceBuffer create(uint64_t size, const DeviceBuffer* dummy, bool host, void* stream){return DeviceBuffer(size, host, stream);}
154154

155+
/// @brief Static factory method that returns an instance of this buffer
156+
/// @param size byte size of buffer to be initialized
157+
/// @param dummy this argument is currently ignored but required to match the API of the HostBuffer
158+
/// @param device id of the device on which to initialize the buffer
159+
/// @param stream cuda stream
155160
static DeviceBuffer create(uint64_t size, const DeviceBuffer* dummy = nullptr, int device = cudaCpuDeviceId, cudaStream_t stream = 0){return DeviceBuffer(size, device, stream);}
156161

157162
/// @brief Static factory method that returns an instance of this buffer that wraps externally managed memory
@@ -167,7 +172,7 @@ class DeviceBuffer
167172
/// @param list list of device IDs and device memory pointers
168173
static DeviceBuffer create(uint64_t size, void* cpuData, std::initializer_list<std::pair<int,void*>> list) {return DeviceBuffer(size, cpuData, list);}
169174

170-
/// @brief Static factory method that returns an instance of this buffer constructed from a HostBuffer
175+
/// @brief Static factory method that returns an instance of this buffer constructed from a HostBuffer
171176
/// @param buffer host buffer from which to copy data
172177
/// @param device id of the device on which to initialize the buffer
173178
/// @param stream cuda stream

nanovdb/nanovdb/cuda/GridHandle.cuh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ __global__ void cpyGridHandleMeta(const GridData *d_data, GridHandleMetaData *d_
3434
__global__ void updateGridCount(GridData *d_data, uint32_t gridIndex, uint32_t gridCount, bool *d_dirty)
3535
{
3636
NANOVDB_ASSERT(gridIndex < gridCount);
37-
if (*d_dirty = d_data->mGridIndex != gridIndex || d_data->mGridCount != gridCount) {
37+
*d_dirty = (d_data->mGridIndex != gridIndex) || (d_data->mGridCount != gridCount);
38+
if (*d_dirty) {
3839
d_data->mGridIndex = gridIndex;
3940
d_data->mGridCount = gridCount;
4041
if (d_data->mChecksum.isEmpty()) *d_dirty = false;// no need to update checksum if it didn't already exist

nanovdb/nanovdb/tools/cuda/PointsToGrid.cuh

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
#include <nanovdb/NanoVDB.h>
2525
#include <nanovdb/cuda/DeviceBuffer.h>
2626
#include <nanovdb/cuda/TempPool.h>
27-
#include <nanovdb/cuda/UnifiedBuffer.h>
2827
#include <nanovdb/GridHandle.h>
2928
#include <nanovdb/tools/cuda/GridChecksum.cuh>
3029
#include <nanovdb/util/cuda/Timer.h>
@@ -789,9 +788,9 @@ struct BuildGridTreeRootFunctor
789788
auto &root = d_data->getRoot();
790789
root.mBBox = CoordBBox(); // init to empty
791790
root.mTableSize = d_data->nodeCount[2];
792-
root.mBackground = NanoRoot<BuildT>::ValueType(0);// background_value
793-
root.mMinimum = root.mMaximum = NanoRoot<BuildT>::ValueType(0);
794-
root.mAverage = root.mStdDevi = NanoRoot<BuildT>::FloatType(0);
791+
root.mBackground = typename NanoRoot<BuildT>::ValueType(0);// background_value
792+
root.mMinimum = root.mMaximum = typename NanoRoot<BuildT>::ValueType(0);
793+
root.mAverage = root.mStdDevi = typename NanoRoot<BuildT>::FloatType(0);
795794

796795
// process Tree
797796
auto &tree = d_data->getTree();
@@ -940,15 +939,15 @@ struct BuildUpperNodesFunctor
940939
};
941940
const Coord ijk = keyToCoord(d_data->d_tile_keys[tid]);
942941
#else
943-
const Coord ijk = NanoRoot<uint32_t>::KeyToCoord(d_data->d_tile_keys[tid]);
942+
const Coord ijk = typename NanoRoot<uint32_t>::KeyToCoord(d_data->d_tile_keys[tid]);
944943
#endif
945944
root.tile(tid)->setChild(ijk, &upper, &root);
946945
upper.mBBox[0] = ijk;
947946
upper.mFlags = 0;
948947
upper.mValueMask.setOff();
949948
upper.mChildMask.setOff();
950-
upper.mMinimum = upper.mMaximum = NanoLower<BuildT>::ValueType(0);
951-
upper.mAverage = upper.mStdDevi = NanoLower<BuildT>::FloatType(0);
949+
upper.mMinimum = upper.mMaximum = typename NanoLower<BuildT>::ValueType(0);
950+
upper.mAverage = upper.mStdDevi = typename NanoLower<BuildT>::FloatType(0);
952951
}
953952
};
954953

@@ -958,7 +957,7 @@ struct SetUpperBackgroundValuesFunctor
958957
__device__
959958
void operator()(size_t tid, PointsToGridData<BuildT> *d_data) {
960959
auto &upper = d_data->getUpper(tid >> 15);
961-
upper.mTable[tid & 32767u].value = NanoUpper<BuildT>::ValueType(0);// background
960+
upper.mTable[tid & 32767u].value = typename NanoUpper<BuildT>::ValueType(0);// background
962961
}
963962
};
964963

@@ -993,8 +992,8 @@ struct BuildLowerNodesFunctor
993992
lower.mFlags = 0;
994993
lower.mValueMask.setOff();
995994
lower.mChildMask.setOff();
996-
lower.mMinimum = lower.mMaximum = NanoLower<BuildT>::ValueType(0);// background;
997-
lower.mAverage = lower.mStdDevi = NanoLower<BuildT>::FloatType(0);
995+
lower.mMinimum = lower.mMaximum = typename NanoLower<BuildT>::ValueType(0);// background;
996+
lower.mAverage = lower.mStdDevi = typename NanoLower<BuildT>::FloatType(0);
998997
}
999998
};
1000999

@@ -1004,7 +1003,7 @@ struct SetLowerBackgroundValuesFunctor
10041003
__device__
10051004
void operator()(size_t tid, PointsToGridData<BuildT> *d_data) {
10061005
auto &lower = d_data->getLower(tid >> 12);
1007-
lower.mTable[tid & 4095u].value = NanoLower<BuildT>::ValueType(0);// background
1006+
lower.mTable[tid & 4095u].value = typename NanoLower<BuildT>::ValueType(0);// background
10081007
}
10091008
};
10101009

@@ -1045,8 +1044,8 @@ struct ProcessLeafMetaDataFunctor
10451044
leaf.mOffset = tid*512u + 1u;// background is index 0
10461045
leaf.mPrefixSum = 0u;
10471046
} else if constexpr(!BuildTraits<BuildT>::is_special) {
1048-
leaf.mAverage = leaf.mStdDevi = NanoLeaf<BuildT>::FloatType(0);
1049-
leaf.mMinimum = leaf.mMaximum = NanoLeaf<BuildT>::ValueType(0);
1047+
leaf.mAverage = leaf.mStdDevi = typename NanoLeaf<BuildT>::FloatType(0);
1048+
leaf.mMinimum = leaf.mMaximum = typename NanoLeaf<BuildT>::ValueType(0);
10501049
}
10511050
}
10521051
};
@@ -1066,7 +1065,7 @@ struct SetLeafActiveVoxelStateAndValuesFunctor
10661065
if constexpr(util::is_same<Point, BuildT>::value) {
10671066
leaf.mValues[n] = uint16_t(pointID + d_data->pointsPerVoxel[tid] - leaf.offset());
10681067
} else if constexpr(!BuildTraits<BuildT>::is_special) {
1069-
leaf.mValues[n] = NanoLeaf<BuildT>::ValueType(1);// set value of active voxels that are not points (or index)
1068+
leaf.mValues[n] = typename NanoLeaf<BuildT>::ValueType(1);// set value of active voxels that are not points (or index)
10701069
}
10711070
}
10721071
};
@@ -1083,7 +1082,7 @@ struct SetLeafInactiveVoxelValuesFunctor
10831082
const uint32_t m = leaf.mValueMask.findPrev<true>(n - 1);
10841083
leaf.mValues[n] = m < 512u ? leaf.mValues[m] : 0u;
10851084
} else if constexpr(!BuildTraits<BuildT>::is_special) {
1086-
leaf.mValues[n] = NanoLeaf<BuildT>::ValueType(0);// value of inactive voxels
1085+
leaf.mValues[n] = typename NanoLeaf<BuildT>::ValueType(0);// value of inactive voxels
10871086
}
10881087
}
10891088
};

0 commit comments

Comments
 (0)