IExecutionContext::executeV2: Error Code 1: Cask (Cask convolution execution)
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 13.4k
- Forks
- 2.4k
- Avg merge
- 5d 3h
- Merged PRs (30d)
- 2
Description
Description
I'm just starting to learn TensorRT and tried converting a model to an engine for inference. However, I encountered issues while running the code. Below are my code snippets and error logs.
def load_engine(engine_file_path):
with open(engine_file_path, "rb") as f, trt.Runtime(trt.Logger(trt.Logger.WARNING)) as runtime:
return runtime.deserialize_cuda_engine(f.read())
def infer(engine, input_data):
with engine.create_execution_context() as context:
tensor_names = [engine.get_tensor_name(i) for i in range(engine.num_io_tensors)]
input_shape = input_data.shape
context.set_input_shape('input', input_shape)
bindings = []
for binding in tensor_names:
shape = context.get_tensor_shape(binding)
dtype = np.dtype(trt.nptype(engine.get_tensor_dtype(binding)))
size = trt.volume(shape) * dtype.itemsize
mem = cuda.mem_alloc(size)
bindings.append(mem)
input_mem = bindings[0]
cuda.memcpy_htod(input_mem, input_data.astype(np.float32))
context.execute_v2(bindings=bindings)
output_shape = context.get_tensor_shape(tensor_names[-1])
output = np.empty(output_shape, dtype=np.float32)
cuda.memcpy_dtoh(output, bindings[1])
return output
engine_path = "model.engine"
engine = load_engine(engine_path)
if not cuda.Context.get_current():
cuda.init()
device = cuda.Device(0)
ctx = device.make_context()
try:
output = infer(engine, np.array(dummy_input))
print("output result:", output)
finally:
ctx.pop()
[05/03/2025-15:12:06] [TRT] [I] [MemUsageChange] Init CUDA: CPU +28, GPU +0, now: CPU 139, GPU 339 (MiB)
[05/03/2025-15:12:08] [TRT] [I] [MemUsageChange] Init builder kernel library: CPU +3102, GPU +488, now: CPU 3442, GPU 827 (MiB)
[05/03/2025-15:12:08] [TRT] [I] Local timing cache in use. Profiling results in this builder pass will not be stored.
[05/03/2025-15:12:12] [TRT] [I] Detected 1 inputs and 1 output network tensors.
[05/03/2025-15:12:12] [TRT] [I] Total Host Persistent Memory: 94560 bytes
[05/03/2025-15:12:12] [TRT] [I] Total Device Persistent Memory: 0 bytes
[05/03/2025-15:12:12] [TRT] [I] Max Scratch Memory: 0 bytes
[05/03/2025-15:12:12] [TRT] [I] [BlockAssignment] Started assigning block shifts. This will take 21 steps to complete.
[05/03/2025-15:12:12] [TRT] [I] [BlockAssignment] Algorithm ShiftNTopDown took 0.039731ms to assign 3 blocks to 21 nodes requiring 102760960 bytes.
[05/03/2025-15:12:12] [TRT] [I] Total Activation Memory: 102760448 bytes
[05/03/2025-15:12:12] [TRT] [I] Total Weights Memory: 2238992 bytes
[05/03/2025-15:12:12] [TRT] [I] Engine generation completed in 3.87254 seconds.
[05/03/2025-15:12:12] [TRT] [I] [MemUsageStats] Peak memory usage of TRT CPU/GPU memory allocators: CPU 0 MiB, GPU 99 MiB
[05/03/2025-15:12:12] [TRT] [E] IExecutionContext::executeV2: Error Code 1: Cask (Cask convolution execution)
output result: [[[[0. 0. 0. ... 0. 0. 0.]
[0. 0. 0. ... 0. 0. 0.]
[0. 0. 0. ... 0. 0. 0.]
...
[0. 0. 0. ... 0. 0. 0.]
[0. 0. 0. ... 0. 0. 0.]
[0. 0. 0. ... 0. 0. 0.]]]]
Environment
TensorRT Version: 10.9
NVIDIA GPU: RTX 5070Ti
NVIDIA Driver Version: 570.124.04
CUDA Version: 12.8
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Python infer() function, especially engine.create_execution_context() and context.execute_v2(bindings=bindings), and reproduce the failure in the stated TensorRT 10.9, CUDA 12.8, driver 570.124.04, and RTX 5070 Ti environment. Confirm the cause of the Cask convolution error and that inference completes without returning an all-zero output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100