Skip to content

Commit ae7f6f8

Browse files
committed
feat: dory
1 parent 80a718e commit ae7f6f8

13 files changed

Lines changed: 953 additions & 184 deletions

File tree

.github/workflows/rust.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ jobs:
6868
python scripts/download_gpt2.py
6969
- uses: taiki-e/install-action@nextest
7070
- name: Run GPT-2 test
71-
run: cargo nextest run --workspace --run-ignored ignored-only -E 'test(test_gpt2)'
71+
run: cargo nextest run --workspace --run-ignored ignored-only -E 'test(test_gpt2_dory)'
7272

7373
test-bge:
7474
name: BGE Prove & Verify

Cargo.lock

Lines changed: 15 additions & 121 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

atlas-onnx-tracer/src/model/mod.rs

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,20 @@ impl Model {
247247

248248
/// Calculate the maximum number of variables needed for any single node in the model.
249249
pub fn max_num_vars(&self) -> usize {
250+
self.graph
251+
.nodes
252+
.values()
253+
.map(|node| self.node_committed_poly_num_vars(node))
254+
.max()
255+
.unwrap_or(1)
256+
}
257+
258+
/// Number of variables of the *largest* committed polynomial this node
259+
/// contributes. Nodes that commit nothing return `1` (their committed-poly
260+
/// count is zero, so this size is never multiplied in). Used both for the
261+
/// max-over-nodes SRS bound ([`max_num_vars`](Self::max_num_vars)) and, in
262+
/// the packed-opening path, for the total packed coefficient count.
263+
pub fn node_committed_poly_num_vars(&self, node: &ComputationNode) -> usize {
250264
let log_2 = |x: usize| {
251265
assert_ne!(x, 0);
252266

@@ -257,10 +271,7 @@ impl Model {
257271
}
258272
};
259273

260-
self.graph
261-
.nodes
262-
.values()
263-
.map(|node| match &node.operator {
274+
match &node.operator {
264275
// Saturating Add/Sub commit a one-hot clamp read-address
265276
// decomposition. Its chunks are `k_chunk`-wide just like the
266277
// activation lookups, so the largest committed poly is
@@ -312,10 +323,8 @@ impl Model {
312323
let num_indices = input_nodes[1].pow2_padded_num_output_elements();
313324
log_2(num_words) + log_2(num_indices)
314325
}
315-
_ => 1,
316-
})
317-
.max()
318-
.unwrap_or(1)
326+
_ => 1,
327+
}
319328
}
320329
}
321330

0 commit comments

Comments
 (0)