Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VolumeGVDB::RenderKernel ERROR: an illegal memory access was encountered #142

Open
vsheihu opened this issue Aug 15, 2023 · 0 comments
Open

Comments

@vsheihu
Copy link

vsheihu commented Aug 15, 2023

This interesting problem always occurs during my rotation of the view, and the detailed error report is as follows:

GVDB CUDA ERROR:
Launch status: an illegal memory access was accounted for
Kernel status: no error
Caller: VolumeGVDB::RenderKernel
Call: cuLaunch
Args: (user kernel)
Error Application will exit.

Currently, I have found a temporary solution and need to modify the cuda_gvdb_raycast.cuh, the original code for the file rayCast function was:
device void rayCast ( VDBInfo* gvdb, uchar chan, float3 pos, float3 dir, float3& hit, float3& norm, float4& clr, gvdbBrickFunc_t brickFunc )
{
...

for (iter=0; iter < MAX_ITER && lev > 0 && lev <= gvdb->top_lev && dda.p.x >=0 && dda.p.y >=0 && dda.p.z >=0 && dda.p.x <= gvdb->res[lev] && dda.p.y <= gvdb->res[lev] && dda.p.z <= gvdb->res[lev]; iter++ ) {
	
	...

	// node active test
	b = (((int(dda.p.z) << gvdb->dim[lev]) + int(dda.p.y)) << gvdb->dim[lev]) + int(dda.p.x);	// bitmaskpos
	if ( isBitOn ( gvdb, node, b ) ) {						// check vdb bitmask for voxel occupancy						
		...
	} else {
		// empty voxel, step DDA
		dda.Step();
	}
	...
}	

}

The modified code is as follows:
device void rayCast ( VDBInfo* gvdb, uchar chan, float3 pos, float3 dir, float3& hit, float3& norm, float4& clr, gvdbBrickFunc_t brickFunc )
{
...

for (iter=0; iter < MAX_ITER && lev > 0 && lev <= gvdb->top_lev && dda.p.x >=0 && dda.p.y >=0 && dda.p.z >=0 && dda.p.x <= gvdb->res[lev] && dda.p.y <= gvdb->res[lev] && dda.p.z <= gvdb->res[lev]; iter++ ) {
	
	...

	// node active test
	b = (((int(dda.p.z) << gvdb->dim[lev]) + int(dda.p.y)) << gvdb->dim[lev]) + int(dda.p.x);	// bitmaskpos
	int vox = gvdb->res[node->mLev] * gvdb->res[node->mLev] * gvdb->res[node->mLev];
	if (b < vox && isBitOn ( gvdb, node, b ) ) {						// check vdb bitmask for voxel occupancy						
		...
	} else {
		// empty voxel, step DDA
		dda.Step();
	}
	...
}	

}

The problem has been resolved and can be filed as your modification.

Through Cuda Nsight Debug, it was found that the direct reason was that the bit parameter in isBitOn exceeded the current node size. As for why the bit exceeded the node range, forgive my clumsiness, i haven't discovered it yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant