From f858e25246a6a2cab8716e3deb1f93f00f03e5a5 Mon Sep 17 00:00:00 2001 From: giles Date: Wed, 4 Feb 2026 09:56:29 +0000 Subject: [PATCH] Add heavy pipeline comparison tests --- test_heavy_fused.sexp | 45 +++++++++++++++++++++++++++++++++++++ test_heavy_interpreted.sexp | 39 ++++++++++++++++++++++++++++++++ 2 files changed, 84 insertions(+) create mode 100644 test_heavy_fused.sexp create mode 100644 test_heavy_interpreted.sexp diff --git a/test_heavy_fused.sexp b/test_heavy_fused.sexp new file mode 100644 index 0000000..498b855 --- /dev/null +++ b/test_heavy_fused.sexp @@ -0,0 +1,45 @@ +;; Heavy Fused Pipeline Test +;; +;; Tests with many effects to show the full benefit of kernel fusion + +(stream "heavy_fused_test" + :fps 30 + :width 1920 + :height 1080 + :seed 42 + + ;; Load primitives + (require-primitives "streaming_gpu") + (require-primitives "image") + (require-primitives "math") + + ;; Define heavy effects pipeline (5 effects fused into one kernel) + (def heavy-pipeline + [{:op "rotate" :angle 0} + {:op "zoom" :amount 1.0} + {:op "hue_shift" :degrees 30} + {:op "ripple" :amplitude 15 :frequency 10 :decay 2 :phase 0 :center_x 960 :center_y 540} + {:op "brightness" :factor 1.0}]) + + ;; Frame pipeline + (frame + (let [;; Create base image + r (+ 0.5 (* 0.5 (math:sin (* t 1)))) + g (+ 0.5 (* 0.5 (math:sin (* t 1.3)))) + b (+ 0.5 (* 0.5 (math:sin (* t 1.7)))) + color [(* r 255) (* g 255) (* b 255)] + base (image:make-image 1920 1080 color) + + ;; Dynamic parameters + angle1 (* t 30) + angle2 (* t -20) + zoom1 (+ 1.0 (* 0.1 (math:sin (* t 0.5)))) + zoom2 (+ 1.0 (* 0.05 (math:cos (* t 0.7)))) + phase1 (* t 2) + phase2 (* t 3)] + + ;; 10 effects in ONE kernel call! + (streaming_gpu:fused-pipeline base heavy-pipeline + :rotate_angle angle1 + :zoom_amount zoom1 + :ripple_phase phase1)))) diff --git a/test_heavy_interpreted.sexp b/test_heavy_interpreted.sexp new file mode 100644 index 0000000..0060c07 --- /dev/null +++ b/test_heavy_interpreted.sexp @@ -0,0 +1,39 @@ +;; Heavy Interpreted Pipeline Test +;; +;; Same effects as test_heavy_fused.sexp but using separate primitive calls + +(stream "heavy_interpreted_test" + :fps 30 + :width 1920 + :height 1080 + :seed 42 + + ;; Load primitives + (require-primitives "streaming_gpu") + (require-primitives "geometry_gpu") + (require-primitives "color_ops") + (require-primitives "image") + (require-primitives "math") + + ;; Frame pipeline - INTERPRETED (separate calls) + (frame + (let [;; Create base image + r (+ 0.5 (* 0.5 (math:sin (* t 1)))) + g (+ 0.5 (* 0.5 (math:sin (* t 1.3)))) + b (+ 0.5 (* 0.5 (math:sin (* t 1.7)))) + color [(* r 255) (* g 255) (* b 255)] + base (image:make-image 1920 1080 color) + + ;; Dynamic parameters + angle (* t 30) + zoom (+ 1.0 (* 0.1 (math:sin (* t 0.5)))) + phase (* t 2) + + ;; Apply 5 effects one by one (INTERPRETED - many kernel launches) + step1 (geometry_gpu:rotate base angle) + step2 (streaming_gpu:gpu-zoom step1 zoom) + step3 (color_ops:hue-shift step2 30) + step4 (geometry_gpu:ripple step3 15 :frequency 10 :decay 2 :time phase) + step5 (color_ops:brightness step4 1.0)] + + step5)))