diff --git a/docs/TODO.txt b/docs/TODO.txt index e975fce8c..007c0fefc 100644 --- a/docs/TODO.txt +++ b/docs/TODO.txt @@ -353,3 +353,163 @@ [ ] Guard or stride the 65,535 * 1024 (~64 MiB/uint8 row) gridDim.y ceiling in ignition/components/state.py row kernels. + +[ ] Run `tests/preparation/test_capture_cublas_workspace_cuda.py` (`test_first_capture_binds_workspace_from_the_recording_pool`); gate: requires an explicitly assigned CUDA device. Close when every listed case passes. + +[ ] Run `tests/preparation/test_capture_order_cuda.py` (`test_capture_pool_reuses_larger_compiled_request_on_fresh_and_cached_load`, `test_compiled_warmup_orders_largest_allocation_first_under_retention`); gate: requires an explicitly assigned CUDA device. Close when every listed case passes. + +[ ] Run `tests/preparation/test_core_snapshot.py` (`test_payload_cache_convert_combine_and_promote`); gate: payload fixture generation requires explicit CUDA test opt-in. Close when every listed case passes. + +[ ] Run `tests/preparation/test_core_snapshot.py` (`test_payload_sign_uses_external_source_profile_namespace`); gate: requires an actual payload core and its source publisher profile. Close when every listed case passes. + +[ ] Run `tests/preparation/test_core_storage.py` (`test_windows_host_range_stays_below_stalling_wddm_addresses`); gate: Windows WDDM address layout. Close when every listed case passes. + +[ ] Run `tests/preparation/test_export_progress.py` (`test_native_export_terminal_progress[0]`, `test_native_export_terminal_progress[1]`); gate: requires a POSIX PTY and explicit CUDA test opt-in. Close when every listed case passes. + +[ ] Run `tests/preparation/test_gelu_storage.py` (`test_compiled_gelu_reuses_storage_after_opaque_consumer[cuda]`); gate: requires CUDA test opt-in. Close when every listed case passes. + +[ ] Run `tests/preparation/test_graph_local_scratch_cuda.py` (`test_graph_local_prepared_scratch_survives_alternating_capture_variants[False]`, `test_graph_local_prepared_scratch_survives_alternating_capture_variants[True]`, `test_storage_backend_reuses_graph_local_prepared_outputs_and_workspace`); gate: requires an explicitly assigned CUDA device. Close when every listed case passes. + +[ ] Run `tests/preparation/test_inductor_tuning_cuda.py` (`test_clock_lock_covers_only_actual_inductor_trials`, `test_cooperative_vision_validation_freezes_and_restores[single]`, `test_cooperative_vision_validation_freezes_and_restores[tp2]`, `test_distributed_catalog_reconciles_real_conflicting_candidates[False]`, `test_distributed_catalog_reconciles_real_conflicting_candidates[True]`, `test_frozen_restore_ignores_conflicting_enabled_local_cache`, `test_input_reset_survives_tuning_and_frozen_warmup[single-False]`, `test_input_reset_survives_tuning_and_frozen_warmup[single-True]`, `test_input_reset_survives_tuning_and_frozen_warmup[tp2-False]`, `test_input_reset_survives_tuning_and_frozen_warmup[tp2-True]`, `test_long_generated_kernel_names_freeze_and_restore`, `test_single_rank_default_tuning_is_frozen_on_reload`, `test_unreferenced_bundled_candidates_are_dropped_and_named_kernels_still_bind`); gate: requires explicitly assigned CUDA devices. Close when every listed case passes. + +[ ] Run `tests/preparation/test_inductor_workspace_lifetimes_cuda.py` (`test_combined_pool_cooperative_validation_replays_without_workspace_aliasing`); gate: requires an explicitly assigned CUDA device. Close when every listed case passes. + +[ ] Run `tests/preparation/test_memory_inventory.py` (`test_cuda_inventory_tracks_shared_scratch_and_bounded_cache`, `test_overlapping_views_bound_claims_and_preserve_first_owner`, `test_repeated_strided_views_have_one_owner_and_preserve_holes`); gate: requires an assigned CUDA device. Close when every listed case passes. + +[ ] Run `tests/preparation/test_module_images.py` (`test_native_recorder_tracks_real_driver_allocation_and_context_lifetimes`); gate: requires explicit CUDA test opt-in. Close when every listed case passes. + +[ ] Run `tests/preparation/test_packed_weights_cuda.py` (`test_weight_packing_preserves_raw_bits_and_transposed_storage[dtype0]`, `test_weight_packing_preserves_raw_bits_and_transposed_storage[dtype1]`, `test_weight_packing_preserves_raw_bits_and_transposed_storage[dtype2]`, `test_weight_packing_preserves_raw_bits_and_transposed_storage[dtype3]`, `test_weight_packing_preserves_raw_bits_and_transposed_storage[dtype4]`, `test_weight_packing_preserves_raw_bits_and_transposed_storage[dtype5]`, `test_weight_packing_preserves_raw_bits_and_transposed_storage[dtype6]`, `test_weight_packing_preserves_recorded_checkpoint_sources`, `test_weight_tree_identity_and_dense_layout_validation`); gate: requires an assigned CUDA GPU. Close when every listed case passes. + +[ ] Run `tests/preparation/test_peer_storage_cuda.py` (`test_fixed_and_dynamic_peer_mappings`); gate: requires two assigned CUDA devices and FLARE_RUN_TP_CUDA_TESTS=1. Close when every listed case passes. + +[ ] Run `tests/preparation/test_prompt_catalog.py` (`test_flag_off_export_preserves_ordinary_catalog_and_buffers`); gate: requires matching flag-off and flag-on exports. Close when every listed case passes. + +[ ] Run `tests/preparation/test_recorded_export_graph_cuda.py` (`test_export_capture_retains_cuda_handles_and_preserves_storage`, `test_exported_node_priority_core_loads_and_replays_in_helios`); gate: requires explicit CUDA test opt-in. Close when every listed case passes. + +[ ] Run `tests/preparation/test_runtime_core.py` (`test_captured_shared_memory_exceeds_function_allowance`, `test_captured_weight_payloads_survive_relocation_and_capacity_changes`, `test_cooperative_core_clamps_to_device_capacity`, `test_core_replays_without_python[67108864-fixed_core_fixture.py-test_fixed_runtime_core-native fixed-address replay passed-False]`, `test_core_replays_without_python[67108864-fixed_core_fixture.py-test_fixed_runtime_core-native fixed-address replay passed-True]`, `test_core_replays_without_python[67108864-runtime_core_fixture.py-test_runtime_core-192 graph launches-False]`, `test_core_replays_without_python[68719476736-fixed_core_fixture.py-test_fixed_runtime_core-native fixed-address replay passed-False]`, `test_core_replays_without_python[68719476736-fixed_core_fixture.py-test_fixed_runtime_core-native fixed-address replay passed-True]`, `test_core_replays_without_python[68719476736-runtime_core_fixture.py-test_runtime_core-192 graph launches-False]`, `test_native_graph_export_preserves_construction_order_across_branches`, `test_payload_forms_preserve_signatures_and_replay[fixed_core_fixture.py-test_fixed_runtime_core-native fixed-address replay passed-False]`, `test_payload_forms_preserve_signatures_and_replay[runtime_core_fixture.py-test_runtime_core-192 graph launches-False]`, `test_payload_forms_preserve_signatures_and_replay[runtime_core_fixture.py-test_runtime_core-192 graph launches-True]`, `test_payload_forms_preserve_signatures_and_replay[runtime_core_fixture.py-test_runtime_core-192 graph launches-template]`); gate: requires explicit CUDA test opt-in. Close when every listed case passes. + +[ ] Run `tests/preparation/test_runtime_dynamo.py` (`test_real_dynamo_trace_accepts_event_before_mutation[False]`, `test_real_dynamo_trace_accepts_event_before_mutation[True]`, `test_real_dynamo_trace_accepts_event_on_unmutated_stream`, `test_real_dynamo_trace_keeps_checks_after_an_earlier_event`, `test_real_dynamo_trace_restarts_and_rejects_event_after_mutation[False]`, `test_real_dynamo_trace_restarts_and_rejects_event_after_mutation[True]`, `test_real_dynamo_trace_without_events_never_scans_inputs`); gate: CUDA stream tracing requires explicitly assigned devices. Close when every listed case passes. + +[ ] Run `tests/preparation/test_scratch_cuda.py` (`test_auxiliary_stream_remains_independent_after_pool_wraparound`, `test_partitioned_scratch_rebinds_and_alternates_with_whole_buffer_graph`); gate: explicit CUDA assignment required. Close when every listed case passes. + +[ ] Run `tests/preparation/test_storage_lifetimes_cuda.py` (`test_compiled_copy_does_not_defer_past_mutated_temporary`, `test_compiled_multi_output_fresh_ops_preserve_pre_mutation_values`, `test_compiled_multi_output_views_preserve_pre_mutation_values[chunk]`, `test_compiled_multi_output_views_preserve_pre_mutation_values[split]`, `test_compiled_multi_output_views_preserve_pre_mutation_values[unbind]`, `test_compiled_split_view_of_mutable_storage_observes_mutation`); gate: requires an explicitly assigned CUDA device. Close when every listed case passes. + +[ ] Run `tests/preparation/test_unavailable_resources.py` (`test_collective_transport_metadata_leaves_cuda_resources_on_the_owning_rank`); gate: requires an explicitly assigned CUDA device. Close when every listed case passes. + +[ ] Run `tests/preparation/test_virtual_storage_cuda.py` (`test_virtual_pages_grow_in_place_after_compilation`); gate: requires an explicitly assigned CUDA device. Close when every listed case passes. + +[ ] Run `helios/src/lib.rs` `--ignored` (`scheduler::policy_tests::planning_tests::benchmark_packed_planning`); gate: CPU planning benchmark; run in release mode with --ignored --nocapture --test-threads=1. Close when every listed case passes. + +[ ] Run `helios/src/lib.rs` `--ignored` (`offload::transfer::codec::tests::cpu_vram_capture_and_restore_copies_exact_bytes_and_rejects_corruption`); gate: exercises CPU VRAM <-> DRAM capture and restore onto a GPU. Close when every listed case passes. + +[ ] Run `helios/src/lib.rs` `--ignored` (`offload::transfer::codec::tests::gpu_vram_capture_and_restore_copies_exact_bytes_and_rejects_corruption`); gate: exercises GPU GKV1 VRAM <-> DRAM capture and restore onto a GPU. Close when every listed case passes. + +[ ] Run `helios/src/lib.rs` `--ignored` (`offload::transfer::codec::tests::mixed_cpu_and_gpu_modes_restore_each_others_packets_and_write_their_own`); gate: exercises mixed CPU ZKV1 <-> GPU GKV1 cross-mode restore without abandoning cache. Close when every listed case passes. + +[ ] Run `helios/src/lib.rs` `--ignored` (`offload::transfer::gpu_codec::imp::tests::gpu_codec_latent576_24_layer_roundtrip_and_compression_vs_bytes`, `offload::transfer::gpu_codec::imp::tests::gpu_codec_round_trips_all_encodings_and_rejects_corruption`); gate: exercises pure-CUDA GPU KV codec on real CUDA GPU. Close when every listed case passes. + +[ ] Run `helios/src/lib.rs` `--ignored` (`scheduler::policy_tests::mixed_tail_planning_cpu_measurement`); gate: manual CPU scheduler planning measurement. Close when every listed case passes. + +[ ] Run `helios/src/lib.rs` `--ignored` (`scheduler::cache_memory::tests::snapshot_quote_cost_at_production_geometry`); gate: measures cost; run explicitly in release. Close when every listed case passes. + +[ ] Run `helios/src/lib.rs` `--ignored` (`scheduler::cache_memory::tests::production_geometry_quote_matches_reference`); gate: reference search takes seconds at production geometry. Close when every listed case passes. + +[ ] Run `helios/src/lib.rs` `--ignored` (`server::runtime::prompt_tests::prompt_prefill_gpu_and_native_costs`); gate: requires CUDA and FLARE_PROMPT_TEST_CORE plus FLARE_PROMPT_TEST_PUBLISHERS. Close when every listed case passes. + +[ ] Run `helios/src/lib.rs` `--ignored` (`cuda::tests::host_registration_unregisters_when_dropped_on_another_thread`, `cuda::tests::pinned_host_event_and_stream_release_when_dropped_on_another_thread`); gate: requires CUDA device 0. Close when every listed case passes. + +[ ] Run `helios/src/lib.rs` `--ignored` (`grammar::tests::checkpoint_mask_trace`); gate: requires FLARE_CHECKPOINT pointing to the exact Qwen3.8 checkpoint. Close when every listed case passes. + +[ ] Run `helios/src/lib.rs` `--ignored` (`runtime_core::cooperative_tests::oversized_cooperative_grids_replay_at_device_capacity`); gate: requires FLARE_COOPERATIVE_TEST_CORE exported by cooperative_core_fixture.py on the assigned GPU. Close when every listed case passes. + +[ ] Run `helios/src/lib.rs` `--ignored` (`grammar::strict::tests::ds41_checkpoint_strict_dsml_fixture_replays_complete_masks`); gate: requires FLARE_DEEPSEEK_TEST_SNAPSHOT pointing to DeepSeek-V4.1-Flash-1017. Close when every listed case passes. + +[ ] Run `helios/src/lib.rs` `--ignored` (`runtime_core::event_tests::disk_cached_and_resident_tables_feed_native_b12x_graphs`); gate: requires FLARE_ENGRAM_TEST_CORE exported by engram_core_fixture.py on the assigned GPU. Close when every listed case passes. + +[ ] Run `helios/src/lib.rs` `--ignored` (`runtime_core::event_tests::named_external_wait_survives_export_and_native_replay`); gate: requires FLARE_EVENT_TEST_CORE exported by fixed_core_fixture.py on the assigned GPU. Close when every listed case passes. + +[ ] Run `helios/src/lib.rs` `--ignored` (`server::request::tml_tests::images_preserve_reference_order_feature_spans_and_message_endpoints`, `server::request::tml_tests::message_endpoints_are_prefixes_of_longer_conversations`, `server::request::tml_tests::outputs_match_reference_parses`, `server::request::tml_tests::prompts_match_tml_renderers_token_for_token`, `server::request::tml_tests::structured_output_grammars_constrain_frames`, `server::request::tml_tests::thinking_budget_prepares_content_headers_cut`); gate: requires FLARE_INKLING2_TEST_SNAPSHOT with the Inkling 2 tokenizer. Close when every listed case passes. + +[ ] Run `helios/src/lib.rs` `--ignored` (`grammar::recipient_tests::recipient_headers_constrain_checkpoint_answers_and_tool_recipients`, `server::request::recipient_tests::recipient_request_preparation_preserves_protocols_tools_and_continuation`); gate: requires FLARE_MUSE_SPARK_SNAPSHOT checkpoint tokenizer. Close when every listed case passes. + +[ ] Run `helios/src/lib.rs` `--ignored` (`runtime_core::node_priority_tests::exported_node_priority_core_instantiates_and_replays_in_helios`); gate: requires FLARE_NODE_PRIORITY_TEST_CORE exported by node_priority_core_fixture.py on the assigned GPU. Close when every listed case passes. + +[ ] Run `helios/src/lib.rs` `--ignored` (`offload::gpu_tests::composite::composite_round_trips_through_memory_and_disk_on_a_loaded_core`, `offload::gpu_tests::composite::composite_writes_a_child_published_while_its_parent_is_in_flight`, `offload::gpu_tests::disk_store::staged_store_round_trips_records_through_files_and_a_restart`, `offload::gpu_tests::geometry::core_geometry_lists_every_plane`, `offload::gpu_tests::memory::memory_store_round_trips_a_checkpoint_through_a_loaded_core`, `offload::gpu_tests::memory::memory_store_round_trips_a_multi_window_checkpoint`, `offload::transfer::tests::transfers_round_trip_pages_and_a_row_through_a_loaded_core`); gate: requires FLARE_OFFLOAD_TEST_CORE naming an exported core and a free GPU 0. Close when every listed case passes. + +[ ] Run `helios/src/lib.rs` `--ignored` (`runtime_core::programmatic_edge_tests::native_core_preserves_programmatic_overlap`); gate: requires FLARE_PROGRAMMATIC_EDGE_TEST_CORE exported on the assigned GPU. Close when every listed case passes. + +[ ] Run `helios/src/lib.rs` `--ignored` (`runtime_core::shared_memory_tests::captured_shared_memory_exceeding_function_allowance_replays`); gate: requires FLARE_SHARED_MEMORY_TEST_CORE exported by shared_memory_core_fixture.py on the assigned GPU. Close when every listed case passes. + +[ ] Run `helios/src/lib.rs` `--ignored` (`grammar::tests::qwen_output_envelope_uses_checkpoint_token_bytes`); gate: requires FLARE_TEST_SNAPSHOT with the Qwen tokenizer. Close when every listed case passes. + +[ ] Run `helios/src/lib.rs` `--ignored` (`execution::transport::confidence_tests::mapped_and_device_confidence_survive_repeated_graph_replay`); gate: requires a CUDA device selected through CUDA_VISIBLE_DEVICES. Close when every listed case passes. + +[ ] Run `helios/src/lib.rs` `--ignored` (`cuda::tests::batched_copies_round_trip_through_registered_memory`); gate: requires a CUDA device; FLARE_OFFLOAD_TEST_DIR names a directory supporting direct I/O. Close when every listed case passes. + +[ ] Run `helios/src/lib.rs` `--ignored` (`core::export::cache_tests::verify_actual_tp16_cached_payloads`); gate: requires a validated TP16 cache entry and exclusive authorization for payload I/O. Close when every listed case passes. + +[ ] Run `helios/src/lib.rs` `--ignored` (`runtime_core::cache_memory::tests::cuda_aliases_preserve_rows_while_unowned_pages_are_rewritten`, `runtime_core::memory::tests::cuda_memory_limits_account_for_context_and_allocations`); gate: requires an assigned CUDA_VISIBLE_DEVICES GPU. Close when every listed case passes. + +[ ] Run `helios/src/lib.rs` `--ignored` (`runtime_core::persistent_worker::tests::cuda_graph_executor_starts_worker_after_startup_tuning_and_drains_on_close`, `runtime_core::persistent_worker::tests::cuda_green_context_persistent_worker_runs_concurrently_with_cooperative_compute_and_drains_cleanly`, `runtime_core::persistent_worker::tests::cuda_persistent_worker_drain_timeout_transitions_to_failed_drain`); gate: requires an assigned CUDA_VISIBLE_DEVICES GPU supporting Green Contexts. Close when every listed case passes. + +[ ] Run `helios/src/lib.rs` `--ignored` (`execution::threaded::cuda_tests::four_cuda_rank_threads_preserve_two_frames_and_device_continuations`); gate: requires four assigned CUDA devices and FLARE_THREADED_TEST_CORE. Close when every listed case passes. + +[ ] Run `helios/src/lib.rs` `--ignored` (`offload::transfer::tests::split_pools_cost_each_device_its_part_and_round_trip_units`); gate: requires two CUDA devices. Close when every listed case passes. + +[ ] Run `helios/tests/actual_qwen38_tp2.rs` `--ignored` (`actual_qwen38_tp2_local_acquisition_matches_independent_export`); gate: requires FLARE_QWEN38_TP_QUALIFICATION with signed TP1/TP2 and an externally combined core. Close when every listed case passes. + +[ ] Run `helios/tests/actual_w4a16.rs` `--ignored` (`actual_w4a16_combine_preserves_all_initializers_and_globals`); gate: requires FLARE_ACTUAL_W4A16_FIXTURE with signed TP1/TP2 actual W4A16 cores. Close when every listed case passes. + +[ ] Run `helios/tests/deepseek_encoder.rs` `--ignored` (`checkpoint_tokenizer_preserves_canonical_image_order_and_prefixes`); gate: requires FLARE_DEEPSEEK_TEST_SNAPSHOT pointing to a DeepSeek tokenizer. Close when every listed case passes. + +[ ] Run `helios/tests/deepseek_frontend.rs` `--ignored` (`numeric_effort_matches_python_reference_bytes_and_checkpoint_token_ids`); gate: requires FLARE_DEEPSEEK_TEST_SNAPSHOT pointing to DeepSeek-V4.1-Flash-1017. Close when every listed case passes. + +[ ] Run `helios/tests/deepseek_frontend.rs` `--ignored` (`official_encoder_renders_and_initializes_native_output_state`); gate: requires FLARE_DEEPSEEK_TEST_SNAPSHOT pointing to the DeepSeek checkpoint. Close when every listed case passes. + +[ ] Run `helios/tests/glm_frontend.rs` `--ignored` (`checkpoint_template_tokenization_requests_and_message_boundaries_match_transformers`); gate: requires FLARE_GLM_TEST_SNAPSHOT and FLARE_GLM_FRONTEND_REFERENCE from generate_glm_fixtures.py. Close when every listed case passes. + +[ ] Run `helios/tests/image_admission.rs` `--ignored` (`nemotron_text_spelling_the_image_placeholder_positions_an_attached_image`); gate: requires FLARE_NEMOTRON_TEST_SNAPSHOT with the Nemotron-3.5 tokenizer and FLARE_TEST_TEMPLATE_DIR. Close when every listed case passes. + +[ ] Run `helios/tests/image_admission.rs` `--ignored` (`jpeg_and_oriented_png_use_actual_checkpoint_request_preparation`); gate: requires FLARE_TEST_SNAPSHOT pointing to the pinned Qwen checkpoint. Close when every listed case passes. + +[ ] Run `helios/tests/instruction_boundary.rs` `--ignored` (`complete_user_and_empty_system_messages_have_checkpoints`, `completed_prompt_and_invalid_messages_do_not_produce_reusable_final_cuts`, `exact_short_instruction_boundary_survives_changed_user_content`, `inline_system_messages_render_in_place_without_changing_the_prefix`, `omitted_output_limit_fills_context_after_chat_tokenization`, `reasoning_defaults_and_explicit_overrides_follow_actual_system_rendering`, `tool_and_system_prefix_survives_assistant_continuation`, `tool_instructions_are_rendered_without_explicit_system_and_disable_with_none`); gate: requires FLARE_TEST_SNAPSHOT pointing to the pinned Qwen checkpoint. Close when every listed case passes. + +[ ] Run `helios/tests/ordinary_tokens.rs` `--ignored` (`deepseek_ordinary_tokens`); gate: requires FLARE_DEEPSEEK_TEST_SNAPSHOT with the DeepSeek V4.1 tokenizer. Close when every listed case passes. + +[ ] Run `helios/tests/ordinary_tokens.rs` `--ignored` (`gemma4_ordinary_tokens`); gate: requires FLARE_GEMMA4_TEST_SNAPSHOT with the Gemma 4 tokenizer and FLARE_TEST_TEMPLATE_DIR. Close when every listed case passes. + +[ ] Run `helios/tests/ordinary_tokens.rs` `--ignored` (`glm53_ordinary_tokens`); gate: requires FLARE_GLM_TEST_SNAPSHOT with the GLM-5.3 tokenizer and FLARE_TEST_TEMPLATE_DIR. Close when every listed case passes. + +[ ] Run `helios/tests/ordinary_tokens.rs` `--ignored` (`mimo_ordinary_tokens`); gate: requires FLARE_MIMO_TEST_SNAPSHOT with the MiMo-V2.6 tokenizer and FLARE_TEST_TEMPLATE_DIR. Close when every listed case passes. + +[ ] Run `helios/tests/ordinary_tokens.rs` `--ignored` (`nemotron_ordinary_tokens`); gate: requires FLARE_NEMOTRON_TEST_SNAPSHOT with the Nemotron-3.5 tokenizer and FLARE_TEST_TEMPLATE_DIR. Close when every listed case passes. + +[ ] Run `helios/tests/ordinary_tokens.rs` `--ignored` (`step5_ordinary_tokens`); gate: requires FLARE_STEP5_TEST_SNAPSHOT with the Step-5 tokenizer and FLARE_TEST_TEMPLATE_DIR. Close when every listed case passes. + +[ ] Run `helios/tests/ordinary_tokens.rs` `--ignored` (`qwen38_ordinary_tokens`); gate: requires FLARE_TEST_SNAPSHOT with the Qwen3.8 tokenizer and FLARE_TEST_TEMPLATE_DIR. Close when every listed case passes. + +[ ] Run `helios/tests/parser_start.rs` `--ignored` (`glm53_parser_start`); gate: requires FLARE_GLM_TEST_SNAPSHOT with the GLM-5.3 tokenizer and FLARE_TEST_TEMPLATE_DIR. Close when every listed case passes. + +[ ] Run `helios/tests/parser_start.rs` `--ignored` (`mimo_v2_parser_start`); gate: requires FLARE_MIMO_TEST_SNAPSHOT with the MiMo-V2 tokenizer and FLARE_TEST_TEMPLATE_DIR. Close when every listed case passes. + +[ ] Run `helios/tests/parser_start.rs` `--ignored` (`nemotron_h_parser_start`); gate: requires FLARE_NEMOTRON_TEST_SNAPSHOT with the Nemotron-3.5 tokenizer and FLARE_TEST_TEMPLATE_DIR. Close when every listed case passes. + +[ ] Run `helios/tests/parser_start.rs` `--ignored` (`step5_parser_start`); gate: requires FLARE_STEP5_TEST_SNAPSHOT with the Step-5 tokenizer and FLARE_TEST_TEMPLATE_DIR. Close when every listed case passes. + +[ ] Run `helios/tests/parser_start.rs` `--ignored` (`qwen38_parser_start`); gate: requires FLARE_TEST_SNAPSHOT with the Qwen3.8 tokenizer and FLARE_TEST_TEMPLATE_DIR. Close when every listed case passes. + +[ ] Run `helios/tests/reasoning_delimiters.rs` `--ignored` (`deepseek41_dsml_reasoning_uses_special_tokens`); gate: requires FLARE_DEEPSEEK_TEST_SNAPSHOT pointing to the DeepSeek checkpoint. Close when every listed case passes. + +[ ] Run `helios/tests/reasoning_delimiters.rs` `--ignored` (`gemma4_channel_close_is_a_single_token`); gate: requires FLARE_GEMMA4_TEST_SNAPSHOT with the Gemma 4 tokenizer. Close when every listed case passes. + +[ ] Run `helios/tests/reasoning_delimiters.rs` `--ignored` (`glm53_close_delimiter_tokens_never_become_content`, `glm53_think_tags_are_single_tokens`); gate: requires FLARE_GLM_TEST_SNAPSHOT with the GLM-5.3 tokenizer. Close when every listed case passes. + +[ ] Run `helios/tests/reasoning_delimiters.rs` `--ignored` (`mimo_v2_think_tags_are_single_tokens`); gate: requires FLARE_MIMO_TEST_SNAPSHOT with the MiMo-V2 tokenizer. Close when every listed case passes. + +[ ] Run `helios/tests/reasoning_delimiters.rs` `--ignored` (`minimax_m3_think_tags_are_single_tokens`); gate: requires FLARE_MINIMAX_TEST_SNAPSHOT with the MiniMax M3 tokenizer. Close when every listed case passes. + +[ ] Run `helios/tests/reasoning_delimiters.rs` `--ignored` (`nemotron_h_think_tags_are_single_tokens`); gate: requires FLARE_NEMOTRON_TEST_SNAPSHOT with the Nemotron-3.5 tokenizer. Close when every listed case passes. + +[ ] Run `helios/tests/reasoning_delimiters.rs` `--ignored` (`step5_think_tags_are_single_tokens`); gate: requires FLARE_STEP5_TEST_SNAPSHOT with the Step-5 tokenizer. Close when every listed case passes. + +[ ] Run `helios/tests/reasoning_delimiters.rs` `--ignored` (`qwen38_think_tags_are_single_tokens`); gate: requires FLARE_TEST_SNAPSHOT with the Qwen3.8 tokenizer. Close when every listed case passes. diff --git a/helios/proto/runtime_core.proto b/helios/proto/runtime_core.proto index 48b4be621..620334c55 100644 --- a/helios/proto/runtime_core.proto +++ b/helios/proto/runtime_core.proto @@ -484,6 +484,7 @@ enum ImagePreparationKind { GLM_IMAGE_PREPARATION = 8; PATCH_MERGE_IMAGE_PREPARATION = 9; PADDED_GRID_IMAGE_PREPARATION = 10; + MUSE_GLIMMER_IMAGE_PREPARATION = 11; } enum ImageLayoutKind { IMAGE_LAYOUT_UNSPECIFIED = 0; @@ -497,6 +498,7 @@ enum ImageLayoutKind { GLM_IMAGE_LAYOUT = 8; BRACKETED_IMAGE_LAYOUT = 9; CLASS_TOKEN_IMAGE_LAYOUT = 10; + WINDOWED_IMAGE_LAYOUT = 11; } message ToolParser { ToolParserKind kind = 1; @@ -619,8 +621,19 @@ message ImageSettings { Empty glm = 8; PatchMergeImageSettings patch_merge = 9; Empty padded_grid = 10; + MuseGlimmerImageSettings muse_glimmer = 11; } } +message MuseGlimmerImageSettings { + uint32 patch_size = 1; + uint32 merge_size = 2; + uint64 max_image_tokens = 3; + repeated float image_mean = 4; + repeated float image_std = 5; + string image_token = 6; + string start_token = 7; + string end_token = 8; +} message PatchMergeImageSettings { uint32 patch_size = 1; uint64 min_pixels = 2; diff --git a/helios/src/frontend/images/conditioned.rs b/helios/src/frontend/images/conditioned.rs index 41a2ed467..7b72fe507 100644 --- a/helios/src/frontend/images/conditioned.rs +++ b/helios/src/frontend/images/conditioned.rs @@ -184,12 +184,14 @@ impl PreparedImageInput { fn valid_processed(&self, images: &ProcessedImages) -> bool { use super::Profile; + // Every profile declares its packed patch width and whether it emits position taps; + // no default arm, so a new profile cannot inherit another's extents. let pixel_width = match &self.processor.profile { Profile::Qwen(profile) => profile.patches.pixel_width(), Profile::MiMo(profile) => profile.pixel_width(), Profile::PatchMerge(profile) => profile.patches.pixel_width(), Profile::Radio => 768, - Profile::Glm => 1176, + Profile::Glm | Profile::MuseGlimmer(_) => 1176, Profile::PaddedGrid => super::padded_grid::FEATURES, Profile::DeepSeek4 | Profile::DeepseekRowMajor(_) @@ -197,10 +199,37 @@ impl PreparedImageInput { | Profile::Step => 588, }; let patches = self.geometry.patches; - let interpolation = matches!( - self.processor.profile, - Profile::Qwen(_) | Profile::Moonvit | Profile::Step | Profile::Radio | Profile::PaddedGrid - ); + let interpolation = match self.processor.profile { + Profile::Qwen(_) + | Profile::Moonvit + | Profile::Step + | Profile::Radio + | Profile::PaddedGrid + | Profile::MuseGlimmer(_) => true, + Profile::MiMo(_) + | Profile::PatchMerge(_) + | Profile::DeepSeek4 + | Profile::DeepseekRowMajor(_) + | Profile::Glm => false, + }; + let (expected_cu_window_seqlens, expected_reverse_index) = match self.processor.profile { + Profile::MuseGlimmer(_) => { + let Some(plan) = super::muse_glimmer::window_plan(&self.geometry) else { + return false; + }; + plan + } + Profile::Qwen(_) + | Profile::MiMo(_) + | Profile::PatchMerge(_) + | Profile::DeepSeek4 + | Profile::DeepseekRowMajor(_) + | Profile::Moonvit + | Profile::Step + | Profile::Radio + | Profile::Glm + | Profile::PaddedGrid => (Vec::new(), Vec::new()), + }; let sequences = if matches!(self.processor.profile, Profile::Step) { let local = self.geometry.grid_thw[1] * self.geometry.grid_thw[2]; (0..=local) @@ -226,6 +255,8 @@ impl PreparedImageInput { && images.interpolation_indices.len() == if interpolation { patches } else { 0 } && images.interpolation_weights.len() == if interpolation { patches } else { 0 } && images.cu_seqlens == sequences + && images.cu_window_seqlens == expected_cu_window_seqlens + && images.reverse_index == expected_reverse_index } pub fn release_decoded(&self) { @@ -334,11 +365,13 @@ mod tests { use super::*; use crate::frontend::images::{ DeepseekRowMajorImageSettings, ImageLimits, ImageSettings, MimoImageSettings, - PatchMergeImageSettings, QwenImageSettings, + MuseGlimmerImageSettings, PatchMergeImageSettings, QwenImageSettings, }; + /// One of every `ImageSettings` variant; the match below fails to compile when a variant + /// is added without a row here. fn settings() -> Vec { - vec![ + let settings = vec![ ImageSettings::Qwen(QwenImageSettings { min_pixels: 65536, max_pixels: 16777216, @@ -373,7 +406,35 @@ mod tests { ImageSettings::Radio {}, ImageSettings::Glm {}, ImageSettings::PaddedGrid {}, - ] + ImageSettings::MuseGlimmer(MuseGlimmerImageSettings { + patch_size: 14, + merge_size: 2, + max_image_tokens: 4096, + image_mean: [0.5; 3], + image_std: [0.5; 3], + image_token: "<|patch|>".into(), + start_token: "<|image_start|>".into(), + end_token: "<|image_end|>".into(), + }), + ]; + let mut covered = [false; 11]; + for variant in &settings { + covered[match variant { + ImageSettings::Qwen(_) => 0, + ImageSettings::Mimo(_) => 1, + ImageSettings::PatchMerge(_) => 2, + ImageSettings::Deepseek4 {} => 3, + ImageSettings::DeepseekRowMajor(_) => 4, + ImageSettings::Moonvit {} => 5, + ImageSettings::Step {} => 6, + ImageSettings::Radio {} => 7, + ImageSettings::Glm {} => 8, + ImageSettings::MuseGlimmer(_) => 9, + ImageSettings::PaddedGrid {} => 10, + }] = true; + } + assert!(covered.iter().all(|c| *c)); + settings } fn processor(settings: ImageSettings) -> Arc { @@ -508,10 +569,49 @@ mod tests { "{settings:?}" ); assert_eq!(actual.cu_seqlens, expected.cu_seqlens, "{settings:?}"); + assert_eq!(actual.cu_window_seqlens, expected.cu_window_seqlens, "{settings:?}"); + assert_eq!(actual.reverse_index, expected.reverse_index, "{settings:?}"); assert_eq!(processor.preparation_counts().prepared_images, 2); } } + /// Every profile's declared width and taps accept its own output: a wildcard arm in + /// `valid_processed` once sized PatchMerge at 588 and rejected every materialization. + #[cfg(feature = "server")] + #[test] + fn every_image_settings_variant_materializes_through_the_cache_path() { + let store = flare_selene::input::InputStore::start( + 64 << 20, + None, + flare_selene::input::DiskBudget::new(0, 0), + ) + .unwrap(); + for settings in settings() { + let processor = processor(settings.clone()); + let source = image(91, 37, 7); + let description = processor.describe_image(&source).unwrap(); + let prepared = input( + processor.clone(), + processor.encoded_source(ImageEncoding::Png, png(&source), None), + description, + ); + let expected = processor.process(&[source]).unwrap(); + let first = prepared.materialize_cached(Some(&store)).unwrap(); + assert_eq!(first.encode().unwrap(), expected.encode().unwrap(), "{settings:?}"); + assert_eq!(first.pixel_values.len(), prepared.geometry.patches * match settings { + ImageSettings::Qwen(_) | ImageSettings::Mimo(_) => 1536, + ImageSettings::Radio {} => 768, + ImageSettings::Glm {} | ImageSettings::PatchMerge(_) | ImageSettings::MuseGlimmer(_) => 1176, + ImageSettings::PaddedGrid {} => super::super::padded_grid::FEATURES, + ImageSettings::Deepseek4 {} | ImageSettings::DeepseekRowMajor(_) + | ImageSettings::Moonvit {} | ImageSettings::Step {} => 588, + }, "{settings:?}"); + let cached = prepared.materialize_cached(Some(&store)).unwrap(); + assert_eq!(cached.encode().unwrap(), first.encode().unwrap(), "{settings:?}"); + assert_eq!(processor.preparation_counts().prepared_images, 1, "{settings:?}"); + } + } + #[test] fn semantic_identity_includes_profile_and_consumed_moonvit_channels() { let source = image(37, 29, 7); @@ -798,9 +898,92 @@ mod tests { assert_eq!(processor.preparation_counts().prepared_images, 1); } + #[cfg(feature = "server")] + #[test] + fn cached_window_plan_values_are_validated_and_recomputed_on_mismatch() { + let store = flare_selene::input::InputStore::start( + 64 << 20, + None, + flare_selene::input::DiskBudget::new(0, 0), + ) + .unwrap(); + let processor = processor(ImageSettings::MuseGlimmer(MuseGlimmerImageSettings { + patch_size: 14, + merge_size: 2, + max_image_tokens: 4096, + image_mean: [0.5; 3], + image_std: [0.5; 3], + image_token: "<|patch|>".into(), + start_token: "<|image_start|>".into(), + end_token: "<|image_end|>".into(), + })); + let source = image(532, 980, 7); + let description = processor.describe_image(&source).unwrap(); + let prepared = input( + processor.clone(), + processor.encoded_source(ImageEncoding::Png, png(&source), None), + description, + ); + let expected = processor.process(&[source]).unwrap(); + assert!(expected.cu_window_seqlens.len() > 2); + + let mut altered_windows = expected.clone(); + let expected_window_len = altered_windows.cu_window_seqlens.len(); + altered_windows.cu_window_seqlens[1] += 1; + assert_eq!(altered_windows.cu_window_seqlens.len(), expected_window_len); + store.insert( + prepared.identity, + Arc::new(flare_selene::input::PreparedInputRecord { + metadata: Arc::from(&b"flare-prepared-image-v1"[..]), + payload: Some(Arc::new(altered_windows.encode().unwrap())), + }), + ); + let recomputed = prepared.materialize_cached(Some(&store)).unwrap(); + assert_eq!(recomputed.cu_window_seqlens, expected.cu_window_seqlens); + assert_eq!(recomputed.reverse_index, expected.reverse_index); + assert_eq!(recomputed.encode().unwrap(), expected.encode().unwrap()); + assert_eq!(processor.preparation_counts().decoded_images, 1); + assert_eq!(processor.preparation_counts().prepared_images, 1); + let cached = prepared.materialize_cached(Some(&store)).unwrap(); + assert_eq!(cached.encode().unwrap(), expected.encode().unwrap()); + assert_eq!(processor.preparation_counts().decoded_images, 1); + assert_eq!(processor.preparation_counts().prepared_images, 1); + + let second_source = image(532, 980, 19); + let second_description = processor.describe_image(&second_source).unwrap(); + let second_prepared = input( + processor.clone(), + processor.encoded_source(ImageEncoding::Png, png(&second_source), None), + second_description, + ); + let second_expected = processor.process(&[second_source]).unwrap(); + let mut altered_reverse = second_expected.clone(); + let expected_reverse_len = altered_reverse.reverse_index.len(); + altered_reverse.reverse_index.swap(0, 38); + assert_eq!(altered_reverse.reverse_index.len(), expected_reverse_len); + assert_ne!(altered_reverse.reverse_index, second_expected.reverse_index); + store.insert( + second_prepared.identity, + Arc::new(flare_selene::input::PreparedInputRecord { + metadata: Arc::from(&b"flare-prepared-image-v1"[..]), + payload: Some(Arc::new(altered_reverse.encode().unwrap())), + }), + ); + let recomputed = second_prepared.materialize_cached(Some(&store)).unwrap(); + assert_eq!(recomputed.cu_window_seqlens, second_expected.cu_window_seqlens); + assert_eq!(recomputed.reverse_index, second_expected.reverse_index); + assert_eq!(recomputed.encode().unwrap(), second_expected.encode().unwrap()); + assert_eq!(processor.preparation_counts().decoded_images, 2); + assert_eq!(processor.preparation_counts().prepared_images, 2); + let cached = second_prepared.materialize_cached(Some(&store)).unwrap(); + assert_eq!(cached.encode().unwrap(), second_expected.encode().unwrap()); + assert_eq!(processor.preparation_counts().decoded_images, 2); + assert_eq!(processor.preparation_counts().prepared_images, 2); + } + #[test] fn malformed_binary_records_cannot_allocate_from_unbounded_counts() { - let mut bytes = b"FLAREIMG\x01".to_vec(); + let mut bytes = b"FLAREIMG\x02".to_vec(); bytes.extend_from_slice(&u64::MAX.to_le_bytes()); assert!(ProcessedImages::decode(&bytes).is_err()); let valid = ProcessedImages::default().encode().unwrap(); diff --git a/helios/src/frontend/images/deepseek4.rs b/helios/src/frontend/images/deepseek4.rs index 4a4381b74..649cc4b03 100644 --- a/helios/src/frontend/images/deepseek4.rs +++ b/helios/src/frontend/images/deepseek4.rs @@ -128,6 +128,8 @@ pub(super) fn pack( interpolation_indices: Vec::new(), interpolation_weights: Vec::new(), cu_seqlens: vec![0], + cu_window_seqlens: vec![], + reverse_index: vec![], }; output.reserve_outputs(total, FEATURES, false, images.len(), images.len() + 1)?; for image in images { diff --git a/helios/src/frontend/images/layouts/bracketed.rs b/helios/src/frontend/images/layouts/bracketed.rs index 2c208037e..e6356fcad 100644 --- a/helios/src/frontend/images/layouts/bracketed.rs +++ b/helios/src/frontend/images/layouts/bracketed.rs @@ -30,6 +30,8 @@ pub(crate) fn prepare_input( interpolation_indices: vec![], interpolation_weights: vec![], cu_seqlens: vec![0], + cu_window_seqlens: vec![], + reverse_index: vec![], }; processor.expand_prompt(frontend, &rendered.token_ids, &empty)?; } diff --git a/helios/src/frontend/images/mod.rs b/helios/src/frontend/images/mod.rs index 03925031e..2607496ac 100644 --- a/helios/src/frontend/images/mod.rs +++ b/helios/src/frontend/images/mod.rs @@ -15,6 +15,7 @@ pub(crate) mod layouts; mod mimo; mod glm; mod moonvit; +mod muse_glimmer; mod orientation; mod conditioned; mod padded_grid; @@ -237,6 +238,13 @@ pub struct ProcessedImages { pub interpolation_indices: Vec<[i64; 4]>, pub interpolation_weights: Vec<[f32; 4]>, pub cu_seqlens: Vec, + /// Window-attention segment boundaries in packed patch order; empty for profiles whose + /// encoder has no windowed layers (only `MuseGlimmer` fills it). + pub cu_window_seqlens: Vec, + /// Transformers' `reverse_indices = argsort(window_index)`: `reverse_index[r]` is the + /// packed (window-order) position of raster patch `r`, so gathering packed rows by it + /// restores raster order. Empty for profiles packed in raster order already. + pub reverse_index: Vec, } impl ProcessedImages { @@ -299,6 +307,7 @@ pub enum ImageSettings { Radio {}, Glm {}, PaddedGrid {}, + MuseGlimmer(MuseGlimmerImageSettings), } /// The text that stands for an image in a RADIO prompt. @@ -325,6 +334,7 @@ impl ImageSettings { Self::Radio {} => ImagePreparationKind::Radio, Self::Glm {} => ImagePreparationKind::Glm, Self::PaddedGrid {} => ImagePreparationKind::PaddedGrid, + Self::MuseGlimmer(_) => ImagePreparationKind::MuseGlimmer, } } } @@ -369,6 +379,19 @@ pub struct PatchMergeImageSettings { pub end_token: String, } +#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)] +#[serde(deny_unknown_fields)] +pub struct MuseGlimmerImageSettings { + pub patch_size: usize, + pub merge_size: usize, + pub max_image_tokens: usize, + pub image_mean: [f32; 3], + pub image_std: [f32; 3], + pub image_token: String, + pub start_token: String, + pub end_token: String, +} + #[derive(Clone)] enum Profile { Qwen(qwen::QwenProcessor), @@ -381,6 +404,7 @@ enum Profile { Radio, Glm, PaddedGrid, + MuseGlimmer(muse_glimmer::Processor), } impl ImageProcessor { @@ -416,6 +440,9 @@ impl ImageProcessor { ImageSettings::PaddedGrid {} => Profile::PaddedGrid, ImageSettings::Mimo(settings) => Profile::MiMo(mimo::load(&settings, limits)?), ImageSettings::PatchMerge(settings) => Profile::PatchMerge(patch_merge::Processor::load(settings, limits)?), + ImageSettings::MuseGlimmer(settings) => { + Profile::MuseGlimmer(muse_glimmer::Processor::load(settings, limits)?) + } ImageSettings::Qwen(settings) => { Profile::Qwen(qwen::QwenProcessor::load(&settings, limits)?) } @@ -886,6 +913,7 @@ impl ImageProcessor { Profile::Radio => radio::geometry(self.limits, width, height), Profile::Glm => glm::geometry(self.limits, width, height), Profile::PaddedGrid => padded_grid::geometry(self.limits, width, height), + Profile::MuseGlimmer(profile) => profile.geometry(width, height), } } pub fn resized_rgb(&self, image: &RgbImage) -> Result<(ImageGeometry, Vec)> { @@ -900,6 +928,7 @@ impl ImageProcessor { Profile::Radio => Err("RADIO resizing produces float32 pixels; use process".into()), Profile::Glm => glm::resized_rgb(self.limits, image), Profile::PaddedGrid => Err("padded-grid preparation pads with values outside RGB8; use process".into()), + Profile::MuseGlimmer(profile) => profile.resized_rgb(image), } } pub fn process(&self, images: &[RgbImage]) -> Result { @@ -919,6 +948,7 @@ impl ImageProcessor { Profile::Radio => radio::process(self.limits, images), Profile::Glm => glm::process(self.limits, images), Profile::PaddedGrid => padded_grid::process(self.limits, images), + Profile::MuseGlimmer(profile) => profile.process(images), } } pub fn expand_prompt( @@ -939,6 +969,7 @@ impl ImageProcessor { Profile::Radio => Err("RADIO image expansion requires its model contract".into()), Profile::Glm => Err("GLM image expansion requires its prepared layout".into()), Profile::PaddedGrid => Err("padded-grid image expansion requires its prepared layout".into()), + Profile::MuseGlimmer(profile) => profile.expand_prompt(frontend, prompt_token_ids, images), } } } diff --git a/helios/src/frontend/images/moonvit.rs b/helios/src/frontend/images/moonvit.rs index 67e48fd36..8b893f7ba 100644 --- a/helios/src/frontend/images/moonvit.rs +++ b/helios/src/frontend/images/moonvit.rs @@ -160,6 +160,8 @@ pub(super) fn process(limits: ImageLimits, images: &[RgbImage]) -> Result = images .iter() diff --git a/helios/src/frontend/images/muse_glimmer.rs b/helios/src/frontend/images/muse_glimmer.rs new file mode 100644 index 000000000..6d90adf14 --- /dev/null +++ b/helios/src/frontend/images/muse_glimmer.rs @@ -0,0 +1,602 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-FileCopyrightText: Copyright (c) 2026 Flare community contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +//! Muse Glimmer: token-capped aspect-preserving Lanczos resize, `(temporal, channel, y, x)` +//! patches packed in 32×32-patch window order with position-table interpolation taps. +//! +//! Mirrors Transformers' `MuseGlimmerImageProcessor` (`smart_resize`, LANCZOS, `patchify`) and +//! `MuseGlimmerVisionModel` precompute (`get_vision_window_index`, +//! `get_vision_interpolation_indices_and_weights`), both run with `spatial_merge_size = 1`: +//! windows, positions and taps are per patch; the 2×2 merge happens after the encoder in +//! `pixel_shuffle`, which gathers raster-ordered rows block by block. + +use super::*; + +const TEMPORAL: usize = 2; +/// Patches per window side: `pos_emb_height × patch_size / patch_size`. +const WINDOW: usize = 32; +/// Side of the learned position-embedding table (`pos_emb_height == pos_emb_width`). +const TABLE_SIDE: usize = 32; + +#[derive(Clone)] +pub(super) struct Processor { + limits: ImageLimits, + patch_size: usize, + merge_size: usize, + max_image_tokens: usize, + image_mean: [f32; 3], + image_std: [f32; 3], + image_token: String, + start_token: String, + end_token: String, +} + +impl Processor { + pub(super) fn load(settings: MuseGlimmerImageSettings, limits: ImageLimits) -> Result { + if settings.patch_size != 14 + || settings.merge_size != 2 + || settings.max_image_tokens == 0 + || settings.image_mean.iter().any(|x| !x.is_finite()) + || settings.image_std.iter().any(|x| !x.is_finite() || *x <= 0.) + || [&settings.image_token, &settings.start_token, &settings.end_token] + .iter() + .any(|s| s.is_empty()) + || settings.image_token == settings.start_token + || settings.image_token == settings.end_token + || settings.start_token == settings.end_token + { + return Err("invalid Muse Glimmer image settings".into()); + } + Ok(Self { + limits, + patch_size: settings.patch_size, + merge_size: settings.merge_size, + max_image_tokens: settings.max_image_tokens, + image_mean: settings.image_mean, + image_std: settings.image_std, + image_token: settings.image_token, + start_token: settings.start_token, + end_token: settings.end_token, + }) + } + + /// `smart_resize`: the patch grid (at `patch × merge` granularity) closest to the input + /// aspect ratio under `max_image_tokens`. + pub(super) fn geometry(&self, width: usize, height: usize) -> Result { + check_input_extent(self.limits, width, height)?; + let factor = (self.patch_size * self.merge_size) as f64; + let max_tokens = self.max_image_tokens as f64; + let (h, w) = (height as f64, width as f64); + let mut ideal_h = h / factor; + let mut ideal_w = w / factor; + let ratio = ideal_w / ideal_h; + if ideal_h * ideal_w > max_tokens { + ideal_h = (max_tokens / ratio).sqrt(); + ideal_w = ideal_h * ratio; + } + let product = [ + (ideal_h.floor(), ideal_w.floor()), + (ideal_h.floor(), ideal_w.ceil()), + (ideal_h.ceil(), ideal_w.floor()), + (ideal_h.ceil(), ideal_w.ceil()), + ] + .map(|(gh, gw)| (gh as u64, gw as u64)); + let aspect = h / w; + let distance = |(gh, gw): (u64, u64)| (gh as f64 / gw as f64 - aspect).abs(); + let mut best: Option<(u64, u64)> = None; + for candidate in cpython_set_order(product) + .into_iter() + .filter(|(gh, gw)| *gh >= 1 && *gw >= 1 && (gh * gw) as f64 <= max_tokens) + { + // Python's `min` keeps the first of equal keys in set iteration order. + if best.is_none_or(|b| distance(candidate) < distance(b)) { + best = Some(candidate); + } + } + let (grid_h, grid_w) = best.unwrap_or(( + (ideal_h.round_ties_even() as u64).max(1), + (ideal_w.round_ties_even() as u64).max(1), + )); + let rows = grid_h as usize * self.merge_size; + let cols = grid_w as usize * self.merge_size; + let patches = rows * cols; + check_image_patches(self.limits, patches)?; + Ok(ImageGeometry { + height: rows * self.patch_size, + width: cols * self.patch_size, + grid_thw: [1, rows as i64, cols as i64], + patches, + tokens: patches / (self.merge_size * self.merge_size), + }) + } + + pub(super) fn resized_rgb(&self, image: &RgbImage) -> Result<(ImageGeometry, Vec)> { + let geometry = self.geometry(image.width, image.height)?; + Ok((geometry, resize::lanczos(image, geometry.width, geometry.height))) + } + + pub(super) fn process(&self, images: &[RgbImage]) -> Result { + self.limits.check_batch(images.len(), 0)?; + let geometry: Vec<_> = images + .iter() + .map(|image| self.geometry(image.width, image.height)) + .collect::>()?; + let total = geometry + .iter() + .try_fold(0usize, |sum, image| sum.checked_add(image.patches)) + .ok_or_else(|| Error::frontend(FrontendError::Input(Failure::new("patch count overflow"))))?; + self.limits.check_batch(images.len(), total)?; + let windows: usize = geometry.iter().map(windows).sum(); + let mut result = ProcessedImages { + geometry, + cu_seqlens: vec![0], + cu_window_seqlens: vec![0], + ..Default::default() + }; + let pixel_width = TEMPORAL * 3 * self.patch_size * self.patch_size; + result.reserve_outputs(total, pixel_width, true, images.len(), images.len() + 1)?; + result.cu_window_seqlens.reserve_exact(windows); + result.reverse_index.reserve_exact(total); + let normalized: [[f32; 256]; 3] = std::array::from_fn(|channel| { + std::array::from_fn(|value| { + (value as f32 - self.image_mean[channel] * 255.) / (self.image_std[channel] * 255.) + }) + }); + for (image, geometry) in images.iter().zip(&result.geometry) { + let (cu_window, reverse) = + window_plan(geometry).ok_or("invalid Muse Glimmer patch grid")?; + let pixels = resize::lanczos(image, geometry.width, geometry.height); + let (grid_h, grid_w) = (geometry.height / self.patch_size, geometry.width / self.patch_size); + let base = result.position_ids.len(); + result.position_ids.resize(base + geometry.patches, [0; 2]); + result.interpolation_indices.resize(base + geometry.patches, [0; 4]); + result.interpolation_weights.resize(base + geometry.patches, [0.; 4]); + result.pixel_values.resize((base + geometry.patches) * pixel_width, 0.); + for row in 0..grid_h { + let (yi, yw) = taps(row, grid_h); + for col in 0..grid_w { + let packed = base + reverse[row * grid_w + col] as usize; + result.position_ids[packed] = [row as i64, col as i64]; + let (xi, xw) = taps(col, grid_w); + result.interpolation_indices[packed] = [ + yi[0] * TABLE_SIDE as i64 + xi[0], + yi[0] * TABLE_SIDE as i64 + xi[1], + yi[1] * TABLE_SIDE as i64 + xi[0], + yi[1] * TABLE_SIDE as i64 + xi[1], + ]; + result.interpolation_weights[packed] = [ + yw[0] * xw[0], + yw[0] * xw[1], + yw[1] * xw[0], + yw[1] * xw[1], + ]; + let patch = + &mut result.pixel_values[packed * pixel_width..(packed + 1) * pixel_width]; + let mut out = 0; + for _temporal in 0..TEMPORAL { + for channel in 0..3 { + for y in 0..self.patch_size { + for x in 0..self.patch_size { + let byte = pixels[((row * self.patch_size + y) * geometry.width + + col * self.patch_size + + x) + * 3 + + channel]; + patch[out] = normalized[channel][byte as usize]; + out += 1; + } + } + } + } + } + } + result + .cu_window_seqlens + .extend(cu_window.into_iter().skip(1).map(|n| n + base as i32)); + result + .reverse_index + .extend(reverse.into_iter().map(|n| n + base as i64)); + result.cu_seqlens.push(result.position_ids.len() as i32); + } + Ok(result) + } + + pub(super) fn expand_prompt( + &self, + frontend: &Frontend, + prompt_token_ids: &[u32], + images: &ProcessedImages, + ) -> Result { + patch_merge::bracketed_prompt( + frontend, + prompt_token_ids, + images, + &self.image_token, + &self.start_token, + &self.end_token, + ) + } +} + +/// Window segments of one image: one per 32×32-patch cell, border cells ragged. +pub(super) fn windows(geometry: &ImageGeometry) -> usize { + (geometry.grid_thw[1] as usize).div_ceil(WINDOW) * (geometry.grid_thw[2] as usize).div_ceil(WINDOW) +} + +/// Window-attention segment boundaries and raster-to-packed index map for one image's patch grid. +pub(super) fn window_plan(geometry: &ImageGeometry) -> Option<(Vec, Vec)> { + let [1, rows, cols] = geometry.grid_thw else { + return None; + }; + let (grid_h, grid_w) = (usize::try_from(rows).ok()?, usize::try_from(cols).ok()?); + if grid_h == 0 || grid_w == 0 || grid_h.checked_mul(grid_w) != Some(geometry.patches) { + return None; + } + let _ = i32::try_from(geometry.patches).ok()?; + let mut cu_window_seqlens = Vec::with_capacity(windows(geometry) + 1); + cu_window_seqlens.push(0); + let mut reverse_index = vec![0i64; geometry.patches]; + let mut packed = 0i64; + for window_y in 0..grid_h.div_ceil(WINDOW) { + for window_x in 0..grid_w.div_ceil(WINDOW) { + for row in window_y * WINDOW..grid_h.min((window_y + 1) * WINDOW) { + for col in window_x * WINDOW..grid_w.min((window_x + 1) * WINDOW) { + reverse_index[row * grid_w + col] = packed; + packed += 1; + } + } + cu_window_seqlens.push(packed as i32); + } + } + Some((cu_window_seqlens, reverse_index)) +} + +/// Bilinear taps of patch `index` on an axis of `size` patches into the 32-entry table: +/// half-pixel centres (`align_corners=False`), out-of-range taps clamped with zero weight +/// (`F.grid_sample(padding_mode="zeros")`), computed in f32 as the reference does. +fn taps(index: usize, size: usize) -> ([i64; 2], [f32; 2]) { + let source = (index as f32 + 0.5) * TABLE_SIDE as f32 / size as f32 - 0.5; + let floor = source.floor(); + let mut indices = [0i64; 2]; + let mut weights = [0f32; 2]; + for (offset, (index, weight)) in indices.iter_mut().zip(&mut weights).enumerate() { + let raw = floor as i64 + offset as i64; + *index = raw.clamp(0, TABLE_SIDE as i64 - 1); + *weight = if (0..TABLE_SIDE as i64).contains(&raw) { + (1.0 - (source - floor - offset as f32).abs()).max(0.0) + } else { + 0.0 + }; + } + (indices, weights) +} + +/// Iteration order of CPython 3.12's `set` built from these four `(int, int)` tuples: the +/// reference's `min(list(set(itertools.product(...))))` resolves equal aspect distances by +/// it, so the same grid needs the same order. Tuple hashing is CPython's xxHash-derived +/// `tuplehash`; the small table has eight slots probed by `i * 5 + 1 + (perturb >>= 5)`. +fn cpython_set_order(items: [(u64, u64); 4]) -> Vec<(u64, u64)> { + const PRIME_1: u64 = 11_400_714_785_074_694_791; + const PRIME_2: u64 = 14_029_467_366_897_019_727; + const PRIME_5: u64 = 2_870_177_450_012_600_261; + const MASK: u64 = 7; + fn hash(item: (u64, u64)) -> u64 { + let mut acc = PRIME_5; + for lane in [item.0, item.1] { + acc = acc.wrapping_add(lane.wrapping_mul(PRIME_2)).rotate_left(31).wrapping_mul(PRIME_1); + } + acc = acc.wrapping_add(2 ^ (PRIME_5 ^ 3_527_539)); + if acc == u64::MAX { 1_546_275_796 } else { acc } + } + let mut table: [Option<(u64, u64)>; 8] = [None; 8]; + for item in items { + let hash = hash(item); + let mut perturb = hash; + let mut slot = (hash & MASK) as usize; + loop { + match table[slot] { + None => { + table[slot] = Some(item); + break; + } + Some(present) if present == item => break, + Some(_) => { + perturb >>= 5; + slot = ((slot as u64 * 5 + 1 + perturb) & MASK) as usize; + } + } + } + } + table.into_iter().flatten().collect() +} + +#[cfg(test)] +mod tests { + use super::*; + + fn settings() -> MuseGlimmerImageSettings { + MuseGlimmerImageSettings { + patch_size: 14, + merge_size: 2, + max_image_tokens: 4096, + image_mean: [0.5; 3], + image_std: [0.5; 3], + image_token: "<|patch|>".into(), + start_token: "<|image_start|>".into(), + end_token: "<|image_end|>".into(), + } + } + + fn processor() -> ImageProcessor { + ImageProcessor::load(ImageSettings::MuseGlimmer(settings()), ImageLimits::default()).unwrap() + } + + fn pattern(width: usize, height: usize) -> RgbImage { + RgbImage::new(width, height, (0..width * height * 3).map(|i| ((i * 37 + 11) % 256) as u8).collect()) + .unwrap() + } + + #[test] + fn load_rejects_other_patch_or_merge_sizes_and_bad_tokens() { + for alter in [ + |s: &mut MuseGlimmerImageSettings| s.patch_size = 16, + |s: &mut MuseGlimmerImageSettings| s.merge_size = 1, + |s: &mut MuseGlimmerImageSettings| s.max_image_tokens = 0, + |s: &mut MuseGlimmerImageSettings| s.image_std[1] = 0., + |s: &mut MuseGlimmerImageSettings| s.start_token = "<|patch|>".into(), + ] { + let mut settings = settings(); + alter(&mut settings); + assert!(ImageProcessor::load(ImageSettings::MuseGlimmer(settings), ImageLimits::default()).is_err()); + } + } + + /// `(width, height, resized width, resized height)` from the Transformers `smart_resize` + /// (patch 28 = 14 × 2, `max_tokens` 4096). + const GEOMETRY: [(usize, usize, usize, usize); 40] = [ + (1, 1, 28, 28), + (8000, 10, 8008, 28), + (10, 8000, 28, 8008), + (28, 28, 28, 28), + (27, 29, 28, 28), + (29, 27, 28, 28), + (14, 14, 28, 28), + (13, 15, 28, 28), + (100, 100, 112, 112), + (1792, 1792, 1792, 1792), + (1793, 1792, 1792, 1792), + (1792, 1793, 1792, 1792), + (3000, 2000, 2184, 1456), + (2000, 3000, 1456, 2184), + (4096, 4096, 1792, 1792), + (1, 4096, 28, 4116), + (4096, 1, 4116, 28), + (500, 1, 504, 28), + (1, 500, 28, 504), + (640, 480, 644, 476), + (480, 640, 476, 644), + (1920, 1080, 1932, 1092), + (1080, 1920, 1092, 1932), + (56, 28, 56, 28), + (57, 29, 56, 28), + (300, 2000, 308, 2016), + (2000, 300, 2016, 308), + (777, 333, 784, 336), + (333, 777, 336, 784), + (2048, 2048, 1792, 1792), + (2047, 2049, 1792, 1792), + (12345, 678, 7644, 420), + (678, 12345, 420, 7644), + (31, 31, 28, 28), + (29, 41, 28, 28), + (1000, 1000, 1008, 1008), + (3, 7, 28, 28), + (7, 3, 28, 28), + (5000, 5000, 1792, 1792), + (16384, 16384, 1792, 1792), + ]; + + /// Sizes where two candidate grids tie on aspect distance; the reference's choice follows + /// CPython set order, `(width, height, grid width, grid height)`. + const TIES: [(usize, usize, usize, usize); 20] = [ + (32, 24, 2, 1), + (36, 27, 2, 1), + (120, 27, 4, 1), + (29, 29, 1, 1), + (38, 29, 1, 1), + (20, 30, 1, 1), + (40, 30, 1, 1), + (41, 31, 1, 1), + (29, 32, 1, 1), + (24, 32, 1, 1), + (27, 36, 1, 1), + (27, 120, 1, 4), + (84, 63, 3, 2), + (63, 84, 2, 3), + (112, 84, 4, 3), + (105, 84, 4, 3), + (147, 105, 6, 4), + (210, 126, 8, 5), + (2520, 1890, 73, 55), + (4200, 1680, 101, 40), + ]; + + #[test] + fn geometry_matches_transformers_smart_resize() { + let processor = ImageProcessor::load( + ImageSettings::MuseGlimmer(settings()), + ImageLimits { max_input_pixels: 1 << 30, ..ImageLimits::default() }, + ) + .unwrap(); + for (width, height, resized_width, resized_height) in GEOMETRY { + let geometry = processor.geometry(width, height).unwrap(); + assert_eq!((geometry.width, geometry.height), (resized_width, resized_height), "{width}x{height}"); + assert_eq!(geometry.grid_thw, [1, (resized_height / 14) as i64, (resized_width / 14) as i64]); + assert_eq!(geometry.patches, resized_height / 14 * (resized_width / 14)); + assert_eq!(geometry.tokens, geometry.patches / 4); + assert!(geometry.tokens <= 4096, "{width}x{height}"); + } + for (width, height, grid_width, grid_height) in TIES { + let geometry = processor.geometry(width, height).unwrap(); + assert_eq!((geometry.width, geometry.height), (grid_width * 28, grid_height * 28), "{width}x{height}"); + } + assert_eq!(processor.geometry(1792, 1792).unwrap().tokens, 4096); + let limited = ImageProcessor::load( + ImageSettings::MuseGlimmer(settings()), + ImageLimits { max_patches_per_image: 1024, ..ImageLimits::default() }, + ) + .unwrap(); + assert!(limited.geometry(1792, 1792).is_err()); + assert!(processor.geometry(0, 10).is_err()); + } + + #[test] + fn patches_are_temporal_channel_y_x_in_raster_order_within_a_window() { + let processor = processor(); + let image = pattern(56, 28); + let (geometry, pixels) = processor.resized_rgb(&image).unwrap(); + assert_eq!((geometry.width, geometry.height), (56, 28)); + assert_eq!(pixels, image.pixels().to_vec()); + let images = processor.process(&[image]).unwrap(); + assert_eq!(images.pixel_values.len(), 8 * 1176); + assert_eq!(images.position_ids, [[0, 0], [0, 1], [0, 2], [0, 3], [1, 0], [1, 1], [1, 2], [1, 3]]); + assert_eq!(images.cu_seqlens, [0, 8]); + assert_eq!(images.cu_window_seqlens, [0, 8]); + assert_eq!(images.reverse_index, (0..8).collect::>()); + for (patch, [row, col]) in images.pixel_values.chunks_exact(1176).zip(&images.position_ids) { + let (frame_a, frame_b) = patch.split_at(588); + assert_eq!(frame_a, frame_b); + for channel in 0..3 { + for y in 0..14 { + for x in 0..14 { + let byte = pixels[(((*row as usize) * 14 + y) * 56 + (*col as usize) * 14 + x) * 3 + channel]; + let expected = (byte as f32 - 127.5) / 127.5; + assert_eq!(patch[channel * 196 + y * 14 + x], expected); + } + } + } + } + } + + #[test] + fn window_order_and_reverse_index_follow_transformers_on_a_ragged_grid() { + let processor = processor(); + // 532×980 px → 38×70 patches: windows of 32×32, 32×6, 6×32 and 6×6 patches. + let (small, large) = (pattern(56, 28), pattern(532, 980)); + let images = processor.process(&[large, small]).unwrap(); + assert_eq!(images.geometry[0].grid_thw, [1, 70, 38]); + assert_eq!(images.cu_seqlens, [0, 2660, 2668]); + assert_eq!(images.cu_window_seqlens, [0, 1024, 1216, 2240, 2432, 2624, 2660, 2668]); + let raster = |k: usize| (images.position_ids[k][0] * 38 + images.position_ids[k][1]) as usize; + assert_eq!((0..6).map(raster).collect::>(), [0, 1, 2, 3, 4, 5]); + assert_eq!((32..34).map(raster).collect::>(), [38, 39]); + assert_eq!((1024..1027).map(raster).collect::>(), [32, 33, 34]); + assert_eq!((1216..1218).map(raster).collect::>(), [1216, 1217]); + assert_eq!((2657..2660).map(raster).collect::>(), [2657, 2658, 2659]); + assert_eq!(&images.reverse_index[..3], &[0, 1, 2]); + assert_eq!(&images.reverse_index[32..34], &[1024, 1025]); + assert_eq!(&images.reverse_index[38..40], &[32, 33]); + assert_eq!(&images.reverse_index[2657..2660], &[2657, 2658, 2659]); + assert_eq!(&images.reverse_index[2660..], &(2660..2668).collect::>()); + for packed in 0..2660 { + assert_eq!(images.reverse_index[raster(packed)], packed as i64); + } + let mut seen = vec![false; 2668]; + for index in &images.reverse_index { + assert!(!std::mem::replace(&mut seen[*index as usize], true)); + } + assert_eq!(images.interpolation_indices.len(), 2668); + assert_eq!(images.interpolation_weights.len(), 2668); + } + + #[test] + fn interpolation_taps_match_transformers_on_interior_and_border_patches() { + let processor = processor(); + // 700×560 px → 50×40 patches (table 32 downsampled); 112×84 px → 8×6 (upsampled). + let images = processor.process(&[pattern(700, 560), pattern(112, 84)]).unwrap(); + let find = |image: usize, row: i64, col: i64| { + let start = images.cu_seqlens[image] as usize; + let end = images.cu_seqlens[image + 1] as usize; + (start..end).find(|k| images.position_ids[*k] == [row, col]).unwrap() + }; + let expected: [(usize, i64, i64, [i64; 4], [f32; 4]); 9] = [ + (0, 20, 25, [495, 496, 527, 528], [0.018000099807977676, 0.08200028538703918, 0.16200020909309387, 0.737999439239502]), + (0, 0, 0, [0, 0, 0, 0], [0.0, 0.0, 0.0, 0.7379999756813049]), + (0, 39, 49, [1023, 1023, 1023, 1023], [0.737999439239502, 0.0, 0.0, 0.0]), + (0, 0, 49, [31, 31, 31, 31], [0.0, 0.0, 0.737999677658081, 0.0]), + (1, 0, 0, [65, 66, 97, 98], [0.4166666269302368, 0.4166666269302368, 0.08333337306976318, 0.08333337306976318]), + (1, 0, 1, [69, 70, 101, 102], [0.4166666269302368, 0.4166666269302368, 0.08333337306976318, 0.08333337306976318]), + (1, 1, 0, [225, 226, 257, 258], [0.25, 0.25, 0.25, 0.25]), + (1, 2, 4, [401, 402, 433, 434], [0.08333349227905273, 0.08333349227905273, 0.41666650772094727, 0.41666650772094727]), + (1, 5, 7, [925, 926, 957, 958], [0.08333301544189453, 0.08333301544189453, 0.41666698455810547, 0.41666698455810547]), + ]; + for (image, row, col, indices, weights) in expected { + let k = find(image, row, col); + assert_eq!(images.interpolation_indices[k], indices, "image {image} patch ({row}, {col})"); + for (actual, expected) in images.interpolation_weights[k].iter().zip(weights) { + assert!((actual - expected).abs() <= 1e-6, "image {image} patch ({row}, {col}): {actual} != {expected}"); + } + } + for (indices, weights) in images.interpolation_indices.iter().zip(&images.interpolation_weights) { + assert!(indices.iter().all(|i| (0..1024).contains(i))); + assert!(weights.iter().all(|w| (0.0..=1.0).contains(w))); + } + } + + #[test] + fn lanczos_matches_torchvision_antialiased_uint8_resize() { + // torchvision 0.29 `InterpolationMode.LANCZOS`, `antialias=True`, CPU uint8 tensors, on the + // `pattern` images; PIL 12.3 `Image.LANCZOS` agrees on the first two and differs by 1 on two + // of the 324 samples of the third. + let cases: [(usize, usize, usize, usize, &[u8]); 3] = [ + (13, 9, 7, 5, &[80,126,157,165,83,130,154,165,92,111,159,125,110,124,122,122,119,142,140,123,103,148,139,101,127,158,123,93,130,171,161,102,118,155,136,86,102,122,141,99,122,123,102,123,157,123,109,130,155,119,113,130,165,121,103,114,174,158,79,120,158,157,81,144,95,125,120,150,104,119,122,151,121,123,126,151,124,127,128,165,123,123,120,172,127,98,143,114,125,104,137,117,126,103,140,122,136,105,144,127,138,107,142,125,152]), + (5, 4, 11, 8, &[0,23,62,16,65,100,55,130,160,139,151,178,239,78,102,255,10,47,186,19,95,92,101,157,101,193,118,164,251,37,206,255,0,4,33,68,29,75,115,76,139,187,142,159,212,193,85,125,190,20,57,137,40,101,93,116,165,131,171,127,198,190,47,240,198,5,22,57,89,58,97,139,117,158,218,153,177,246,119,101,155,71,43,80,61,82,119,103,149,182,177,139,147,237,90,69,255,60,24,44,79,129,89,127,152,157,202,188,170,228,192,73,138,133,0,69,106,28,118,171,126,181,235,186,127,188,199,28,99,202,0,43,63,95,174,107,149,145,173,233,102,190,255,62,100,167,66,33,88,125,78,132,221,156,199,255,145,153,215,89,62,120,53,9,59,90,139,214,132,158,157,196,187,68,219,189,11,141,137,62,84,114,151,132,169,202,189,224,202,137,186,166,45,110,129,0,63,104,113,187,235,155,156,182,220,109,94,241,70,49,161,80,112,102,137,174,150,214,143,211,248,82,165,202,88,78,128,127,25,80,152,123,212,241,165,152,196,230,60,119,251,0,85,170,44,147,110,147,184,156,236,104,219,255,9,185,209,40,108,136,123,62,88,177]), + (40, 30, 9, 12, &[121,133,128,140,117,131,125,127,120,131,126,131,131,140,118,117,122,133,124,124,123,130,136,135,143,112,132,123,142,116,125,122,131,135,135,118,116,129,125,128,122,128,122,136,136,134,118,129,126,125,121,132,124,136,136,136,120,121,133,140,125,119,126,128,134,132,120,120,134,133,121,118,127,125,135,137,133,120,119,131,124,122,119,126,127,132,127,134,125,137,136,123,118,124,132,129,138,120,126,123,136,117,125,123,126,131,134,133,126,131,138,138,116,123,121,128,125,134,131,129,128,139,122,119,123,135,131,134,121,117,129,138,123,117,122,126,122,124,129,126,133,134,139,116,117,124,130,130,128,128,122,134,139,138,117,126,124,129,127,132,126,133,139,130,121,118,131,121,128,122,128,123,137,136,126,118,129,131,126,121,131,125,137,136,137,118,116,133,126,125,119,127,129,136,129,116,122,136,130,122,119,128,126,135,138,126,123,119,134,120,130,124,128,128,140,134,131,122,141,137,120,120,123,132,130,138,116,127,124,133,117,125,125,127,134,137,127,116,124,138,128,125,118,124,128,128,134,128,132,129,140,117,120,124,135,132,134,119,117,130,135,123,119,124,126,134,132,135,118,130,134,141,118,119,126,125,132,128,129,121,134,138,132,117,128,126,130,127,129,121,135,133,120,118,120,129,127,128,122,124,125,136,135,118,117,128,129,131,125,136,127,137,137,132,120,120,132,125,133,126,126,127,135,114]), + ]; + for (width, height, out_width, out_height, expected) in cases { + let actual = resize::lanczos(&pattern(width, height), out_width, out_height); + assert_eq!(actual.as_slice(), expected, "{width}x{height}->{out_width}x{out_height}"); + } + } + + #[test] + fn native_pixels_match_canonical_transformers_processor() { + let python = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("../.venv/bin/python"); + if !python.is_file() { + return; + } + let script = r#" +import sys, struct, torch +from transformers.models.muse_glimmer.image_processing_muse_glimmer import MuseGlimmerImageProcessor +image=((torch.arange(37*91*3,dtype=torch.int64)*37+11)%256).to(torch.uint8).view(37,91,3).permute(2,0,1) +result=MuseGlimmerImageProcessor(image_mean=[0.5,0.5,0.5],image_std=[0.5,0.5,0.5])(image,return_tensors='pt') +sys.stdout.buffer.write(struct.pack(' = reference.stdout[..24] + .chunks_exact(8) + .map(|x| i64::from_le_bytes(x.try_into().unwrap())) + .collect(); + assert_eq!(actual.geometry[0].grid_thw.as_slice(), grid.as_slice()); + let pixels: Vec = reference.stdout[24..] + .chunks_exact(4) + .map(|x| f32::from_le_bytes(x.try_into().unwrap())) + .collect(); + assert_eq!(actual.pixel_values.len(), pixels.len()); + // The reference packs raster order; `reverse_index[r]` is raster patch `r`'s packed row. + for (raster, packed) in actual.reverse_index.iter().enumerate() { + let packed = *packed as usize; + let actual = &actual.pixel_values[packed * 1176..(packed + 1) * 1176]; + let expected = &pixels[raster * 1176..(raster + 1) * 1176]; + for (i, (a, b)) in actual.iter().zip(expected).enumerate() { + assert_eq!(*a, *b, "raster patch {raster} value {i}"); + } + } + } +} diff --git a/helios/src/frontend/images/packing.rs b/helios/src/frontend/images/packing.rs index 827e55ca0..ae9a4ef56 100644 --- a/helios/src/frontend/images/packing.rs +++ b/helios/src/frontend/images/packing.rs @@ -31,6 +31,7 @@ pub(crate) fn tensor_layout( (ImageLayoutKind::Radio, "vision_pixel_values") => (Float32, patches * 768), (ImageLayoutKind::Glm, "vision_pixel_values") => (Float32, patches * 1176), (ImageLayoutKind::ClassToken, "vision_pixel_values") => (Float32, patches * 1200), + (ImageLayoutKind::Windowed, "vision_pixel_values") => (Float32, patches * 1176), // One class-token row precedes each image's patch positions. (ImageLayoutKind::ClassToken, "vision_position_ids") => (Int64, (patches + 1) * 2), (_, "vision_position_ids") => (Int64, patches * 2), @@ -51,7 +52,8 @@ pub(crate) fn tensor_layout( | ImageLayoutKind::Moonvit | ImageLayoutKind::Step | ImageLayoutKind::Radio - | ImageLayoutKind::ClassToken, + | ImageLayoutKind::ClassToken + | ImageLayoutKind::Windowed, "vision_interpolation_indices", ) => (Int64, patches * 4), ( @@ -59,9 +61,14 @@ pub(crate) fn tensor_layout( | ImageLayoutKind::Moonvit | ImageLayoutKind::Step | ImageLayoutKind::Radio - | ImageLayoutKind::ClassToken, + | ImageLayoutKind::ClassToken + | ImageLayoutKind::Windowed, "vision_interpolation_weights", ) => (Float32, patches * 4), + // One cumulative segment entry per 32×32-patch window (`patches / 64 + 1` at most for + // an even-sided grid) plus the leading zero. + (ImageLayoutKind::Windowed, "vision_cu_window_seqlens") => (Int32, patches / 64 + 2), + (ImageLayoutKind::Windowed, "vision_reverse_index") => (Int64, patches), (ImageLayoutKind::Mimo, "vision_column_indices" | "vision_row_indices") => { (Int32, patches / 4) } @@ -98,6 +105,7 @@ pub(crate) fn prepare( ImageLayoutKind::Moonvit | ImageLayoutKind::Radio => spatial_merge(config, handle, images, image, destination_feature_offset), ImageLayoutKind::Step => step(config, handle, images, image, destination_feature_offset), ImageLayoutKind::ClassToken => class_token(config, handle, images, image, destination_feature_offset), + ImageLayoutKind::Windowed => windowed(config, handle, images, image, destination_feature_offset), } } @@ -544,3 +552,171 @@ fn class_token( staging.i32("vision_feature_offset", 0, [destination_feature_offset as i32]); Ok(staging) } + +/// Window-ordered patches with bilinear position interpolation, per-window cumulative +/// segment lengths padded to the bound width by repeating the patch count, and the +/// per-image raster-to-packed reverse index, each rebased to the scheduled image. +fn windowed(config: &ModelConfig, handle: RequestHandle, images: &ProcessedImages, image: usize, destination_feature_offset: usize) -> Result { + let geometry = images.geometry.get(image).ok_or("missing scheduled image")?; + let start: usize = images.geometry[..image].iter().map(|g| g.patches).sum(); + let end = start + geometry.patches; + let capacity = *config.contract.vision.patch_capacities.last().ok_or("missing vision capacities")?; + let [t, h, w] = geometry.grid_thw; + if t != 1 || h <= 0 || w <= 0 || h % 2 != 0 || w % 2 != 0 + || (h as usize).checked_mul(w as usize) != Some(geometry.patches) + || geometry.tokens != geometry.patches / 4 || config.contract.vision.patches_per_feature != 4 + || geometry.patches > capacity + || handle.slot as usize >= config.limits.max_active || handle.generation == 0 || handle.generation > i64::MAX as u64 { + return Err("invalid windowed image extent".into()); + } + let window_start: usize = images.geometry[..image].iter().map(super::muse_glimmer::windows).sum(); + let windows = super::muse_glimmer::windows(geometry); + let cu_window = images + .cu_window_seqlens + .get(window_start..=window_start + windows) + .ok_or("truncated vision window segments")?; + if cu_window.first() != Some(&(start as i32)) || cu_window.last() != Some(&(end as i32)) { + return Err("vision window segments differ from the image extent".into()); + } + let padded = capacity / 64 + 2; + let mut cu_window: Vec = cu_window.iter().map(|n| n - start as i32).collect(); + cu_window.resize(padded, geometry.patches as i32); + let reverse_index = images + .reverse_index + .get(start..end) + .ok_or("truncated vision reverse index")?; + if reverse_index.iter().any(|packed| !(start as i64..end as i64).contains(packed)) { + return Err("vision reverse index leaves the image extent".into()); + } + let mut staging = UploadBatch::default(); + staging.put("vision_pixel_values", 0, images.pixel_values.get(start*1176..end*1176).ok_or("truncated vision pixels")?.iter().copied().flat_map(f32::to_le_bytes)); + staging.i64("vision_interpolation_indices", 0, images.interpolation_indices.get(start..end).ok_or("truncated vision interpolation indices")?.iter().flatten().copied()); + staging.put("vision_interpolation_weights", 0, images.interpolation_weights.get(start..end).ok_or("truncated vision interpolation weights")?.iter().flatten().copied().flat_map(f32::to_le_bytes)); + staging.i64("vision_position_ids", 0, images.position_ids.get(start..end).ok_or("truncated vision positions")?.iter().flatten().copied()); + staging.i32("vision_cu_seqlens", 0, [0, geometry.patches as i32]); + staging.i32("vision_cu_window_seqlens", 0, cu_window); + staging.i64("vision_reverse_index", 0, reverse_index.iter().map(|packed| packed - start as i64)); + staging.i32("vision_num_patches", 0, [geometry.patches as i32]); + staging.i32("vision_feature_offset", 0, [destination_feature_offset as i32]); + Ok(staging) +} + +#[cfg(test)] +mod tests { + use super::*; + use crate::frontend::images::{ImageLimits, ImageProcessor, ImageSettings, MuseGlimmerImageSettings, RgbImage}; + use crate::model::contract::ImagePreparationKind; + + fn glimmer_config() -> ModelConfig { + let mut contract = crate::model::testing::metadata(); + contract.frontend.image_layout = Some(ImageLayoutKind::Windowed); + contract.frontend.image_preparation = Some(ImagePreparationKind::MuseGlimmer); + contract.vision.patches_per_feature = 4; + contract.vision.patch_capacities = vec![1024, 4096, 16384]; + contract.vision.features_per_request = 16384; + ModelConfig { + completion_token_capacity: 16, + max_top_logprobs: 0, + logprob_token_id_capacity: 0, + prepared_sequence_tokens: 2048, + contract, + identity: [1; 32], + model_id: "muse_glimmer".into(), + limits: crate::scheduler::SchedulerLimits { + request_slots: 4, + max_active: 4, + max_sequence_tokens: 2048, + prefill_chunk_size: 512, + pages: 64, + snapshots: 40, + }, + eos_token_ids: vec![1], + sampling_ranges: Default::default(), + sampling_defaults: crate::model::SamplingParameters::default(), + max_new_tokens: 256, + speculative_widths: Vec::new(), + speculative_fixed_width: None, + speculative_token_capacity: 512, + decode_weight_bytes: 0, + } + } + + fn pattern(width: usize, height: usize) -> RgbImage { + RgbImage::new(width, height, (0..width * height * 3).map(|i| ((i * 37 + 11) % 256) as u8).collect()).unwrap() + } + + #[test] + fn windowed_layout_stages_window_tensors_rebased_per_image_and_padded_to_the_bound_width() { + let config = glimmer_config(); + let processor = ImageProcessor::load( + ImageSettings::MuseGlimmer(MuseGlimmerImageSettings { + patch_size: 14, + merge_size: 2, + max_image_tokens: 4096, + image_mean: [0.5; 3], + image_std: [0.5; 3], + image_token: "<|patch|>".into(), + start_token: "<|image_start|>".into(), + end_token: "<|image_end|>".into(), + }), + ImageLimits::default(), + ) + .unwrap(); + // A 2×4-patch image first, then the ragged 70×38-patch image (532×980 px). + let images = processor.process(&[pattern(56, 28), pattern(532, 980)]).unwrap(); + assert_eq!(images.geometry[1].grid_thw, [1, 70, 38]); + let handle = RequestHandle { slot: 3, generation: 19 }; + let staging = prepare(&config, handle, &images, 1, 8).unwrap(); + let uploads = staging.uploads(); + let names: Vec<&str> = uploads.iter().map(|u| u.buffer).collect(); + assert_eq!(names, [ + "vision_pixel_values", "vision_interpolation_indices", "vision_interpolation_weights", + "vision_position_ids", "vision_cu_seqlens", "vision_cu_window_seqlens", "vision_reverse_index", + "vision_num_patches", "vision_feature_offset", + ]); + let bytes = |name: &str| uploads.iter().find(|u| u.buffer == name).unwrap().bytes; + let i32s = |name: &str| bytes(name).chunks_exact(4).map(|b| i32::from_le_bytes(b.try_into().unwrap())).collect::>(); + let i64s = |name: &str| bytes(name).chunks_exact(8).map(|b| i64::from_le_bytes(b.try_into().unwrap())).collect::>(); + for name in names { + let (dtype, minimum) = tensor_layout(ImageLayoutKind::Windowed, name, 16384).unwrap(); + assert!(bytes(name).len() <= minimum * dtype.size(), "{name}"); + assert_eq!(uploads.iter().find(|u| u.buffer == name).unwrap().offset, 0); + } + assert!(tensor_layout(ImageLayoutKind::Windowed, "vision_num_features", 16384).is_err()); + assert_eq!(bytes("vision_pixel_values").len(), 2660 * 1176 * 4); + assert_eq!(&bytes("vision_pixel_values")[..4], &images.pixel_values[8 * 1176].to_le_bytes()); + assert_eq!(i64s("vision_interpolation_indices").len(), 2660 * 4); + assert_eq!(bytes("vision_interpolation_weights").len(), 2660 * 4 * 4); + let positions = i64s("vision_position_ids"); + assert_eq!(positions.len(), 2660 * 2); + assert_eq!(&positions[..4], &[0, 0, 0, 1]); + assert_eq!(&positions[2 * 1024..2 * 1024 + 2], &[0, 32]); + assert_eq!(i32s("vision_cu_seqlens"), [0, 2660]); + let cu_window = i32s("vision_cu_window_seqlens"); + assert_eq!(cu_window.len(), 16384 / 64 + 2); + assert_eq!(&cu_window[..7], &[0, 1024, 1216, 2240, 2432, 2624, 2660]); + assert!(cu_window[7..].iter().all(|n| *n == 2660)); + let reverse = i64s("vision_reverse_index"); + assert_eq!(reverse.len(), 2660); + assert_eq!(&reverse[..3], &[0, 1, 2]); + assert_eq!(&reverse[32..34], &[1024, 1025]); + assert_eq!(&reverse[38..40], &[32, 33]); + for packed in 0..2660 { + let raster = (positions[2 * packed] * 38 + positions[2 * packed + 1]) as usize; + assert_eq!(reverse[raster], packed as i64); + } + assert_eq!(i32s("vision_num_patches"), [2660]); + assert_eq!(i32s("vision_feature_offset"), [8]); + let first = prepare(&config, handle, &images, 0, 0).unwrap(); + let first = first.uploads(); + let cu = first.iter().find(|u| u.buffer == "vision_cu_window_seqlens").unwrap(); + assert_eq!(&cu.bytes[..8], &[0, 0, 0, 0, 8, 0, 0, 0]); + assert!(prepare(&config, RequestHandle { slot: 4, generation: 19 }, &images, 1, 8).is_err()); + assert!(prepare(&config, handle, &images, 1, 16384 - 100).is_err()); + let mut relabelled = glimmer_config(); + relabelled.contract.frontend.image_preparation = Some(ImagePreparationKind::PatchMerge); + let independent = prepare(&relabelled, handle, &images, 0, 0).unwrap(); + assert!(independent.uploads().iter().map(|u| (u.buffer, u.offset, u.bytes)) + .eq(first.iter().map(|u| (u.buffer, u.offset, u.bytes)))); + } +} diff --git a/helios/src/frontend/images/patch_merge.rs b/helios/src/frontend/images/patch_merge.rs index fa9c6d034..d612249bc 100644 --- a/helios/src/frontend/images/patch_merge.rs +++ b/helios/src/frontend/images/patch_merge.rs @@ -62,49 +62,69 @@ impl Processor { prompt_token_ids: &[u32], images: &ProcessedImages, ) -> Result { - let image_ids = frontend.encode(&self.image_token, false)?; - let [image_id] = image_ids.as_slice() else { - return Err("image placeholder must encode one token".into()); - }; - let envelope_id = |marker: &str| -> Result { - let ids = frontend.encode(marker, false)?; - match ids.as_slice() { - [id] => Ok(*id), - _ => Err("image envelope marker must encode one token".into()), - } - }; - let start_id = envelope_id(&self.start_token)?; - let end_id = envelope_id(&self.end_token)?; - let placeholder_count = prompt_token_ids - .iter() - .filter(|id| **id == *image_id) - .count(); - if placeholder_count != images.geometry.len() { - return Err("image placeholder count does not match input images".into()); + bracketed_prompt( + frontend, + prompt_token_ids, + images, + &self.image_token, + &self.start_token, + &self.end_token, + ) + } +} + +/// Replaces each `image_token` placeholder with `start_token`, one `image_token` per image +/// token, and `end_token`; shared by every profile with a bracketed image layout. +pub(super) fn bracketed_prompt( + frontend: &Frontend, + prompt_token_ids: &[u32], + images: &ProcessedImages, + image_token: &str, + start_token: &str, + end_token: &str, +) -> Result { + let image_ids = frontend.encode(image_token, false)?; + let [image_id] = image_ids.as_slice() else { + return Err("image placeholder must encode one token".into()); + }; + let envelope_id = |marker: &str| -> Result { + let ids = frontend.encode(marker, false)?; + match ids.as_slice() { + [id] => Ok(*id), + _ => Err("image envelope marker must encode one token".into()), } - let mut token_ids = Vec::new(); - let mut geometry = images.geometry.iter(); - for &id in prompt_token_ids { - if id == *image_id { - let tokens = geometry.next().expect("placeholder count was checked").tokens; - token_ids.push(start_id); - token_ids.extend(std::iter::repeat_n(*image_id, tokens)); - token_ids.push(end_id); - } else { - token_ids.push(id); - } + }; + let start_id = envelope_id(start_token)?; + let end_id = envelope_id(end_token)?; + let placeholder_count = prompt_token_ids + .iter() + .filter(|id| **id == *image_id) + .count(); + if placeholder_count != images.geometry.len() { + return Err("image placeholder count does not match input images".into()); + } + let mut token_ids = Vec::new(); + let mut geometry = images.geometry.iter(); + for &id in prompt_token_ids { + if id == *image_id { + let tokens = geometry.next().expect("placeholder count was checked").tokens; + token_ids.push(start_id); + token_ids.extend(std::iter::repeat_n(*image_id, tokens)); + token_ids.push(end_id); + } else { + token_ids.push(id); } - let mm_token_type_ids = token_ids - .iter() - .map(|id| i32::from(*id == *image_id)) - .collect(); - Ok(ImagePrompt { - position_ids: std::array::from_fn(|_| (0..token_ids.len() as i64).collect()), - token_ids, - mm_token_type_ids, - rope_delta: 0, - }) } + let mm_token_type_ids = token_ids + .iter() + .map(|id| i32::from(*id == *image_id)) + .collect(); + Ok(ImagePrompt { + position_ids: std::array::from_fn(|_| (0..token_ids.len() as i64).collect()), + token_ids, + mm_token_type_ids, + rope_delta: 0, + }) } #[cfg(test)] diff --git a/helios/src/frontend/images/patches.rs b/helios/src/frontend/images/patches.rs index a7dae57d1..378781a8e 100644 --- a/helios/src/frontend/images/patches.rs +++ b/helios/src/frontend/images/patches.rs @@ -101,6 +101,8 @@ impl PatchProcessor { interpolation_indices: Vec::new(), interpolation_weights: Vec::new(), cu_seqlens: vec![0], + cu_window_seqlens: vec![], + reverse_index: vec![], }; result.reserve_outputs(total, pixel_width, false, images.len(), images.len() + 1)?; let normalized: [Vec; 3] = std::array::from_fn(|channel| { diff --git a/helios/src/frontend/images/radio.rs b/helios/src/frontend/images/radio.rs index 696edc07b..5f42fa482 100644 --- a/helios/src/frontend/images/radio.rs +++ b/helios/src/frontend/images/radio.rs @@ -71,6 +71,8 @@ pub(super) fn process(limits: ImageLimits, images: &[RgbImage]) -> Result = images .iter() diff --git a/helios/src/frontend/images/record.rs b/helios/src/frontend/images/record.rs index a1982ed35..33be71535 100644 --- a/helios/src/frontend/images/record.rs +++ b/helios/src/frontend/images/record.rs @@ -24,6 +24,23 @@ impl ProcessedImages { .append(&mut images.interpolation_indices); self.interpolation_weights .append(&mut images.interpolation_weights); + if self.cu_window_seqlens.is_empty() { + self.cu_window_seqlens.push(0); + } + let window_offset = *self.cu_window_seqlens.last().unwrap(); + self.cu_window_seqlens.extend( + images + .cu_window_seqlens + .into_iter() + .skip(1) + .map(|n| n + window_offset), + ); + if self.cu_window_seqlens.len() == 1 { + self.cu_window_seqlens.clear(); + } + let patch_offset = self.reverse_index.len() as i64; + self.reverse_index + .extend(images.reverse_index.into_iter().map(|n| n + patch_offset)); } pub fn encoded_len(&self) -> Result { @@ -34,9 +51,11 @@ impl ProcessedImages { (self.interpolation_indices.len(), 32), (self.interpolation_weights.len(), 16), (self.cu_seqlens.len(), 4), + (self.cu_window_seqlens.len(), 4), + (self.reverse_index.len(), 8), ] .into_iter() - .try_fold(9usize + 6 * 8, |total, (count, width)| { + .try_fold(9usize + 8 * 8, |total, (count, width)| { count .checked_mul(width) .and_then(|bytes| total.checked_add(bytes)) @@ -51,7 +70,7 @@ impl ProcessedImages { } fn write_encoded(&self, mut write: impl FnMut(&[u8])) { - write(b"FLAREIMG\x01"); + write(b"FLAREIMG\x02"); let count = |write: &mut dyn FnMut(&[u8]), n: usize| write(&(n as u64).to_le_bytes()); count(&mut write, self.geometry.len()); for g in &self.geometry { @@ -82,13 +101,23 @@ impl ProcessedImages { for n in &self.cu_seqlens { write(&n.to_le_bytes()); } + count(&mut write, self.cu_window_seqlens.len()); + for n in &self.cu_window_seqlens { + write(&n.to_le_bytes()); + } + count(&mut write, self.reverse_index.len()); + for n in &self.reverse_index { + write(&n.to_le_bytes()); + } } pub fn decode(bytes: &[u8]) -> Result { let mut reader = Reader(bytes); - if reader.take(9)? != b"FLAREIMG\x01" { - return Err("invalid prepared image record version".into()); - } + let version = match reader.take(9)? { + b"FLAREIMG\x01" => 1u8, + b"FLAREIMG\x02" => 2u8, + _ => return Err("invalid prepared image record version".into()), + }; let count = reader.count(56)?; let mut geometry = Vec::with_capacity(count); for _ in 0..count { @@ -142,6 +171,21 @@ impl ProcessedImages { for _ in 0..count { cu_seqlens.push(i32::from_le_bytes(reader.take(4)?.try_into().unwrap())); } + let (cu_window_seqlens, reverse_index) = if version == 2 { + let count = reader.count(4)?; + let mut cu_window_seqlens = Vec::with_capacity(count); + for _ in 0..count { + cu_window_seqlens.push(i32::from_le_bytes(reader.take(4)?.try_into().unwrap())); + } + let count = reader.count(8)?; + let mut reverse_index = Vec::with_capacity(count); + for _ in 0..count { + reverse_index.push(reader.i64()?); + } + (cu_window_seqlens, reverse_index) + } else { + (Vec::new(), Vec::new()) + }; if !reader.0.is_empty() { return Err("trailing prepared image record bytes".into()); } @@ -152,6 +196,8 @@ impl ProcessedImages { interpolation_indices, interpolation_weights, cu_seqlens, + cu_window_seqlens, + reverse_index, }) } } @@ -181,3 +227,121 @@ impl<'a> Reader<'a> { Ok(f32::from_le_bytes(self.take(4)?.try_into().unwrap())) } } + +#[cfg(test)] +mod tests { + use super::*; + + fn sample_without_windows() -> ProcessedImages { + ProcessedImages { + geometry: vec![ImageGeometry { + height: 28, + width: 56, + patches: 8, + tokens: 2, + grid_thw: [1, 2, 4], + }], + pixel_values: vec![-0.5, 0.0, 0.25, 1.0], + position_ids: vec![[0, 0], [0, 1]], + interpolation_indices: vec![[0, 1, 32, 33]], + interpolation_weights: vec![[0.25, 0.25, 0.25, 0.25]], + cu_seqlens: vec![0, 8], + cu_window_seqlens: Vec::new(), + reverse_index: Vec::new(), + } + } + + fn encode_v1(images: &ProcessedImages) -> Vec { + let mut out = Vec::new(); + out.extend_from_slice(b"FLAREIMG\x01"); + out.extend_from_slice(&(images.geometry.len() as u64).to_le_bytes()); + for g in &images.geometry { + for n in [g.height, g.width, g.patches, g.tokens] { + out.extend_from_slice(&(n as u64).to_le_bytes()); + } + for n in g.grid_thw { + out.extend_from_slice(&n.to_le_bytes()); + } + } + out.extend_from_slice(&(images.pixel_values.len() as u64).to_le_bytes()); + for n in &images.pixel_values { + out.extend_from_slice(&n.to_le_bytes()); + } + out.extend_from_slice(&(images.position_ids.len() as u64).to_le_bytes()); + for n in images.position_ids.iter().flatten() { + out.extend_from_slice(&n.to_le_bytes()); + } + out.extend_from_slice(&(images.interpolation_indices.len() as u64).to_le_bytes()); + for n in images.interpolation_indices.iter().flatten() { + out.extend_from_slice(&n.to_le_bytes()); + } + out.extend_from_slice(&(images.interpolation_weights.len() as u64).to_le_bytes()); + for n in images.interpolation_weights.iter().flatten() { + out.extend_from_slice(&n.to_le_bytes()); + } + out.extend_from_slice(&(images.cu_seqlens.len() as u64).to_le_bytes()); + for n in &images.cu_seqlens { + out.extend_from_slice(&n.to_le_bytes()); + } + out + } + + #[test] + fn version_2_record_round_trips_and_rejects_bad_headers() { + let mut sample = sample_without_windows(); + sample.cu_window_seqlens = vec![0, 4, 8]; + sample.reverse_index = (0..8).rev().collect(); + let encoded = sample.encode().unwrap(); + assert_eq!(&encoded[..9], b"FLAREIMG\x02"); + assert_eq!(encoded.len(), sample.encoded_len().unwrap()); + let decoded = ProcessedImages::decode(&encoded).unwrap(); + assert_eq!(decoded.geometry, sample.geometry); + assert_eq!(decoded.pixel_values, sample.pixel_values); + assert_eq!(decoded.position_ids, sample.position_ids); + assert_eq!(decoded.interpolation_indices, sample.interpolation_indices); + assert_eq!(decoded.interpolation_weights, sample.interpolation_weights); + assert_eq!(decoded.cu_seqlens, sample.cu_seqlens); + assert_eq!(decoded.cu_window_seqlens, sample.cu_window_seqlens); + assert_eq!(decoded.reverse_index, sample.reverse_index); + for bad_header in [b"FLAREIMG\x00", b"FLAREIMG\x03", b"FLAREIMG\xff", b"BADMAGIC\x02"] { + let mut altered = encoded.clone(); + altered[..9].copy_from_slice(bad_header); + assert!(ProcessedImages::decode(&altered).is_err()); + } + let mut trailing = encoded.clone(); + trailing.push(0); + assert!(ProcessedImages::decode(&trailing).is_err()); + } + + #[test] + fn version_1_record_decodes_with_empty_window_vectors_and_rejects_trailing_bytes() { + let sample = sample_without_windows(); + let v1 = encode_v1(&sample); + let v2 = sample.encode().unwrap(); + assert_eq!(&v2[..9], b"FLAREIMG\x02"); + assert_eq!(&v1[9..], &v2[9..v2.len() - 16]); + assert_eq!(&v2[v2.len() - 16..], &[0u8; 16]); + + let decoded = ProcessedImages::decode(&v1).unwrap(); + assert_eq!(decoded.geometry, sample.geometry); + assert_eq!(decoded.pixel_values, sample.pixel_values); + assert_eq!(decoded.position_ids, sample.position_ids); + assert_eq!(decoded.interpolation_indices, sample.interpolation_indices); + assert_eq!(decoded.interpolation_weights, sample.interpolation_weights); + assert_eq!(decoded.cu_seqlens, sample.cu_seqlens); + assert!(decoded.cu_window_seqlens.is_empty()); + assert_eq!(decoded.cu_window_seqlens.capacity(), 0); + assert!(decoded.reverse_index.is_empty()); + assert_eq!(decoded.reverse_index.capacity(), 0); + + for end in 0..v1.len() { + assert!(ProcessedImages::decode(&v1[..end]).is_err()); + } + let mut trailing = v1.clone(); + trailing.push(0); + assert!(ProcessedImages::decode(&trailing).is_err()); + let mut v1_with_v2_tail = v1; + v1_with_v2_tail.extend_from_slice(&[0u8; 16]); + assert!(ProcessedImages::decode(&v1_with_v2_tail).is_err()); + } +} diff --git a/helios/src/frontend/images/resize.rs b/helios/src/frontend/images/resize.rs index 304ee2554..74d3c9813 100644 --- a/helios/src/frontend/images/resize.rs +++ b/helios/src/frontend/images/resize.rs @@ -76,6 +76,43 @@ struct Axis { precision: u32, } +#[derive(Clone, Copy)] +enum Filter { + Cubic, + Linear, + /// Lanczos with `a = 3`, PyTorch's `lanczos_filter` (also Pillow's `LANCZOS`). + Lanczos, +} + +impl Filter { + fn support(self) -> f64 { + match self { + Self::Cubic => 2.0, + Self::Linear => 1.0, + Self::Lanczos => 3.0, + } + } + fn weight(self, x: f64) -> f64 { + match self { + Self::Cubic => cubic(x), + Self::Linear => (1.0 - x.abs()).max(0.0), + Self::Lanczos => lanczos3(x), + } + } +} + +fn lanczos3(x: f64) -> f64 { + const A: f64 = 3.0; + if x == 0.0 { + return 1.0; + } + if x.abs() >= A { + return 0.0; + } + let x = x * std::f64::consts::PI; + A * x.sin() * (x / A).sin() / (x * x) +} + fn cubic(x: f64) -> f64 { let x = x.abs(); if x < 1.0 { @@ -87,9 +124,9 @@ fn cubic(x: f64) -> f64 { } } -fn axis(input: usize, output: usize, pillow: bool, linear: bool) -> Axis { +fn axis(input: usize, output: usize, pillow: bool, filter: Filter) -> Axis { let scale = input as f64 / output as f64; - let support = (if linear { 1.0 } else { 2.0 }) * scale.max(1.0); + let support = filter.support() * scale.max(1.0); let inverse_scale = if scale >= 1.0 { 1.0 / scale } else { 1.0 }; let max_taps = support.ceil() as usize * 2 + 1; let mut maximum = 0.0f64; @@ -101,12 +138,7 @@ fn axis(input: usize, output: usize, pillow: bool, linear: bool) -> Axis { let count = (end - start).min(max_taps); let mut weights: Vec<_> = (0..count) .map(|j| { - let x = (j as f64 + start as f64 - center + 0.5) * inverse_scale; - if linear { - (1.0 - x.abs()).max(0.0) - } else { - cubic(x) - } + filter.weight((j as f64 + start as f64 - center + 0.5) * inverse_scale) }) .collect(); let sum: f64 = weights.iter().sum(); @@ -154,30 +186,37 @@ fn axis(input: usize, output: usize, pillow: bool, linear: bool) -> Axis { } pub(super) fn resize(input: &RgbImage, width: usize, height: usize) -> Vec { - resample(input, width, height, false, false) + resample(input, width, height, false, Filter::Cubic) +} + +/// Antialiased Lanczos (`a = 3`) resampling as torchvision's `InterpolationMode.LANCZOS` +/// runs it on CPU uint8 tensors: PyTorch's separable antialiased kernel, horizontal pass +/// then vertical, each rounded to uint8. +pub(super) fn lanczos(input: &RgbImage, width: usize, height: usize) -> Vec { + resample(input, width, height, false, Filter::Lanczos) } pub(super) fn pillow(input: &RgbImage, width: usize, height: usize) -> Vec { // Pillow resizes vertically first only when shrinking an image taller than // 100 times its width. Each pass rounds to uint8, so the order affects RGB. if input.height > height && input.height > input.width * 100 { - let pixels = resample(input, input.width, height, true, false); + let pixels = resample(input, input.width, height, true, Filter::Cubic); let intermediate = RgbImage::new(input.width, height, pixels).unwrap(); - return resample(&intermediate, width, height, true, false); + return resample(&intermediate, width, height, true, Filter::Cubic); } - resample(input, width, height, true, false) + resample(input, width, height, true, Filter::Cubic) } pub(super) fn bilinear(input: &RgbImage, width: usize, height: usize) -> Vec { - resample(input, width, height, false, true) + resample(input, width, height, false, Filter::Linear) } -fn resample(input: &RgbImage, width: usize, height: usize, pillow: bool, linear: bool) -> Vec { +fn resample(input: &RgbImage, width: usize, height: usize, pillow: bool, filter: Filter) -> Vec { let source = &input.pixels; let horizontal = if width == input.width { None } else { - let axis = axis(input.width, width, pillow, linear); + let axis = axis(input.width, width, pillow, filter); let mut pixels = vec![0; input.height * width * 3]; for y in 0..input.height { for (x, (start, weights)) in axis.taps.iter().enumerate() { @@ -198,7 +237,7 @@ fn resample(input: &RgbImage, width: usize, height: usize, pillow: bool, linear: if height == input.height { return source.clone(); } - let axis = axis(input.height, height, pillow, linear); + let axis = axis(input.height, height, pillow, filter); let mut pixels = vec![0; height * width * 3]; for (y, (start, weights)) in axis.taps.iter().enumerate() { for x in 0..width * 3 { diff --git a/helios/src/frontend/images/step.rs b/helios/src/frontend/images/step.rs index 784eaaf15..e07b72ed8 100644 --- a/helios/src/frontend/images/step.rs +++ b/helios/src/frontend/images/step.rs @@ -182,6 +182,8 @@ pub(super) fn process(limits: ImageLimits, images: &[RgbImage]) -> Result(); diff --git a/helios/src/model/contract.rs b/helios/src/model/contract.rs index 24c19155c..07b8b99a6 100644 --- a/helios/src/model/contract.rs +++ b/helios/src/model/contract.rs @@ -66,8 +66,8 @@ contract_enum!(InputIndexing { Scalar = 1, SubmissionRow = 2, RequestRow = 3, Pa contract_enum!(StateAccessKind { Read = 1, Write = 2, ReadWrite = 3 }); contract_enum!(ToolParserKind { QwenCoder = 1, GlmArgumentTags = 2, Dsml = 3, Xtml = 4, MiniMaxXml = 5, GemmaCall = 6, Atem = 7, TmlJson = 8 }); contract_enum!(ReasoningParserKind { ThinkTags = 1, XtmlThink = 2, MmThink = 3, ChannelThought = 4, RecipientHeaders = 5, ContentHeaders = 6 }); -contract_enum!(ImagePreparationKind { Qwen = 1, Mimo = 2, Deepseek = 3, Moonvit = 4, Step = 5, Radio = 6, DeepseekRowMajor = 7, Glm = 8, PatchMerge = 9, PaddedGrid = 10 }); -contract_enum!(ImageLayoutKind { Qwen = 1, Mimo = 2, Deepseek = 3, Moonvit = 4, Step = 5, Radio = 6, DeepseekRowMajor = 7, Glm = 8, Bracketed = 9, ClassToken = 10 }); +contract_enum!(ImagePreparationKind { Qwen = 1, Mimo = 2, Deepseek = 3, Moonvit = 4, Step = 5, Radio = 6, DeepseekRowMajor = 7, Glm = 8, PatchMerge = 9, PaddedGrid = 10, MuseGlimmer = 11 }); +contract_enum!(ImageLayoutKind { Qwen = 1, Mimo = 2, Deepseek = 3, Moonvit = 4, Step = 5, Radio = 6, DeepseekRowMajor = 7, Glm = 8, Bracketed = 9, ClassToken = 10, Windowed = 11 }); contract_enum!(GraphOperation { Init = 1, Restore = 2, Snapshot = 3, Prefill = 4, Decode = 5, Resume = 6, Vision = 7, Speculative = 8, Mixed = 9, ScoredPrefill = 12, TerminalPrefill = 14 }); impl TryFrom for GraphOperation { diff --git a/helios/src/model/prompt.rs b/helios/src/model/prompt.rs index 377fc0945..ad78a3f74 100644 --- a/helios/src/model/prompt.rs +++ b/helios/src/model/prompt.rs @@ -53,6 +53,9 @@ pub fn prepare_image_inputs( Some(ImageLayoutKind::Bracketed) => crate::frontend::images::layouts::bracketed::prepare_input( frontend, processor, rendered, &images, )?, + Some(ImageLayoutKind::Windowed) => crate::frontend::images::layouts::bracketed::prepare_input( + frontend, processor, rendered, &images, + )?, Some(ImageLayoutKind::Glm) => crate::frontend::images::layouts::glm::prepare_input( frontend, processor, rendered, &images, )?, @@ -423,7 +426,7 @@ mod tests { #[test] fn every_image_layout_describes_history_larger_than_the_feature_window() { use crate::frontend::images::{DeepseekRowMajorImageSettings, ImageSettings, - MimoImageSettings, QwenImageSettings}; + MimoImageSettings, MuseGlimmerImageSettings, QwenImageSettings}; use crate::model::contract::{ImageSpan, ImageTokenLayout}; let frontend = image_frontend(); let token = |text: &str| frontend.encode(text, false).unwrap()[0]; @@ -443,6 +446,11 @@ mod tests { (ImageLayoutKind::Step, ImageSettings::Step {}, "", 16), (ImageLayoutKind::Radio, ImageSettings::Radio {}, "", 4), (ImageLayoutKind::ClassToken, ImageSettings::PaddedGrid {}, "", 4), + (ImageLayoutKind::Windowed, ImageSettings::MuseGlimmer(MuseGlimmerImageSettings { + patch_size: 14, merge_size: 2, max_image_tokens: 4096, + image_mean: [0.5; 3], image_std: [0.5; 3], + image_token: "".into(), start_token: "".into(), end_token: "".into(), + }), "", 4), ]; for (layout, settings, placeholder, merge) in profiles { let initial = ImageProcessor::load(settings.clone(), Default::default()).unwrap(); diff --git a/helios/src/model/tests.rs b/helios/src/model/tests.rs index 2f9189c5c..c4be386d9 100644 --- a/helios/src/model/tests.rs +++ b/helios/src/model/tests.rs @@ -1558,6 +1558,8 @@ fn vision_upload_selects_source_image_independently_of_destination_feature_offse interpolation_indices: (0..8).map(|i| [i, i + 1, i + 2, i + 3]).collect(), interpolation_weights: vec![[0.25; 4]; 8], cu_seqlens: vec![0, 4, 8], + cu_window_seqlens: vec![], + reverse_index: vec![], }; for (image, destination) in [(0, 0), (1, 1), (1, 0)] { let staging = crate::frontend::images::packing::prepare( diff --git a/helios/src/runtime_core/describe.rs b/helios/src/runtime_core/describe.rs index 6177ac380..6f1fe86bf 100644 --- a/helios/src/runtime_core/describe.rs +++ b/helios/src/runtime_core/describe.rs @@ -448,6 +448,8 @@ pub(super) fn vision_json( "min_pixels": c.min_pixels, "max_pixels": c.max_pixels}), Profile::Glm(_) => json!({"profile": "glm"}), Profile::PaddedGrid(_) => json!({"profile": "padded_grid"}), + Profile::MuseGlimmer(c) => json!({"profile": "muse_glimmer", "patch_size": c.patch_size, + "merge_size": c.merge_size, "max_image_tokens": c.max_image_tokens}), } }); json!({ diff --git a/helios/src/runtime_core/protobuf.rs b/helios/src/runtime_core/protobuf.rs index e675938b3..5da8ee8d5 100644 --- a/helios/src/runtime_core/protobuf.rs +++ b/helios/src/runtime_core/protobuf.rs @@ -200,6 +200,12 @@ pub(super) fn frontend_settings(value: wire::FrontendSettings) -> Result serde_json::json!({"radio": {}}), Profile::Glm(_) => serde_json::json!({"glm": {}}), Profile::PaddedGrid(_) => serde_json::json!({"padded_grid": {}}), + Profile::MuseGlimmer(config) => serde_json::json!({"muse_glimmer": { + "patch_size": config.patch_size, "merge_size": config.merge_size, + "max_image_tokens": config.max_image_tokens, + "image_mean": config.image_mean, "image_std": config.image_std, + "image_token": config.image_token, "start_token": config.start_token, "end_token": config.end_token, + }}), }) }) .transpose()?; @@ -829,6 +835,93 @@ mod tests { } } + #[test] + fn muse_glimmer_image_settings_and_preparation_kind_round_trip_on_wire() { + // Muse Glimmer image settings occupy ImageSettings oneof field 11 (tag 0x5a), while + // MUSE_GLIMMER_IMAGE_PREPARATION (field 3, tag 0x18) and WINDOWED_IMAGE_LAYOUT + // (field 4, tag 0x20) each encode as enum value 11 in FrontendContract. + let profile = wire::MuseGlimmerImageSettings { + patch_size: 14, + merge_size: 2, + max_image_tokens: 4096, + image_mean: vec![0.5; 3], + image_std: vec![0.5; 3], + image_token: "<|patch|>".into(), + start_token: "<|image_start|>".into(), + end_token: "<|image_end|>".into(), + }; + let image_settings = wire::ImageSettings { + profile: Some(wire::image_settings::Profile::MuseGlimmer(profile)), + }; + let image_bytes = image_settings.encode_to_vec(); + assert_eq!(image_bytes[0], 0x5a); + let value = wire::FrontendSettings { + tokenizer: Some(wire::TokenizerSettings::default()), + image: Some(image_settings), + eos_token_ids: vec![1], + ..Default::default() + }; + let decoded = wire::FrontendSettings::decode(value.encode_to_vec().as_slice()).unwrap(); + assert_eq!(decoded, value); + let json = frontend_settings(decoded).unwrap(); + assert_eq!( + json["image"], + serde_json::json!({ + "muse_glimmer": { + "patch_size": 14, + "merge_size": 2, + "max_image_tokens": 4096, + "image_mean": [0.5, 0.5, 0.5], + "image_std": [0.5, 0.5, 0.5], + "image_token": "<|patch|>", + "start_token": "<|image_start|>", + "end_token": "<|image_end|>", + } + }) + ); + assert_eq!( + wire::ImagePreparationKind::MuseGlimmerImagePreparation as i32, + 11 + ); + assert_eq!( + wire::ImageLayoutKind::WindowedImageLayout as i32, + 11 + ); + let contract_wire = wire::FrontendContract { + image_preparation: Some(wire::ImagePreparationKind::MuseGlimmerImagePreparation as i32), + image_layout: Some(wire::ImageLayoutKind::WindowedImageLayout as i32), + assistant_marker: "assistant".into(), + ..Default::default() + }; + let contract_bytes = contract_wire.encode_to_vec(); + assert!(contract_bytes.starts_with(&[0x18, 0x0b, 0x20, 0x0b])); + let decoded_contract = wire::FrontendContract::decode(contract_bytes.as_slice()).unwrap(); + assert_eq!(decoded_contract, contract_wire); + let contract: crate::model::contract::FrontendContract = + serde_json::from_value(serde_json::to_value(decoded_contract).unwrap()).unwrap(); + assert_eq!( + contract.image_preparation, + Some(crate::model::contract::ImagePreparationKind::MuseGlimmer) + ); + assert_eq!( + contract.image_layout, + Some(crate::model::contract::ImageLayoutKind::Windowed) + ); + #[cfg(feature = "server")] + { + let frontend: crate::frontend::FrontendSettings = serde_json::from_value(json).unwrap(); + let settings = frontend.image.unwrap(); + assert_eq!( + settings.preparation_kind(), + crate::model::contract::ImagePreparationKind::MuseGlimmer + ); + let processor = + crate::frontend::images::ImageProcessor::load(settings, Default::default()) + .unwrap(); + assert_eq!(processor.geometry(112, 112).unwrap().tokens, 16); + } + } + #[test] fn prompt_encoder_round_trip_preserves_explicit_image_token_and_rejects_unknown_encoder() { for encoder in [1, 2, 3] { diff --git a/helios/tests/fixtures/templates/muse_glimmer_nvfp4/chat_template.patch.json b/helios/tests/fixtures/templates/muse_glimmer_nvfp4/chat_template.patch.json new file mode 100644 index 000000000..9cd2ffde6 --- /dev/null +++ b/helios/tests/fixtures/templates/muse_glimmer_nvfp4/chat_template.patch.json @@ -0,0 +1,13 @@ +{ + "source": { + "repository": "original-el8/Muse-Glimmer-30B-NVFP4", + "revision": "b47e1e9f77d9a86e18cda5e318c68c632a7fbe59", + "filename": "chat_template.jinja" + }, + "source_sha256": "cfc67e5f349f37690dfd31ed1f18bc4442a9dd32fe39a648f993cb4eb3cae678", + "result_sha256": "16eef5dd60244db14458243ae874e018957d427b9e3b6b75b74e68a7fd25d106", + "insertions": [ + 6247, + 9896 + ] +} diff --git a/ignition/preparation/frontend.py b/ignition/preparation/frontend.py index befb094d3..73ee88682 100644 --- a/ignition/preparation/frontend.py +++ b/ignition/preparation/frontend.py @@ -148,6 +148,22 @@ def image_settings(config, model, profile, qwen_model_type="qwen4_exp"): "init_pos_emb_width": 64, "pos_emb_interpolation_mode": "bilinear", "merge_kernel_size": [2, 2]}, "MoonViT vision configuration") return {"moonvit": {}} + if profile == "muse_glimmer": + _expected(config, {"processor_class": "MuseGlimmerProcessor"}, "Muse Glimmer processor") + image = config["image_processor"] + _expected(image, {"image_processor_type": "MuseGlimmerImageProcessor", "patch_size": 14, + "merge_size": 2, "temporal_patch_size": 2, "max_image_tokens": 4096, "resample": 1, + "image_mean": [0.5] * 3, "image_std": [0.5] * 3}, "Muse Glimmer image processor") + optional = {"rescale_factor": 1 / 255, + "do_resize": True, "do_rescale": True, "do_normalize": True, "do_convert_rgb": True} + _expected(image, {key: value for key, value in optional.items() if key in image}, "Muse Glimmer image processor") + _expected(model, {"model_type": "muse_glimmer", "image_token_id": 200092, "video_token_id": 200091}, + "Muse Glimmer model configuration") + _expected(model["vision_config"], {"patch_size": 14, "merge_size": 2, "patch_temporal": 2, + "pos_emb_height": 32, "pos_emb_width": 32}, "Muse Glimmer vision configuration") + return {"muse_glimmer": dict(patch_size=14, merge_size=2, max_image_tokens=4096, + image_mean=image["image_mean"], image_std=image["image_std"], + image_token="<|patch|>", start_token="<|image_start|>", end_token="<|image_end|>")} if profile == "deepseek_row_major": vision = model["vision_config"] _expected(vision, {"patch_size": 14, "downsample_ratio": 3, "max_image_tokens": 1024, diff --git a/ignition/preparation/runtime_core_pb2.py b/ignition/preparation/runtime_core_pb2.py index 76789f968..4c3c31fa2 100644 --- a/ignition/preparation/runtime_core_pb2.py +++ b/ignition/preparation/runtime_core_pb2.py @@ -24,7 +24,7 @@ -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x12runtime_core.proto\x12\rflare.runtime\"\x99\x01\n\x0eProtectedIndex\x12\x0f\n\x07version\x18\x01 \x01(\r\x12\x0f\n\x07\x63ore_id\x18\x02 \x01(\x0c\x12\x0e\n\x06signer\x18\x03 \x01(\x0c\x12*\n\x06groups\x18\x04 \x03(\x0b\x32\x1a.flare.runtime.SignedGroup\x12)\n\x05ranks\x18\x05 \x03(\x0b\x32\x1a.flare.runtime.SignedGroup\"<\n\x0bSignedGroup\x12\x0c\n\x04kind\x18\x01 \x01(\r\x12\x0c\n\x04\x62ody\x18\x02 \x01(\x0c\x12\x11\n\tsignature\x18\x03 \x01(\x0c\"\xcc\x01\n\x11PublisherMetadata\x12(\n\x05index\x18\x01 \x01(\x0b\x32\x19.flare.runtime.ModelIndex\x12\x11\n\tnamespace\x18\x02 \x01(\t\x12\x17\n\x0fofficial_source\x18\x03 \x01(\t\x12\x14\n\x0cgroup_hashes\x18\x04 \x03(\x0c\x12\x13\n\x0b\x64\x65velopment\x18\x05 \x01(\x08\x12\r\n\x05ranks\x18\x06 \x01(\r\x12\'\n\x07license\x18\x07 \x01(\x0b\x32\x16.flare.runtime.License\"%\n\x07License\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0c\n\x04link\x18\x02 \x01(\t\"F\n\x0fResourceCatalog\x12\x33\n\tresources\x18\x01 \x03(\x0b\x32 .flare.runtime.ProtectedResource\"^\n\x11ProtectedResource\x12\x0e\n\x06offset\x18\x01 \x01(\x04\x12\x14\n\x0cstored_bytes\x18\x02 \x01(\x04\x12\x13\n\x0bplain_bytes\x18\x03 \x01(\x04\x12\x0e\n\x06sha256\x18\x04 \x03(\x0c\"`\n\nStoredData\x12\x0e\n\x06nbytes\x18\x01 \x01(\x04\x12\x0e\n\x06sha256\x18\x02 \x01(\x0c\x12\x0e\n\x06offset\x18\x03 \x01(\x04\x12\"\n\x05parts\x18\x04 \x03(\x0b\x32\x13.flare.runtime.Span\"\xd9\x01\n\x0eRankProtection\x12\x0c\n\x04rank\x18\x01 \x01(\r\x12*\n\x06\x62undle\x18\x02 \x01(\x0b\x32\x1a.flare.runtime.BundleIndex\x12\x33\n\x0b\x65xecutables\x18\x03 \x01(\x0b\x32\x1e.flare.runtime.ResourceCatalog\x12/\n\x07support\x18\x04 \x01(\x0b\x32\x1e.flare.runtime.ResourceCatalog\x12\'\n\x04\x64\x61ta\x18\x05 \x01(\x0b\x32\x19.flare.runtime.StoredData\"\x8c\x04\n\nModelIndex\x12\x0f\n\x07version\x18\x01 \x01(\r\x12)\n\x05ranks\x18\x02 \x03(\x0b\x32\x1a.flare.runtime.BundleIndex\x12.\n\x0bpeer_memory\x18\x03 \x03(\x0b\x32\x19.flare.runtime.PeerMemory\x12$\n\x06\x61ssets\x18\x05 \x03(\x0b\x32\x14.flare.runtime.Asset\x12%\n\x06\x65ngram\x18\x06 \x01(\x0b\x32\x15.flare.runtime.Engram\x12\x43\n\x11sampling_defaults\x18\x07 \x01(\x0b\x32(.flare.runtime.DefaultSamplingParameters\x12\x31\n\x08\x66rontend\x18\x08 \x01(\x0b\x32\x1f.flare.runtime.FrontendSettings\x12\'\n\x07\x63luster\x18\t \x01(\x0b\x32\x16.flare.runtime.Cluster\x12\x30\n\x08\x63ontract\x18\n \x01(\x0b\x32\x1e.flare.runtime.ServingContract\x12\x33\n\x07rebuild\x18\x0b \x01(\x0b\x32\x1e.flare.runtime.RebuildManifestB\x02\x18\x01\x12\x37\n\x0bpreparation\x18\x0c \x01(\x0b\x32\".flare.runtime.PreparationManifestJ\x04\x08\x04\x10\x05\"\xf9\x01\n\x13PreparationManifest\x12\x0f\n\x07version\x18\x01 \x01(\r\x12\x0e\n\x06recipe\x18\x02 \x01(\t\x12\x17\n\x0fsource_identity\x18\x03 \x01(\t\x12\x1d\n\x15\x63heckpoint_repository\x18\x04 \x01(\t\x12\x1b\n\x13\x63heckpoint_revision\x18\x05 \x01(\t\x12\x18\n\x10local_checkpoint\x18\x06 \x01(\x08\x12\x19\n\x11reproduction_args\x18\x07 \x03(\t\x12\x37\n\nparameters\x18\x08 \x03(\x0b\x32#.flare.runtime.PreparationParameter\"\x8c\x01\n\x14PreparationParameter\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\x37\n\x05scope\x18\x02 \x01(\x0e\x32(.flare.runtime.PreparationParameterScope\x12.\n\x05value\x18\x03 \x01(\x0b\x32\x1f.flare.runtime.PreparationValue\"\xc6\x01\n\x10PreparationValue\x12\x14\n\nbool_value\x18\x01 \x01(\x08H\x00\x12\x13\n\tint_value\x18\x02 \x01(\x03H\x00\x12\x14\n\nuint_value\x18\x03 \x01(\x04H\x00\x12\x15\n\x0b\x66loat_value\x18\x04 \x01(\x01H\x00\x12\x16\n\x0cstring_value\x18\x05 \x01(\tH\x00\x12\x39\n\nlist_value\x18\x06 \x01(\x0b\x32#.flare.runtime.PreparationValueListH\x00\x42\x07\n\x05value\"G\n\x14PreparationValueList\x12/\n\x06values\x18\x01 \x03(\x0b\x32\x1f.flare.runtime.PreparationValue\"\xdb\x07\n\x0fRebuildManifest\x12\x0f\n\x07version\x18\x01 \x01(\r\x12\x0e\n\x06recipe\x18\x02 \x01(\t\x12\x17\n\x0fsource_identity\x18\x03 \x01(\t\x12\x1d\n\x15\x63heckpoint_repository\x18\x04 \x01(\t\x12\x1b\n\x13\x63heckpoint_revision\x18\x05 \x01(\t\x12\x17\n\x0ftensor_parallel\x18\x06 \x01(\r\x12\x17\n\x0fmax_concurrency\x18\x07 \x01(\x04\x12\x15\n\rprefill_chunk\x18\x08 \x01(\x04\x12\x19\n\x11image_concurrency\x18\t \x01(\x04\x12\x18\n\x10\x63ontext_parallel\x18\n \x01(\x08\x12\x16\n\x0estream_overlap\x18\x0b \x01(\x08\x12\x15\n\rmixed_prefill\x18\x0c \x01(\x08\x12%\n\x18\x65xpert_scale_compression\x18\r \x01(\tH\x00\x88\x01\x01\x12\x18\n\x10mla_compute_mode\x18\x0e \x01(\t\x12\x11\n\troce_ring\x18\x0f \x01(\x08\x12\x14\n\x0conline_mxfp8\x18\x10 \x01(\x08\x12\x1b\n\x13language_model_only\x18\x11 \x01(\x08\x12\x36\n\x0bspeculation\x18\x12 \x01(\x0b\x32!.flare.runtime.RebuildSpeculation\x12\x19\n\x11\x63ompiled_forwards\x18\x13 \x01(\x08\x12\x15\n\rreserve_bytes\x18\x14 \x01(\x04\x12\x18\n\x10local_checkpoint\x18\x15 \x01(\x08\x12\x12\n\nroce_chain\x18\x16 \x01(\x08\x12\x1e\n\x16shard_hyperconnections\x18\x18 \x01(\x08\x12\x1c\n\x14\x66orce_moe_decode_a16\x18\x1b \x01(\x08\x12\x19\n\x11row_shard_prefill\x18\x1c \x01(\x08\x12\x1a\n\x12online_mxfp8_scope\x18\x1e \x01(\t\x12\x1d\n\x15\x63ontext_parallel_size\x18\x1f \x01(\r\x12\x17\n\x0fprompt_logprobs\x18 \x01(\x08\x12\x17\n\x0f\x61utotune_effort\x18! \x01(\t\x12 \n\x18native_dense_activations\x18\" \x01(\x08\x12\x17\n\x0flock_gpu_clocks\x18# \x01(\x08\x12\x19\n\x11reproduction_args\x18$ \x03(\t:\x02\x18\x01\x42\x1b\n\x19_expert_scale_compressionJ\x04\x08\x17\x10\x18J\x04\x08\x19\x10\x1aJ\x04\x08\x1a\x10\x1bR\x0cjoint_tuningR\x11\x63ollective_tuningR\x16\x63ollective_ladder_json\"\x82\x04\n\x12RebuildSpeculation\x12\x14\n\x0c\x64raft_tokens\x18\x01 \x01(\r\x12\x10\n\x08\x61\x64\x61ptive\x18\x02 \x01(\x08\x12\x17\n\x0fproposal_source\x18\x03 \x01(\t\x12\x16\n\x0ehistory_drafts\x18\x04 \x01(\x08\x12\x16\n\x0etoken_capacity\x18\x05 \x01(\x04\x12\x1b\n\x13packed_verification\x18\x06 \x01(\x08\x12\x1e\n\x16\x64raft_prefix_selection\x18\x07 \x01(\t\x12$\n\x17\x64raft_head_quantization\x18\x08 \x01(\tH\x00\x88\x01\x01\x12%\n\x18markov_head_quantization\x18\t \x01(\tH\x01\x88\x01\x01\x12\x19\n\x0cgraph_budget\x18\n \x01(\x04H\x02\x88\x01\x01\x12$\n\x1cvocabulary_parallel_sampling\x18\x0b \x01(\x08\x12\x0e\n\x06method\x18\x0c \x01(\t\x12\x10\n\x08mtp_only\x18\r \x01(\x08\x12$\n\x17\x64raft_body_quantization\x18\x0e \x01(\tH\x03\x88\x01\x01:\x02\x18\x01\x42\x1a\n\x18_draft_head_quantizationB\x1b\n\x19_markov_head_quantizationB\x0f\n\r_graph_budgetB\x1a\n\x18_draft_body_quantization\"e\n\x0eRebuildWeights\x12\x0f\n\x07version\x18\x01 \x01(\r\x12-\n\x07tensors\x18\x02 \x03(\x0b\x32\x1c.flare.runtime.RebuildTensor\x12\x13\n\x0bunavailable\x18\x03 \x03(\t\"\xa2\x01\n\rRebuildTensor\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\r\n\x05\x64type\x18\x02 \x01(\t\x12\x15\n\relement_bytes\x18\x03 \x01(\r\x12\r\n\x05shape\x18\x04 \x03(\x04\x12\x0e\n\x06stride\x18\x05 \x03(\x04\x12\x13\n\x0blayout_type\x18\x06 \x01(\t\x12)\n\x07storage\x18\x07 \x01(\x0b\x32\x18.flare.runtime.Reference\"\xcb\x06\n\x0fServingContract\x12\x10\n\x08model_id\x18\x01 \x01(\t\x12\x10\n\x08identity\x18\x02 \x01(\t\x12\x34\n\x0emodel_contract\x18\x03 \x01(\x0b\x32\x1c.flare.runtime.ModelContract\x12\x1b\n\x13max_sequence_tokens\x18\x04 \x01(\x04\x12\x1a\n\x12prefill_chunk_size\x18\x05 \x01(\x04\x12\r\n\x05pages\x18\x06 \x01(\x04\x12\x12\n\nstate_rows\x18\x07 \x01(\x04\x12\x11\n\tsnapshots\x18\x08 \x01(\x04\x12\x13\n\x0bpage_tokens\x18\t \x01(\x04\x12\x1a\n\x12speculative_widths\x18\x0b \x03(\x04\x12$\n\x17speculative_fixed_width\x18\x0c \x01(\x04H\x00\x88\x01\x01\x12\x16\n\x0ehistory_drafts\x18\r \x01(\x08\x12#\n\x1bspeculative_proposal_source\x18\x0e \x01(\t\x12\x1b\n\x0emax_new_tokens\x18\x0f \x01(\x04H\x01\x88\x01\x01\x12\x17\n\nmax_active\x18\x10 \x01(\x04H\x02\x88\x01\x01\x12\x14\n\x0cserved_names\x18\x11 \x03(\t\x12\x1a\n\rreserve_bytes\x18\x12 \x01(\x04H\x03\x88\x01\x01\x12\x1b\n\x0equeue_capacity\x18\x13 \x01(\x04H\x04\x88\x01\x01\x12\x1d\n\x10\x66rontend_workers\x18\x14 \x01(\x04H\x05\x88\x01\x01\x12\x1b\n\x0emax_body_bytes\x18\x15 \x01(\x04H\x06\x88\x01\x01\x12\x14\n\x0c\x63ontext_hint\x18\x16 \x01(\t\x12\x15\n\rcapacity_hint\x18\x17 \x01(\t\x12\"\n\x1aspeculative_token_capacity\x18\x18 \x01(\x04\x12 \n\x13\x64\x65\x63ode_weight_bytes\x18\x19 \x01(\x04H\x07\x88\x01\x01\x42\x1a\n\x18_speculative_fixed_widthB\x11\n\x0f_max_new_tokensB\r\n\x0b_max_activeB\x10\n\x0e_reserve_bytesB\x11\n\x0f_queue_capacityB\x13\n\x11_frontend_workersB\x11\n\x0f_max_body_bytesB\x16\n\x14_decode_weight_bytesJ\x04\x08\n\x10\x0b\"\xc2\x02\n\rModelContract\x12\x0f\n\x07version\x18\x01 \x01(\r\x12\x12\n\nvocabulary\x18\x02 \x01(\x04\x12\x18\n\x10input_vocabulary\x18\x03 \x01(\x04\x12-\n\x06vision\x18\x04 \x01(\x0b\x32\x1d.flare.runtime.VisionCapacity\x12+\n\x05\x63\x61\x63he\x18\x05 \x01(\x0b\x32\x1c.flare.runtime.CacheContract\x12,\n\x06graphs\x18\x06 \x03(\x0b\x32\x1c.flare.runtime.GraphContract\x12\x31\n\x08\x66rontend\x18\x07 \x01(\x0b\x32\x1f.flare.runtime.FrontendContract\x12\x35\n\x0f\x63ore_parameters\x18\x08 \x03(\x0b\x32\x1c.flare.runtime.CoreParameter\"}\n\rCoreParameter\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x1a\n\rdefault_value\x18\x02 \x01(\x02H\x00\x88\x01\x01\x12\x30\n\x05range\x18\x03 \x01(\x0b\x32!.flare.runtime.CoreParameterRangeB\x10\n\x0e_default_value\"H\n\x12\x43oreParameterRange\x12\x10\n\x03min\x18\x01 \x01(\x02H\x00\x88\x01\x01\x12\x10\n\x03max\x18\x02 \x01(\x02H\x01\x88\x01\x01\x42\x06\n\x04_minB\x06\n\x04_max\"\x90\x01\n\x0eVisionCapacity\x12\x15\n\rfeature_slots\x18\x05 \x01(\x04\x12\x1c\n\x14\x66\x65\x61tures_per_request\x18\x01 \x01(\x04\x12\x12\n\nmax_images\x18\x02 \x01(\x04\x12\x1b\n\x13patches_per_feature\x18\x03 \x01(\x04\x12\x18\n\x10patch_capacities\x18\x04 \x03(\x04\"\xb8\x01\n\rCacheContract\x12\x13\n\x0bpage_tokens\x18\x01 \x01(\x04\x12-\n\x07regions\x18\x02 \x03(\x0b\x32\x1c.flare.runtime.HistoryRegion\x12\x31\n\x0bpage_tables\x18\x03 \x03(\x0b\x32\x1c.flare.runtime.PageTableView\x12\x30\n\x0c\x63odec_layout\x18\x04 \x01(\x0b\x32\x1a.flare.runtime.CodecLayout\"r\n\x0b\x43odecLayout\x12\x10\n\x08revision\x18\x01 \x01(\r\x12)\n\x06\x66ields\x18\x02 \x03(\x0b\x32\x19.flare.runtime.CodecField\x12\x17\n\ngpu_module\x18\x03 \x01(\tH\x00\x88\x01\x01\x42\r\n\x0b_gpu_module\"N\n\nCodecField\x12\x0e\n\x06\x62uffer\x18\x01 \x01(\t\x12\x0e\n\x06offset\x18\x02 \x01(\x04\x12\x0e\n\x06length\x18\x03 \x01(\x04\x12\x10\n\x08\x65ncoding\x18\x04 \x01(\r\"\x96\x01\n\rHistoryRegion\x12(\n\x04kind\x18\x01 \x01(\x0e\x32\x1a.flare.runtime.HistoryKind\x12)\n\x07storage\x18\x02 \x01(\x0b\x32\x18.flare.runtime.StateView\x12\x19\n\x11tokens_per_record\x18\x03 \x01(\x04\x12\x15\n\rwindow_tokens\x18\x04 \x01(\x04\"4\n\rPageTableView\x12\x0e\n\x06\x62uffer\x18\x01 \x01(\t\x12\x13\n\x0bpage_offset\x18\x02 \x01(\x04\"\xc4\x01\n\x0cValueBinding\x12\x0e\n\x06\x62uffer\x18\x01 \x01(\t\x12*\n\x06source\x18\x02 \x01(\x0e\x32\x1a.flare.runtime.ValueSource\x12.\n\x08indexing\x18\x03 \x01(\x0e\x32\x1c.flare.runtime.InputIndexing\x12\x14\n\x0cvalue_offset\x18\x04 \x01(\x12\x12\x0f\n\x07padding\x18\x05 \x01(\x12\x12\x0e\n\x06tensor\x18\x06 \x01(\t\x12\x11\n\tparameter\x18\x07 \x01(\t\"K\n\tStateView\x12\x0e\n\x06\x62uffer\x18\x01 \x01(\t\x12\x0e\n\x06offset\x18\x02 \x01(\x04\x12\x0e\n\x06stride\x18\x03 \x01(\x04\x12\x0e\n\x06nbytes\x18\x04 \x01(\x04\"e\n\x0bStateAccess\x12&\n\x04view\x18\x01 \x01(\x0b\x32\x18.flare.runtime.StateView\x12.\n\x06\x61\x63\x63\x65ss\x18\x02 \x01(\x0e\x32\x1e.flare.runtime.StateAccessKind\"O\n\x10\x43ompletionCursor\x12\'\n\x05state\x18\x01 \x01(\x0b\x32\x18.flare.runtime.StateView\x12\x12\n\nlag_tokens\x18\x02 \x01(\x04\"4\n\x0cTunedBinding\x12\x0e\n\x06\x62uffer\x18\x01 \x01(\t\x12\x14\n\x0ctuning_graph\x18\x02 \x01(\t\"\xfa\x02\n\rGraphContract\x12\r\n\x05graph\x18\x01 \x01(\t\x12+\n\x06inputs\x18\x02 \x03(\x0b\x32\x1b.flare.runtime.ValueBinding\x12)\n\x05state\x18\x03 \x03(\x0b\x32\x1a.flare.runtime.StateAccess\x12\x1e\n\x16state_rows_per_request\x18\x04 \x01(\x04\x12\x35\n\x0c\x64raft_cursor\x18\x05 \x01(\x0b\x32\x1f.flare.runtime.CompletionCursor\x12\x18\n\x10\x65mbedding_tables\x18\x06 \x03(\r\x12/\n\rpending_token\x18\x07 \x01(\x0b\x32\x18.flare.runtime.StateView\x12+\n\x04kind\x18\x08 \x01(\x0e\x32\x1d.flare.runtime.GraphOperation\x12\x33\n\x0etuned_bindings\x18\t \x03(\x0b\x32\x1b.flare.runtime.TunedBinding\"k\n\nToolParser\x12+\n\x04kind\x18\x01 \x01(\x0e\x32\x1d.flare.runtime.ToolParserKind\x12\x19\n\x11wrapping_newlines\x18\x02 \x01(\r\x12\x15\n\rtag_separator\x18\x03 \x01(\t\"\x95\x01\n\x0fReasoningParser\x12\x30\n\x04kind\x18\x01 \x01(\x0e\x32\".flare.runtime.ReasoningParserKind\x12\x0c\n\x04open\x18\x02 \x01(\t\x12\r\n\x05\x63lose\x18\x03 \x01(\t\x12\x19\n\x11wrapping_newlines\x18\x04 \x01(\r\x12\x18\n\x10terminal_markers\x18\x05 \x03(\t\"\xca\x01\n\x0ePrefixBoundary\x12\r\n\x05roles\x18\x01 \x03(\t\x12\x18\n\x0b\x61ppend_role\x18\x02 \x01(\tH\x00\x88\x01\x01\x12\x1e\n\x16\x63ontinue_final_message\x18\x03 \x01(\x08\x12\x18\n\x10minimum_messages\x18\x04 \x01(\x04\x12\x16\n\x0erequired_start\x18\x05 \x01(\t\x12\x14\n\x0crequired_end\x18\x06 \x01(\t\x12\x17\n\x0frequired_marker\x18\x07 \x01(\tB\x0e\n\x0c_append_role\"y\n\tImageSpan\x12\x13\n\x0bstart_token\x18\x01 \x01(\r\x12\x11\n\tend_token\x18\x02 \x01(\r\x12\x12\n\nmax_tokens\x18\x03 \x01(\x04\x12\x17\n\x0finterior_tokens\x18\x04 \x03(\r\x12\x17\n\x0funscoped_tokens\x18\x05 \x03(\r\"Q\n\x10ImageTokenLayout\x12\x15\n\rfeature_token\x18\x01 \x01(\r\x12&\n\x04span\x18\x02 \x01(\x0b\x32\x18.flare.runtime.ImageSpan\"\xf2\x03\n\x10\x46rontendContract\x12(\n\x05tools\x18\x01 \x01(\x0b\x32\x19.flare.runtime.ToolParser\x12\x31\n\treasoning\x18\x02 \x01(\x0b\x32\x1e.flare.runtime.ReasoningParser\x12\x43\n\x11image_preparation\x18\x03 \x01(\x0e\x32#.flare.runtime.ImagePreparationKindH\x00\x88\x01\x01\x12\x39\n\x0cimage_layout\x18\x04 \x01(\x0e\x32\x1e.flare.runtime.ImageLayoutKindH\x01\x88\x01\x01\x12\x17\n\x0frejected_tokens\x18\x05 \x03(\r\x12\x1b\n\x13position_dimensions\x18\x06 \x01(\r\x12\x18\n\x10\x61ssistant_marker\x18\x07 \x01(\t\x12\x1b\n\x13message_end_markers\x18\x08 \x03(\t\x12\x36\n\x0fprefix_boundary\x18\t \x01(\x0b\x32\x1d.flare.runtime.PrefixBoundary\x12\x35\n\x0cimage_tokens\x18\n \x01(\x0b\x32\x1f.flare.runtime.ImageTokenLayoutB\x14\n\x12_image_preparationB\x0f\n\r_image_layout\"1\n\x07\x43luster\x12\r\n\x05world\x18\x01 \x01(\r\x12\x11\n\texport_id\x18\x03 \x01(\tJ\x04\x08\x02\x10\x03\"\x8c\x03\n\x19\x44\x65\x66\x61ultSamplingParameters\x12\x11\n\x04seed\x18\x01 \x01(\x04H\x00\x88\x01\x01\x12\x18\n\x0btemperature\x18\x02 \x01(\x02H\x01\x88\x01\x01\x12\x12\n\x05top_k\x18\x03 \x01(\x05H\x02\x88\x01\x01\x12\x12\n\x05top_p\x18\x04 \x01(\x02H\x03\x88\x01\x01\x12\x12\n\x05min_p\x18\x05 \x01(\x02H\x04\x88\x01\x01\x12\x1f\n\x12repetition_penalty\x18\x06 \x01(\x02H\x05\x88\x01\x01\x12\x1d\n\x10presence_penalty\x18\x07 \x01(\x02H\x06\x88\x01\x01\x12\x1e\n\x11\x66requency_penalty\x18\x08 \x01(\x02H\x07\x88\x01\x01\x12-\n\x06ranges\x18\t \x01(\x0b\x32\x1d.flare.runtime.SamplingRangesB\x07\n\x05_seedB\x0e\n\x0c_temperatureB\x08\n\x06_top_kB\x08\n\x06_top_pB\x08\n\x06_min_pB\x15\n\x13_repetition_penaltyB\x13\n\x11_presence_penaltyB\x14\n\x12_frequency_penalty\"H\n\x12SamplingFloatRange\x12\x10\n\x03min\x18\x01 \x01(\x02H\x00\x88\x01\x01\x12\x10\n\x03max\x18\x02 \x01(\x02H\x01\x88\x01\x01\x42\x06\n\x04_minB\x06\n\x04_max\"F\n\x10SamplingIntRange\x12\x10\n\x03min\x18\x01 \x01(\x05H\x00\x88\x01\x01\x12\x10\n\x03max\x18\x02 \x01(\x05H\x01\x88\x01\x01\x42\x06\n\x04_minB\x06\n\x04_max\"\x96\x03\n\x0eSamplingRanges\x12\x36\n\x0btemperature\x18\x01 \x01(\x0b\x32!.flare.runtime.SamplingFloatRange\x12.\n\x05top_k\x18\x02 \x01(\x0b\x32\x1f.flare.runtime.SamplingIntRange\x12\x30\n\x05top_p\x18\x03 \x01(\x0b\x32!.flare.runtime.SamplingFloatRange\x12\x30\n\x05min_p\x18\x04 \x01(\x0b\x32!.flare.runtime.SamplingFloatRange\x12=\n\x12repetition_penalty\x18\x05 \x01(\x0b\x32!.flare.runtime.SamplingFloatRange\x12;\n\x10presence_penalty\x18\x06 \x01(\x0b\x32!.flare.runtime.SamplingFloatRange\x12<\n\x11\x66requency_penalty\x18\x07 \x01(\x0b\x32!.flare.runtime.SamplingFloatRange\"\xc5\x02\n\x10\x46rontendSettings\x12\x33\n\ttokenizer\x18\x01 \x01(\x0b\x32 .flare.runtime.TokenizerSettings\x12+\n\x05image\x18\x02 \x01(\x0b\x32\x1c.flare.runtime.ImageSettings\x12\x15\n\reos_token_ids\x18\x03 \x03(\r\x12:\n\x11template_encoding\x18\x04 \x01(\x0e\x32\x1f.flare.runtime.TemplateEncoding\x12\x34\n\x0eprompt_encoder\x18\x05 \x01(\x0e\x32\x1c.flare.runtime.PromptEncoder\x12\'\n\x1aimage_placeholder_token_id\x18\x06 \x01(\rH\x00\x88\x01\x01\x42\x1d\n\x1b_image_placeholder_token_id\"\xdc\x02\n\x11TokenizerSettings\x12\x16\n\tbos_token\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x16\n\teos_token\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x16\n\tunk_token\x18\x03 \x01(\tH\x02\x88\x01\x01\x12\x16\n\tsep_token\x18\x04 \x01(\tH\x03\x88\x01\x01\x12\x16\n\tpad_token\x18\x05 \x01(\tH\x04\x88\x01\x01\x12\x16\n\tcls_token\x18\x06 \x01(\tH\x05\x88\x01\x01\x12\x17\n\nmask_token\x18\x07 \x01(\tH\x06\x88\x01\x01\x12;\n\x19\x61\x64\x64itional_special_tokens\x18\x08 \x01(\x0b\x32\x18.flare.runtime.TokenListB\x0c\n\n_bos_tokenB\x0c\n\n_eos_tokenB\x0c\n\n_unk_tokenB\x0c\n\n_sep_tokenB\x0c\n\n_pad_tokenB\x0c\n\n_cls_tokenB\r\n\x0b_mask_token\"\x1b\n\tTokenList\x12\x0e\n\x06values\x18\x01 \x03(\t\"\xfc\x03\n\rImageSettings\x12\x30\n\x04qwen\x18\x01 \x01(\x0b\x32 .flare.runtime.QwenImageSettingsH\x00\x12\x30\n\x04mimo\x18\x02 \x01(\x0b\x32 .flare.runtime.MimoImageSettingsH\x00\x12)\n\tdeepseek4\x18\x03 \x01(\x0b\x32\x14.flare.runtime.EmptyH\x00\x12\'\n\x07moonvit\x18\x04 \x01(\x0b\x32\x14.flare.runtime.EmptyH\x00\x12$\n\x04step\x18\x05 \x01(\x0b\x32\x14.flare.runtime.EmptyH\x00\x12%\n\x05radio\x18\x06 \x01(\x0b\x32\x14.flare.runtime.EmptyH\x00\x12J\n\x12\x64\x65\x65pseek_row_major\x18\x07 \x01(\x0b\x32,.flare.runtime.DeepseekRowMajorImageSettingsH\x00\x12#\n\x03glm\x18\x08 \x01(\x0b\x32\x14.flare.runtime.EmptyH\x00\x12=\n\x0bpatch_merge\x18\t \x01(\x0b\x32&.flare.runtime.PatchMergeImageSettingsH\x00\x12+\n\x0bpadded_grid\x18\n \x01(\x0b\x32\x14.flare.runtime.EmptyH\x00\x42\t\n\x07profile\"\xb9\x01\n\x17PatchMergeImageSettings\x12\x12\n\npatch_size\x18\x01 \x01(\r\x12\x12\n\nmin_pixels\x18\x02 \x01(\x04\x12\x12\n\nmax_pixels\x18\x03 \x01(\x04\x12\x12\n\nimage_mean\x18\x04 \x03(\x02\x12\x11\n\timage_std\x18\x05 \x03(\x02\x12\x13\n\x0bimage_token\x18\x06 \x01(\t\x12\x13\n\x0bstart_token\x18\x07 \x01(\t\x12\x11\n\tend_token\x18\x08 \x01(\t\"\x87\x01\n\x1d\x44\x65\x65pseekRowMajorImageSettings\x12\x12\n\nmin_pixels\x18\x01 \x01(\x04\x12\x12\n\nmax_tokens\x18\x02 \x01(\x04\x12#\n\x16max_width_height_ratio\x18\x03 \x01(\x04H\x00\x88\x01\x01\x42\x19\n\x17_max_width_height_ratio\"\x82\x01\n\x11QwenImageSettings\x12\x12\n\nmin_pixels\x18\x01 \x01(\x04\x12\x12\n\nmax_pixels\x18\x02 \x01(\x04\x12\x15\n\rposition_side\x18\x03 \x01(\r\x12\x16\n\x0eimage_token_id\x18\x04 \x01(\r\x12\x16\n\x0evideo_token_id\x18\x05 \x01(\r\"b\n\x11MimoImageSettings\x12\x12\n\nmin_pixels\x18\x01 \x01(\x04\x12\x12\n\nmax_pixels\x18\x02 \x01(\x04\x12\x12\n\nimage_mean\x18\x03 \x03(\x02\x12\x11\n\timage_std\x18\x04 \x03(\x02\"|\n\x06\x45ngram\x12\x11\n\ttoken_map\x18\x01 \x03(\r\x12\x14\n\x0cpad_token_id\x18\x02 \x01(\r\x12\x1d\n\x15\x63ompressed_vocabulary\x18\x03 \x01(\r\x12*\n\x06tables\x18\x04 \x03(\x0b\x32\x1a.flare.runtime.EngramTable\"\x99\x04\n\x0b\x45ngramTable\x12\r\n\x05layer\x18\x01 \x01(\r\x12\x0c\n\x04rows\x18\x02 \x01(\x04\x12\x17\n\x0f\x65mbedding_width\x18\x03 \x01(\r\x12\x13\n\x0bscale_block\x18\x04 \x01(\r\x12$\n\x07weights\x18\x05 \x01(\x0b\x32\x13.flare.runtime.Span\x12#\n\x06scales\x18\x06 \x01(\x0b\x32\x13.flare.runtime.Span\x12\'\n\x04hash\x18\x07 \x01(\x0b\x32\x19.flare.runtime.EngramHash\x12\x15\n\rweight_buffer\x18\x08 \x01(\t\x12\x14\n\x0cscale_buffer\x18\t \x01(\t\x12\x13\n\x0bhash_buffer\x18\n \x01(\t\x12\x13\n\x0bready_event\x18\x0b \x01(\t\x12\x35\n\x08\x65ncoding\x18\x0c \x01(\x0e\x32#.flare.runtime.EngramTable.Encoding\x12\x16\n\x0erequest_buffer\x18\r \x01(\t\x12\x14\n\x0cglobal_scale\x18\x0e \x01(\x02\x12/\n\x06shards\x18\x0f \x03(\x0b\x32\x1f.flare.runtime.EngramTableShard\x12\x17\n\x0fprefetch_buffer\x18\x10 \x01(\t\"E\n\x08\x45ncoding\x12\x0f\n\x0bUNSPECIFIED\x10\x00\x12\x11\n\rFP8_E4M3_E8M0\x10\x01\x12\x15\n\x11NVFP4_E4M3_GLOBAL\x10\x02\"\x8c\x01\n\x10\x45ngramTableShard\x12\x0c\n\x04rank\x18\x01 \x01(\r\x12\x11\n\tfirst_row\x18\x02 \x01(\x04\x12\x0c\n\x04rows\x18\x03 \x01(\x04\x12$\n\x07weights\x18\x04 \x01(\x0b\x32\x13.flare.runtime.Span\x12#\n\x06scales\x18\x05 \x01(\x0b\x32\x13.flare.runtime.Span\"\xc3\x01\n\nEngramHash\x12\x30\n\x06method\x18\x01 \x01(\x0e\x32 .flare.runtime.EngramHash.Method\x12\x0e\n\x06orders\x18\x02 \x03(\r\x12\x13\n\x0bmultipliers\x18\x03 \x03(\x04\x12\x0e\n\x06primes\x18\x04 \x03(\x04\x12\x0f\n\x07offsets\x18\x05 \x03(\x04\"=\n\x06Method\x12\x0f\n\x0bUNSPECIFIED\x10\x00\x12\x0e\n\nXOR_MODULO\x10\x01\x12\x12\n\x0e\x45OS_XOR_MODULO\x10\x02\"K\n\x05\x41sset\x12\x0c\n\x04name\x18\x01 \x01(\t\x12$\n\x07payload\x18\x02 \x01(\x0b\x32\x13.flare.runtime.Span\x12\x0e\n\x06sha256\x18\x03 \x01(\t\"\xd3\x04\n\x0b\x42undleIndex\x12\x14\n\x0c\x61rchitecture\x18\x01 \x03(\x05\x12.\n\x0b\x61llocations\x18\x02 \x03(\x0b\x32\x19.flare.runtime.Allocation\x12&\n\x07modules\x18\x03 \x03(\x0b\x32\x15.flare.runtime.Module\x12*\n\tfunctions\x18\x04 \x03(\x0b\x32\x17.flare.runtime.Function\x12)\n\x06graphs\x18\x05 \x03(\x0b\x32\x19.flare.runtime.GraphIndex\x12\x30\n\x0creservations\x18\x06 \x03(\x0b\x32\x1a.flare.runtime.Reservation\x12+\n\texecution\x18\x07 \x01(\x0b\x32\x18.flare.runtime.Execution\x12\'\n\x07\x63ontext\x18\x08 \x01(\x0b\x32\x16.flare.runtime.Context\x12<\n\tresources\x18\t \x03(\x0b\x32).flare.runtime.BundleIndex.ResourcesEntry\x12\x0e\n\x06\x65vents\x18\n \x03(\t\x12*\n\x04roce\x18\x0b \x01(\x0b\x32\x1c.flare.runtime.RoceTransport\x12\x36\n\x0frebuild_weights\x18\x0c \x01(\x0b\x32\x1d.flare.runtime.RebuildWeights\x1a\x45\n\x0eResourcesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\"\n\x05value\x18\x02 \x01(\x0b\x32\x13.flare.runtime.Span:\x02\x38\x01\"\xf8\x01\n\rRoceTransport\x12\x11\n\tproxy_abi\x18\x01 \x01(\r\x12\r\n\x05world\x18\x02 \x01(\r\x12\x0c\n\x04rank\x18\x03 \x01(\r\x12\x16\n\x0eregion_address\x18\x04 \x01(\x04\x12\x14\n\x0cregion_bytes\x18\x05 \x01(\x04\x12\x18\n\x10\x63ounters_address\x18\x06 \x01(\x04\x12\x16\n\x0e\x63ounters_bytes\x18\x07 \x01(\x04\x12\x12\n\nslot_bytes\x18\x08 \x01(\x04\x12\x12\n\npipe_bytes\x18\t \x01(\x04\x12\x13\n\x0b\x63trl_offset\x18\n \x01(\x04\x12\x14\n\x0cvarlen_bytes\x18\x10 \x01(\x04J\x04\x08\x0b\x10\x10\"v\n\nGraphIndex\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\r\n\x05\x66lags\x18\x02 \x01(\x04\x12\x10\n\x08resource\x18\x03 \x01(\t\x12\x12\n\nnode_count\x18\x04 \x01(\x04\x12\x12\n\nedge_count\x18\x05 \x01(\x04\x12\x11\n\tfunctions\x18\x06 \x03(\x04\"M\n\nPeerMemory\x12\r\n\x05owner\x18\x01 \x01(\r\x12\x0f\n\x07\x61\x64\x64ress\x18\x02 \x01(\x04\x12\x0e\n\x06nbytes\x18\x03 \x01(\x04\x12\x0f\n\x07readers\x18\x04 \x03(\r\"M\n\x07\x43ontext\x12\r\n\x05\x66lags\x18\x01 \x01(\r\x12\r\n\x05\x63\x61\x63he\x18\x02 \x01(\x05\x12$\n\x06limits\x18\x03 \x03(\x0b\x32\x14.flare.runtime.Limit\"\"\n\x05Limit\x12\n\n\x02id\x18\x01 \x01(\x04\x12\r\n\x05value\x18\x02 \x01(\x04\".\n\x0bReservation\x12\x0f\n\x07\x61\x64\x64ress\x18\x01 \x01(\x04\x12\x0e\n\x06nbytes\x18\x02 \x01(\x04\"8\n\x04Span\x12\x0e\n\x06offset\x18\x01 \x01(\x04\x12\x0e\n\x06nbytes\x18\x02 \x01(\x04\x12\x10\n\x08\x66ilename\x18\x03 \x01(\t\"\xa2\x02\n\nAllocation\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0e\n\x06nbytes\x18\x02 \x01(\x04\x12\x11\n\talignment\x18\x03 \x01(\x04\x12\x11\n\x04\x66ile\x18\x04 \x01(\tH\x00\x88\x01\x01\x12\'\n\ndata_spans\x18\x05 \x03(\x0b\x32\x13.flare.runtime.Span\x12.\n\x0brelocations\x18\x06 \x03(\x0b\x32\x19.flare.runtime.Relocation\x12\x14\n\x07\x61\x64\x64ress\x18\x07 \x01(\x04H\x01\x88\x01\x01\x12%\n\x06memory\x18\x08 \x01(\x0e\x32\x15.flare.runtime.Memory\x12%\n\x06sizing\x18\t \x01(\x0b\x32\x15.flare.runtime.SizingB\x07\n\x05_fileB\n\n\x08_address\"X\n\x06Sizing\x12)\n\x08\x63\x61pacity\x18\x01 \x01(\x0e\x32\x17.flare.runtime.Capacity\x12\x12\n\nunit_bytes\x18\x02 \x01(\x04\x12\x0f\n\x07maximum\x18\x03 \x01(\x04\"L\n\x06Module\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0c\n\x04\x66ile\x18\x02 \x01(\t\x12&\n\x07globals\x18\x03 \x03(\x0b\x32\x15.flare.runtime.Global\"f\n\x06Global\x12\x0e\n\x06symbol\x18\x01 \x01(\t\x12\x0c\n\x04\x66ile\x18\x02 \x01(\t\x12\x0e\n\x06nbytes\x18\x03 \x01(\x04\x12.\n\x0brelocations\x18\x04 \x03(\x0b\x32\x19.flare.runtime.Relocation\"y\n\x08\x46unction\x12\x0e\n\x06module\x18\x01 \x01(\t\x12\x0e\n\x06symbol\x18\x02 \x01(\t\x12\x17\n\x0fparameter_sizes\x18\x03 \x03(\x04\x12\x34\n\nattributes\x18\x04 \x03(\x0b\x32 .flare.runtime.FunctionAttribute\".\n\x11\x46unctionAttribute\x12\n\n\x02id\x18\x01 \x01(\x05\x12\r\n\x05value\x18\x02 \x01(\x05\"/\n\tReference\x12\x12\n\nallocation\x18\x01 \x01(\t\x12\x0e\n\x06offset\x18\x02 \x01(\x04\"s\n\nRelocation\x12\x0e\n\x06offset\x18\x01 \x01(\x04\x12(\n\x06target\x18\x02 \x01(\x0b\x32\x18.flare.runtime.Reference\x12+\n\x04kind\x18\x03 \x01(\x0e\x32\x1d.flare.runtime.RelocationKind\"D\n\x04\x42lob\x12\x0c\n\x04\x64\x61ta\x18\x01 \x01(\x0c\x12.\n\x0brelocations\x18\x02 \x03(\x0b\x32\x19.flare.runtime.Relocation\";\n\tAttribute\x12\n\n\x02id\x18\x01 \x01(\x05\x12\"\n\x05value\x18\x02 \x01(\x0b\x32\x13.flare.runtime.Blob\"\x9d\x01\n\x06Kernel\x12\x10\n\x08\x66unction\x18\x01 \x01(\x04\x12\x0c\n\x04grid\x18\x02 \x03(\r\x12\r\n\x05\x62lock\x18\x03 \x03(\r\x12\x0e\n\x06shared\x18\x04 \x01(\r\x12&\n\targuments\x18\x05 \x03(\x0b\x32\x13.flare.runtime.Blob\x12,\n\nattributes\x18\x06 \x03(\x0b\x32\x18.flare.runtime.Attribute\"\x8a\x01\n\x06Memset\x12-\n\x0b\x64\x65stination\x18\x01 \x01(\x0b\x32\x18.flare.runtime.Reference\x12\r\n\x05pitch\x18\x02 \x01(\x04\x12\r\n\x05value\x18\x03 \x01(\r\x12\x14\n\x0c\x65lement_size\x18\x04 \x01(\r\x12\r\n\x05width\x18\x05 \x01(\x04\x12\x0e\n\x06height\x18\x06 \x01(\x04\"o\n\x04\x43opy\x12(\n\x06source\x18\x01 \x01(\x0b\x32\x18.flare.runtime.Reference\x12-\n\x0b\x64\x65stination\x18\x02 \x01(\x0b\x32\x18.flare.runtime.Reference\x12\x0e\n\x06nbytes\x18\x03 \x01(\x04\"\x07\n\x05\x45mpty\"\x1a\n\tEventWait\x12\r\n\x05\x65vent\x18\x01 \x01(\t\"\xe1\x01\n\x04Node\x12\'\n\x06kernel\x18\x01 \x01(\x0b\x32\x15.flare.runtime.KernelH\x00\x12\'\n\x06memset\x18\x02 \x01(\x0b\x32\x15.flare.runtime.MemsetH\x00\x12#\n\x04\x63opy\x18\x03 \x01(\x0b\x32\x13.flare.runtime.CopyH\x00\x12%\n\x05\x65mpty\x18\x04 \x01(\x0b\x32\x14.flare.runtime.EmptyH\x00\x12.\n\nevent_wait\x18\x05 \x01(\x0b\x32\x18.flare.runtime.EventWaitH\x00\x42\x0b\n\toperation\"9\n\x04\x45\x64ge\x12\x0e\n\x06source\x18\x01 \x01(\x04\x12\x13\n\x0b\x64\x65stination\x18\x02 \x01(\x04\x12\x0c\n\x04\x64\x61ta\x18\x03 \x01(\x0c\"\xb9\x02\n\tExecution\x12\x13\n\x0b\x61\x62i_version\x18\x01 \x01(\r\x12\x12\n\nmax_active\x18\x02 \x01(\x04\x12\x19\n\x11input_frame_bytes\x18\x03 \x01(\x04\x12&\n\x07\x62uffers\x18\x04 \x03(\x0b\x32\x15.flare.runtime.Buffer\x12-\n\x06graphs\x18\x05 \x03(\x0b\x32\x1d.flare.runtime.ExecutionGraph\x12\x31\n\rtuning_graphs\x18\x06 \x03(\x0b\x32\x1a.flare.runtime.TuningGraph\x12!\n\x19\x63ompletion_token_capacity\x18\x07 \x01(\r\x12;\n\x12persistent_workers\x18\x08 \x03(\x0b\x32\x1f.flare.runtime.PersistentWorker\"\xa9\x01\n\x10PersistentWorker\x12\x17\n\x0fworker_sm_count\x18\x01 \x01(\r\x12\r\n\x05graph\x18\x02 \x01(\t\x12+\n\tstop_flag\x18\x03 \x01(\x0b\x32\x18.flare.runtime.Reference\x12)\n\x07metrics\x18\x04 \x01(\x0b\x32\x18.flare.runtime.Reference\x12\x15\n\rmetrics_count\x18\x05 \x01(\r\"C\n\x0bTuningGraph\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0f\n\x07outputs\x18\x02 \x03(\t\x12\x15\n\rstatus_buffer\x18\x03 \x01(\t\"\x82\x01\n\x06\x42uffer\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0e\n\x06nbytes\x18\x02 \x01(\x04\x12\r\n\x05\x64type\x18\x03 \x01(\t\x12\r\n\x05shape\x18\x04 \x03(\x04\x12\x0f\n\x07strides\x18\x05 \x03(\x04\x12+\n\treference\x18\x06 \x01(\x0b\x32\x18.flare.runtime.Reference\"\x95\x04\n\x0e\x45xecutionGraph\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0c\n\x04kind\x18\x02 \x01(\t\x12\x15\n\rsampling_mode\x18\x03 \x01(\t\x12\x16\n\x0e\x62\x61tch_capacity\x18\x04 \x01(\x04\x12\x16\n\x0etoken_capacity\x18\x05 \x01(\x04\x12\x33\n\x0einput_bindings\x18\x06 \x03(\x0b\x32\x1b.flare.runtime.InputBinding\x12\x19\n\x0c\x64raft_tokens\x18\x07 \x01(\rH\x00\x88\x01\x01\x12\x1a\n\rverify_tokens\x18\x08 \x01(\rH\x01\x88\x01\x01\x12\x30\n\x0c\x64raft_source\x18\t \x01(\x0e\x32\x1a.flare.runtime.DraftSource\x12 \n\x13speculation_enabled\x18\n \x01(\x08H\x02\x88\x01\x01\x12\x1d\n\x15\x65stimated_duration_ns\x18\x0b \x01(\x04\x12\x18\n\x10prefill_capacity\x18\x0c \x01(\x04\x12\x1d\n\x15packed_token_capacity\x18\r \x01(\x04\x12\x18\n\x10\x63onfidence_width\x18\x0e \x01(\r\x12\x33\n\x0etuned_bindings\x18\x0f \x03(\x0b\x32\x1b.flare.runtime.TunedBindingB\x0f\n\r_draft_tokensB\x10\n\x0e_verify_tokensB\x16\n\x14_speculation_enabled\"H\n\x0cInputBinding\x12\x13\n\x0b\x62uffer_name\x18\x01 \x01(\t\x12\x13\n\x0bhost_offset\x18\x02 \x01(\x04\x12\x0e\n\x06nbytes\x18\x03 \x01(\x04*\xfa\x01\n\x19PreparationParameterScope\x12+\n\'PREPARATION_PARAMETER_SCOPE_UNSPECIFIED\x10\x00\x12*\n&PREPARATION_PARAMETER_SCOPE_DEPLOYMENT\x10\x01\x12\'\n#PREPARATION_PARAMETER_SCOPE_COMBINE\x10\x02\x12-\n)PREPARATION_PARAMETER_SCOPE_TARGET_WEIGHT\x10\x03\x12,\n(PREPARATION_PARAMETER_SCOPE_DRAFT_WEIGHT\x10\x04*\x8e\x01\n\x0bHistoryKind\x12\x17\n\x13HISTORY_UNSPECIFIED\x10\x00\x12\x13\n\x0fPAGED_KEY_VALUE\x10\x01\x12\x10\n\x0cPAGED_LATENT\x10\x02\x12\x12\n\x0eSLIDING_WINDOW\x10\x03\x12\x13\n\x0fRECURRENT_STATE\x10\x04\x12\x16\n\x12\x43ONTINUATION_STATE\x10\x05*\xc7\x07\n\x0bValueSource\x12\x15\n\x11VALUE_UNSPECIFIED\x10\x00\x12\x0c\n\x08\x43ONSTANT\x10\x01\x12\x10\n\x0cREQUEST_SLOT\x10\x02\x12\x16\n\x12REQUEST_GENERATION\x10\x03\x12\r\n\tLIVE_ROWS\x10\x04\x12\x10\n\x0cQUERY_LENGTH\x10\x05\x12\x12\n\x0eSAMPLE_ENABLED\x10\x06\x12\x10\n\x0cPROMPT_TOKEN\x10\x07\x12\x11\n\rPENDING_TOKEN\x10\x08\x12\x1c\n\x18PROMPT_AND_PENDING_TOKEN\x10\t\x12\x13\n\x0fPROMPT_POSITION\x10\n\x12\x17\n\x13IMAGE_FEATURE_INDEX\x10\x0b\x12\x16\n\x12IMAGE_LEFT_CONTEXT\x10\x0c\x12\x17\n\x13IMAGE_RIGHT_CONTEXT\x10\r\x12\x0e\n\nPAGE_TABLE\x10\x0e\x12\x13\n\x0fLIVE_STATE_ROWS\x10\x0f\x12\x12\n\x0eLIVE_STATE_ROW\x10\x10\x12\x14\n\x10PREFIX_STATE_ROW\x10\x11\x12\x16\n\x12SNAPSHOT_STATE_ROW\x10\x12\x12\x13\n\x0f\x43ONSUMED_TOKENS\x10\x13\x12\x1c\n\x18SNAPSHOT_CONSUMED_TOKENS\x10\x14\x12\x0f\n\x0bPREFILL_ROW\x10\x15\x12\x11\n\rSAMPLING_SEED\x10\x16\x12\x17\n\x13SAMPLING_PARAMETERS\x10\x17\x12\x12\n\x0eSAMPLING_TOP_K\x10\x18\x12\x12\n\x0eMAX_NEW_TOKENS\x10\x19\x12\x11\n\rEOS_TOKEN_IDS\x10\x1a\x12\r\n\tEOS_COUNT\x10\x1b\x12\x14\n\x10PROMPT_HISTOGRAM\x10\x1c\x12\x10\n\x0cGRAMMAR_MASK\x10\x1d\x12\x13\n\x0fGRAMMAR_ENABLED\x10\x1e\x12\x12\n\x0e\x43OPY_TOKEN_IDS\x10\x1f\x12\x14\n\x10\x43OPY_TOKEN_COUNT\x10 \x12\x18\n\x14\x43OPY_CONSUMED_TOKENS\x10!\x12\x13\n\x0f\x43OPY_GENERATION\x10\"\x12\x15\n\x11\x43OPY_GRAMMAR_MASK\x10#\x12\x16\n\x12\x43OPY_GRAMMAR_COUNT\x10$\x12\x10\n\x0cIMAGE_TENSOR\x10%\x12\x16\n\x12IMAGE_FEATURE_SLOT\x10&\x12\x17\n\x13PROMPT_TARGET_TOKEN\x10\'\x12\x1c\n\x18SPECULATIVE_PREFIX_LIMIT\x10(\x12\x1a\n\x16PROMPT_LOOKAHEAD_TOKEN\x10)\x12\x1b\n\x17PROMPT_LOOKAHEAD_LENGTH\x10*\x12\x12\n\x0e\x43ORE_PARAMETER\x10+*|\n\rInputIndexing\x12\x18\n\x14INDEXING_UNSPECIFIED\x10\x00\x12\n\n\x06SCALAR\x10\x01\x12\x12\n\x0eSUBMISSION_ROW\x10\x02\x12\x0f\n\x0bREQUEST_ROW\x10\x03\x12\x10\n\x0cPACKED_TOKEN\x10\x04\x12\x0e\n\nACTIVE_ROW\x10\x05*T\n\x0fStateAccessKind\x12\x1c\n\x18STATE_ACCESS_UNSPECIFIED\x10\x00\x12\x08\n\x04READ\x10\x01\x12\t\n\x05WRITE\x10\x02\x12\x0e\n\nREAD_WRITE\x10\x03*\x8b\x02\n\x0eGraphOperation\x12\x1f\n\x1bGRAPH_OPERATION_UNSPECIFIED\x10\x00\x12\x08\n\x04INIT\x10\x01\x12\x0b\n\x07RESTORE\x10\x02\x12\x0c\n\x08SNAPSHOT\x10\x03\x12\x0b\n\x07PREFILL\x10\x04\x12\n\n\x06\x44\x45\x43ODE\x10\x05\x12\n\n\x06RESUME\x10\x06\x12\n\n\x06VISION\x10\x07\x12\x0f\n\x0bSPECULATIVE\x10\x08\x12\t\n\x05MIXED\x10\t\x12\x12\n\x0eSCORED_PREFILL\x10\x0c\x12\x14\n\x10TERMINAL_PREFILL\x10\x0e\"\x04\x08\n\x10\n\"\x04\x08\x0b\x10\x0b\"\x04\x08\r\x10\r*\x08PROPOSAL*\x0cVERIFICATION*\x12PACKED_SPECULATIVE*\xa1\x01\n\x0eToolParserKind\x12\x1b\n\x17TOOL_PARSER_UNSPECIFIED\x10\x00\x12\x0e\n\nQWEN_CODER\x10\x01\x12\x15\n\x11GLM_ARGUMENT_TAGS\x10\x02\x12\x08\n\x04\x44SML\x10\x03\x12\x08\n\x04XTML\x10\x04\x12\x0f\n\x0bMINIMAX_XML\x10\x05\x12\x0e\n\nGEMMA_CALL\x10\x06\x12\x08\n\x04\x41TEM\x10\x07\x12\x0c\n\x08TML_JSON\x10\x08*\xa6\x01\n\x13ReasoningParserKind\x12 \n\x1cREASONING_PARSER_UNSPECIFIED\x10\x00\x12\x0e\n\nTHINK_TAGS\x10\x01\x12\x0e\n\nXTML_THINK\x10\x02\x12\x0c\n\x08MM_THINK\x10\x03\x12\x13\n\x0f\x43HANNEL_THOUGHT\x10\x04\x12\x15\n\x11RECIPIENT_HEADERS\x10\x05\x12\x13\n\x0f\x43ONTENT_HEADERS\x10\x06*\xf4\x02\n\x14ImagePreparationKind\x12!\n\x1dIMAGE_PREPARATION_UNSPECIFIED\x10\x00\x12\x1a\n\x16QWEN_IMAGE_PREPARATION\x10\x01\x12\x1a\n\x16MIMO_IMAGE_PREPARATION\x10\x02\x12\x1e\n\x1a\x44\x45\x45PSEEK_IMAGE_PREPARATION\x10\x03\x12\x1d\n\x19MOONVIT_IMAGE_PREPARATION\x10\x04\x12\x1a\n\x16STEP_IMAGE_PREPARATION\x10\x05\x12\x1b\n\x17RADIO_IMAGE_PREPARATION\x10\x06\x12(\n$DEEPSEEK_ROW_MAJOR_IMAGE_PREPARATION\x10\x07\x12\x19\n\x15GLM_IMAGE_PREPARATION\x10\x08\x12!\n\x1dPATCH_MERGE_IMAGE_PREPARATION\x10\t\x12!\n\x1dPADDED_GRID_IMAGE_PREPARATION\x10\n*\xb6\x02\n\x0fImageLayoutKind\x12\x1c\n\x18IMAGE_LAYOUT_UNSPECIFIED\x10\x00\x12\x15\n\x11QWEN_IMAGE_LAYOUT\x10\x01\x12\x15\n\x11MIMO_IMAGE_LAYOUT\x10\x02\x12\x19\n\x15\x44\x45\x45PSEEK_IMAGE_LAYOUT\x10\x03\x12\x18\n\x14MOONVIT_IMAGE_LAYOUT\x10\x04\x12\x15\n\x11STEP_IMAGE_LAYOUT\x10\x05\x12\x16\n\x12RADIO_IMAGE_LAYOUT\x10\x06\x12#\n\x1f\x44\x45\x45PSEEK_ROW_MAJOR_IMAGE_LAYOUT\x10\x07\x12\x14\n\x10GLM_IMAGE_LAYOUT\x10\x08\x12\x1a\n\x16\x42RACKETED_IMAGE_LAYOUT\x10\t\x12\x1c\n\x18\x43LASS_TOKEN_IMAGE_LAYOUT\x10\n*P\n\rPromptEncoder\x12\x10\n\x0cPROMPT_JINJA\x10\x00\x12\x0f\n\x0b\x44\x45\x45PSEEK_V4\x10\x01\x12\x10\n\x0c\x44\x45\x45PSEEK_V41\x10\x02\x12\n\n\x06TML_V0\x10\x03*B\n\x10TemplateEncoding\x12\x11\n\rTEMPLATE_TEXT\x10\x00\x12\x1b\n\x17TEMPLATE_TOKEN_SEGMENTS\x10\x01*/\n\x06Memory\x12\n\n\x06\x44\x45VICE\x10\x00\x12\x0f\n\x0bMAPPED_HOST\x10\x01\x12\x08\n\x04PEER\x10\x02*(\n\x08\x43\x61pacity\x12\x0e\n\nSTATE_ROWS\x10\x00\x12\x0c\n\x08KV_PAGES\x10\x01*-\n\x0eRelocationKind\x12\x0b\n\x07POINTER\x10\x00\x12\x0e\n\nTENSOR_MAP\x10\x01*4\n\x0b\x44raftSource\x12\x0c\n\x08NO_DRAFT\x10\x00\x12\x07\n\x03MTP\x10\x01\x12\x0e\n\nCOPY_DRAFT\x10\x02\x62\x06proto3') +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x12runtime_core.proto\x12\rflare.runtime\"\x99\x01\n\x0eProtectedIndex\x12\x0f\n\x07version\x18\x01 \x01(\r\x12\x0f\n\x07\x63ore_id\x18\x02 \x01(\x0c\x12\x0e\n\x06signer\x18\x03 \x01(\x0c\x12*\n\x06groups\x18\x04 \x03(\x0b\x32\x1a.flare.runtime.SignedGroup\x12)\n\x05ranks\x18\x05 \x03(\x0b\x32\x1a.flare.runtime.SignedGroup\"<\n\x0bSignedGroup\x12\x0c\n\x04kind\x18\x01 \x01(\r\x12\x0c\n\x04\x62ody\x18\x02 \x01(\x0c\x12\x11\n\tsignature\x18\x03 \x01(\x0c\"\xcc\x01\n\x11PublisherMetadata\x12(\n\x05index\x18\x01 \x01(\x0b\x32\x19.flare.runtime.ModelIndex\x12\x11\n\tnamespace\x18\x02 \x01(\t\x12\x17\n\x0fofficial_source\x18\x03 \x01(\t\x12\x14\n\x0cgroup_hashes\x18\x04 \x03(\x0c\x12\x13\n\x0b\x64\x65velopment\x18\x05 \x01(\x08\x12\r\n\x05ranks\x18\x06 \x01(\r\x12\'\n\x07license\x18\x07 \x01(\x0b\x32\x16.flare.runtime.License\"%\n\x07License\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0c\n\x04link\x18\x02 \x01(\t\"F\n\x0fResourceCatalog\x12\x33\n\tresources\x18\x01 \x03(\x0b\x32 .flare.runtime.ProtectedResource\"^\n\x11ProtectedResource\x12\x0e\n\x06offset\x18\x01 \x01(\x04\x12\x14\n\x0cstored_bytes\x18\x02 \x01(\x04\x12\x13\n\x0bplain_bytes\x18\x03 \x01(\x04\x12\x0e\n\x06sha256\x18\x04 \x03(\x0c\"`\n\nStoredData\x12\x0e\n\x06nbytes\x18\x01 \x01(\x04\x12\x0e\n\x06sha256\x18\x02 \x01(\x0c\x12\x0e\n\x06offset\x18\x03 \x01(\x04\x12\"\n\x05parts\x18\x04 \x03(\x0b\x32\x13.flare.runtime.Span\"\xd9\x01\n\x0eRankProtection\x12\x0c\n\x04rank\x18\x01 \x01(\r\x12*\n\x06\x62undle\x18\x02 \x01(\x0b\x32\x1a.flare.runtime.BundleIndex\x12\x33\n\x0b\x65xecutables\x18\x03 \x01(\x0b\x32\x1e.flare.runtime.ResourceCatalog\x12/\n\x07support\x18\x04 \x01(\x0b\x32\x1e.flare.runtime.ResourceCatalog\x12\'\n\x04\x64\x61ta\x18\x05 \x01(\x0b\x32\x19.flare.runtime.StoredData\"\x8c\x04\n\nModelIndex\x12\x0f\n\x07version\x18\x01 \x01(\r\x12)\n\x05ranks\x18\x02 \x03(\x0b\x32\x1a.flare.runtime.BundleIndex\x12.\n\x0bpeer_memory\x18\x03 \x03(\x0b\x32\x19.flare.runtime.PeerMemory\x12$\n\x06\x61ssets\x18\x05 \x03(\x0b\x32\x14.flare.runtime.Asset\x12%\n\x06\x65ngram\x18\x06 \x01(\x0b\x32\x15.flare.runtime.Engram\x12\x43\n\x11sampling_defaults\x18\x07 \x01(\x0b\x32(.flare.runtime.DefaultSamplingParameters\x12\x31\n\x08\x66rontend\x18\x08 \x01(\x0b\x32\x1f.flare.runtime.FrontendSettings\x12\'\n\x07\x63luster\x18\t \x01(\x0b\x32\x16.flare.runtime.Cluster\x12\x30\n\x08\x63ontract\x18\n \x01(\x0b\x32\x1e.flare.runtime.ServingContract\x12\x33\n\x07rebuild\x18\x0b \x01(\x0b\x32\x1e.flare.runtime.RebuildManifestB\x02\x18\x01\x12\x37\n\x0bpreparation\x18\x0c \x01(\x0b\x32\".flare.runtime.PreparationManifestJ\x04\x08\x04\x10\x05\"\xf9\x01\n\x13PreparationManifest\x12\x0f\n\x07version\x18\x01 \x01(\r\x12\x0e\n\x06recipe\x18\x02 \x01(\t\x12\x17\n\x0fsource_identity\x18\x03 \x01(\t\x12\x1d\n\x15\x63heckpoint_repository\x18\x04 \x01(\t\x12\x1b\n\x13\x63heckpoint_revision\x18\x05 \x01(\t\x12\x18\n\x10local_checkpoint\x18\x06 \x01(\x08\x12\x19\n\x11reproduction_args\x18\x07 \x03(\t\x12\x37\n\nparameters\x18\x08 \x03(\x0b\x32#.flare.runtime.PreparationParameter\"\x8c\x01\n\x14PreparationParameter\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\x37\n\x05scope\x18\x02 \x01(\x0e\x32(.flare.runtime.PreparationParameterScope\x12.\n\x05value\x18\x03 \x01(\x0b\x32\x1f.flare.runtime.PreparationValue\"\xc6\x01\n\x10PreparationValue\x12\x14\n\nbool_value\x18\x01 \x01(\x08H\x00\x12\x13\n\tint_value\x18\x02 \x01(\x03H\x00\x12\x14\n\nuint_value\x18\x03 \x01(\x04H\x00\x12\x15\n\x0b\x66loat_value\x18\x04 \x01(\x01H\x00\x12\x16\n\x0cstring_value\x18\x05 \x01(\tH\x00\x12\x39\n\nlist_value\x18\x06 \x01(\x0b\x32#.flare.runtime.PreparationValueListH\x00\x42\x07\n\x05value\"G\n\x14PreparationValueList\x12/\n\x06values\x18\x01 \x03(\x0b\x32\x1f.flare.runtime.PreparationValue\"\xdb\x07\n\x0fRebuildManifest\x12\x0f\n\x07version\x18\x01 \x01(\r\x12\x0e\n\x06recipe\x18\x02 \x01(\t\x12\x17\n\x0fsource_identity\x18\x03 \x01(\t\x12\x1d\n\x15\x63heckpoint_repository\x18\x04 \x01(\t\x12\x1b\n\x13\x63heckpoint_revision\x18\x05 \x01(\t\x12\x17\n\x0ftensor_parallel\x18\x06 \x01(\r\x12\x17\n\x0fmax_concurrency\x18\x07 \x01(\x04\x12\x15\n\rprefill_chunk\x18\x08 \x01(\x04\x12\x19\n\x11image_concurrency\x18\t \x01(\x04\x12\x18\n\x10\x63ontext_parallel\x18\n \x01(\x08\x12\x16\n\x0estream_overlap\x18\x0b \x01(\x08\x12\x15\n\rmixed_prefill\x18\x0c \x01(\x08\x12%\n\x18\x65xpert_scale_compression\x18\r \x01(\tH\x00\x88\x01\x01\x12\x18\n\x10mla_compute_mode\x18\x0e \x01(\t\x12\x11\n\troce_ring\x18\x0f \x01(\x08\x12\x14\n\x0conline_mxfp8\x18\x10 \x01(\x08\x12\x1b\n\x13language_model_only\x18\x11 \x01(\x08\x12\x36\n\x0bspeculation\x18\x12 \x01(\x0b\x32!.flare.runtime.RebuildSpeculation\x12\x19\n\x11\x63ompiled_forwards\x18\x13 \x01(\x08\x12\x15\n\rreserve_bytes\x18\x14 \x01(\x04\x12\x18\n\x10local_checkpoint\x18\x15 \x01(\x08\x12\x12\n\nroce_chain\x18\x16 \x01(\x08\x12\x1e\n\x16shard_hyperconnections\x18\x18 \x01(\x08\x12\x1c\n\x14\x66orce_moe_decode_a16\x18\x1b \x01(\x08\x12\x19\n\x11row_shard_prefill\x18\x1c \x01(\x08\x12\x1a\n\x12online_mxfp8_scope\x18\x1e \x01(\t\x12\x1d\n\x15\x63ontext_parallel_size\x18\x1f \x01(\r\x12\x17\n\x0fprompt_logprobs\x18 \x01(\x08\x12\x17\n\x0f\x61utotune_effort\x18! \x01(\t\x12 \n\x18native_dense_activations\x18\" \x01(\x08\x12\x17\n\x0flock_gpu_clocks\x18# \x01(\x08\x12\x19\n\x11reproduction_args\x18$ \x03(\t:\x02\x18\x01\x42\x1b\n\x19_expert_scale_compressionJ\x04\x08\x17\x10\x18J\x04\x08\x19\x10\x1aJ\x04\x08\x1a\x10\x1bR\x0cjoint_tuningR\x11\x63ollective_tuningR\x16\x63ollective_ladder_json\"\x82\x04\n\x12RebuildSpeculation\x12\x14\n\x0c\x64raft_tokens\x18\x01 \x01(\r\x12\x10\n\x08\x61\x64\x61ptive\x18\x02 \x01(\x08\x12\x17\n\x0fproposal_source\x18\x03 \x01(\t\x12\x16\n\x0ehistory_drafts\x18\x04 \x01(\x08\x12\x16\n\x0etoken_capacity\x18\x05 \x01(\x04\x12\x1b\n\x13packed_verification\x18\x06 \x01(\x08\x12\x1e\n\x16\x64raft_prefix_selection\x18\x07 \x01(\t\x12$\n\x17\x64raft_head_quantization\x18\x08 \x01(\tH\x00\x88\x01\x01\x12%\n\x18markov_head_quantization\x18\t \x01(\tH\x01\x88\x01\x01\x12\x19\n\x0cgraph_budget\x18\n \x01(\x04H\x02\x88\x01\x01\x12$\n\x1cvocabulary_parallel_sampling\x18\x0b \x01(\x08\x12\x0e\n\x06method\x18\x0c \x01(\t\x12\x10\n\x08mtp_only\x18\r \x01(\x08\x12$\n\x17\x64raft_body_quantization\x18\x0e \x01(\tH\x03\x88\x01\x01:\x02\x18\x01\x42\x1a\n\x18_draft_head_quantizationB\x1b\n\x19_markov_head_quantizationB\x0f\n\r_graph_budgetB\x1a\n\x18_draft_body_quantization\"e\n\x0eRebuildWeights\x12\x0f\n\x07version\x18\x01 \x01(\r\x12-\n\x07tensors\x18\x02 \x03(\x0b\x32\x1c.flare.runtime.RebuildTensor\x12\x13\n\x0bunavailable\x18\x03 \x03(\t\"\xa2\x01\n\rRebuildTensor\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\r\n\x05\x64type\x18\x02 \x01(\t\x12\x15\n\relement_bytes\x18\x03 \x01(\r\x12\r\n\x05shape\x18\x04 \x03(\x04\x12\x0e\n\x06stride\x18\x05 \x03(\x04\x12\x13\n\x0blayout_type\x18\x06 \x01(\t\x12)\n\x07storage\x18\x07 \x01(\x0b\x32\x18.flare.runtime.Reference\"\xcb\x06\n\x0fServingContract\x12\x10\n\x08model_id\x18\x01 \x01(\t\x12\x10\n\x08identity\x18\x02 \x01(\t\x12\x34\n\x0emodel_contract\x18\x03 \x01(\x0b\x32\x1c.flare.runtime.ModelContract\x12\x1b\n\x13max_sequence_tokens\x18\x04 \x01(\x04\x12\x1a\n\x12prefill_chunk_size\x18\x05 \x01(\x04\x12\r\n\x05pages\x18\x06 \x01(\x04\x12\x12\n\nstate_rows\x18\x07 \x01(\x04\x12\x11\n\tsnapshots\x18\x08 \x01(\x04\x12\x13\n\x0bpage_tokens\x18\t \x01(\x04\x12\x1a\n\x12speculative_widths\x18\x0b \x03(\x04\x12$\n\x17speculative_fixed_width\x18\x0c \x01(\x04H\x00\x88\x01\x01\x12\x16\n\x0ehistory_drafts\x18\r \x01(\x08\x12#\n\x1bspeculative_proposal_source\x18\x0e \x01(\t\x12\x1b\n\x0emax_new_tokens\x18\x0f \x01(\x04H\x01\x88\x01\x01\x12\x17\n\nmax_active\x18\x10 \x01(\x04H\x02\x88\x01\x01\x12\x14\n\x0cserved_names\x18\x11 \x03(\t\x12\x1a\n\rreserve_bytes\x18\x12 \x01(\x04H\x03\x88\x01\x01\x12\x1b\n\x0equeue_capacity\x18\x13 \x01(\x04H\x04\x88\x01\x01\x12\x1d\n\x10\x66rontend_workers\x18\x14 \x01(\x04H\x05\x88\x01\x01\x12\x1b\n\x0emax_body_bytes\x18\x15 \x01(\x04H\x06\x88\x01\x01\x12\x14\n\x0c\x63ontext_hint\x18\x16 \x01(\t\x12\x15\n\rcapacity_hint\x18\x17 \x01(\t\x12\"\n\x1aspeculative_token_capacity\x18\x18 \x01(\x04\x12 \n\x13\x64\x65\x63ode_weight_bytes\x18\x19 \x01(\x04H\x07\x88\x01\x01\x42\x1a\n\x18_speculative_fixed_widthB\x11\n\x0f_max_new_tokensB\r\n\x0b_max_activeB\x10\n\x0e_reserve_bytesB\x11\n\x0f_queue_capacityB\x13\n\x11_frontend_workersB\x11\n\x0f_max_body_bytesB\x16\n\x14_decode_weight_bytesJ\x04\x08\n\x10\x0b\"\xc2\x02\n\rModelContract\x12\x0f\n\x07version\x18\x01 \x01(\r\x12\x12\n\nvocabulary\x18\x02 \x01(\x04\x12\x18\n\x10input_vocabulary\x18\x03 \x01(\x04\x12-\n\x06vision\x18\x04 \x01(\x0b\x32\x1d.flare.runtime.VisionCapacity\x12+\n\x05\x63\x61\x63he\x18\x05 \x01(\x0b\x32\x1c.flare.runtime.CacheContract\x12,\n\x06graphs\x18\x06 \x03(\x0b\x32\x1c.flare.runtime.GraphContract\x12\x31\n\x08\x66rontend\x18\x07 \x01(\x0b\x32\x1f.flare.runtime.FrontendContract\x12\x35\n\x0f\x63ore_parameters\x18\x08 \x03(\x0b\x32\x1c.flare.runtime.CoreParameter\"}\n\rCoreParameter\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x1a\n\rdefault_value\x18\x02 \x01(\x02H\x00\x88\x01\x01\x12\x30\n\x05range\x18\x03 \x01(\x0b\x32!.flare.runtime.CoreParameterRangeB\x10\n\x0e_default_value\"H\n\x12\x43oreParameterRange\x12\x10\n\x03min\x18\x01 \x01(\x02H\x00\x88\x01\x01\x12\x10\n\x03max\x18\x02 \x01(\x02H\x01\x88\x01\x01\x42\x06\n\x04_minB\x06\n\x04_max\"\x90\x01\n\x0eVisionCapacity\x12\x15\n\rfeature_slots\x18\x05 \x01(\x04\x12\x1c\n\x14\x66\x65\x61tures_per_request\x18\x01 \x01(\x04\x12\x12\n\nmax_images\x18\x02 \x01(\x04\x12\x1b\n\x13patches_per_feature\x18\x03 \x01(\x04\x12\x18\n\x10patch_capacities\x18\x04 \x03(\x04\"\xb8\x01\n\rCacheContract\x12\x13\n\x0bpage_tokens\x18\x01 \x01(\x04\x12-\n\x07regions\x18\x02 \x03(\x0b\x32\x1c.flare.runtime.HistoryRegion\x12\x31\n\x0bpage_tables\x18\x03 \x03(\x0b\x32\x1c.flare.runtime.PageTableView\x12\x30\n\x0c\x63odec_layout\x18\x04 \x01(\x0b\x32\x1a.flare.runtime.CodecLayout\"r\n\x0b\x43odecLayout\x12\x10\n\x08revision\x18\x01 \x01(\r\x12)\n\x06\x66ields\x18\x02 \x03(\x0b\x32\x19.flare.runtime.CodecField\x12\x17\n\ngpu_module\x18\x03 \x01(\tH\x00\x88\x01\x01\x42\r\n\x0b_gpu_module\"N\n\nCodecField\x12\x0e\n\x06\x62uffer\x18\x01 \x01(\t\x12\x0e\n\x06offset\x18\x02 \x01(\x04\x12\x0e\n\x06length\x18\x03 \x01(\x04\x12\x10\n\x08\x65ncoding\x18\x04 \x01(\r\"\x96\x01\n\rHistoryRegion\x12(\n\x04kind\x18\x01 \x01(\x0e\x32\x1a.flare.runtime.HistoryKind\x12)\n\x07storage\x18\x02 \x01(\x0b\x32\x18.flare.runtime.StateView\x12\x19\n\x11tokens_per_record\x18\x03 \x01(\x04\x12\x15\n\rwindow_tokens\x18\x04 \x01(\x04\"4\n\rPageTableView\x12\x0e\n\x06\x62uffer\x18\x01 \x01(\t\x12\x13\n\x0bpage_offset\x18\x02 \x01(\x04\"\xc4\x01\n\x0cValueBinding\x12\x0e\n\x06\x62uffer\x18\x01 \x01(\t\x12*\n\x06source\x18\x02 \x01(\x0e\x32\x1a.flare.runtime.ValueSource\x12.\n\x08indexing\x18\x03 \x01(\x0e\x32\x1c.flare.runtime.InputIndexing\x12\x14\n\x0cvalue_offset\x18\x04 \x01(\x12\x12\x0f\n\x07padding\x18\x05 \x01(\x12\x12\x0e\n\x06tensor\x18\x06 \x01(\t\x12\x11\n\tparameter\x18\x07 \x01(\t\"K\n\tStateView\x12\x0e\n\x06\x62uffer\x18\x01 \x01(\t\x12\x0e\n\x06offset\x18\x02 \x01(\x04\x12\x0e\n\x06stride\x18\x03 \x01(\x04\x12\x0e\n\x06nbytes\x18\x04 \x01(\x04\"e\n\x0bStateAccess\x12&\n\x04view\x18\x01 \x01(\x0b\x32\x18.flare.runtime.StateView\x12.\n\x06\x61\x63\x63\x65ss\x18\x02 \x01(\x0e\x32\x1e.flare.runtime.StateAccessKind\"O\n\x10\x43ompletionCursor\x12\'\n\x05state\x18\x01 \x01(\x0b\x32\x18.flare.runtime.StateView\x12\x12\n\nlag_tokens\x18\x02 \x01(\x04\"4\n\x0cTunedBinding\x12\x0e\n\x06\x62uffer\x18\x01 \x01(\t\x12\x14\n\x0ctuning_graph\x18\x02 \x01(\t\"\xfa\x02\n\rGraphContract\x12\r\n\x05graph\x18\x01 \x01(\t\x12+\n\x06inputs\x18\x02 \x03(\x0b\x32\x1b.flare.runtime.ValueBinding\x12)\n\x05state\x18\x03 \x03(\x0b\x32\x1a.flare.runtime.StateAccess\x12\x1e\n\x16state_rows_per_request\x18\x04 \x01(\x04\x12\x35\n\x0c\x64raft_cursor\x18\x05 \x01(\x0b\x32\x1f.flare.runtime.CompletionCursor\x12\x18\n\x10\x65mbedding_tables\x18\x06 \x03(\r\x12/\n\rpending_token\x18\x07 \x01(\x0b\x32\x18.flare.runtime.StateView\x12+\n\x04kind\x18\x08 \x01(\x0e\x32\x1d.flare.runtime.GraphOperation\x12\x33\n\x0etuned_bindings\x18\t \x03(\x0b\x32\x1b.flare.runtime.TunedBinding\"k\n\nToolParser\x12+\n\x04kind\x18\x01 \x01(\x0e\x32\x1d.flare.runtime.ToolParserKind\x12\x19\n\x11wrapping_newlines\x18\x02 \x01(\r\x12\x15\n\rtag_separator\x18\x03 \x01(\t\"\x95\x01\n\x0fReasoningParser\x12\x30\n\x04kind\x18\x01 \x01(\x0e\x32\".flare.runtime.ReasoningParserKind\x12\x0c\n\x04open\x18\x02 \x01(\t\x12\r\n\x05\x63lose\x18\x03 \x01(\t\x12\x19\n\x11wrapping_newlines\x18\x04 \x01(\r\x12\x18\n\x10terminal_markers\x18\x05 \x03(\t\"\xca\x01\n\x0ePrefixBoundary\x12\r\n\x05roles\x18\x01 \x03(\t\x12\x18\n\x0b\x61ppend_role\x18\x02 \x01(\tH\x00\x88\x01\x01\x12\x1e\n\x16\x63ontinue_final_message\x18\x03 \x01(\x08\x12\x18\n\x10minimum_messages\x18\x04 \x01(\x04\x12\x16\n\x0erequired_start\x18\x05 \x01(\t\x12\x14\n\x0crequired_end\x18\x06 \x01(\t\x12\x17\n\x0frequired_marker\x18\x07 \x01(\tB\x0e\n\x0c_append_role\"y\n\tImageSpan\x12\x13\n\x0bstart_token\x18\x01 \x01(\r\x12\x11\n\tend_token\x18\x02 \x01(\r\x12\x12\n\nmax_tokens\x18\x03 \x01(\x04\x12\x17\n\x0finterior_tokens\x18\x04 \x03(\r\x12\x17\n\x0funscoped_tokens\x18\x05 \x03(\r\"Q\n\x10ImageTokenLayout\x12\x15\n\rfeature_token\x18\x01 \x01(\r\x12&\n\x04span\x18\x02 \x01(\x0b\x32\x18.flare.runtime.ImageSpan\"\xf2\x03\n\x10\x46rontendContract\x12(\n\x05tools\x18\x01 \x01(\x0b\x32\x19.flare.runtime.ToolParser\x12\x31\n\treasoning\x18\x02 \x01(\x0b\x32\x1e.flare.runtime.ReasoningParser\x12\x43\n\x11image_preparation\x18\x03 \x01(\x0e\x32#.flare.runtime.ImagePreparationKindH\x00\x88\x01\x01\x12\x39\n\x0cimage_layout\x18\x04 \x01(\x0e\x32\x1e.flare.runtime.ImageLayoutKindH\x01\x88\x01\x01\x12\x17\n\x0frejected_tokens\x18\x05 \x03(\r\x12\x1b\n\x13position_dimensions\x18\x06 \x01(\r\x12\x18\n\x10\x61ssistant_marker\x18\x07 \x01(\t\x12\x1b\n\x13message_end_markers\x18\x08 \x03(\t\x12\x36\n\x0fprefix_boundary\x18\t \x01(\x0b\x32\x1d.flare.runtime.PrefixBoundary\x12\x35\n\x0cimage_tokens\x18\n \x01(\x0b\x32\x1f.flare.runtime.ImageTokenLayoutB\x14\n\x12_image_preparationB\x0f\n\r_image_layout\"1\n\x07\x43luster\x12\r\n\x05world\x18\x01 \x01(\r\x12\x11\n\texport_id\x18\x03 \x01(\tJ\x04\x08\x02\x10\x03\"\x8c\x03\n\x19\x44\x65\x66\x61ultSamplingParameters\x12\x11\n\x04seed\x18\x01 \x01(\x04H\x00\x88\x01\x01\x12\x18\n\x0btemperature\x18\x02 \x01(\x02H\x01\x88\x01\x01\x12\x12\n\x05top_k\x18\x03 \x01(\x05H\x02\x88\x01\x01\x12\x12\n\x05top_p\x18\x04 \x01(\x02H\x03\x88\x01\x01\x12\x12\n\x05min_p\x18\x05 \x01(\x02H\x04\x88\x01\x01\x12\x1f\n\x12repetition_penalty\x18\x06 \x01(\x02H\x05\x88\x01\x01\x12\x1d\n\x10presence_penalty\x18\x07 \x01(\x02H\x06\x88\x01\x01\x12\x1e\n\x11\x66requency_penalty\x18\x08 \x01(\x02H\x07\x88\x01\x01\x12-\n\x06ranges\x18\t \x01(\x0b\x32\x1d.flare.runtime.SamplingRangesB\x07\n\x05_seedB\x0e\n\x0c_temperatureB\x08\n\x06_top_kB\x08\n\x06_top_pB\x08\n\x06_min_pB\x15\n\x13_repetition_penaltyB\x13\n\x11_presence_penaltyB\x14\n\x12_frequency_penalty\"H\n\x12SamplingFloatRange\x12\x10\n\x03min\x18\x01 \x01(\x02H\x00\x88\x01\x01\x12\x10\n\x03max\x18\x02 \x01(\x02H\x01\x88\x01\x01\x42\x06\n\x04_minB\x06\n\x04_max\"F\n\x10SamplingIntRange\x12\x10\n\x03min\x18\x01 \x01(\x05H\x00\x88\x01\x01\x12\x10\n\x03max\x18\x02 \x01(\x05H\x01\x88\x01\x01\x42\x06\n\x04_minB\x06\n\x04_max\"\x96\x03\n\x0eSamplingRanges\x12\x36\n\x0btemperature\x18\x01 \x01(\x0b\x32!.flare.runtime.SamplingFloatRange\x12.\n\x05top_k\x18\x02 \x01(\x0b\x32\x1f.flare.runtime.SamplingIntRange\x12\x30\n\x05top_p\x18\x03 \x01(\x0b\x32!.flare.runtime.SamplingFloatRange\x12\x30\n\x05min_p\x18\x04 \x01(\x0b\x32!.flare.runtime.SamplingFloatRange\x12=\n\x12repetition_penalty\x18\x05 \x01(\x0b\x32!.flare.runtime.SamplingFloatRange\x12;\n\x10presence_penalty\x18\x06 \x01(\x0b\x32!.flare.runtime.SamplingFloatRange\x12<\n\x11\x66requency_penalty\x18\x07 \x01(\x0b\x32!.flare.runtime.SamplingFloatRange\"\xc5\x02\n\x10\x46rontendSettings\x12\x33\n\ttokenizer\x18\x01 \x01(\x0b\x32 .flare.runtime.TokenizerSettings\x12+\n\x05image\x18\x02 \x01(\x0b\x32\x1c.flare.runtime.ImageSettings\x12\x15\n\reos_token_ids\x18\x03 \x03(\r\x12:\n\x11template_encoding\x18\x04 \x01(\x0e\x32\x1f.flare.runtime.TemplateEncoding\x12\x34\n\x0eprompt_encoder\x18\x05 \x01(\x0e\x32\x1c.flare.runtime.PromptEncoder\x12\'\n\x1aimage_placeholder_token_id\x18\x06 \x01(\rH\x00\x88\x01\x01\x42\x1d\n\x1b_image_placeholder_token_id\"\xdc\x02\n\x11TokenizerSettings\x12\x16\n\tbos_token\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x16\n\teos_token\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x16\n\tunk_token\x18\x03 \x01(\tH\x02\x88\x01\x01\x12\x16\n\tsep_token\x18\x04 \x01(\tH\x03\x88\x01\x01\x12\x16\n\tpad_token\x18\x05 \x01(\tH\x04\x88\x01\x01\x12\x16\n\tcls_token\x18\x06 \x01(\tH\x05\x88\x01\x01\x12\x17\n\nmask_token\x18\x07 \x01(\tH\x06\x88\x01\x01\x12;\n\x19\x61\x64\x64itional_special_tokens\x18\x08 \x01(\x0b\x32\x18.flare.runtime.TokenListB\x0c\n\n_bos_tokenB\x0c\n\n_eos_tokenB\x0c\n\n_unk_tokenB\x0c\n\n_sep_tokenB\x0c\n\n_pad_tokenB\x0c\n\n_cls_tokenB\r\n\x0b_mask_token\"\x1b\n\tTokenList\x12\x0e\n\x06values\x18\x01 \x03(\t\"\xbd\x04\n\rImageSettings\x12\x30\n\x04qwen\x18\x01 \x01(\x0b\x32 .flare.runtime.QwenImageSettingsH\x00\x12\x30\n\x04mimo\x18\x02 \x01(\x0b\x32 .flare.runtime.MimoImageSettingsH\x00\x12)\n\tdeepseek4\x18\x03 \x01(\x0b\x32\x14.flare.runtime.EmptyH\x00\x12\'\n\x07moonvit\x18\x04 \x01(\x0b\x32\x14.flare.runtime.EmptyH\x00\x12$\n\x04step\x18\x05 \x01(\x0b\x32\x14.flare.runtime.EmptyH\x00\x12%\n\x05radio\x18\x06 \x01(\x0b\x32\x14.flare.runtime.EmptyH\x00\x12J\n\x12\x64\x65\x65pseek_row_major\x18\x07 \x01(\x0b\x32,.flare.runtime.DeepseekRowMajorImageSettingsH\x00\x12#\n\x03glm\x18\x08 \x01(\x0b\x32\x14.flare.runtime.EmptyH\x00\x12=\n\x0bpatch_merge\x18\t \x01(\x0b\x32&.flare.runtime.PatchMergeImageSettingsH\x00\x12+\n\x0bpadded_grid\x18\n \x01(\x0b\x32\x14.flare.runtime.EmptyH\x00\x12?\n\x0cmuse_glimmer\x18\x0b \x01(\x0b\x32\'.flare.runtime.MuseGlimmerImageSettingsH\x00\x42\t\n\x07profile\"\xc0\x01\n\x18MuseGlimmerImageSettings\x12\x12\n\npatch_size\x18\x01 \x01(\r\x12\x12\n\nmerge_size\x18\x02 \x01(\r\x12\x18\n\x10max_image_tokens\x18\x03 \x01(\x04\x12\x12\n\nimage_mean\x18\x04 \x03(\x02\x12\x11\n\timage_std\x18\x05 \x03(\x02\x12\x13\n\x0bimage_token\x18\x06 \x01(\t\x12\x13\n\x0bstart_token\x18\x07 \x01(\t\x12\x11\n\tend_token\x18\x08 \x01(\t\"\xb9\x01\n\x17PatchMergeImageSettings\x12\x12\n\npatch_size\x18\x01 \x01(\r\x12\x12\n\nmin_pixels\x18\x02 \x01(\x04\x12\x12\n\nmax_pixels\x18\x03 \x01(\x04\x12\x12\n\nimage_mean\x18\x04 \x03(\x02\x12\x11\n\timage_std\x18\x05 \x03(\x02\x12\x13\n\x0bimage_token\x18\x06 \x01(\t\x12\x13\n\x0bstart_token\x18\x07 \x01(\t\x12\x11\n\tend_token\x18\x08 \x01(\t\"\x87\x01\n\x1d\x44\x65\x65pseekRowMajorImageSettings\x12\x12\n\nmin_pixels\x18\x01 \x01(\x04\x12\x12\n\nmax_tokens\x18\x02 \x01(\x04\x12#\n\x16max_width_height_ratio\x18\x03 \x01(\x04H\x00\x88\x01\x01\x42\x19\n\x17_max_width_height_ratio\"\x82\x01\n\x11QwenImageSettings\x12\x12\n\nmin_pixels\x18\x01 \x01(\x04\x12\x12\n\nmax_pixels\x18\x02 \x01(\x04\x12\x15\n\rposition_side\x18\x03 \x01(\r\x12\x16\n\x0eimage_token_id\x18\x04 \x01(\r\x12\x16\n\x0evideo_token_id\x18\x05 \x01(\r\"b\n\x11MimoImageSettings\x12\x12\n\nmin_pixels\x18\x01 \x01(\x04\x12\x12\n\nmax_pixels\x18\x02 \x01(\x04\x12\x12\n\nimage_mean\x18\x03 \x03(\x02\x12\x11\n\timage_std\x18\x04 \x03(\x02\"|\n\x06\x45ngram\x12\x11\n\ttoken_map\x18\x01 \x03(\r\x12\x14\n\x0cpad_token_id\x18\x02 \x01(\r\x12\x1d\n\x15\x63ompressed_vocabulary\x18\x03 \x01(\r\x12*\n\x06tables\x18\x04 \x03(\x0b\x32\x1a.flare.runtime.EngramTable\"\x99\x04\n\x0b\x45ngramTable\x12\r\n\x05layer\x18\x01 \x01(\r\x12\x0c\n\x04rows\x18\x02 \x01(\x04\x12\x17\n\x0f\x65mbedding_width\x18\x03 \x01(\r\x12\x13\n\x0bscale_block\x18\x04 \x01(\r\x12$\n\x07weights\x18\x05 \x01(\x0b\x32\x13.flare.runtime.Span\x12#\n\x06scales\x18\x06 \x01(\x0b\x32\x13.flare.runtime.Span\x12\'\n\x04hash\x18\x07 \x01(\x0b\x32\x19.flare.runtime.EngramHash\x12\x15\n\rweight_buffer\x18\x08 \x01(\t\x12\x14\n\x0cscale_buffer\x18\t \x01(\t\x12\x13\n\x0bhash_buffer\x18\n \x01(\t\x12\x13\n\x0bready_event\x18\x0b \x01(\t\x12\x35\n\x08\x65ncoding\x18\x0c \x01(\x0e\x32#.flare.runtime.EngramTable.Encoding\x12\x16\n\x0erequest_buffer\x18\r \x01(\t\x12\x14\n\x0cglobal_scale\x18\x0e \x01(\x02\x12/\n\x06shards\x18\x0f \x03(\x0b\x32\x1f.flare.runtime.EngramTableShard\x12\x17\n\x0fprefetch_buffer\x18\x10 \x01(\t\"E\n\x08\x45ncoding\x12\x0f\n\x0bUNSPECIFIED\x10\x00\x12\x11\n\rFP8_E4M3_E8M0\x10\x01\x12\x15\n\x11NVFP4_E4M3_GLOBAL\x10\x02\"\x8c\x01\n\x10\x45ngramTableShard\x12\x0c\n\x04rank\x18\x01 \x01(\r\x12\x11\n\tfirst_row\x18\x02 \x01(\x04\x12\x0c\n\x04rows\x18\x03 \x01(\x04\x12$\n\x07weights\x18\x04 \x01(\x0b\x32\x13.flare.runtime.Span\x12#\n\x06scales\x18\x05 \x01(\x0b\x32\x13.flare.runtime.Span\"\xc3\x01\n\nEngramHash\x12\x30\n\x06method\x18\x01 \x01(\x0e\x32 .flare.runtime.EngramHash.Method\x12\x0e\n\x06orders\x18\x02 \x03(\r\x12\x13\n\x0bmultipliers\x18\x03 \x03(\x04\x12\x0e\n\x06primes\x18\x04 \x03(\x04\x12\x0f\n\x07offsets\x18\x05 \x03(\x04\"=\n\x06Method\x12\x0f\n\x0bUNSPECIFIED\x10\x00\x12\x0e\n\nXOR_MODULO\x10\x01\x12\x12\n\x0e\x45OS_XOR_MODULO\x10\x02\"K\n\x05\x41sset\x12\x0c\n\x04name\x18\x01 \x01(\t\x12$\n\x07payload\x18\x02 \x01(\x0b\x32\x13.flare.runtime.Span\x12\x0e\n\x06sha256\x18\x03 \x01(\t\"\xd3\x04\n\x0b\x42undleIndex\x12\x14\n\x0c\x61rchitecture\x18\x01 \x03(\x05\x12.\n\x0b\x61llocations\x18\x02 \x03(\x0b\x32\x19.flare.runtime.Allocation\x12&\n\x07modules\x18\x03 \x03(\x0b\x32\x15.flare.runtime.Module\x12*\n\tfunctions\x18\x04 \x03(\x0b\x32\x17.flare.runtime.Function\x12)\n\x06graphs\x18\x05 \x03(\x0b\x32\x19.flare.runtime.GraphIndex\x12\x30\n\x0creservations\x18\x06 \x03(\x0b\x32\x1a.flare.runtime.Reservation\x12+\n\texecution\x18\x07 \x01(\x0b\x32\x18.flare.runtime.Execution\x12\'\n\x07\x63ontext\x18\x08 \x01(\x0b\x32\x16.flare.runtime.Context\x12<\n\tresources\x18\t \x03(\x0b\x32).flare.runtime.BundleIndex.ResourcesEntry\x12\x0e\n\x06\x65vents\x18\n \x03(\t\x12*\n\x04roce\x18\x0b \x01(\x0b\x32\x1c.flare.runtime.RoceTransport\x12\x36\n\x0frebuild_weights\x18\x0c \x01(\x0b\x32\x1d.flare.runtime.RebuildWeights\x1a\x45\n\x0eResourcesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\"\n\x05value\x18\x02 \x01(\x0b\x32\x13.flare.runtime.Span:\x02\x38\x01\"\xf8\x01\n\rRoceTransport\x12\x11\n\tproxy_abi\x18\x01 \x01(\r\x12\r\n\x05world\x18\x02 \x01(\r\x12\x0c\n\x04rank\x18\x03 \x01(\r\x12\x16\n\x0eregion_address\x18\x04 \x01(\x04\x12\x14\n\x0cregion_bytes\x18\x05 \x01(\x04\x12\x18\n\x10\x63ounters_address\x18\x06 \x01(\x04\x12\x16\n\x0e\x63ounters_bytes\x18\x07 \x01(\x04\x12\x12\n\nslot_bytes\x18\x08 \x01(\x04\x12\x12\n\npipe_bytes\x18\t \x01(\x04\x12\x13\n\x0b\x63trl_offset\x18\n \x01(\x04\x12\x14\n\x0cvarlen_bytes\x18\x10 \x01(\x04J\x04\x08\x0b\x10\x10\"v\n\nGraphIndex\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\r\n\x05\x66lags\x18\x02 \x01(\x04\x12\x10\n\x08resource\x18\x03 \x01(\t\x12\x12\n\nnode_count\x18\x04 \x01(\x04\x12\x12\n\nedge_count\x18\x05 \x01(\x04\x12\x11\n\tfunctions\x18\x06 \x03(\x04\"M\n\nPeerMemory\x12\r\n\x05owner\x18\x01 \x01(\r\x12\x0f\n\x07\x61\x64\x64ress\x18\x02 \x01(\x04\x12\x0e\n\x06nbytes\x18\x03 \x01(\x04\x12\x0f\n\x07readers\x18\x04 \x03(\r\"M\n\x07\x43ontext\x12\r\n\x05\x66lags\x18\x01 \x01(\r\x12\r\n\x05\x63\x61\x63he\x18\x02 \x01(\x05\x12$\n\x06limits\x18\x03 \x03(\x0b\x32\x14.flare.runtime.Limit\"\"\n\x05Limit\x12\n\n\x02id\x18\x01 \x01(\x04\x12\r\n\x05value\x18\x02 \x01(\x04\".\n\x0bReservation\x12\x0f\n\x07\x61\x64\x64ress\x18\x01 \x01(\x04\x12\x0e\n\x06nbytes\x18\x02 \x01(\x04\"8\n\x04Span\x12\x0e\n\x06offset\x18\x01 \x01(\x04\x12\x0e\n\x06nbytes\x18\x02 \x01(\x04\x12\x10\n\x08\x66ilename\x18\x03 \x01(\t\"\xa2\x02\n\nAllocation\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0e\n\x06nbytes\x18\x02 \x01(\x04\x12\x11\n\talignment\x18\x03 \x01(\x04\x12\x11\n\x04\x66ile\x18\x04 \x01(\tH\x00\x88\x01\x01\x12\'\n\ndata_spans\x18\x05 \x03(\x0b\x32\x13.flare.runtime.Span\x12.\n\x0brelocations\x18\x06 \x03(\x0b\x32\x19.flare.runtime.Relocation\x12\x14\n\x07\x61\x64\x64ress\x18\x07 \x01(\x04H\x01\x88\x01\x01\x12%\n\x06memory\x18\x08 \x01(\x0e\x32\x15.flare.runtime.Memory\x12%\n\x06sizing\x18\t \x01(\x0b\x32\x15.flare.runtime.SizingB\x07\n\x05_fileB\n\n\x08_address\"X\n\x06Sizing\x12)\n\x08\x63\x61pacity\x18\x01 \x01(\x0e\x32\x17.flare.runtime.Capacity\x12\x12\n\nunit_bytes\x18\x02 \x01(\x04\x12\x0f\n\x07maximum\x18\x03 \x01(\x04\"L\n\x06Module\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0c\n\x04\x66ile\x18\x02 \x01(\t\x12&\n\x07globals\x18\x03 \x03(\x0b\x32\x15.flare.runtime.Global\"f\n\x06Global\x12\x0e\n\x06symbol\x18\x01 \x01(\t\x12\x0c\n\x04\x66ile\x18\x02 \x01(\t\x12\x0e\n\x06nbytes\x18\x03 \x01(\x04\x12.\n\x0brelocations\x18\x04 \x03(\x0b\x32\x19.flare.runtime.Relocation\"y\n\x08\x46unction\x12\x0e\n\x06module\x18\x01 \x01(\t\x12\x0e\n\x06symbol\x18\x02 \x01(\t\x12\x17\n\x0fparameter_sizes\x18\x03 \x03(\x04\x12\x34\n\nattributes\x18\x04 \x03(\x0b\x32 .flare.runtime.FunctionAttribute\".\n\x11\x46unctionAttribute\x12\n\n\x02id\x18\x01 \x01(\x05\x12\r\n\x05value\x18\x02 \x01(\x05\"/\n\tReference\x12\x12\n\nallocation\x18\x01 \x01(\t\x12\x0e\n\x06offset\x18\x02 \x01(\x04\"s\n\nRelocation\x12\x0e\n\x06offset\x18\x01 \x01(\x04\x12(\n\x06target\x18\x02 \x01(\x0b\x32\x18.flare.runtime.Reference\x12+\n\x04kind\x18\x03 \x01(\x0e\x32\x1d.flare.runtime.RelocationKind\"D\n\x04\x42lob\x12\x0c\n\x04\x64\x61ta\x18\x01 \x01(\x0c\x12.\n\x0brelocations\x18\x02 \x03(\x0b\x32\x19.flare.runtime.Relocation\";\n\tAttribute\x12\n\n\x02id\x18\x01 \x01(\x05\x12\"\n\x05value\x18\x02 \x01(\x0b\x32\x13.flare.runtime.Blob\"\x9d\x01\n\x06Kernel\x12\x10\n\x08\x66unction\x18\x01 \x01(\x04\x12\x0c\n\x04grid\x18\x02 \x03(\r\x12\r\n\x05\x62lock\x18\x03 \x03(\r\x12\x0e\n\x06shared\x18\x04 \x01(\r\x12&\n\targuments\x18\x05 \x03(\x0b\x32\x13.flare.runtime.Blob\x12,\n\nattributes\x18\x06 \x03(\x0b\x32\x18.flare.runtime.Attribute\"\x8a\x01\n\x06Memset\x12-\n\x0b\x64\x65stination\x18\x01 \x01(\x0b\x32\x18.flare.runtime.Reference\x12\r\n\x05pitch\x18\x02 \x01(\x04\x12\r\n\x05value\x18\x03 \x01(\r\x12\x14\n\x0c\x65lement_size\x18\x04 \x01(\r\x12\r\n\x05width\x18\x05 \x01(\x04\x12\x0e\n\x06height\x18\x06 \x01(\x04\"o\n\x04\x43opy\x12(\n\x06source\x18\x01 \x01(\x0b\x32\x18.flare.runtime.Reference\x12-\n\x0b\x64\x65stination\x18\x02 \x01(\x0b\x32\x18.flare.runtime.Reference\x12\x0e\n\x06nbytes\x18\x03 \x01(\x04\"\x07\n\x05\x45mpty\"\x1a\n\tEventWait\x12\r\n\x05\x65vent\x18\x01 \x01(\t\"\xe1\x01\n\x04Node\x12\'\n\x06kernel\x18\x01 \x01(\x0b\x32\x15.flare.runtime.KernelH\x00\x12\'\n\x06memset\x18\x02 \x01(\x0b\x32\x15.flare.runtime.MemsetH\x00\x12#\n\x04\x63opy\x18\x03 \x01(\x0b\x32\x13.flare.runtime.CopyH\x00\x12%\n\x05\x65mpty\x18\x04 \x01(\x0b\x32\x14.flare.runtime.EmptyH\x00\x12.\n\nevent_wait\x18\x05 \x01(\x0b\x32\x18.flare.runtime.EventWaitH\x00\x42\x0b\n\toperation\"9\n\x04\x45\x64ge\x12\x0e\n\x06source\x18\x01 \x01(\x04\x12\x13\n\x0b\x64\x65stination\x18\x02 \x01(\x04\x12\x0c\n\x04\x64\x61ta\x18\x03 \x01(\x0c\"\xb9\x02\n\tExecution\x12\x13\n\x0b\x61\x62i_version\x18\x01 \x01(\r\x12\x12\n\nmax_active\x18\x02 \x01(\x04\x12\x19\n\x11input_frame_bytes\x18\x03 \x01(\x04\x12&\n\x07\x62uffers\x18\x04 \x03(\x0b\x32\x15.flare.runtime.Buffer\x12-\n\x06graphs\x18\x05 \x03(\x0b\x32\x1d.flare.runtime.ExecutionGraph\x12\x31\n\rtuning_graphs\x18\x06 \x03(\x0b\x32\x1a.flare.runtime.TuningGraph\x12!\n\x19\x63ompletion_token_capacity\x18\x07 \x01(\r\x12;\n\x12persistent_workers\x18\x08 \x03(\x0b\x32\x1f.flare.runtime.PersistentWorker\"\xa9\x01\n\x10PersistentWorker\x12\x17\n\x0fworker_sm_count\x18\x01 \x01(\r\x12\r\n\x05graph\x18\x02 \x01(\t\x12+\n\tstop_flag\x18\x03 \x01(\x0b\x32\x18.flare.runtime.Reference\x12)\n\x07metrics\x18\x04 \x01(\x0b\x32\x18.flare.runtime.Reference\x12\x15\n\rmetrics_count\x18\x05 \x01(\r\"C\n\x0bTuningGraph\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0f\n\x07outputs\x18\x02 \x03(\t\x12\x15\n\rstatus_buffer\x18\x03 \x01(\t\"\x82\x01\n\x06\x42uffer\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0e\n\x06nbytes\x18\x02 \x01(\x04\x12\r\n\x05\x64type\x18\x03 \x01(\t\x12\r\n\x05shape\x18\x04 \x03(\x04\x12\x0f\n\x07strides\x18\x05 \x03(\x04\x12+\n\treference\x18\x06 \x01(\x0b\x32\x18.flare.runtime.Reference\"\x95\x04\n\x0e\x45xecutionGraph\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0c\n\x04kind\x18\x02 \x01(\t\x12\x15\n\rsampling_mode\x18\x03 \x01(\t\x12\x16\n\x0e\x62\x61tch_capacity\x18\x04 \x01(\x04\x12\x16\n\x0etoken_capacity\x18\x05 \x01(\x04\x12\x33\n\x0einput_bindings\x18\x06 \x03(\x0b\x32\x1b.flare.runtime.InputBinding\x12\x19\n\x0c\x64raft_tokens\x18\x07 \x01(\rH\x00\x88\x01\x01\x12\x1a\n\rverify_tokens\x18\x08 \x01(\rH\x01\x88\x01\x01\x12\x30\n\x0c\x64raft_source\x18\t \x01(\x0e\x32\x1a.flare.runtime.DraftSource\x12 \n\x13speculation_enabled\x18\n \x01(\x08H\x02\x88\x01\x01\x12\x1d\n\x15\x65stimated_duration_ns\x18\x0b \x01(\x04\x12\x18\n\x10prefill_capacity\x18\x0c \x01(\x04\x12\x1d\n\x15packed_token_capacity\x18\r \x01(\x04\x12\x18\n\x10\x63onfidence_width\x18\x0e \x01(\r\x12\x33\n\x0etuned_bindings\x18\x0f \x03(\x0b\x32\x1b.flare.runtime.TunedBindingB\x0f\n\r_draft_tokensB\x10\n\x0e_verify_tokensB\x16\n\x14_speculation_enabled\"H\n\x0cInputBinding\x12\x13\n\x0b\x62uffer_name\x18\x01 \x01(\t\x12\x13\n\x0bhost_offset\x18\x02 \x01(\x04\x12\x0e\n\x06nbytes\x18\x03 \x01(\x04*\xfa\x01\n\x19PreparationParameterScope\x12+\n\'PREPARATION_PARAMETER_SCOPE_UNSPECIFIED\x10\x00\x12*\n&PREPARATION_PARAMETER_SCOPE_DEPLOYMENT\x10\x01\x12\'\n#PREPARATION_PARAMETER_SCOPE_COMBINE\x10\x02\x12-\n)PREPARATION_PARAMETER_SCOPE_TARGET_WEIGHT\x10\x03\x12,\n(PREPARATION_PARAMETER_SCOPE_DRAFT_WEIGHT\x10\x04*\x8e\x01\n\x0bHistoryKind\x12\x17\n\x13HISTORY_UNSPECIFIED\x10\x00\x12\x13\n\x0fPAGED_KEY_VALUE\x10\x01\x12\x10\n\x0cPAGED_LATENT\x10\x02\x12\x12\n\x0eSLIDING_WINDOW\x10\x03\x12\x13\n\x0fRECURRENT_STATE\x10\x04\x12\x16\n\x12\x43ONTINUATION_STATE\x10\x05*\xc7\x07\n\x0bValueSource\x12\x15\n\x11VALUE_UNSPECIFIED\x10\x00\x12\x0c\n\x08\x43ONSTANT\x10\x01\x12\x10\n\x0cREQUEST_SLOT\x10\x02\x12\x16\n\x12REQUEST_GENERATION\x10\x03\x12\r\n\tLIVE_ROWS\x10\x04\x12\x10\n\x0cQUERY_LENGTH\x10\x05\x12\x12\n\x0eSAMPLE_ENABLED\x10\x06\x12\x10\n\x0cPROMPT_TOKEN\x10\x07\x12\x11\n\rPENDING_TOKEN\x10\x08\x12\x1c\n\x18PROMPT_AND_PENDING_TOKEN\x10\t\x12\x13\n\x0fPROMPT_POSITION\x10\n\x12\x17\n\x13IMAGE_FEATURE_INDEX\x10\x0b\x12\x16\n\x12IMAGE_LEFT_CONTEXT\x10\x0c\x12\x17\n\x13IMAGE_RIGHT_CONTEXT\x10\r\x12\x0e\n\nPAGE_TABLE\x10\x0e\x12\x13\n\x0fLIVE_STATE_ROWS\x10\x0f\x12\x12\n\x0eLIVE_STATE_ROW\x10\x10\x12\x14\n\x10PREFIX_STATE_ROW\x10\x11\x12\x16\n\x12SNAPSHOT_STATE_ROW\x10\x12\x12\x13\n\x0f\x43ONSUMED_TOKENS\x10\x13\x12\x1c\n\x18SNAPSHOT_CONSUMED_TOKENS\x10\x14\x12\x0f\n\x0bPREFILL_ROW\x10\x15\x12\x11\n\rSAMPLING_SEED\x10\x16\x12\x17\n\x13SAMPLING_PARAMETERS\x10\x17\x12\x12\n\x0eSAMPLING_TOP_K\x10\x18\x12\x12\n\x0eMAX_NEW_TOKENS\x10\x19\x12\x11\n\rEOS_TOKEN_IDS\x10\x1a\x12\r\n\tEOS_COUNT\x10\x1b\x12\x14\n\x10PROMPT_HISTOGRAM\x10\x1c\x12\x10\n\x0cGRAMMAR_MASK\x10\x1d\x12\x13\n\x0fGRAMMAR_ENABLED\x10\x1e\x12\x12\n\x0e\x43OPY_TOKEN_IDS\x10\x1f\x12\x14\n\x10\x43OPY_TOKEN_COUNT\x10 \x12\x18\n\x14\x43OPY_CONSUMED_TOKENS\x10!\x12\x13\n\x0f\x43OPY_GENERATION\x10\"\x12\x15\n\x11\x43OPY_GRAMMAR_MASK\x10#\x12\x16\n\x12\x43OPY_GRAMMAR_COUNT\x10$\x12\x10\n\x0cIMAGE_TENSOR\x10%\x12\x16\n\x12IMAGE_FEATURE_SLOT\x10&\x12\x17\n\x13PROMPT_TARGET_TOKEN\x10\'\x12\x1c\n\x18SPECULATIVE_PREFIX_LIMIT\x10(\x12\x1a\n\x16PROMPT_LOOKAHEAD_TOKEN\x10)\x12\x1b\n\x17PROMPT_LOOKAHEAD_LENGTH\x10*\x12\x12\n\x0e\x43ORE_PARAMETER\x10+*|\n\rInputIndexing\x12\x18\n\x14INDEXING_UNSPECIFIED\x10\x00\x12\n\n\x06SCALAR\x10\x01\x12\x12\n\x0eSUBMISSION_ROW\x10\x02\x12\x0f\n\x0bREQUEST_ROW\x10\x03\x12\x10\n\x0cPACKED_TOKEN\x10\x04\x12\x0e\n\nACTIVE_ROW\x10\x05*T\n\x0fStateAccessKind\x12\x1c\n\x18STATE_ACCESS_UNSPECIFIED\x10\x00\x12\x08\n\x04READ\x10\x01\x12\t\n\x05WRITE\x10\x02\x12\x0e\n\nREAD_WRITE\x10\x03*\x8b\x02\n\x0eGraphOperation\x12\x1f\n\x1bGRAPH_OPERATION_UNSPECIFIED\x10\x00\x12\x08\n\x04INIT\x10\x01\x12\x0b\n\x07RESTORE\x10\x02\x12\x0c\n\x08SNAPSHOT\x10\x03\x12\x0b\n\x07PREFILL\x10\x04\x12\n\n\x06\x44\x45\x43ODE\x10\x05\x12\n\n\x06RESUME\x10\x06\x12\n\n\x06VISION\x10\x07\x12\x0f\n\x0bSPECULATIVE\x10\x08\x12\t\n\x05MIXED\x10\t\x12\x12\n\x0eSCORED_PREFILL\x10\x0c\x12\x14\n\x10TERMINAL_PREFILL\x10\x0e\"\x04\x08\n\x10\n\"\x04\x08\x0b\x10\x0b\"\x04\x08\r\x10\r*\x08PROPOSAL*\x0cVERIFICATION*\x12PACKED_SPECULATIVE*\xa1\x01\n\x0eToolParserKind\x12\x1b\n\x17TOOL_PARSER_UNSPECIFIED\x10\x00\x12\x0e\n\nQWEN_CODER\x10\x01\x12\x15\n\x11GLM_ARGUMENT_TAGS\x10\x02\x12\x08\n\x04\x44SML\x10\x03\x12\x08\n\x04XTML\x10\x04\x12\x0f\n\x0bMINIMAX_XML\x10\x05\x12\x0e\n\nGEMMA_CALL\x10\x06\x12\x08\n\x04\x41TEM\x10\x07\x12\x0c\n\x08TML_JSON\x10\x08*\xa6\x01\n\x13ReasoningParserKind\x12 \n\x1cREASONING_PARSER_UNSPECIFIED\x10\x00\x12\x0e\n\nTHINK_TAGS\x10\x01\x12\x0e\n\nXTML_THINK\x10\x02\x12\x0c\n\x08MM_THINK\x10\x03\x12\x13\n\x0f\x43HANNEL_THOUGHT\x10\x04\x12\x15\n\x11RECIPIENT_HEADERS\x10\x05\x12\x13\n\x0f\x43ONTENT_HEADERS\x10\x06*\x98\x03\n\x14ImagePreparationKind\x12!\n\x1dIMAGE_PREPARATION_UNSPECIFIED\x10\x00\x12\x1a\n\x16QWEN_IMAGE_PREPARATION\x10\x01\x12\x1a\n\x16MIMO_IMAGE_PREPARATION\x10\x02\x12\x1e\n\x1a\x44\x45\x45PSEEK_IMAGE_PREPARATION\x10\x03\x12\x1d\n\x19MOONVIT_IMAGE_PREPARATION\x10\x04\x12\x1a\n\x16STEP_IMAGE_PREPARATION\x10\x05\x12\x1b\n\x17RADIO_IMAGE_PREPARATION\x10\x06\x12(\n$DEEPSEEK_ROW_MAJOR_IMAGE_PREPARATION\x10\x07\x12\x19\n\x15GLM_IMAGE_PREPARATION\x10\x08\x12!\n\x1dPATCH_MERGE_IMAGE_PREPARATION\x10\t\x12!\n\x1dPADDED_GRID_IMAGE_PREPARATION\x10\n\x12\"\n\x1eMUSE_GLIMMER_IMAGE_PREPARATION\x10\x0b*\xd1\x02\n\x0fImageLayoutKind\x12\x1c\n\x18IMAGE_LAYOUT_UNSPECIFIED\x10\x00\x12\x15\n\x11QWEN_IMAGE_LAYOUT\x10\x01\x12\x15\n\x11MIMO_IMAGE_LAYOUT\x10\x02\x12\x19\n\x15\x44\x45\x45PSEEK_IMAGE_LAYOUT\x10\x03\x12\x18\n\x14MOONVIT_IMAGE_LAYOUT\x10\x04\x12\x15\n\x11STEP_IMAGE_LAYOUT\x10\x05\x12\x16\n\x12RADIO_IMAGE_LAYOUT\x10\x06\x12#\n\x1f\x44\x45\x45PSEEK_ROW_MAJOR_IMAGE_LAYOUT\x10\x07\x12\x14\n\x10GLM_IMAGE_LAYOUT\x10\x08\x12\x1a\n\x16\x42RACKETED_IMAGE_LAYOUT\x10\t\x12\x1c\n\x18\x43LASS_TOKEN_IMAGE_LAYOUT\x10\n\x12\x19\n\x15WINDOWED_IMAGE_LAYOUT\x10\x0b*P\n\rPromptEncoder\x12\x10\n\x0cPROMPT_JINJA\x10\x00\x12\x0f\n\x0b\x44\x45\x45PSEEK_V4\x10\x01\x12\x10\n\x0c\x44\x45\x45PSEEK_V41\x10\x02\x12\n\n\x06TML_V0\x10\x03*B\n\x10TemplateEncoding\x12\x11\n\rTEMPLATE_TEXT\x10\x00\x12\x1b\n\x17TEMPLATE_TOKEN_SEGMENTS\x10\x01*/\n\x06Memory\x12\n\n\x06\x44\x45VICE\x10\x00\x12\x0f\n\x0bMAPPED_HOST\x10\x01\x12\x08\n\x04PEER\x10\x02*(\n\x08\x43\x61pacity\x12\x0e\n\nSTATE_ROWS\x10\x00\x12\x0c\n\x08KV_PAGES\x10\x01*-\n\x0eRelocationKind\x12\x0b\n\x07POINTER\x10\x00\x12\x0e\n\nTENSOR_MAP\x10\x01*4\n\x0b\x44raftSource\x12\x0c\n\x08NO_DRAFT\x10\x00\x12\x07\n\x03MTP\x10\x01\x12\x0e\n\nCOPY_DRAFT\x10\x02\x62\x06proto3') _globals = globals() _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) @@ -39,38 +39,38 @@ _globals['_REBUILDSPECULATION']._serialized_options = b'\030\001' _globals['_BUNDLEINDEX_RESOURCESENTRY']._loaded_options = None _globals['_BUNDLEINDEX_RESOURCESENTRY']._serialized_options = b'8\001' - _globals['_PREPARATIONPARAMETERSCOPE']._serialized_start=16343 - _globals['_PREPARATIONPARAMETERSCOPE']._serialized_end=16593 - _globals['_HISTORYKIND']._serialized_start=16596 - _globals['_HISTORYKIND']._serialized_end=16738 - _globals['_VALUESOURCE']._serialized_start=16741 - _globals['_VALUESOURCE']._serialized_end=17708 - _globals['_INPUTINDEXING']._serialized_start=17710 - _globals['_INPUTINDEXING']._serialized_end=17834 - _globals['_STATEACCESSKIND']._serialized_start=17836 - _globals['_STATEACCESSKIND']._serialized_end=17920 - _globals['_GRAPHOPERATION']._serialized_start=17923 - _globals['_GRAPHOPERATION']._serialized_end=18190 - _globals['_TOOLPARSERKIND']._serialized_start=18193 - _globals['_TOOLPARSERKIND']._serialized_end=18354 - _globals['_REASONINGPARSERKIND']._serialized_start=18357 - _globals['_REASONINGPARSERKIND']._serialized_end=18523 - _globals['_IMAGEPREPARATIONKIND']._serialized_start=18526 - _globals['_IMAGEPREPARATIONKIND']._serialized_end=18898 - _globals['_IMAGELAYOUTKIND']._serialized_start=18901 - _globals['_IMAGELAYOUTKIND']._serialized_end=19211 - _globals['_PROMPTENCODER']._serialized_start=19213 - _globals['_PROMPTENCODER']._serialized_end=19293 - _globals['_TEMPLATEENCODING']._serialized_start=19295 - _globals['_TEMPLATEENCODING']._serialized_end=19361 - _globals['_MEMORY']._serialized_start=19363 - _globals['_MEMORY']._serialized_end=19410 - _globals['_CAPACITY']._serialized_start=19412 - _globals['_CAPACITY']._serialized_end=19452 - _globals['_RELOCATIONKIND']._serialized_start=19454 - _globals['_RELOCATIONKIND']._serialized_end=19499 - _globals['_DRAFTSOURCE']._serialized_start=19501 - _globals['_DRAFTSOURCE']._serialized_end=19553 + _globals['_PREPARATIONPARAMETERSCOPE']._serialized_start=16603 + _globals['_PREPARATIONPARAMETERSCOPE']._serialized_end=16853 + _globals['_HISTORYKIND']._serialized_start=16856 + _globals['_HISTORYKIND']._serialized_end=16998 + _globals['_VALUESOURCE']._serialized_start=17001 + _globals['_VALUESOURCE']._serialized_end=17968 + _globals['_INPUTINDEXING']._serialized_start=17970 + _globals['_INPUTINDEXING']._serialized_end=18094 + _globals['_STATEACCESSKIND']._serialized_start=18096 + _globals['_STATEACCESSKIND']._serialized_end=18180 + _globals['_GRAPHOPERATION']._serialized_start=18183 + _globals['_GRAPHOPERATION']._serialized_end=18450 + _globals['_TOOLPARSERKIND']._serialized_start=18453 + _globals['_TOOLPARSERKIND']._serialized_end=18614 + _globals['_REASONINGPARSERKIND']._serialized_start=18617 + _globals['_REASONINGPARSERKIND']._serialized_end=18783 + _globals['_IMAGEPREPARATIONKIND']._serialized_start=18786 + _globals['_IMAGEPREPARATIONKIND']._serialized_end=19194 + _globals['_IMAGELAYOUTKIND']._serialized_start=19197 + _globals['_IMAGELAYOUTKIND']._serialized_end=19534 + _globals['_PROMPTENCODER']._serialized_start=19536 + _globals['_PROMPTENCODER']._serialized_end=19616 + _globals['_TEMPLATEENCODING']._serialized_start=19618 + _globals['_TEMPLATEENCODING']._serialized_end=19684 + _globals['_MEMORY']._serialized_start=19686 + _globals['_MEMORY']._serialized_end=19733 + _globals['_CAPACITY']._serialized_start=19735 + _globals['_CAPACITY']._serialized_end=19775 + _globals['_RELOCATIONKIND']._serialized_start=19777 + _globals['_RELOCATIONKIND']._serialized_end=19822 + _globals['_DRAFTSOURCE']._serialized_start=19824 + _globals['_DRAFTSOURCE']._serialized_end=19876 _globals['_PROTECTEDINDEX']._serialized_start=38 _globals['_PROTECTEDINDEX']._serialized_end=191 _globals['_SIGNEDGROUP']._serialized_start=193 @@ -166,91 +166,93 @@ _globals['_TOKENLIST']._serialized_start=9819 _globals['_TOKENLIST']._serialized_end=9846 _globals['_IMAGESETTINGS']._serialized_start=9849 - _globals['_IMAGESETTINGS']._serialized_end=10357 - _globals['_PATCHMERGEIMAGESETTINGS']._serialized_start=10360 - _globals['_PATCHMERGEIMAGESETTINGS']._serialized_end=10545 - _globals['_DEEPSEEKROWMAJORIMAGESETTINGS']._serialized_start=10548 - _globals['_DEEPSEEKROWMAJORIMAGESETTINGS']._serialized_end=10683 - _globals['_QWENIMAGESETTINGS']._serialized_start=10686 - _globals['_QWENIMAGESETTINGS']._serialized_end=10816 - _globals['_MIMOIMAGESETTINGS']._serialized_start=10818 - _globals['_MIMOIMAGESETTINGS']._serialized_end=10916 - _globals['_ENGRAM']._serialized_start=10918 - _globals['_ENGRAM']._serialized_end=11042 - _globals['_ENGRAMTABLE']._serialized_start=11045 - _globals['_ENGRAMTABLE']._serialized_end=11582 - _globals['_ENGRAMTABLE_ENCODING']._serialized_start=11513 - _globals['_ENGRAMTABLE_ENCODING']._serialized_end=11582 - _globals['_ENGRAMTABLESHARD']._serialized_start=11585 - _globals['_ENGRAMTABLESHARD']._serialized_end=11725 - _globals['_ENGRAMHASH']._serialized_start=11728 - _globals['_ENGRAMHASH']._serialized_end=11923 - _globals['_ENGRAMHASH_METHOD']._serialized_start=11862 - _globals['_ENGRAMHASH_METHOD']._serialized_end=11923 - _globals['_ASSET']._serialized_start=11925 - _globals['_ASSET']._serialized_end=12000 - _globals['_BUNDLEINDEX']._serialized_start=12003 - _globals['_BUNDLEINDEX']._serialized_end=12598 - _globals['_BUNDLEINDEX_RESOURCESENTRY']._serialized_start=12529 - _globals['_BUNDLEINDEX_RESOURCESENTRY']._serialized_end=12598 - _globals['_ROCETRANSPORT']._serialized_start=12601 - _globals['_ROCETRANSPORT']._serialized_end=12849 - _globals['_GRAPHINDEX']._serialized_start=12851 - _globals['_GRAPHINDEX']._serialized_end=12969 - _globals['_PEERMEMORY']._serialized_start=12971 - _globals['_PEERMEMORY']._serialized_end=13048 - _globals['_CONTEXT']._serialized_start=13050 - _globals['_CONTEXT']._serialized_end=13127 - _globals['_LIMIT']._serialized_start=13129 - _globals['_LIMIT']._serialized_end=13163 - _globals['_RESERVATION']._serialized_start=13165 - _globals['_RESERVATION']._serialized_end=13211 - _globals['_SPAN']._serialized_start=13213 - _globals['_SPAN']._serialized_end=13269 - _globals['_ALLOCATION']._serialized_start=13272 - _globals['_ALLOCATION']._serialized_end=13562 - _globals['_SIZING']._serialized_start=13564 - _globals['_SIZING']._serialized_end=13652 - _globals['_MODULE']._serialized_start=13654 - _globals['_MODULE']._serialized_end=13730 - _globals['_GLOBAL']._serialized_start=13732 - _globals['_GLOBAL']._serialized_end=13834 - _globals['_FUNCTION']._serialized_start=13836 - _globals['_FUNCTION']._serialized_end=13957 - _globals['_FUNCTIONATTRIBUTE']._serialized_start=13959 - _globals['_FUNCTIONATTRIBUTE']._serialized_end=14005 - _globals['_REFERENCE']._serialized_start=14007 - _globals['_REFERENCE']._serialized_end=14054 - _globals['_RELOCATION']._serialized_start=14056 - _globals['_RELOCATION']._serialized_end=14171 - _globals['_BLOB']._serialized_start=14173 - _globals['_BLOB']._serialized_end=14241 - _globals['_ATTRIBUTE']._serialized_start=14243 - _globals['_ATTRIBUTE']._serialized_end=14302 - _globals['_KERNEL']._serialized_start=14305 - _globals['_KERNEL']._serialized_end=14462 - _globals['_MEMSET']._serialized_start=14465 - _globals['_MEMSET']._serialized_end=14603 - _globals['_COPY']._serialized_start=14605 - _globals['_COPY']._serialized_end=14716 - _globals['_EMPTY']._serialized_start=14718 - _globals['_EMPTY']._serialized_end=14725 - _globals['_EVENTWAIT']._serialized_start=14727 - _globals['_EVENTWAIT']._serialized_end=14753 - _globals['_NODE']._serialized_start=14756 - _globals['_NODE']._serialized_end=14981 - _globals['_EDGE']._serialized_start=14983 - _globals['_EDGE']._serialized_end=15040 - _globals['_EXECUTION']._serialized_start=15043 - _globals['_EXECUTION']._serialized_end=15356 - _globals['_PERSISTENTWORKER']._serialized_start=15359 - _globals['_PERSISTENTWORKER']._serialized_end=15528 - _globals['_TUNINGGRAPH']._serialized_start=15530 - _globals['_TUNINGGRAPH']._serialized_end=15597 - _globals['_BUFFER']._serialized_start=15600 - _globals['_BUFFER']._serialized_end=15730 - _globals['_EXECUTIONGRAPH']._serialized_start=15733 - _globals['_EXECUTIONGRAPH']._serialized_end=16266 - _globals['_INPUTBINDING']._serialized_start=16268 - _globals['_INPUTBINDING']._serialized_end=16340 + _globals['_IMAGESETTINGS']._serialized_end=10422 + _globals['_MUSEGLIMMERIMAGESETTINGS']._serialized_start=10425 + _globals['_MUSEGLIMMERIMAGESETTINGS']._serialized_end=10617 + _globals['_PATCHMERGEIMAGESETTINGS']._serialized_start=10620 + _globals['_PATCHMERGEIMAGESETTINGS']._serialized_end=10805 + _globals['_DEEPSEEKROWMAJORIMAGESETTINGS']._serialized_start=10808 + _globals['_DEEPSEEKROWMAJORIMAGESETTINGS']._serialized_end=10943 + _globals['_QWENIMAGESETTINGS']._serialized_start=10946 + _globals['_QWENIMAGESETTINGS']._serialized_end=11076 + _globals['_MIMOIMAGESETTINGS']._serialized_start=11078 + _globals['_MIMOIMAGESETTINGS']._serialized_end=11176 + _globals['_ENGRAM']._serialized_start=11178 + _globals['_ENGRAM']._serialized_end=11302 + _globals['_ENGRAMTABLE']._serialized_start=11305 + _globals['_ENGRAMTABLE']._serialized_end=11842 + _globals['_ENGRAMTABLE_ENCODING']._serialized_start=11773 + _globals['_ENGRAMTABLE_ENCODING']._serialized_end=11842 + _globals['_ENGRAMTABLESHARD']._serialized_start=11845 + _globals['_ENGRAMTABLESHARD']._serialized_end=11985 + _globals['_ENGRAMHASH']._serialized_start=11988 + _globals['_ENGRAMHASH']._serialized_end=12183 + _globals['_ENGRAMHASH_METHOD']._serialized_start=12122 + _globals['_ENGRAMHASH_METHOD']._serialized_end=12183 + _globals['_ASSET']._serialized_start=12185 + _globals['_ASSET']._serialized_end=12260 + _globals['_BUNDLEINDEX']._serialized_start=12263 + _globals['_BUNDLEINDEX']._serialized_end=12858 + _globals['_BUNDLEINDEX_RESOURCESENTRY']._serialized_start=12789 + _globals['_BUNDLEINDEX_RESOURCESENTRY']._serialized_end=12858 + _globals['_ROCETRANSPORT']._serialized_start=12861 + _globals['_ROCETRANSPORT']._serialized_end=13109 + _globals['_GRAPHINDEX']._serialized_start=13111 + _globals['_GRAPHINDEX']._serialized_end=13229 + _globals['_PEERMEMORY']._serialized_start=13231 + _globals['_PEERMEMORY']._serialized_end=13308 + _globals['_CONTEXT']._serialized_start=13310 + _globals['_CONTEXT']._serialized_end=13387 + _globals['_LIMIT']._serialized_start=13389 + _globals['_LIMIT']._serialized_end=13423 + _globals['_RESERVATION']._serialized_start=13425 + _globals['_RESERVATION']._serialized_end=13471 + _globals['_SPAN']._serialized_start=13473 + _globals['_SPAN']._serialized_end=13529 + _globals['_ALLOCATION']._serialized_start=13532 + _globals['_ALLOCATION']._serialized_end=13822 + _globals['_SIZING']._serialized_start=13824 + _globals['_SIZING']._serialized_end=13912 + _globals['_MODULE']._serialized_start=13914 + _globals['_MODULE']._serialized_end=13990 + _globals['_GLOBAL']._serialized_start=13992 + _globals['_GLOBAL']._serialized_end=14094 + _globals['_FUNCTION']._serialized_start=14096 + _globals['_FUNCTION']._serialized_end=14217 + _globals['_FUNCTIONATTRIBUTE']._serialized_start=14219 + _globals['_FUNCTIONATTRIBUTE']._serialized_end=14265 + _globals['_REFERENCE']._serialized_start=14267 + _globals['_REFERENCE']._serialized_end=14314 + _globals['_RELOCATION']._serialized_start=14316 + _globals['_RELOCATION']._serialized_end=14431 + _globals['_BLOB']._serialized_start=14433 + _globals['_BLOB']._serialized_end=14501 + _globals['_ATTRIBUTE']._serialized_start=14503 + _globals['_ATTRIBUTE']._serialized_end=14562 + _globals['_KERNEL']._serialized_start=14565 + _globals['_KERNEL']._serialized_end=14722 + _globals['_MEMSET']._serialized_start=14725 + _globals['_MEMSET']._serialized_end=14863 + _globals['_COPY']._serialized_start=14865 + _globals['_COPY']._serialized_end=14976 + _globals['_EMPTY']._serialized_start=14978 + _globals['_EMPTY']._serialized_end=14985 + _globals['_EVENTWAIT']._serialized_start=14987 + _globals['_EVENTWAIT']._serialized_end=15013 + _globals['_NODE']._serialized_start=15016 + _globals['_NODE']._serialized_end=15241 + _globals['_EDGE']._serialized_start=15243 + _globals['_EDGE']._serialized_end=15300 + _globals['_EXECUTION']._serialized_start=15303 + _globals['_EXECUTION']._serialized_end=15616 + _globals['_PERSISTENTWORKER']._serialized_start=15619 + _globals['_PERSISTENTWORKER']._serialized_end=15788 + _globals['_TUNINGGRAPH']._serialized_start=15790 + _globals['_TUNINGGRAPH']._serialized_end=15857 + _globals['_BUFFER']._serialized_start=15860 + _globals['_BUFFER']._serialized_end=15990 + _globals['_EXECUTIONGRAPH']._serialized_start=15993 + _globals['_EXECUTIONGRAPH']._serialized_end=16526 + _globals['_INPUTBINDING']._serialized_start=16528 + _globals['_INPUTBINDING']._serialized_end=16600 # @@protoc_insertion_point(module_scope)