| 543 | return 1; |
| 544 | } |
| 545 | if (cli_wait_distributed_route(cfg, session) != 0) { |
| 546 | ds4_session_free(session); |
| 547 | return 1; |
| 548 | } |
| 549 | /* Pay the one-time first-submission GPU cost before the prefill timer |
| 550 | * starts (matches the TP worker's startup warmup). */ |
| 551 | ds4_session_gpu_warmup(session); |
| 552 | |
| 553 | char err[160]; |
| 554 | ds4_think_mode think_mode = cli_effective_think_mode(&cfg->gen); |
| 555 | token_printer printer = { |
| 556 | .engine = engine, |
| 557 | .fp = stdout, |
| 558 | .format_thinking = ds4_think_mode_enabled(think_mode), |
| 559 | .in_think = ds4_think_mode_enabled(think_mode), |
| 560 | .use_color = isatty(fileno(stdout)) != 0, |
| 561 | .last_output_newline = true, |
| 562 | }; |
| 563 | cli_prefill_progress progress = { |
| 564 | .base_tokens = 0, |
| 565 | .input_tokens = prompt->len, |
| 566 | .use_color = ds4_log_is_tty(stderr), |
| 567 | }; |
| 568 | |
| 569 | const double t_prefill0 = cli_now_sec(); |
| 570 | ds4_session_set_progress(session, cli_prefill_progress_cb, &progress); |
| 571 | ds4_session_set_display_progress(session, |