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

Avoid arithmetic on void pointer in multilevelProposeROIPlugin.cpp #1028

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions plugin/multilevelProposeROI/multilevelProposeROIPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ int MultilevelProposeROI::enqueue(
static_cast<float>(mImageSize.d[1]), // Input Height
static_cast<float>(mImageSize.d[2]),
DataType::kFLOAT, // mType,
mParam, proposal_ws, workspace + kernel_workspace_offset,
mParam, proposal_ws, reinterpret_cast<uint8_t*>(workspace) + kernel_workspace_offset,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please update to static_cast to go from void * to T *:
https://github.com/NVIDIA/TensorRT/blob/master/CODING-GUIDELINES.md#casts

inputs[2 * i + 1], // inputs[object_score],
inputs[2 * i], // inputs[bbox_delta]
mValidCnt->mPtr,
Expand All @@ -418,8 +418,8 @@ int MultilevelProposeROI::enqueue(

ConcatTopKWorkSpace ctopk_ws(batch_size, mFeatureCnt, mKeepTopK, mType);
status = ConcatTopK(stream, batch_size, mFeatureCnt, mKeepTopK, DataType::kFLOAT,
workspace + kernel_workspace_offset, ctopk_ws, reinterpret_cast<void**>(mDeviceScores),
reinterpret_cast<void**>(mDeviceBboxes), final_proposals);
reinterpret_cast<uint8_t*>(workspace) + kernel_workspace_offset, ctopk_ws,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same as above - please use static_cast

reinterpret_cast<void**>(mDeviceScores), reinterpret_cast<void**>(mDeviceBboxes), final_proposals);

assert(status == cudaSuccess);
return status;
Expand Down