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

enqueueV2 problem #1

Closed
ioo0s opened this issue Jul 4, 2023 · 2 comments
Closed

enqueueV2 problem #1

ioo0s opened this issue Jul 4, 2023 · 2 comments

Comments

@ioo0s
Copy link

ioo0s commented Jul 4, 2023

I am not using the latest version 8.6 but 8.4 with tensor, so I don't have the api of enqueueV3.
I want to be able to add a binding for enqueueV2.

As same time,I try to modify the code of the V3 function, but I am not familiar with the bindings parameter and cudaEvent_t of V2 Function.

bool nvinfer1::IExecutionContext::enqueueV2 (void *const * bindings,
cudaStream_t  stream,
cudaEvent_t * inputConsumed
) 
 pub fn enqueue<T: Copy>(
        &mut self,
        io_tensors: &mut std::collections::HashMap<
            &str,
            &mut async_cuda_core::ffi::memory::DeviceBuffer<T>,
        >,
        stream: &async_cuda_core::ffi::stream::Stream,
    ) -> Result<()> {
        let internal = self.as_mut_ptr();
        for (tensor_name, buffer) in io_tensors {
            unsafe {
                self.set_tensor_address(tensor_name, buffer)?;
            }
        }
        let stream_ptr = stream.as_internal().as_ptr();
        let success = cpp!(unsafe [
            internal as "void*",
            stream_ptr as "const void*"
        ] -> bool as "bool" {
            return ((IExecutionContext*) internal)->enqueueV2((cudaStream_t) stream_ptr);
        });
        if success {
            Ok(())
        } else {
            Err(last_error())
        }
    }

How should I modify next?

@gerwin3
Copy link
Contributor

gerwin3 commented Jul 5, 2023

See documentation for enqueueV2 here: https://docs.nvidia.com/deeplearning/tensorrt/api/c_api/classnvinfer1_1_1_i_execution_context.html#a63cd95430852038ce864e17c670e0b36

The parameter bindings is a list of addresses to the input and output buffers. The previous version of TRT API was quite different but it should be doable to change it (though I suspect you have to change it in a few other places as well).

If possible I'd recommend upgrading TRT

@gerwin3 gerwin3 closed this as completed Jul 5, 2023
@ioo0s
Copy link
Author

ioo0s commented Jul 5, 2023

Thanks for the reply, I'm already trying to build it, it should be there soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants