@gmitch215/folio 1.0.0 → 1.0.1
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.
- package/README.md +78 -19
- package/dist/bake.d.ts +8 -3
- package/dist/bake.js +5 -2
- package/dist/compiler.d.ts +37 -1
- package/dist/compiler.js +116 -1
- package/dist/context.d.ts +33 -0
- package/dist/context.js +93 -0
- package/dist/coordinator.d.ts +1 -1
- package/dist/coordinator.js +4 -2
- package/dist/extract.d.ts +95 -1
- package/dist/extract.js +883 -242
- package/dist/frames.d.ts +15 -1
- package/dist/frames.js +49 -1
- package/dist/inline.d.ts +68 -0
- package/dist/inline.js +503 -0
- package/dist/iteration-admission.d.ts +76 -0
- package/dist/iteration-admission.js +72 -0
- package/dist/iteration-layout.d.ts +75 -0
- package/dist/iteration-layout.js +118 -0
- package/dist/iteration-owner.d.ts +32 -0
- package/dist/iteration-owner.js +223 -0
- package/dist/iteration-worker.d.ts +1 -0
- package/dist/iteration-worker.js +150 -0
- package/dist/iteration.d.ts +163 -0
- package/dist/iteration.js +435 -0
- package/dist/managed.d.ts +6 -0
- package/dist/managed.js +33 -10
- package/dist/node.d.ts +19 -5
- package/dist/node.js +344 -22
- package/dist/tasks.js +16 -3
- package/package.json +6 -2
package/dist/extract.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export interface AdmissionOptions {
|
|
|
8
8
|
/** Iterations assumed for a loop whose bound is neither a constant nor a parameter. */
|
|
9
9
|
assumedTripCount?: number;
|
|
10
10
|
}
|
|
11
|
-
/** Calibrated on Apple M2 Pro; see `results/
|
|
11
|
+
/** Calibrated on Apple M2 Pro; see `results/execution/admission/admission-calibration.summary.json`. */
|
|
12
12
|
export declare const DEFAULT_MINIMUM_REGION_WORK = 200000;
|
|
13
13
|
export declare const DEFAULT_ASSUMED_TRIP_COUNT = 1000;
|
|
14
14
|
export interface ControlPlan {
|
|
@@ -69,3 +69,97 @@ export declare function extract(original: Uint8Array, prepareTracked: (bytes: Ui
|
|
|
69
69
|
accesses: number;
|
|
70
70
|
}) => void;
|
|
71
71
|
}): ControlPlan | undefined;
|
|
72
|
+
/**
|
|
73
|
+
* The stack route: functions a worker could run when it holds a private copy of one mutable i32
|
|
74
|
+
* global, the stack pointer, and calls may recurse. Nothing consumes it yet, and it never changes
|
|
75
|
+
* the control plan or the module-wide reasons.
|
|
76
|
+
*/
|
|
77
|
+
export interface StackRoute {
|
|
78
|
+
/** True when at least one function can run on a worker and no global is refused for the module. */
|
|
79
|
+
eligible: boolean;
|
|
80
|
+
/** The one admitted mutable global and its initial value, when a function reads it. */
|
|
81
|
+
stack?: {
|
|
82
|
+
name: string;
|
|
83
|
+
initial: number;
|
|
84
|
+
};
|
|
85
|
+
/** Immutable globals with a constant initializer that the set reads. */
|
|
86
|
+
constants: string[];
|
|
87
|
+
/** The worker set: closed under calls, in module order. */
|
|
88
|
+
functions: string[];
|
|
89
|
+
/** The members that sit on a call cycle. */
|
|
90
|
+
recursive: string[];
|
|
91
|
+
/** Static work per member; a recursive member counts one level of its own calls. */
|
|
92
|
+
work: Record<string, Work>;
|
|
93
|
+
/** Why the module is or is not eligible. */
|
|
94
|
+
diagnostics: string[];
|
|
95
|
+
}
|
|
96
|
+
/** Computes the stack route of a module. A failure is reported in `diagnostics`, never thrown. */
|
|
97
|
+
export declare function stackRoute(original: Uint8Array, options?: AdmissionOptions): StackRoute;
|
|
98
|
+
/** One local of the owner that the schedule or the outlined body needs. */
|
|
99
|
+
export interface IterationLocal {
|
|
100
|
+
local: number;
|
|
101
|
+
/** `induction` is the trip counter; `stride` advances by a constant each iteration */
|
|
102
|
+
kind: 'induction' | 'stride' | 'invariant' | 'frame';
|
|
103
|
+
/** position in the `iterate` argument list; absent when the body never reads the local */
|
|
104
|
+
argument?: number;
|
|
105
|
+
/** where the value at loop entry comes from, when it is an owner parameter or a constant */
|
|
106
|
+
start?: {
|
|
107
|
+
parameter: number;
|
|
108
|
+
} | {
|
|
109
|
+
constant: number;
|
|
110
|
+
};
|
|
111
|
+
/** change per iteration, modulo 2^32; the value for iteration k is `start + k * stride` */
|
|
112
|
+
stride?: number;
|
|
113
|
+
/**
|
|
114
|
+
* a stride held in an owner local the loop never writes: the step is `stride * entry[strideLocal]`
|
|
115
|
+
* with `stride` 1 or -1, read at loop entry, and the value for iteration k is `start + k * step`
|
|
116
|
+
*/
|
|
117
|
+
strideLocal?: number;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* The iteration route: one owner function whose single loop runs independent calls into the worker
|
|
121
|
+
* set. It reads the stack route and changes nothing; `Folio.open` consumes it when no older route
|
|
122
|
+
* covers the program. `module` holds the worker set, the stack global and the constants, with
|
|
123
|
+
* `iterate` doing one iteration of the body.
|
|
124
|
+
*
|
|
125
|
+
* The route proves a shape, not independence. A loop-carried dependence through the owner frame
|
|
126
|
+
* is caught at run time: the lowered worker module tracks the frame bytes each iteration reads
|
|
127
|
+
* before it writes them, and validation fails an iteration that read a byte an earlier iteration
|
|
128
|
+
* of its batch wrote. Reads of stale callee stack below the frame and imported host functions that
|
|
129
|
+
* touch memory are not tracked.
|
|
130
|
+
*/
|
|
131
|
+
export interface IterationRoute {
|
|
132
|
+
eligible: boolean;
|
|
133
|
+
owner?: string;
|
|
134
|
+
/** the loop label, when the owner names it */
|
|
135
|
+
loop?: string;
|
|
136
|
+
/** the loop runs the entry value of `local` times; an entry value of zero runs it 2^32 times */
|
|
137
|
+
trip?: {
|
|
138
|
+
local: number;
|
|
139
|
+
parameter?: number;
|
|
140
|
+
constant?: number;
|
|
141
|
+
};
|
|
142
|
+
/** every local the body reads or the schedule advances; `iterate` takes them in `argument` order */
|
|
143
|
+
locals: IterationLocal[];
|
|
144
|
+
/**
|
|
145
|
+
* the owner's frame: `local` holds `global - size` after the prologue and `iterate` takes it last.
|
|
146
|
+
* The image at [global - size, global) is copied into each slot at enqueue; a body that reads a
|
|
147
|
+
* frame byte an earlier iteration wrote is not detected here.
|
|
148
|
+
*/
|
|
149
|
+
frame?: {
|
|
150
|
+
global: string;
|
|
151
|
+
size: number;
|
|
152
|
+
local: number;
|
|
153
|
+
copy: true;
|
|
154
|
+
};
|
|
155
|
+
/** export names in `module` */
|
|
156
|
+
iterate?: string;
|
|
157
|
+
stackExport?: string;
|
|
158
|
+
module?: Uint8Array;
|
|
159
|
+
diagnostics: string[];
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Finds an owner whose single loop is a countdown over independent calls into the stack route's
|
|
163
|
+
* worker set and outlines one iteration of it. A refusal is a named diagnostic, never an exception.
|
|
164
|
+
*/
|
|
165
|
+
export declare function iterationRoute(original: Uint8Array, route: StackRoute): IterationRoute;
|