Skip to content

[BUG] nanovdb::tools::cuda::voxelToGrid fails to free memory when launched with a non default stream. #1945

Open
@ZephirFXEC

Description

@ZephirFXEC

Environment

Operating System: Windows 10
Version / Commit SHA: openvdb 11.0.0
Other: using Cuda 12.6

Describe the bug

When launching the function nanovdb::tools::cuda::voxelToGrid using a stream, it fails freeing memory here :

    mMemPool.free(mData.d_keys, mData.pointsPerVoxel, mData.pointsPerVoxelPrefix, mData.pointsPerLeafPrefix, mData.pointsPerLeaf);

With the error message : CUDA error 1: invalid argument

the code that fails :

	CudaResources<ValueOutT> resources(npoints, stream);
	resources.template LoadPointData<ValueInT>(in_data, npoints, stream);

	cudaStreamWaitEvent(stream, resources.beenCopied, 0);
	auto handle = nanovdb::cudaVoxelsToGrid<ValueOutT>(resources.d_coords, npoints, voxelSize, stream);
	nanovdb::NanoGrid<ValueOutT>* d_grid = handle.template deviceGrid<ValueOutT>();

the one that works :

	CudaResources<ValueOutT> resources(npoints, stream);
	resources.template LoadPointData<ValueInT>(in_data, npoints, stream);

	cudaStreamWaitEvent(stream, resources.beenCopied, 0);
	auto handle = nanovdb::cudaVoxelsToGrid<ValueOutT>(resources.d_coords, npoints, voxelSize);
	nanovdb::NanoGrid<ValueOutT>* d_grid = handle.template deviceGrid<ValueOutT>();

Additional context

I reorganized the parameters so I can set a stream without having to set a BufferT.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions