From bb0e1308d5d1df6014239ac2d650a200d50aaa2a Mon Sep 17 00:00:00 2001 From: jgrusewski Date: Wed, 8 Apr 2026 19:49:58 +0200 Subject: [PATCH] =?UTF-8?q?fix(4branch):=20backtest=20single-step=20kernel?= =?UTF-8?q?=20uses=204-branch=20decode=20=E2=80=94=20was=20using=20old=203?= =?UTF-8?q?-branch?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The single-step backtest_env_step kernel still called decode_exposure_index() and compute_target_position() (old linear 3-branch mapping). Updated to use decode_direction_4b/decode_magnitude_4b/compute_target_position_4branch. Co-Authored-By: Claude Opus 4.6 (1M context) --- crates/ml/src/cuda_pipeline/backtest_env_kernel.cu | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/crates/ml/src/cuda_pipeline/backtest_env_kernel.cu b/crates/ml/src/cuda_pipeline/backtest_env_kernel.cu index 07d529c8e..208e0b71f 100644 --- a/crates/ml/src/cuda_pipeline/backtest_env_kernel.cu +++ b/crates/ml/src/cuda_pipeline/backtest_env_kernel.cu @@ -137,11 +137,12 @@ extern "C" __global__ void backtest_env_step( return; } - // ── Decode action (shared: trade_physics.cuh) ──────────────────────── + // ── Decode action (4-branch: trade_physics.cuh) ─────────────────────── int action_val = actions[w]; - int exposure_idx = decode_exposure_index(action_val, b0_size, b1_size, b2_size); - float target_exposure = compute_target_position(exposure_idx, b0_size, max_position); - int order_type_idx = decode_order_type(action_val, b1_size, b2_size); + int dir_idx = decode_direction_4b(action_val, b1_size, b2_size, b3_size); + int mag_idx = decode_magnitude_4b(action_val, b1_size, b2_size, b3_size); + float target_exposure = compute_target_position_4branch(dir_idx, mag_idx, max_position); + int order_type_idx = decode_order_4b(action_val, b2_size, b3_size); // ── Margin-aware position cap (shared: trade_physics.cuh) ──────────── // margin = price * multiplier * margin_pct (e.g. 5000 * 50 * 0.06 = $15K for ES)