portable interpolated look-up table using texture memory #26
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Lookup class
hemi::Table3D<T>
that creates an interface to a look-up table structure, using texture memory on GPU. Trilinear interpolation is implemented on CPU, and agrees to 5/6 decimal places when compared to the texture memory results.The user calls
readOnlyDevicePtr()
to return a pointer to the struct objecthemi::table3<T>
that can be passed to the kernel. The similarity ofTable3D<T>
andtable3<t>
bothers me slightly so a better naming convention would be appreciated. The interpolation can then be performed bylookup_struct->lookup(x, y, z)
both in a CUDA kernel and in host code. The device code is ~20 times faster when performing millions of interpolations.The current implementation is only for 3D LUTs, but it is straightforward to create 1D and 2D versions. There are also other limitations such as read-only access, but this could be improved on with surface objects. Also, the CPU implementation has no out-of-bounds array checking, for speed reasons. This could be changed.
See the two example programs added in /hemi/examples/simple