Skip to content

Commit 7a2144e

Browse files
TrueDoctorKeavon
andauthored
Fix and reenable profiling CI action (#2632)
* Reenable profiling ci action * Remove deprecated iai feature flag * Remove unused import --------- Co-authored-by: Keavon Chambers <keavon@keavon.com>
1 parent ebf3512 commit 7a2144e

File tree

5 files changed

+21
-16
lines changed

5 files changed

+21
-16
lines changed

.github/workflows/comment-profiling-changes.yaml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ env:
99

1010
jobs:
1111
profile:
12-
# TODO(TrueDoctor): Fix and reenable this action
13-
if: false
1412
runs-on: ubuntu-latest
1513
steps:
1614
- uses: actions/checkout@v3
@@ -48,7 +46,7 @@ jobs:
4846
4947
- name: Run baseline benchmarks
5048
run: |
51-
cargo bench --bench compile_demo_art --features=iai -- --save-baseline=master
49+
cargo bench --bench compile_demo_art_iai -- --save-baseline=master
5250
5351
- name: Checkout PR branch
5452
run: |
@@ -57,7 +55,7 @@ jobs:
5755
- name: Run PR benchmarks
5856
id: benchmark
5957
run: |
60-
BENCH_OUTPUT=$(cargo bench --bench compile_demo_art --features=iai -- --baseline=master --output-format=json | jq -sc | sed 's/\\"//g')
58+
BENCH_OUTPUT=$(cargo bench --bench compile_demo_art_iai -- --baseline=master --output-format=json | jq -sc | sed 's/\\"//g')
6159
echo "BENCHMARK_OUTPUT<<EOF" >> $GITHUB_OUTPUT
6260
echo "$BENCH_OUTPUT" >> $GITHUB_OUTPUT
6361
echo "EOF" >> $GITHUB_OUTPUT

node-graph/graph-craft/src/util.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ use crate::proto::ProtoNetwork;
44

55
pub fn load_network(document_string: &str) -> NodeNetwork {
66
let document: serde_json::Value = serde_json::from_str(document_string).expect("Failed to parse document");
7-
serde_json::from_value::<NodeNetwork>(document["network_interface"]["network"].clone()).expect("Failed to parse document")
7+
let document = (document["network_interface"]["network"].clone()).to_string();
8+
serde_json::from_str::<NodeNetwork>(&document).expect("Failed to parse document")
89
}
910

1011
pub fn compile(network: NodeNetwork) -> ProtoNetwork {

node-graph/interpreted-executor/benches/run_cached.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@ mod benchmark_util;
22

33
use benchmark_util::{bench_for_each_demo, setup_network};
44
use criterion::{Criterion, criterion_group, criterion_main};
5-
use graph_craft::graphene_compiler::Executor;
6-
use graphene_std::transform::Footprint;
5+
use graphene_std::Context;
76

87
fn subsequent_evaluations(c: &mut Criterion) {
98
let mut group = c.benchmark_group("Subsequent Evaluations");
10-
let footprint = Footprint::default();
9+
let context: Context = None;
1110
bench_for_each_demo(&mut group, |name, g| {
1211
let (executor, _) = setup_network(name);
13-
futures::executor::block_on((&executor).execute(criterion::black_box(footprint))).unwrap();
14-
g.bench_function(name, |b| b.iter(|| futures::executor::block_on((&executor).execute(criterion::black_box(footprint)))));
12+
g.bench_function(name, |b| {
13+
b.iter(|| futures::executor::block_on(executor.tree().eval_tagged_value(executor.output(), criterion::black_box(context.clone()))).unwrap())
14+
});
1515
});
1616
group.finish();
1717
}

node-graph/interpreted-executor/benches/run_once.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,16 @@ mod benchmark_util;
22

33
use benchmark_util::{bench_for_each_demo, setup_network};
44
use criterion::{Criterion, criterion_group, criterion_main};
5-
use graph_craft::graphene_compiler::Executor;
6-
use graphene_std::transform::Footprint;
5+
use graphene_std::Context;
76

87
fn run_once(c: &mut Criterion) {
98
let mut group = c.benchmark_group("Run Once");
10-
let footprint = Footprint::default();
9+
let context: Context = None;
1110
bench_for_each_demo(&mut group, |name, g| {
1211
g.bench_function(name, |b| {
1312
b.iter_batched(
1413
|| setup_network(name),
15-
|(executor, _)| futures::executor::block_on((&executor).execute(criterion::black_box(footprint))),
14+
|(executor, _)| futures::executor::block_on(executor.tree().eval_tagged_value(executor.output(), criterion::black_box(context.clone()))).unwrap(),
1615
criterion::BatchSize::SmallInput,
1716
)
1817
});

node-graph/interpreted-executor/src/dynamic_executor.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ use graph_craft::proto::{ConstructionArgs, GraphError, LocalFuture, NodeContaine
88
use graph_craft::proto::{GraphErrorType, GraphErrors};
99
use std::collections::{HashMap, HashSet};
1010
use std::error::Error;
11-
use std::panic::UnwindSafe;
1211
use std::sync::Arc;
1312

1413
/// An executor of a node graph that does not require an online compilation server, and instead uses `Box<dyn ...>`.
@@ -101,6 +100,14 @@ impl DynamicExecutor {
101100
self.typing_context.type_of(self.output).map(|node_io| node_io.call_argument.clone())
102101
}
103102

103+
pub fn tree(&self) -> &BorrowTree {
104+
&self.tree
105+
}
106+
107+
pub fn output(&self) -> NodeId {
108+
self.output
109+
}
110+
104111
pub fn output_type(&self) -> Option<Type> {
105112
self.typing_context.type_of(self.output).map(|node_io| node_io.return_value.clone())
106113
}
@@ -239,7 +246,7 @@ impl BorrowTree {
239246
/// This ensures that no borrowed data can escape the node graph.
240247
pub async fn eval_tagged_value<I>(&self, id: NodeId, input: I) -> Result<TaggedValue, String>
241248
where
242-
I: StaticType + 'static + Send + Sync + UnwindSafe,
249+
I: StaticType + 'static + Send + Sync,
243250
{
244251
let (node, _path) = self.nodes.get(&id).cloned().ok_or("Output node not found in executor")?;
245252
let output = node.eval(Box::new(input));

0 commit comments

Comments
 (0)