flashrt-structures 0.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- flashrt_structures-0.2.0/LICENSE +202 -0
- flashrt_structures-0.2.0/PKG-INFO +140 -0
- flashrt_structures-0.2.0/README.md +108 -0
- flashrt_structures-0.2.0/flashrt_structures/__init__.py +174 -0
- flashrt_structures-0.2.0/flashrt_structures/adapters/__init__.py +55 -0
- flashrt_structures-0.2.0/flashrt_structures/adapters/diffusers_attention.py +237 -0
- flashrt_structures-0.2.0/flashrt_structures/adapters/diffusers_rotary_attention.py +239 -0
- flashrt_structures-0.2.0/flashrt_structures/adapters/factored_qk_norm_rope.py +252 -0
- flashrt_structures-0.2.0/flashrt_structures/adapters/factored_two_way_attention.py +99 -0
- flashrt_structures-0.2.0/flashrt_structures/adapters/gemma_attention.py +226 -0
- flashrt_structures-0.2.0/flashrt_structures/adapters/packed_qkv_rope.py +342 -0
- flashrt_structures-0.2.0/flashrt_structures/adapters/packed_stream_qk_norm_rope.py +376 -0
- flashrt_structures-0.2.0/flashrt_structures/adapters/qwen_per_head_qk_norm_rope.py +231 -0
- flashrt_structures-0.2.0/flashrt_structures/adapters/sglang_engine.py +207 -0
- flashrt_structures-0.2.0/flashrt_structures/adapters/transformers_attention_interface.py +73 -0
- flashrt_structures-0.2.0/flashrt_structures/adapters/transformers_gated_delta.py +152 -0
- flashrt_structures-0.2.0/flashrt_structures/adapters/transformers_gated_delta_fused.py +96 -0
- flashrt_structures-0.2.0/flashrt_structures/adapters/vllm_engine.py +424 -0
- flashrt_structures-0.2.0/flashrt_structures/adjudicate.py +85 -0
- flashrt_structures-0.2.0/flashrt_structures/aot.py +191 -0
- flashrt_structures-0.2.0/flashrt_structures/autobuild.py +2052 -0
- flashrt_structures-0.2.0/flashrt_structures/beta/__init__.py +43 -0
- flashrt_structures-0.2.0/flashrt_structures/beta/conform.py +94 -0
- flashrt_structures-0.2.0/flashrt_structures/beta/joins.py +113 -0
- flashrt_structures-0.2.0/flashrt_structures/beta/negotiate.py +84 -0
- flashrt_structures-0.2.0/flashrt_structures/beta/ports.py +140 -0
- flashrt_structures-0.2.0/flashrt_structures/decisions.py +80 -0
- flashrt_structures-0.2.0/flashrt_structures/discover.py +623 -0
- flashrt_structures-0.2.0/flashrt_structures/explain.py +70 -0
- flashrt_structures-0.2.0/flashrt_structures/frontdoor.py +572 -0
- flashrt_structures-0.2.0/flashrt_structures/gates.py +465 -0
- flashrt_structures-0.2.0/flashrt_structures/guard.py +421 -0
- flashrt_structures-0.2.0/flashrt_structures/handle.py +189 -0
- flashrt_structures-0.2.0/flashrt_structures/impls/__init__.py +219 -0
- flashrt_structures-0.2.0/flashrt_structures/impls/adaln_producer/__init__.py +8 -0
- flashrt_structures-0.2.0/flashrt_structures/impls/adaln_producer/broker.py +116 -0
- flashrt_structures-0.2.0/flashrt_structures/impls/adaln_producer/fused.py +388 -0
- flashrt_structures-0.2.0/flashrt_structures/impls/adarms_stack/__init__.py +8 -0
- flashrt_structures-0.2.0/flashrt_structures/impls/adarms_stack/fp8_chain.py +832 -0
- flashrt_structures-0.2.0/flashrt_structures/impls/adarms_stack/region.py +102 -0
- flashrt_structures-0.2.0/flashrt_structures/impls/attention_core/__init__.py +132 -0
- flashrt_structures-0.2.0/flashrt_structures/impls/attention_core/fa2_seqused.py +458 -0
- flashrt_structures-0.2.0/flashrt_structures/impls/attention_core/fa4_cute.py +154 -0
- flashrt_structures-0.2.0/flashrt_structures/impls/attention_core/fa4_fp8.py +178 -0
- flashrt_structures-0.2.0/flashrt_structures/impls/attention_core/masked_mha.py +158 -0
- flashrt_structures-0.2.0/flashrt_structures/impls/attention_core/two_way_fa2.py +220 -0
- flashrt_structures-0.2.0/flashrt_structures/impls/cadence_static/__init__.py +18 -0
- flashrt_structures-0.2.0/flashrt_structures/impls/cadence_static/buffers.py +122 -0
- flashrt_structures-0.2.0/flashrt_structures/impls/cadence_static/cross_attention.py +187 -0
- flashrt_structures-0.2.0/flashrt_structures/impls/chain_elements.py +89 -0
- flashrt_structures-0.2.0/flashrt_structures/impls/decode_loop/__init__.py +0 -0
- flashrt_structures-0.2.0/flashrt_structures/impls/decode_loop/fp8_kv.py +206 -0
- flashrt_structures-0.2.0/flashrt_structures/impls/decode_loop/mtp_speculative.py +245 -0
- flashrt_structures-0.2.0/flashrt_structures/impls/decode_loop/whole_step.py +852 -0
- flashrt_structures-0.2.0/flashrt_structures/impls/decoder_block/__init__.py +6 -0
- flashrt_structures-0.2.0/flashrt_structures/impls/decoder_block/attn_sublayer.py +110 -0
- flashrt_structures-0.2.0/flashrt_structures/impls/decoder_block/fused.py +167 -0
- flashrt_structures-0.2.0/flashrt_structures/impls/decoder_ffn/__init__.py +0 -0
- flashrt_structures-0.2.0/flashrt_structures/impls/decoder_ffn/fp8_static.py +310 -0
- flashrt_structures-0.2.0/flashrt_structures/impls/decoder_ffn/fp8_static.yaml +22 -0
- flashrt_structures-0.2.0/flashrt_structures/impls/decoder_ffn/w4a16_static.py +221 -0
- flashrt_structures-0.2.0/flashrt_structures/impls/decoder_ffn/w8a16_static.py +183 -0
- flashrt_structures-0.2.0/flashrt_structures/impls/dit_stack/__init__.py +11 -0
- flashrt_structures-0.2.0/flashrt_structures/impls/dit_stack/fp4_chain.py +417 -0
- flashrt_structures-0.2.0/flashrt_structures/impls/dit_stack/region.py +86 -0
- flashrt_structures-0.2.0/flashrt_structures/impls/fixed_iter/__init__.py +29 -0
- flashrt_structures-0.2.0/flashrt_structures/impls/fixed_iter/openpi.py +264 -0
- flashrt_structures-0.2.0/flashrt_structures/impls/fixed_iter/protocol.py +94 -0
- flashrt_structures-0.2.0/flashrt_structures/impls/gated_delta_core/__init__.py +3 -0
- flashrt_structures-0.2.0/flashrt_structures/impls/gated_delta_core/fused_layer.py +545 -0
- flashrt_structures-0.2.0/flashrt_structures/impls/gated_delta_core/hub_v3.py +152 -0
- flashrt_structures-0.2.0/flashrt_structures/impls/graph_lowering/__init__.py +27 -0
- flashrt_structures-0.2.0/flashrt_structures/impls/graph_lowering/pi052_denoise.py +179 -0
- flashrt_structures-0.2.0/flashrt_structures/impls/graph_lowering/protocol.py +76 -0
- flashrt_structures-0.2.0/flashrt_structures/impls/graph_lowering/qwen3_vl.py +364 -0
- flashrt_structures-0.2.0/flashrt_structures/impls/linear_proj/__init__.py +0 -0
- flashrt_structures-0.2.0/flashrt_structures/impls/linear_proj/fp8_static.py +270 -0
- flashrt_structures-0.2.0/flashrt_structures/impls/linear_proj/nvfp4_balance.py +131 -0
- flashrt_structures-0.2.0/flashrt_structures/impls/linear_proj/nvfp4_dynamic.py +182 -0
- flashrt_structures-0.2.0/flashrt_structures/impls/linear_proj/w8a16_static.py +230 -0
- flashrt_structures-0.2.0/flashrt_structures/impls/modnorm_qkv_chain/__init__.py +0 -0
- flashrt_structures-0.2.0/flashrt_structures/impls/modnorm_qkv_chain/fp8_ptok_table.py +291 -0
- flashrt_structures-0.2.0/flashrt_structures/impls/moe_experts/__init__.py +9 -0
- flashrt_structures-0.2.0/flashrt_structures/impls/moe_experts/nvfp4_dynamic.py +208 -0
- flashrt_structures-0.2.0/flashrt_structures/impls/moe_experts/nvfp4_w4a16.py +129 -0
- flashrt_structures-0.2.0/flashrt_structures/impls/norm_fused/__init__.py +3 -0
- flashrt_structures-0.2.0/flashrt_structures/impls/norm_fused/bf16.py +94 -0
- flashrt_structures-0.2.0/flashrt_structures/impls/norm_fused/fp8_producer.py +84 -0
- flashrt_structures-0.2.0/flashrt_structures/impls/patch_projection/__init__.py +3 -0
- flashrt_structures-0.2.0/flashrt_structures/impls/patch_projection/bf16_flat.py +139 -0
- flashrt_structures-0.2.0/flashrt_structures/impls/prefill_tower/__init__.py +10 -0
- flashrt_structures-0.2.0/flashrt_structures/impls/prefill_tower/fp8_chain.py +955 -0
- flashrt_structures-0.2.0/flashrt_structures/impls/prefill_tower/region.py +99 -0
- flashrt_structures-0.2.0/flashrt_structures/impls/qk_norm_rope/__init__.py +12 -0
- flashrt_structures-0.2.0/flashrt_structures/impls/qk_norm_rope/per_head_gqa.py +199 -0
- flashrt_structures-0.2.0/flashrt_structures/impls/qk_norm_rope/projection_bf16.py +165 -0
- flashrt_structures-0.2.0/flashrt_structures/impls/qkv_pack/__init__.py +5 -0
- flashrt_structures-0.2.0/flashrt_structures/impls/qkv_pack/bf16.py +110 -0
- flashrt_structures-0.2.0/flashrt_structures/impls/qkv_pack/fp8_static.py +435 -0
- flashrt_structures-0.2.0/flashrt_structures/impls/qkv_pack/nvfp4_balance.py +218 -0
- flashrt_structures-0.2.0/flashrt_structures/impls/qkv_rope/__init__.py +3 -0
- flashrt_structures-0.2.0/flashrt_structures/impls/qkv_rope/packed_bias_bf16.py +143 -0
- flashrt_structures-0.2.0/flashrt_structures/impls/step_table.py +113 -0
- flashrt_structures-0.2.0/flashrt_structures/impls/vision_ffn/__init__.py +0 -0
- flashrt_structures-0.2.0/flashrt_structures/impls/vision_ffn/fp8_static.py +261 -0
- flashrt_structures-0.2.0/flashrt_structures/impls/vision_ffn/nvfp4_balance.py +211 -0
- flashrt_structures-0.2.0/flashrt_structures/impls/vision_tower/__init__.py +7 -0
- flashrt_structures-0.2.0/flashrt_structures/impls/vision_tower/fp8_chain.py +533 -0
- flashrt_structures-0.2.0/flashrt_structures/impls/vision_tower/region.py +91 -0
- flashrt_structures-0.2.0/flashrt_structures/matrix.py +126 -0
- flashrt_structures-0.2.0/flashrt_structures/points.py +368 -0
- flashrt_structures-0.2.0/flashrt_structures/prequantized.py +131 -0
- flashrt_structures-0.2.0/flashrt_structures/quantize_on_adopt.py +94 -0
- flashrt_structures-0.2.0/flashrt_structures/recipe.py +438 -0
- flashrt_structures-0.2.0/flashrt_structures/regions.py +208 -0
- flashrt_structures-0.2.0/flashrt_structures/schemes.py +490 -0
- flashrt_structures-0.2.0/flashrt_structures/stages.py +298 -0
- flashrt_structures-0.2.0/flashrt_structures/storage.py +255 -0
- flashrt_structures-0.2.0/flashrt_structures/swap.py +398 -0
- flashrt_structures-0.2.0/flashrt_structures/workspace.py +110 -0
- flashrt_structures-0.2.0/flashrt_structures.egg-info/PKG-INFO +140 -0
- flashrt_structures-0.2.0/flashrt_structures.egg-info/SOURCES.txt +166 -0
- flashrt_structures-0.2.0/flashrt_structures.egg-info/dependency_links.txt +1 -0
- flashrt_structures-0.2.0/flashrt_structures.egg-info/requires.txt +10 -0
- flashrt_structures-0.2.0/flashrt_structures.egg-info/top_level.txt +1 -0
- flashrt_structures-0.2.0/pyproject.toml +57 -0
- flashrt_structures-0.2.0/setup.cfg +4 -0
- flashrt_structures-0.2.0/tests/test_attention_variant_family.py +82 -0
- flashrt_structures-0.2.0/tests/test_diffusers_attention_adapter.py +189 -0
- flashrt_structures-0.2.0/tests/test_fixed_iteration_schedule.py +184 -0
- flashrt_structures-0.2.0/tests/test_graph_lowering_registry.py +62 -0
- flashrt_structures-0.2.0/tests/test_kernel_unavailable.py +101 -0
- flashrt_structures-0.2.0/tests/test_norm_fused_native_dependency.py +58 -0
- flashrt_structures-0.2.0/tests/test_pi05_scalar_capture.py +92 -0
- flashrt_structures-0.2.0/tests/test_schemes_nvfp4_awq.py +35 -0
- flashrt_structures-0.2.0/tests/test_structures_adarms_stack_region.py +221 -0
- flashrt_structures-0.2.0/tests/test_structures_attention_logical_dims.py +144 -0
- flashrt_structures-0.2.0/tests/test_structures_cadence_refresh_wiring.py +104 -0
- flashrt_structures-0.2.0/tests/test_structures_cross_attention_cadence.py +151 -0
- flashrt_structures-0.2.0/tests/test_structures_decode_loop.py +147 -0
- flashrt_structures-0.2.0/tests/test_structures_decode_recipe_generality.py +78 -0
- flashrt_structures-0.2.0/tests/test_structures_diffusers_rotary_attention.py +91 -0
- flashrt_structures-0.2.0/tests/test_structures_discovery_contracts.py +280 -0
- flashrt_structures-0.2.0/tests/test_structures_dit_stack_region.py +206 -0
- flashrt_structures-0.2.0/tests/test_structures_factored_qk_norm_rope_adapter.py +270 -0
- flashrt_structures-0.2.0/tests/test_structures_fault_injection.py +59 -0
- flashrt_structures-0.2.0/tests/test_structures_frontdoor_routed.py +73 -0
- flashrt_structures-0.2.0/tests/test_structures_gated_delta_core.py +261 -0
- flashrt_structures-0.2.0/tests/test_structures_guard.py +304 -0
- flashrt_structures-0.2.0/tests/test_structures_hwcap.py +127 -0
- flashrt_structures-0.2.0/tests/test_structures_modnorm_ptok.py +136 -0
- flashrt_structures-0.2.0/tests/test_structures_packed_stream_qk_norm_rope_gpu.py +274 -0
- flashrt_structures-0.2.0/tests/test_structures_patch_projection.py +187 -0
- flashrt_structures-0.2.0/tests/test_structures_precision_entry.py +232 -0
- flashrt_structures-0.2.0/tests/test_structures_prequantized.py +106 -0
- flashrt_structures-0.2.0/tests/test_structures_qk_norm_rope_impl.py +176 -0
- flashrt_structures-0.2.0/tests/test_structures_qkv_pack_capacity.py +156 -0
- flashrt_structures-0.2.0/tests/test_structures_qkv_pack_hub_gpu.py +84 -0
- flashrt_structures-0.2.0/tests/test_structures_qkv_pack_workspace.py +134 -0
- flashrt_structures-0.2.0/tests/test_structures_qkv_rope.py +255 -0
- flashrt_structures-0.2.0/tests/test_structures_quantize_on_adopt.py +97 -0
- flashrt_structures-0.2.0/tests/test_structures_qwen_qk_norm_rope_adapter.py +249 -0
- flashrt_structures-0.2.0/tests/test_structures_regions.py +128 -0
- flashrt_structures-0.2.0/tests/test_structures_registry_receipt.py +57 -0
- flashrt_structures-0.2.0/tests/test_structures_schemes.py +141 -0
- flashrt_structures-0.2.0/tests/test_structures_two_way_attention.py +182 -0
- flashrt_structures-0.2.0/tests/test_structures_weight_store.py +165 -0
- flashrt_structures-0.2.0/tests/test_structures_workspace_finalize.py +71 -0
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: flashrt-structures
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Attach FlashRT's verified acceleration structures to an unmodified PyTorch host (lerobot, Isaac-GR00T, openpi, transformers, diffusers, vLLM, SGLang) with no fork and no edit to the host.
|
|
5
|
+
License: Apache-2.0
|
|
6
|
+
Project-URL: Homepage, https://github.com/flashrt-project/FlashRT-Structures
|
|
7
|
+
Project-URL: Repository, https://github.com/flashrt-project/FlashRT-Structures
|
|
8
|
+
Project-URL: Issues, https://github.com/flashrt-project/FlashRT-Structures/issues
|
|
9
|
+
Project-URL: Engine, https://github.com/flashrt-project/FlashRT
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Environment :: GPU :: NVIDIA CUDA
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Intended Audience :: Science/Research
|
|
14
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
20
|
+
Requires-Python: >=3.10
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
Requires-Dist: flash-rt>=0.1.0
|
|
24
|
+
Requires-Dist: numpy
|
|
25
|
+
Requires-Dist: pyyaml
|
|
26
|
+
Provides-Extra: hub
|
|
27
|
+
Requires-Dist: kernels>=0.12; extra == "hub"
|
|
28
|
+
Provides-Extra: torch
|
|
29
|
+
Requires-Dist: torch; extra == "torch"
|
|
30
|
+
Requires-Dist: safetensors; extra == "torch"
|
|
31
|
+
Dynamic: license-file
|
|
32
|
+
|
|
33
|
+
# FlashRT Structures
|
|
34
|
+
|
|
35
|
+
Attach [FlashRT](https://github.com/flashrt-project/FlashRT)'s verified
|
|
36
|
+
acceleration structures to an **unmodified** PyTorch host: `lerobot`,
|
|
37
|
+
Isaac-GR00T, `openpi`, `transformers`, `diffusers`, and inside vLLM /
|
|
38
|
+
SGLang. No fork, no edit to the host's source. Kernels arrive from the
|
|
39
|
+
Hugging Face kernel hub at bind time.
|
|
40
|
+
|
|
41
|
+
```python
|
|
42
|
+
import flashrt_structures as structures
|
|
43
|
+
|
|
44
|
+
plan = structures.attach(model, forward) # discover → calibrate → gate → activate
|
|
45
|
+
print(structures.explain(plan)) # bound / routed / kept-at-host / refused, with reasons
|
|
46
|
+
|
|
47
|
+
loop = structures.decode_loop(model, max_len=4096) # serving door
|
|
48
|
+
out = loop.generate(input_ids, max_new_tokens=256)
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Measured on VLA, VLM, LLM and video models across RTX 5090 and Jetson AGX
|
|
52
|
+
Thor; the films are in the
|
|
53
|
+
[walkthrough](https://huggingface.co/spaces/liangsu9988/fast-kernels-are-not-fast-pipelines).
|
|
54
|
+
|
|
55
|
+
## What this package is, and what it is not
|
|
56
|
+
|
|
57
|
+
A *structure* is a versioned specification of one model region: boundary
|
|
58
|
+
tensors, framework-neutral weight slots, calibration points, gates, and a
|
|
59
|
+
plain-torch reference that is the gate's ground truth. Those
|
|
60
|
+
specifications, and the per-host *bindings* that say where the positions
|
|
61
|
+
sit on a concrete host, live in the FlashRT repository as
|
|
62
|
+
`flash_rt.catalog` and ship in the pure-Python `flash-rt` wheel.
|
|
63
|
+
|
|
64
|
+
This package is everything that acts on them for a PyTorch host:
|
|
65
|
+
|
|
66
|
+
| layer | here |
|
|
67
|
+
|---|---|
|
|
68
|
+
| `impls/` | executable forms per structure family: FP8 / NVFP4 / weight-only projections and FFNs, fused norm producers, attention cores, fused decoder and vision towers, the whole-step decode loop, graph-lowering pins |
|
|
69
|
+
| `adapters/` | host adapters: `transformers`, `diffusers`, Gemma / Qwen attention, gated-delta, and the vLLM / SGLang engine hooks |
|
|
70
|
+
| `discover.py`, `autobuild.py`, `points.py`, `schemes.py`, `gates.py` | structural discovery, the one-pass discover → calibrate → bind assembly, calibration collection, quantisation schemes, accuracy judgment |
|
|
71
|
+
| `guard.py`, `swap.py`, `frontdoor.py`, `stages.py`, `recipe.py` | the runtime contract and ledger, attach / detach, the one-call door, graph capture with declared swap windows, recipes |
|
|
72
|
+
| `examples/` | the explicit pipeline: seat tables, calibration hooks and binder calls written out by hand for GR00T N1.7 and π0.5 |
|
|
73
|
+
|
|
74
|
+
Structure specs, references and bindings are **not** here. A new structure
|
|
75
|
+
or a new host binding is a change to `flash_rt/catalog/` in FlashRT; a new
|
|
76
|
+
executable form, adapter or door is a change here.
|
|
77
|
+
|
|
78
|
+
## Install
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
pip install flashrt-structures # pulls flash-rt (pure Python) for the catalog
|
|
82
|
+
pip install "flashrt-structures[hub]" # + the kernel hub client, needed to bind
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
`flash-rt` must be a version that ships the catalog as `flash_rt.catalog`:
|
|
86
|
+
FlashRT `main` after the structures split, or a wheel newer than 0.1.0
|
|
87
|
+
(the 0.1.0 wheel on PyPI predates the split and still carries the layer
|
|
88
|
+
inside `flash_rt.structures`). An older flash-rt makes `import
|
|
89
|
+
flashrt_structures` fail with a message that says exactly this.
|
|
90
|
+
|
|
91
|
+
Bring your own torch. Which kernels exist is decided by the torch version:
|
|
92
|
+
the hub's published face is thickest at `torch 2.11 / cu128` on x86-64 and
|
|
93
|
+
much thinner at the newest release. If binds refuse on a fresh install,
|
|
94
|
+
check the torch version first.
|
|
95
|
+
|
|
96
|
+
Three boundaries produce refusals that look like bugs and are not:
|
|
97
|
+
|
|
98
|
+
- **Kernel availability follows the hub's build matrix, not this
|
|
99
|
+
package's.** The wheel installs on any torch; the kernels do not exist
|
|
100
|
+
for every torch.
|
|
101
|
+
- **`HF_HUB_OFFLINE=1` makes every kernel unavailable, even with a fully
|
|
102
|
+
warm cache**, because a version specifier has to resolve refs online.
|
|
103
|
+
Air-gapped deployments should stage packages and point at them with
|
|
104
|
+
`LOCAL_KERNELS=<repo>=<path>` rather than switching the hub offline.
|
|
105
|
+
- **aarch64 (Jetson Thor, sm_110) is not covered by the current
|
|
106
|
+
qualification pass.** Nothing in the wheel is architecture-bound, but
|
|
107
|
+
the engine adapters were last verified against vLLM 0.26 on Thor in
|
|
108
|
+
August 2026, not in the release run.
|
|
109
|
+
|
|
110
|
+
## Where to read next
|
|
111
|
+
|
|
112
|
+
- [`docs/hosts.md`](docs/hosts.md) — which door your host takes, how to
|
|
113
|
+
tell a seated run from a refused one from a door that never fired, how
|
|
114
|
+
to read a refusal, and what has been measured where.
|
|
115
|
+
- [`docs/structures.md`](docs/structures.md) — the norm: what a structure
|
|
116
|
+
is, the three-layer split, calibration reuse, accuracy bands, the
|
|
117
|
+
runtime contract and ledger, and the norms that came from being wrong.
|
|
118
|
+
- [`docs/serving_engines.md`](docs/serving_engines.md) — attaching inside
|
|
119
|
+
vLLM or SGLang without forking either.
|
|
120
|
+
- [`docs/adopt_in_20_lines.md`](docs/adopt_in_20_lines.md) — a measured
|
|
121
|
+
Qwen3-VL-8B adoption, twenty lines end to end.
|
|
122
|
+
- [`examples/README.md`](examples/README.md) — the explicit pipeline
|
|
123
|
+
against the automatic one, measured on two GR00T N1.7 hosts.
|
|
124
|
+
- [`docs/structure_release_qualification.md`](docs/structure_release_qualification.md)
|
|
125
|
+
— how a structure moves from a reusable boundary to a released hardware
|
|
126
|
+
route.
|
|
127
|
+
- [`AGENTS.md`](AGENTS.md) — the operating procedure for producing
|
|
128
|
+
structures; [`docs/structure_contributing.md`](docs/structure_contributing.md)
|
|
129
|
+
— the contribution boundary and PR self-review checklist.
|
|
130
|
+
|
|
131
|
+
## Tests
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
pip install -e . pytest
|
|
135
|
+
pytest tests # the CPU set; two *_gpu tests need a CUDA device and hub access
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
## License
|
|
139
|
+
|
|
140
|
+
Apache-2.0, same as FlashRT.
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# FlashRT Structures
|
|
2
|
+
|
|
3
|
+
Attach [FlashRT](https://github.com/flashrt-project/FlashRT)'s verified
|
|
4
|
+
acceleration structures to an **unmodified** PyTorch host: `lerobot`,
|
|
5
|
+
Isaac-GR00T, `openpi`, `transformers`, `diffusers`, and inside vLLM /
|
|
6
|
+
SGLang. No fork, no edit to the host's source. Kernels arrive from the
|
|
7
|
+
Hugging Face kernel hub at bind time.
|
|
8
|
+
|
|
9
|
+
```python
|
|
10
|
+
import flashrt_structures as structures
|
|
11
|
+
|
|
12
|
+
plan = structures.attach(model, forward) # discover → calibrate → gate → activate
|
|
13
|
+
print(structures.explain(plan)) # bound / routed / kept-at-host / refused, with reasons
|
|
14
|
+
|
|
15
|
+
loop = structures.decode_loop(model, max_len=4096) # serving door
|
|
16
|
+
out = loop.generate(input_ids, max_new_tokens=256)
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Measured on VLA, VLM, LLM and video models across RTX 5090 and Jetson AGX
|
|
20
|
+
Thor; the films are in the
|
|
21
|
+
[walkthrough](https://huggingface.co/spaces/liangsu9988/fast-kernels-are-not-fast-pipelines).
|
|
22
|
+
|
|
23
|
+
## What this package is, and what it is not
|
|
24
|
+
|
|
25
|
+
A *structure* is a versioned specification of one model region: boundary
|
|
26
|
+
tensors, framework-neutral weight slots, calibration points, gates, and a
|
|
27
|
+
plain-torch reference that is the gate's ground truth. Those
|
|
28
|
+
specifications, and the per-host *bindings* that say where the positions
|
|
29
|
+
sit on a concrete host, live in the FlashRT repository as
|
|
30
|
+
`flash_rt.catalog` and ship in the pure-Python `flash-rt` wheel.
|
|
31
|
+
|
|
32
|
+
This package is everything that acts on them for a PyTorch host:
|
|
33
|
+
|
|
34
|
+
| layer | here |
|
|
35
|
+
|---|---|
|
|
36
|
+
| `impls/` | executable forms per structure family: FP8 / NVFP4 / weight-only projections and FFNs, fused norm producers, attention cores, fused decoder and vision towers, the whole-step decode loop, graph-lowering pins |
|
|
37
|
+
| `adapters/` | host adapters: `transformers`, `diffusers`, Gemma / Qwen attention, gated-delta, and the vLLM / SGLang engine hooks |
|
|
38
|
+
| `discover.py`, `autobuild.py`, `points.py`, `schemes.py`, `gates.py` | structural discovery, the one-pass discover → calibrate → bind assembly, calibration collection, quantisation schemes, accuracy judgment |
|
|
39
|
+
| `guard.py`, `swap.py`, `frontdoor.py`, `stages.py`, `recipe.py` | the runtime contract and ledger, attach / detach, the one-call door, graph capture with declared swap windows, recipes |
|
|
40
|
+
| `examples/` | the explicit pipeline: seat tables, calibration hooks and binder calls written out by hand for GR00T N1.7 and π0.5 |
|
|
41
|
+
|
|
42
|
+
Structure specs, references and bindings are **not** here. A new structure
|
|
43
|
+
or a new host binding is a change to `flash_rt/catalog/` in FlashRT; a new
|
|
44
|
+
executable form, adapter or door is a change here.
|
|
45
|
+
|
|
46
|
+
## Install
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
pip install flashrt-structures # pulls flash-rt (pure Python) for the catalog
|
|
50
|
+
pip install "flashrt-structures[hub]" # + the kernel hub client, needed to bind
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
`flash-rt` must be a version that ships the catalog as `flash_rt.catalog`:
|
|
54
|
+
FlashRT `main` after the structures split, or a wheel newer than 0.1.0
|
|
55
|
+
(the 0.1.0 wheel on PyPI predates the split and still carries the layer
|
|
56
|
+
inside `flash_rt.structures`). An older flash-rt makes `import
|
|
57
|
+
flashrt_structures` fail with a message that says exactly this.
|
|
58
|
+
|
|
59
|
+
Bring your own torch. Which kernels exist is decided by the torch version:
|
|
60
|
+
the hub's published face is thickest at `torch 2.11 / cu128` on x86-64 and
|
|
61
|
+
much thinner at the newest release. If binds refuse on a fresh install,
|
|
62
|
+
check the torch version first.
|
|
63
|
+
|
|
64
|
+
Three boundaries produce refusals that look like bugs and are not:
|
|
65
|
+
|
|
66
|
+
- **Kernel availability follows the hub's build matrix, not this
|
|
67
|
+
package's.** The wheel installs on any torch; the kernels do not exist
|
|
68
|
+
for every torch.
|
|
69
|
+
- **`HF_HUB_OFFLINE=1` makes every kernel unavailable, even with a fully
|
|
70
|
+
warm cache**, because a version specifier has to resolve refs online.
|
|
71
|
+
Air-gapped deployments should stage packages and point at them with
|
|
72
|
+
`LOCAL_KERNELS=<repo>=<path>` rather than switching the hub offline.
|
|
73
|
+
- **aarch64 (Jetson Thor, sm_110) is not covered by the current
|
|
74
|
+
qualification pass.** Nothing in the wheel is architecture-bound, but
|
|
75
|
+
the engine adapters were last verified against vLLM 0.26 on Thor in
|
|
76
|
+
August 2026, not in the release run.
|
|
77
|
+
|
|
78
|
+
## Where to read next
|
|
79
|
+
|
|
80
|
+
- [`docs/hosts.md`](docs/hosts.md) — which door your host takes, how to
|
|
81
|
+
tell a seated run from a refused one from a door that never fired, how
|
|
82
|
+
to read a refusal, and what has been measured where.
|
|
83
|
+
- [`docs/structures.md`](docs/structures.md) — the norm: what a structure
|
|
84
|
+
is, the three-layer split, calibration reuse, accuracy bands, the
|
|
85
|
+
runtime contract and ledger, and the norms that came from being wrong.
|
|
86
|
+
- [`docs/serving_engines.md`](docs/serving_engines.md) — attaching inside
|
|
87
|
+
vLLM or SGLang without forking either.
|
|
88
|
+
- [`docs/adopt_in_20_lines.md`](docs/adopt_in_20_lines.md) — a measured
|
|
89
|
+
Qwen3-VL-8B adoption, twenty lines end to end.
|
|
90
|
+
- [`examples/README.md`](examples/README.md) — the explicit pipeline
|
|
91
|
+
against the automatic one, measured on two GR00T N1.7 hosts.
|
|
92
|
+
- [`docs/structure_release_qualification.md`](docs/structure_release_qualification.md)
|
|
93
|
+
— how a structure moves from a reusable boundary to a released hardware
|
|
94
|
+
route.
|
|
95
|
+
- [`AGENTS.md`](AGENTS.md) — the operating procedure for producing
|
|
96
|
+
structures; [`docs/structure_contributing.md`](docs/structure_contributing.md)
|
|
97
|
+
— the contribution boundary and PR self-review checklist.
|
|
98
|
+
|
|
99
|
+
## Tests
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
pip install -e . pytest
|
|
103
|
+
pytest tests # the CPU set; two *_gpu tests need a CUDA device and hub access
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## License
|
|
107
|
+
|
|
108
|
+
Apache-2.0, same as FlashRT.
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
"""FlashRT structures — verified, composable model sub-blocks.
|
|
2
|
+
|
|
3
|
+
A structure is a versioned specification of one model region: boundary
|
|
4
|
+
tensors, framework-neutral weight slots, a plain reference implementation
|
|
5
|
+
used as ground truth, and qualification gates. This package hosts the
|
|
6
|
+
structure catalog and its registry. Implementations, host adapters, and
|
|
7
|
+
the qualification harness build on top of these specifications.
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
try:
|
|
11
|
+
from flash_rt.catalog.binding import (
|
|
12
|
+
BindingSpec,
|
|
13
|
+
CoverageSegment,
|
|
14
|
+
list_bindings,
|
|
15
|
+
load_binding,
|
|
16
|
+
)
|
|
17
|
+
from flash_rt.catalog.registry import StructureSpec, list_structures, load
|
|
18
|
+
except ImportError as _e: # pragma: no cover - depends on the installed flash-rt
|
|
19
|
+
raise ImportError(
|
|
20
|
+
"flashrt-structures needs a flash-rt that ships the structure "
|
|
21
|
+
"catalog as flash_rt.catalog (FlashRT main after the structures "
|
|
22
|
+
"split; the 0.1.0 wheel on PyPI predates it and still carries the "
|
|
23
|
+
"layer as flash_rt.structures). Install FlashRT from "
|
|
24
|
+
"https://github.com/flashrt-project/FlashRT or upgrade flash-rt."
|
|
25
|
+
) from _e
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def get(name):
|
|
29
|
+
"""Explicit door: pull one structure and bind it yourself.
|
|
30
|
+
|
|
31
|
+
Mirrors ``kernels.get_kernel``: ``get("decoder_ffn").bind(module,
|
|
32
|
+
calibration=[...])`` returns a gated drop-in replacement you plug in
|
|
33
|
+
where you choose. See :mod:`flashrt_structures.handle`.
|
|
34
|
+
"""
|
|
35
|
+
from flashrt_structures.handle import get as _get
|
|
36
|
+
|
|
37
|
+
return _get(name)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def capture(fn, **kwargs):
|
|
41
|
+
"""Capture door: graph a hot stage with declared swap windows.
|
|
42
|
+
|
|
43
|
+
See :func:`flashrt_structures.stages.capture`.
|
|
44
|
+
"""
|
|
45
|
+
from flashrt_structures.stages import capture as _capture
|
|
46
|
+
|
|
47
|
+
return _capture(fn, **kwargs)
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def auto_swaps(model, forward, **kwargs):
|
|
51
|
+
"""Distribution layer: discover, calibrate, bind — one pass, no
|
|
52
|
+
per-seam scaffolding. Returns an :class:`AutoPlan` of swaps.
|
|
53
|
+
|
|
54
|
+
See :func:`flashrt_structures.autobuild.auto_swaps`.
|
|
55
|
+
"""
|
|
56
|
+
from flashrt_structures.autobuild import auto_swaps as _auto
|
|
57
|
+
|
|
58
|
+
return _auto(model, forward, **kwargs)
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def run_recipe(recipe, model, ctx=None, **kwargs):
|
|
62
|
+
"""Recipe door: assemble declared levers, audit same-process on the
|
|
63
|
+
graph, certify or refuse — one call, one receipt.
|
|
64
|
+
|
|
65
|
+
See :mod:`flashrt_structures.recipe` for ``Recipe``/``Lever``/
|
|
66
|
+
``Gates`` and the switch lifecycle.
|
|
67
|
+
"""
|
|
68
|
+
from flashrt_structures.recipe import run_recipe as _run
|
|
69
|
+
|
|
70
|
+
return _run(recipe, model, ctx, **kwargs)
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def attach(model, forward, **kwargs):
|
|
74
|
+
"""One-call front door: discover, calibrate, gate, activate.
|
|
75
|
+
|
|
76
|
+
See :func:`flashrt_structures.frontdoor.attach`. Imported lazily so
|
|
77
|
+
that spec-only consumers do not pay for torch-side machinery.
|
|
78
|
+
"""
|
|
79
|
+
from flashrt_structures.frontdoor import attach as _attach
|
|
80
|
+
|
|
81
|
+
return _attach(model, forward, **kwargs)
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
def adopt_prequantized(model, fmt="ct_nvfp4", **kwargs):
|
|
85
|
+
"""Checkpoint door: adopt an already-quantized checkpoint by
|
|
86
|
+
converting its packed projections into structure impls.
|
|
87
|
+
|
|
88
|
+
See :func:`flashrt_structures.prequantized.adopt_prequantized`.
|
|
89
|
+
"""
|
|
90
|
+
from flashrt_structures.prequantized import (
|
|
91
|
+
adopt_prequantized as _adopt)
|
|
92
|
+
|
|
93
|
+
return _adopt(model, fmt, **kwargs)
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
def quantize_on_adopt(model, fmt="moe_experts_nvfp4", **kwargs):
|
|
97
|
+
"""Checkpoint door: quantize a full-precision checkpoint that cannot
|
|
98
|
+
fit the card, converting its dominant structure family (a sparse-MoE
|
|
99
|
+
expert bank) into structure impls at load time.
|
|
100
|
+
|
|
101
|
+
See :func:`flashrt_structures.quantize_on_adopt.quantize_on_adopt`.
|
|
102
|
+
"""
|
|
103
|
+
from flashrt_structures.quantize_on_adopt import (
|
|
104
|
+
quantize_on_adopt as _adopt)
|
|
105
|
+
|
|
106
|
+
return _adopt(model, fmt, **kwargs)
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
def explain(plan):
|
|
110
|
+
"""Coverage table for one plan: bound / routed / kept / refused,
|
|
111
|
+
each with its reason. See :mod:`flashrt_structures.explain`."""
|
|
112
|
+
from flashrt_structures.explain import explain as _explain
|
|
113
|
+
|
|
114
|
+
return _explain(plan)
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
def decode_loop(model, *, max_len, compile_step=True,
|
|
118
|
+
compile_prefill=True, kv_band=None):
|
|
119
|
+
"""Serving door: the whole-loop decode form (static cache + compiled
|
|
120
|
+
step + whole-step CUDA graph) over whatever structures are attached.
|
|
121
|
+
|
|
122
|
+
See :mod:`flashrt_structures.impls.decode_loop.whole_step`.
|
|
123
|
+
"""
|
|
124
|
+
from flashrt_structures.impls.decode_loop.whole_step import (
|
|
125
|
+
build_decode_loop)
|
|
126
|
+
|
|
127
|
+
return build_decode_loop(model, max_len=max_len,
|
|
128
|
+
compile_step=compile_step,
|
|
129
|
+
compile_prefill=compile_prefill,
|
|
130
|
+
kv_band=kv_band)
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
def aot_package(module, args=(), kwargs=None,
|
|
134
|
+
package_path="module_aot.pt2", **opts):
|
|
135
|
+
"""Whole-graph door: export the swapped module and AOT-compile it
|
|
136
|
+
into a reusable package (graph breaks are defects, not fallbacks).
|
|
137
|
+
|
|
138
|
+
See :mod:`flashrt_structures.aot`.
|
|
139
|
+
"""
|
|
140
|
+
from flashrt_structures.aot import aot_package as _pkg
|
|
141
|
+
|
|
142
|
+
return _pkg(module, args=args, kwargs=kwargs,
|
|
143
|
+
package_path=package_path, **opts)
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
def aot_load(package_path, weights=None):
|
|
147
|
+
"""Load an AOT package back as a callable graph."""
|
|
148
|
+
from flashrt_structures.aot import aot_load as _load
|
|
149
|
+
|
|
150
|
+
return _load(package_path, weights=weights)
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
from . import schemes # noqa: E402 (registry: quantisation schemes)
|
|
154
|
+
|
|
155
|
+
__all__ = [
|
|
156
|
+
"BindingSpec",
|
|
157
|
+
"CoverageSegment",
|
|
158
|
+
"StructureSpec",
|
|
159
|
+
"adopt_prequantized",
|
|
160
|
+
"aot_load",
|
|
161
|
+
"aot_package",
|
|
162
|
+
"decode_loop",
|
|
163
|
+
"explain",
|
|
164
|
+
"attach",
|
|
165
|
+
"capture",
|
|
166
|
+
"get",
|
|
167
|
+
"list_bindings",
|
|
168
|
+
"list_structures",
|
|
169
|
+
"load",
|
|
170
|
+
"load_binding",
|
|
171
|
+
"quantize_on_adopt",
|
|
172
|
+
"run_recipe",
|
|
173
|
+
"schemes",
|
|
174
|
+
]
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"""Host-family adapters — where a structure's seam is host-specific.
|
|
2
|
+
|
|
3
|
+
Importing this package registers the built-in adapters with autobuild.
|
|
4
|
+
Attention seams (attention_core) live here because where the attention
|
|
5
|
+
math runs differs by host family; a static module pattern cannot find
|
|
6
|
+
them, so each family gets a small adapter.
|
|
7
|
+
"""
|
|
8
|
+
from ..autobuild import (
|
|
9
|
+
register_attention_adapter,
|
|
10
|
+
register_gated_delta_adapter,
|
|
11
|
+
register_qk_norm_rope_adapter,
|
|
12
|
+
register_qkv_rope_adapter,
|
|
13
|
+
)
|
|
14
|
+
from .diffusers_attention import DiffusersAttentionAdapter
|
|
15
|
+
from .diffusers_rotary_attention import DiffusersRotaryAttentionAdapter
|
|
16
|
+
from .factored_two_way_attention import FactoredTwoWayAttentionAdapter
|
|
17
|
+
from .factored_qk_norm_rope import FactoredQkNormRopeAdapter
|
|
18
|
+
from .packed_stream_qk_norm_rope import PackedStreamQkNormRopeAdapter
|
|
19
|
+
from .gemma_attention import GemmaAttentionAdapter
|
|
20
|
+
from .transformers_gated_delta import TransformersGatedDeltaAdapter
|
|
21
|
+
from .transformers_gated_delta_fused import (
|
|
22
|
+
TransformersGatedDeltaFusedAdapter,
|
|
23
|
+
)
|
|
24
|
+
from .qwen_per_head_qk_norm_rope import (
|
|
25
|
+
PerHeadGqaQkNormRopeAdapter,
|
|
26
|
+
QwenPerHeadQkNormRopeAdapter,
|
|
27
|
+
)
|
|
28
|
+
from .packed_qkv_rope import PackedQkvRopeAdapter
|
|
29
|
+
|
|
30
|
+
register_qk_norm_rope_adapter(PerHeadGqaQkNormRopeAdapter())
|
|
31
|
+
register_qk_norm_rope_adapter(FactoredQkNormRopeAdapter())
|
|
32
|
+
register_qk_norm_rope_adapter(PackedStreamQkNormRopeAdapter())
|
|
33
|
+
register_qkv_rope_adapter(PackedQkvRopeAdapter())
|
|
34
|
+
register_attention_adapter(GemmaAttentionAdapter())
|
|
35
|
+
register_attention_adapter(FactoredTwoWayAttentionAdapter())
|
|
36
|
+
register_attention_adapter(DiffusersRotaryAttentionAdapter())
|
|
37
|
+
register_attention_adapter(DiffusersAttentionAdapter())
|
|
38
|
+
# the fused-layer form is tried first; it refuses cleanly (missing
|
|
39
|
+
# package entries, out-of-profile layers) and the ladder falls
|
|
40
|
+
# through to the callable-slot form
|
|
41
|
+
register_gated_delta_adapter(TransformersGatedDeltaFusedAdapter())
|
|
42
|
+
register_gated_delta_adapter(TransformersGatedDeltaAdapter())
|
|
43
|
+
|
|
44
|
+
__all__ = [
|
|
45
|
+
"DiffusersAttentionAdapter",
|
|
46
|
+
"DiffusersRotaryAttentionAdapter",
|
|
47
|
+
"GemmaAttentionAdapter",
|
|
48
|
+
"TransformersGatedDeltaAdapter",
|
|
49
|
+
"FactoredTwoWayAttentionAdapter",
|
|
50
|
+
"FactoredQkNormRopeAdapter",
|
|
51
|
+
"PackedStreamQkNormRopeAdapter",
|
|
52
|
+
"PerHeadGqaQkNormRopeAdapter",
|
|
53
|
+
"QwenPerHeadQkNormRopeAdapter",
|
|
54
|
+
"PackedQkvRopeAdapter",
|
|
55
|
+
]
|