From 377e0d51567a370ef2fc88859d938b2a6b11395b Mon Sep 17 00:00:00 2001 From: discountchubbs Date: Sat, 5 Sep 2026 10:44:03 -0700 Subject: [PATCH] agnostic --- openpilot/sunnypilot/modeld_v2/compile_modeld.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/openpilot/sunnypilot/modeld_v2/compile_modeld.py b/openpilot/sunnypilot/modeld_v2/compile_modeld.py index 6f27afebef..f4f4146522 100755 --- a/openpilot/sunnypilot/modeld_v2/compile_modeld.py +++ b/openpilot/sunnypilot/modeld_v2/compile_modeld.py @@ -157,7 +157,10 @@ def make_warp(nv12: NV12Frame, model_w: int, model_h: int): def warp(tfm, big_tfm, frame, big_frame): tfm = tfm.to(Device.DEFAULT) big_tfm = big_tfm.to(Device.DEFAULT) - Tensor.realize(tfm, big_tfm) + if Device.DEFAULT == 'AMD': + frame = frame.to(Device.DEFAULT) + big_frame = big_frame.to(Device.DEFAULT) + Tensor.realize(tfm, big_tfm, frame, big_frame) warped_frame = frame_prepare(frame, tfm).unsqueeze(0) warped_big_frame = frame_prepare(big_frame, big_tfm).unsqueeze(0) @@ -372,7 +375,8 @@ if __name__ == "__main__": for cam_w, cam_h in args.camera_resolutions: print(f"Compiling warp JIT for {cam_w}x{cam_h}...") nv12 = NV12Frame(cam_w, cam_h, *get_nv12_info(cam_w, cam_h)) - make_random_warp_inputs = partial(make_random_images, keys=['frame', 'big_frame'], shape=nv12.size, device=Device.DEFAULT) + warp_input_dev = 'NPY' if Device.DEFAULT == 'AMD' else Device.DEFAULT + make_random_warp_inputs = partial(make_random_images, keys=['frame', 'big_frame'], shape=nv12.size, device=warp_input_dev) warp = TinyJit(make_warp(nv12, model_w, model_h), prune=True) output_data[(cam_w, cam_h)] = compile_jit(warp, make_random_warp_inputs, WARP_INPUTS, make_warp_queues)