Skip to content

Commit fdf08af

Browse files
authored
Fix the handling for empty GPU tensor (triton-inference-server#187)
* Fix the handling for empty GPU tensor * Fix start_address initialization
1 parent 4fc9cf6 commit fdf08af

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

src/pb_memory.cc

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -295,11 +295,15 @@ PbMemory::GetGPUStartAddress()
295295
{
296296
if (memory_shm_ptr_->memory_type == TRITONSERVER_MEMORY_GPU) {
297297
CUDAHandler& cuda_api = CUDAHandler::getInstance();
298-
CUdeviceptr start_address;
299-
300-
cuda_api.PointerGetAttribute(
301-
&start_address, CU_POINTER_ATTRIBUTE_RANGE_START_ADDR,
302-
reinterpret_cast<CUdeviceptr>(data_ptr_));
298+
CUdeviceptr start_address = 0;
299+
300+
// Skip this step for empty tensor as the CUDA API 'cuPointerGetAttribute'
301+
// we use in this function does not accept nullptr.
302+
if (data_ptr_) {
303+
cuda_api.PointerGetAttribute(
304+
&start_address, CU_POINTER_ATTRIBUTE_RANGE_START_ADDR,
305+
reinterpret_cast<CUdeviceptr>(data_ptr_));
306+
}
303307

304308
return reinterpret_cast<void*>(start_address);
305309
}

0 commit comments

Comments
 (0)