Skip to content

Commit 4095ee1

Browse files
authored
Fix L0_output_validation failure (triton-inference-server#4)
1 parent 32ffc9a commit 4095ee1

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

cmake/TritonPyTorchBackendConfig.cmake.in

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,4 @@ if(NOT TARGET TritonPyTorchBackend::triton-pytorch-backend)
3636
include("${TRITONPYTORCHBACKEND_CMAKE_DIR}/TritonPyTorchBackendTargets.cmake")
3737
endif()
3838

39-
set(TRITONPYTORCHBACKEND_LIBRARIES TritonPyTorchBackend::triton-pytorch-backend)
39+
set(TRITONPYTORCHBACKEND_LIBRARIES TritonPyTorchBackend::triton-pytorch-backend)

src/libtorch.cc

+12-5
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,9 @@ ModelInstanceState::~ModelInstanceState()
327327
{
328328
torch_model_.reset();
329329
#ifdef TRITON_ENABLE_GPU
330-
c10::cuda::CUDACachingAllocator::emptyCache();
330+
if (device_.is_cuda()) {
331+
c10::cuda::CUDACachingAllocator::emptyCache();
332+
}
331333
#endif // TRITON_ENABLE_GPU
332334
}
333335

@@ -666,11 +668,12 @@ ModelInstanceState::ProcessRequests(
666668
input_memories.clear();
667669

668670
// Verify output indices are valid with number of outputs after execution
671+
bool invalid_index = false;
669672
int max_index = output_tensors.size() - 1;
670673
for (const auto& name : output_names) {
671674
int op_index = output_index_map_[name];
672675
if ((op_index < 0) || (op_index > max_index)) {
673-
RESPOND_ALL_AND_RETURN_IF_ERROR(
676+
SendErrorForResponses(
674677
&responses, request_count,
675678
TRITONSERVER_ErrorNew(
676679
TRITONSERVER_ERROR_INVALID_ARG,
@@ -680,12 +683,16 @@ ModelInstanceState::ProcessRequests(
680683
" doesn't exist. This model has " +
681684
std::to_string(max_index + 1) + " outputs")
682685
.c_str()));
686+
invalid_index = true;
687+
break;
683688
}
684689
}
685690

686-
ReadOutputTensors(
687-
total_batch_size, output_names, output_tensors, requests, request_count,
688-
&responses);
691+
if (!invalid_index) {
692+
ReadOutputTensors(
693+
total_batch_size, output_names, output_tensors, requests, request_count,
694+
&responses);
695+
}
689696

690697
uint64_t exec_end_ns = 0;
691698
SET_TIMESTAMP(exec_end_ns);

0 commit comments

Comments
 (0)