Problem Statement
When writing custom GPU-accelerated friction or compliance solvers using NVIDIA Warp JIT, the JIT compiler may throw the following error upon wp.launch():
Static Compiler Error [Type Mismatch]: Argument 'relative_velocities' inside kernel 'compute_vectorized_wet_friction' lacks a strict type annotation.
Root Cause
Unlike standard Python functions, functions decorated with @wp.kernel compile down to native CUDA/C++ code. Every input parameter must be explicitly annotated with Warp’s native types (wp.array, float, wp.vec3).
Solution
Ensure all kernel arguments carry explicit type signatures in the function definition:
import warp as wp
# INCORRECT (Triggers Compiler Error)
@wp.kernel
def compute_vectorized_wet_friction(relative_velocities, normal_forces, mu_dry):
...
# CORRECT (Compiles natively to CUDA)
@wp.kernel
def compute_vectorized_wet_friction(
relative_velocities: wp.array2d(dtype=wp.vec3),
normal_forces: wp.array2d(dtype=float),
mu_dry: float,
mu_fluid: float,
out_friction_forces: wp.array2d(dtype=wp.vec3)
):
env_idx, contact_idx = wp.tid()
...
For more mathematical derivations on Stribeck hydrodynamic lubrication, visit the HV-OS Physics Documentation.