tomii-rt 1.0.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.
- tomii_rt-1.0.0/Cargo.toml +29 -0
- tomii_rt-1.0.0/LICENSE +201 -0
- tomii_rt-1.0.0/PKG-INFO +331 -0
- tomii_rt-1.0.0/README.md +302 -0
- tomii_rt-1.0.0/pyproject.toml +76 -0
- tomii_rt-1.0.0/tomii/.gitignore +3 -0
- tomii_rt-1.0.0/tomii/__init__.py +88 -0
- tomii_rt-1.0.0/tomii/__main__.py +79 -0
- tomii_rt-1.0.0/tomii/_bin/PLACEHOLDER +1 -0
- tomii_rt-1.0.0/tomii/_builder.py +414 -0
- tomii_rt-1.0.0/tomii/_export.py +113 -0
- tomii_rt-1.0.0/tomii/_generated.py +140 -0
- tomii_rt-1.0.0/tomii/_graph.py +435 -0
- tomii_rt-1.0.0/tomii/_lib/__init__.py +1 -0
- tomii_rt-1.0.0/tomii/_loop.py +50 -0
- tomii_rt-1.0.0/tomii/_node.py +135 -0
- tomii_rt-1.0.0/tomii/_procs.py +128 -0
- tomii_rt-1.0.0/tomii/_run_config.py +108 -0
- tomii_rt-1.0.0/tomii/_runner.py +226 -0
- tomii_rt-1.0.0/tomii/_schema.py +127 -0
- tomii_rt-1.0.0/tomii/_serialize.py +227 -0
- tomii_rt-1.0.0/tomii/_types.py +110 -0
- tomii_rt-1.0.0/tomii/_var.py +33 -0
- tomii_rt-1.0.0/tomii/_visualize/__init__.py +103 -0
- tomii_rt-1.0.0/tomii/_visualize/_ascii.py +257 -0
- tomii_rt-1.0.0/tomii/_visualize/_codegen.py +337 -0
- tomii_rt-1.0.0/tomii/_visualize/_parser.py +213 -0
- tomii_rt-1.0.0/tomii/_visualize/_server.py +194 -0
- tomii_rt-1.0.0/tomii/_visualize/_web/index.html +1284 -0
- tomii_rt-1.0.0/tomii-types/Cargo.toml +19 -0
- tomii_rt-1.0.0/tomii-types/README.md +17 -0
- tomii_rt-1.0.0/tomii-types/src/lib.rs +2202 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
[workspace]
|
|
2
|
+
members = ["tomii-types", "tomii/_python_bridge"]
|
|
3
|
+
exclude = [
|
|
4
|
+
# Pure-C examples: no Rust source; built with Make, not Cargo.
|
|
5
|
+
"examples/matrix-compute-C",
|
|
6
|
+
"examples/mapreduce",
|
|
7
|
+
"examples/gpu-vectoradd",
|
|
8
|
+
# Pure-Python examples: no Rust source; bridge is in tomii/_python_bridge/.
|
|
9
|
+
"examples/matrix-compute-python",
|
|
10
|
+
# Stale worktree remnant from a prunable branch; exclude to avoid broken path dep.
|
|
11
|
+
"examples/.mimolib",
|
|
12
|
+
# agent-tuning has no Cargo.toml (Python/shell harness only).
|
|
13
|
+
"examples/agent-tuning",
|
|
14
|
+
]
|
|
15
|
+
resolver = "3"
|
|
16
|
+
|
|
17
|
+
# Shared metadata inherited by the publishable crates via `field.workspace = true`.
|
|
18
|
+
[workspace.package]
|
|
19
|
+
version = "1.0.0"
|
|
20
|
+
edition = "2021"
|
|
21
|
+
license = "Apache-2.0"
|
|
22
|
+
authors = ["Τομί Team"]
|
|
23
|
+
repository = "https://github.com/Giotyp/Tomii"
|
|
24
|
+
|
|
25
|
+
[profile.release]
|
|
26
|
+
opt-level = 3
|
|
27
|
+
debug = false
|
|
28
|
+
lto = "thin"
|
|
29
|
+
codegen-units = 1
|
tomii_rt-1.0.0/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 Τομί Team
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
tomii_rt-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: tomii-rt
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Classifier: Programming Language :: Python :: 3
|
|
5
|
+
Classifier: Programming Language :: Rust
|
|
6
|
+
Classifier: Topic :: System :: Distributed Computing
|
|
7
|
+
Classifier: Intended Audience :: Developers
|
|
8
|
+
Classifier: Intended Audience :: Science/Research
|
|
9
|
+
Requires-Dist: pydantic>=2.0
|
|
10
|
+
Requires-Dist: matplotlib>=3.0
|
|
11
|
+
Requires-Dist: optuna>=3 ; extra == 'agent-tuning'
|
|
12
|
+
Requires-Dist: datamodel-code-generator>=0.25 ; extra == 'dev'
|
|
13
|
+
Requires-Dist: pytest>=7.0 ; extra == 'dev'
|
|
14
|
+
Requires-Dist: mypy>=1.0 ; extra == 'dev'
|
|
15
|
+
Requires-Dist: ruff>=0.4 ; extra == 'dev'
|
|
16
|
+
Provides-Extra: agent-tuning
|
|
17
|
+
Provides-Extra: dev
|
|
18
|
+
License-File: LICENSE
|
|
19
|
+
Summary: Python API for the Τομί task-graph framework
|
|
20
|
+
Keywords: task-graph,streaming,mimo,scheduling,low-latency
|
|
21
|
+
Author: Τομί Team
|
|
22
|
+
License-Expression: Apache-2.0
|
|
23
|
+
Requires-Python: >=3.9
|
|
24
|
+
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
25
|
+
Project-URL: Changelog, https://github.com/Giotyp/Tomii/blob/main/CHANGELOG.md
|
|
26
|
+
Project-URL: Homepage, https://github.com/Giotyp/Tomii
|
|
27
|
+
Project-URL: Repository, https://github.com/Giotyp/Tomii
|
|
28
|
+
|
|
29
|
+
# Τομί (Tomii)
|
|
30
|
+
|
|
31
|
+
**Task-graph framework for streaming pipelines, MIMO workloads, and agent-tuneable applications.**
|
|
32
|
+
|
|
33
|
+
Tomii implements **Tripartite Decoupling** separating the three following artifacts: 1) Computation structure, 2) Kernel Implementation, 3) Runtime.
|
|
34
|
+
Each artifact can be modified independently and Tomii is responsible for combining them at compile (transform kernels into tomii-suitable format) or execution time (parse computation structure description).
|
|
35
|
+
|
|
36
|
+
Tomii is *not* a general-purpose Taskflow or TBB replacement. For pure single-stream
|
|
37
|
+
micro-task DAGs where dispatch overhead dominates, Taskflow is faster. Tomii's advantage
|
|
38
|
+
is in workloads that benefit from concurrent streams, generational slot reuse, and
|
|
39
|
+
structured graph surfaces — particularly MIMO-class packet-driven pipelines and
|
|
40
|
+
agent-driven automated optimisation loops.
|
|
41
|
+
|
|
42
|
+
Each benchmark under `bench/<name>/` is verifier-gated and reproducible from this
|
|
43
|
+
repository — run the script in its directory; see `bench/*/README.md` for the topology,
|
|
44
|
+
metric definition, and run instructions. Measured comparison numbers are published in
|
|
45
|
+
the project documentation, not in these READMEs.
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## Python API (recommended)
|
|
50
|
+
|
|
51
|
+
```python
|
|
52
|
+
import tomii as tm
|
|
53
|
+
|
|
54
|
+
app = tm.Graph()
|
|
55
|
+
|
|
56
|
+
buf_size = app.var("buf_size", 100)
|
|
57
|
+
fft_planner = app.var("fft_planner", func="fft_planner", args=[buf_size])
|
|
58
|
+
|
|
59
|
+
gen_vec = app.node("gen_vec", func="generate_vector", factor=200, args=[buf_size])
|
|
60
|
+
compute_fft = app.node("compute_fft", func="compute_fft", factor=200,
|
|
61
|
+
args=[fft_planner, gen_vec.out()])
|
|
62
|
+
vec_mat = app.node("vec_mat", func="vec_to_mat", factor=200,
|
|
63
|
+
args=[gen_vec.out(), compute_fft.wait()])
|
|
64
|
+
|
|
65
|
+
app.build(func_path="plugin/src/lib.rs", plugin_manifest="plugin/Cargo.toml")
|
|
66
|
+
app.run(workers=4, slots=2, timing="timing.csv")
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Install
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
python -m venv .venv && source .venv/bin/activate
|
|
73
|
+
pip install -e ".[dev]"
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Graph API
|
|
77
|
+
|
|
78
|
+
| Method | Description |
|
|
79
|
+
|---|---|
|
|
80
|
+
| `app.var(name, value)` | Constant initialization |
|
|
81
|
+
| `app.var(name, func=..., args=[...])` | Computed initialization |
|
|
82
|
+
| `app.node(name, func=..., args=[...], factor=...)` | Computation node; `factor` = parallel instances |
|
|
83
|
+
| `app.post_node(...)` | Post-computation cleanup node |
|
|
84
|
+
| `node.out(i)` | Data dependency on instance `i` (`$res`) |
|
|
85
|
+
| `node.wait(i)` | Barrier — wait for instance `i` (`$barrier`) |
|
|
86
|
+
| `('dep', node)` | Ordering-only dependency, no output (`$dep`) |
|
|
87
|
+
| `app.network(**cfg)` | Configure UDP/TCP packet-driven dispatch |
|
|
88
|
+
| `app.to_json()` | Export graph to JSON |
|
|
89
|
+
|
|
90
|
+
### Type system
|
|
91
|
+
|
|
92
|
+
```python
|
|
93
|
+
tm.i32(-5) / tm.f32(3.14) / tm.String("hello") / tm.bool_(True)
|
|
94
|
+
tm.Complex64(1.0, -0.5) / tm.Vec("f32", [1.0, 2.0, 3.0])
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Python `int` → `usize`, `float` → `f64` by default.
|
|
98
|
+
|
|
99
|
+
### Loops and conditions
|
|
100
|
+
|
|
101
|
+
```python
|
|
102
|
+
loop_node = app.node("proc", func="process", factor=200,
|
|
103
|
+
loop=Loop("iter", factor=loop_factor))
|
|
104
|
+
|
|
105
|
+
cond_node = app.node("filter", func="filter_fn", factor=200,
|
|
106
|
+
condition=Condition(operation="Eq", value=1, value_type="usize",
|
|
107
|
+
func="check_fn", args=[some_var]))
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### Build options
|
|
111
|
+
|
|
112
|
+
```python
|
|
113
|
+
app.build(func_path="plugin/src/lib.rs", # Rust source — auto-generates wrappers
|
|
114
|
+
# or func_path="include/plugin.h", # C header with // @tomii_export annotations
|
|
115
|
+
plugin_manifest="plugin/Cargo.toml",
|
|
116
|
+
release=True)
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Run options
|
|
120
|
+
|
|
121
|
+
```python
|
|
122
|
+
app.run(workers=8, system_threads=2, slots=4, max_streams=100,
|
|
123
|
+
timing="timing.csv", report="report.json",
|
|
124
|
+
inline_continuation=True, coalesce_barriers=True)
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
## Agent-native interfaces
|
|
130
|
+
|
|
131
|
+
Tomii exposes structured discovery and diagnostic interfaces designed for LLM agents.
|
|
132
|
+
|
|
133
|
+
### Discovery
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
python -m tomii --list-knobs # all graph.run() options
|
|
137
|
+
python -m tomii --list-knobs-json # machine-readable JSON with search hints
|
|
138
|
+
python -m tomii --schema # JSON schema for the graph construction API
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### Structured performance report
|
|
142
|
+
|
|
143
|
+
Pass `report="report.json"` to `app.run()` for a JSON performance report after each run:
|
|
144
|
+
|
|
145
|
+
| Key | Description |
|
|
146
|
+
|---|---|
|
|
147
|
+
| `summary.avg_latency_us` / `p50` / `p99` | Stream latency statistics |
|
|
148
|
+
| `summary.throughput_streams_per_sec` | End-to-end throughput |
|
|
149
|
+
| `summary.scheduling_overhead_diagnostic` | `overhead_pct`, `overhead_us`, interpretation |
|
|
150
|
+
| `per_node` | Per-node avg/p99 exec time, `on_critical_path` flag |
|
|
151
|
+
| `optimization_suggestions` | Prioritised list: category, action, knob, estimated speedup |
|
|
152
|
+
|
|
153
|
+
### Agent Skills
|
|
154
|
+
|
|
155
|
+
[`SKILLS/`](SKILLS/) contains structured workflow skills covering the full optimisation
|
|
156
|
+
lifecycle — from project discovery to graph coarsening:
|
|
157
|
+
|
|
158
|
+
| Skill | Purpose |
|
|
159
|
+
|---|---|
|
|
160
|
+
| `project-discover` | Orient in an unknown project: topology, knob inventory, baseline |
|
|
161
|
+
| `graph-build` | Translate a computation description into a graph + plugin stubs |
|
|
162
|
+
| `run-validate` | Build, verify correctness, establish baseline |
|
|
163
|
+
| `diagnose` | Classify bottleneck (scheduling / compute / imbalance) |
|
|
164
|
+
| `knob-search` | 5-iteration search over scheduler knobs using per-knob hints |
|
|
165
|
+
| `graph-coarsen` | Reduce task count when `overhead_pct > 60%` |
|
|
166
|
+
| `plugin-author` | Write correct `#[tomii_export]` Rust/C plugin functions |
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
./SKILLS/install-skills.sh # installs to .claude/skills/ in CWD
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
## Graph visualisation
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
python -m tomii --visualize examples/stream-analytics/graph.json # browser view
|
|
178
|
+
python -m tomii --visualize examples/stream-analytics/graph.json --edit # browser edit
|
|
179
|
+
python -m tomii --visualize graph.json --ascii # terminal ASCII
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
The web UI renders a colour-coded DAG (Dagre layout): green for compute nodes,
|
|
183
|
+
orange-bordered for conditional, gray for post-nodes. Edges are styled by type
|
|
184
|
+
(`$res` solid blue, `$dep` dashed, `$barrier` thick orange). **Export Python** downloads a
|
|
185
|
+
ready-to-run script from the current graph.
|
|
186
|
+
|
|
187
|
+
---
|
|
188
|
+
|
|
189
|
+
## JSON + CLI workflow
|
|
190
|
+
|
|
191
|
+
```
|
|
192
|
+
cargo run -p tomii-core --bin main -- \
|
|
193
|
+
--json graph.json --dylib plugin.so \
|
|
194
|
+
--workers 4 --slots 2 --max-streams 100
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
Key flags: `--workers`, `--slots`, `--system-threads`, `--timing`, `--report`,
|
|
198
|
+
`--fifo`, `--custom`, `--inline-continuation`, `--coalesce-barriers`,
|
|
199
|
+
`--resolution-strategy multi-slot-batch`.
|
|
200
|
+
|
|
201
|
+
Full flag list: `cargo run -p tomii-core --bin main -- --help`
|
|
202
|
+
|
|
203
|
+
---
|
|
204
|
+
|
|
205
|
+
## Pluggable scheduler
|
|
206
|
+
|
|
207
|
+
Implement the `TaskScheduler` trait (defined entirely in `tomii-types` — no `tomii-core`
|
|
208
|
+
dependency required) and load it at runtime:
|
|
209
|
+
|
|
210
|
+
```bash
|
|
211
|
+
cargo build --release -p scheduler-plugin
|
|
212
|
+
cargo run -p tomii-core --bin main -- \
|
|
213
|
+
--scheduler-plugin target/release/libscheduler_plugin.so \
|
|
214
|
+
--json graph.json --dylib plugin.so
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
See `examples/scheduler-plugin/` for a minimal FIFO example and
|
|
218
|
+
`tomii-core/PLUGIN_SCHEDULER_API.md` for the stability contract.
|
|
219
|
+
|
|
220
|
+
---
|
|
221
|
+
|
|
222
|
+
## Flagship examples
|
|
223
|
+
|
|
224
|
+
### Example #1 — Public 4×4 MIMO uplink benchmark
|
|
225
|
+
|
|
226
|
+
```bash
|
|
227
|
+
cd bench/mimo-bench
|
|
228
|
+
# requires Intel MKL, Agora sender (see README)
|
|
229
|
+
python tomii/run_bench.py --workers 4 --slots 4 --streams 200
|
|
230
|
+
python taskflow/run_bench.py --workers 4 --slots 4 --streams 200
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
Tomii dispatches FFT tasks as each UDP packet arrives; Taskflow must collect all packets
|
|
234
|
+
before submitting the full DAG. This packet-overlap is the structural advantage the
|
|
235
|
+
benchmark measures. See `bench/mimo-bench/README.md` for topology and metric.
|
|
236
|
+
|
|
237
|
+
### Example #2 — Multi-stream pipeline S-scaling
|
|
238
|
+
|
|
239
|
+
```bash
|
|
240
|
+
cd bench/pipeline-bench
|
|
241
|
+
python tomii/run_bench.py --workers 4 --slots 16 --streams 200
|
|
242
|
+
python taskflow/run_bench.py --workers 4 --slots 16 --streams 200
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
Sweeps concurrent-slot count (S) to show how per-stream scheduling overhead amortises
|
|
246
|
+
as multi-slot reuse takes effect. Run `run_bench.py` to generate the sweep CSV locally
|
|
247
|
+
(run outputs are not committed). See `bench/pipeline-bench/README.md` for the topology
|
|
248
|
+
and metric.
|
|
249
|
+
|
|
250
|
+
Tomii runs use `--custom --coalesce-barriers --inline-continuation` (hardcoded in `run_bench.py`);
|
|
251
|
+
these are the recommended flags for streaming workloads. Taskflow uses default `tf::Executor`.
|
|
252
|
+
|
|
253
|
+
### Ergonomics #1 — Agent-native graph tuning
|
|
254
|
+
|
|
255
|
+
```bash
|
|
256
|
+
cd examples/agent-tuning
|
|
257
|
+
bash run_all.sh 50 # runs all 4 arms (random, Bayesian, grid, Claude)
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
Four optimisation arms (random, Bayesian, grid, Claude) compete over the stream-analytics
|
|
261
|
+
knob space with the same budget (50 iterations) and verifier. The agent converges without
|
|
262
|
+
being given source code or documentation; an edit that drops a barrier or removes a `$dep`
|
|
263
|
+
edge fails the verifier and is rejected. See `examples/agent-tuning/README.md`.
|
|
264
|
+
|
|
265
|
+
### Ergonomics #2 — Polyglot plugin showcase
|
|
266
|
+
|
|
267
|
+
The same DAG (FFT + matrix compute) runs with Rust, C, and Python kernels:
|
|
268
|
+
|
|
269
|
+
```bash
|
|
270
|
+
python examples/matrix-compute/run_bench.py --workers 4
|
|
271
|
+
python examples/matrix-compute-C/run_bench.py --workers 4
|
|
272
|
+
python examples/matrix-compute-python/run_bench.py --workers 4
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
No source changes to the runtime — the plugin boundary is a C ABI, language-agnostic by
|
|
276
|
+
design. See `examples/README.md` for the full capability matrix.
|
|
277
|
+
|
|
278
|
+
---
|
|
279
|
+
|
|
280
|
+
## Architecture
|
|
281
|
+
|
|
282
|
+
**Workspace crates:**
|
|
283
|
+
- `tomii-core` — runtime, scheduler, graph engine, network receiver
|
|
284
|
+
- `tomii-types` — `CmTypes` enum + stable scheduler API types (`SchedulerPriority`, `SchedulerWorkerRange`, `CoreSpec`)
|
|
285
|
+
- `tomii-converter` — code-generation: wraps Rust/C plugin headers into `wrappers.rs`/`reg.rs`
|
|
286
|
+
- `tomii-macro` — procedural macros for plugin wrapping (WIP)
|
|
287
|
+
- `tomii/` — Python API package
|
|
288
|
+
|
|
289
|
+
**Key runtime modules (`tomii-core/src/runtime/`):**
|
|
290
|
+
- `resolution_loop.rs` — main resolution loop, batch draining
|
|
291
|
+
- `batch_resolution.rs` — four-phase batch processing (Phases 1–3)
|
|
292
|
+
- `resolution_strategy.rs` — `ResolutionStrategy` trait + `MultiSlotBatchStrategy`
|
|
293
|
+
- `task_execution.rs` — worker task execution, inline-continuation fast path
|
|
294
|
+
- `successor.rs` — successor collection and dependency propagation
|
|
295
|
+
- `shared_data.rs` — `SharedData`, `SlotData`, borrow bundles
|
|
296
|
+
- `slot_lifecycle.rs` — slot completion detection
|
|
297
|
+
- `ARCHITECTURE.md` — detailed threading model, memory ordering, invariants
|
|
298
|
+
|
|
299
|
+
**Threading model:**
|
|
300
|
+
- Worker threads (Rayon or custom pool) with CPU affinity — kernel execution
|
|
301
|
+
- System thread(s) — dependency propagation and slot lifecycle
|
|
302
|
+
- Network receiver threads — low-latency UDP/TCP packet ingestion (feature `network`)
|
|
303
|
+
- Async recorder thread — non-blocking timing output
|
|
304
|
+
|
|
305
|
+
See `tomii-core/src/runtime/ARCHITECTURE.md` for the performance envelope (intrinsic costs,
|
|
306
|
+
target workload classes, and workloads Tomii explicitly does not target).
|
|
307
|
+
|
|
308
|
+
---
|
|
309
|
+
|
|
310
|
+
## Build
|
|
311
|
+
|
|
312
|
+
```bash
|
|
313
|
+
cargo build --release
|
|
314
|
+
make schema # regenerate Python bindings after changing json_structs.rs
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
> **Note for `bench/mimo-bench/` builds:** the MIMO bench links Intel MKL and Agora libs.
|
|
318
|
+
> Run `source examples/mimolib/scripts/export.sh` before building to set the required
|
|
319
|
+
> library paths. See `bench/mimo-bench/README.md` for the full dependency list.
|
|
320
|
+
|
|
321
|
+
## Environment variables
|
|
322
|
+
|
|
323
|
+
- `FUNC_PATH` — path to plugin header or Rust source (required for tomii-converter)
|
|
324
|
+
- `WRAP_PATH` / `REG_PATH` — wrapper/registry files (optional, auto-generated)
|
|
325
|
+
|
|
326
|
+
---
|
|
327
|
+
|
|
328
|
+
## License
|
|
329
|
+
|
|
330
|
+
[Apache License 2.0](LICENSE)
|
|
331
|
+
|