Skip to content

Commit

Permalink
Fix bad cast in util_device.
Browse files Browse the repository at this point in the history
Fixes NVIDIA#286.
  • Loading branch information
alliepiper committed Nov 11, 2021
1 parent 99c2931 commit 800c92a
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions cub/util_device.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -371,11 +371,9 @@ CUB_RUNTIME_FUNCTION inline cudaError_t PtxVersionUncached(int& ptx_version)
#if CUB_INCLUDE_HOST_CODE
cudaFuncAttributes empty_kernel_attrs;

do {
if (CubDebug(result = cudaFuncGetAttributes(&empty_kernel_attrs, empty_kernel)))
break;
}
while(0);
result = cudaFuncGetAttributes(&empty_kernel_attrs,
reinterpret_cast<void*>(empty_kernel));
CubDebug(result);

ptx_version = empty_kernel_attrs.ptxVersion * 10;
#endif
Expand Down

1 comment on commit 800c92a

@jiapei-nexera
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Logically speaking, this seems to be wrong. The right modification might be ????

        do {
            result = cudaFuncGetAttributes(&empty_kernel_attrs,
                                           reinterpret_cast<void*>(empty_kernel));
            CubDebug(result);
        } while(0);

Please sign in to comment.