Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions crates/rue-compiler/src/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4363,6 +4363,13 @@ impl CompilerSession {
target: options.target,
preview_features: StablePreviewFeatures::new(&options.preview_features),
};
// This compiler-owned consumer boundary includes retained-terminal
// validation, query dispatch, deterministic terminal collection, and
// the immediate work reduction. The timing layer records it
// worker-locally, so the broad boundary does not serialize the query
// runtime (RUE-1223).
let _body_closure_collection_span =
tracing::info_span!("body_closure_collection", phase = "semantic_analysis").entered();
let request = self
.queries
.revisioned
Expand Down Expand Up @@ -4401,6 +4408,7 @@ impl CompilerSession {
),
}
}
drop(_body_closure_collection_span);
let mut errors = closure
.scheduling_errors
.iter()
Expand Down Expand Up @@ -4826,6 +4834,9 @@ impl CompilerSession {
let mut cfgs = Vec::with_capacity(cfg_inputs.len());
#[cfg(test)]
self.rooted_cfg_executions.clear();
let _cfg_collection_span =
tracing::info_span!("optimized_cfg_collection", phase = "cfg_and_optimization")
.entered();
for (function, semantic_input, body_span) in cfg_inputs {
let (optimized_cfg_key, attempt) = self
.queries
Expand Down Expand Up @@ -4900,6 +4911,7 @@ impl CompilerSession {
body_span,
});
}
drop(_cfg_collection_span);

// Preserve the canonical backend/presentation order independently of
// the query scheduling order. Function-instance identity is the right
Expand Down Expand Up @@ -4963,6 +4975,8 @@ impl CompilerSession {
self.codegen_attempt_work.clear();
self.codegen_collections = 0;
}
let _codegen_collection_span =
tracing::info_span!("codegen_collection", phase = "backend").entered();
for cfg in &cfgs {
let attempt = self
.queries
Expand Down Expand Up @@ -5011,6 +5025,7 @@ impl CompilerSession {
}
}
}
drop(_codegen_collection_span);
let export_roots = graph
.c_export_roots
.iter()
Expand Down
13 changes: 10 additions & 3 deletions crates/rue-query/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4923,8 +4923,8 @@ where
V: Clone + Send + Sync + 'static,
{
tracing::dispatcher::with_default(&tracing_dispatch, || {
let _parent = tracing_parent.enter();
catch_unwind(AssertUnwindSafe(|| {
let parent_span = tracing_parent.enter();
let result = catch_unwind(AssertUnwindSafe(|| {
let mut completed = Vec::new();
loop {
let Some((index, request_id, key)) = lock(&queue).pop_front() else {
Expand All @@ -4935,7 +4935,14 @@ where
completed.push((index, request_id, key, child, result));
}
completed
}))
}));
drop(parent_span);
// A tracing subscriber may buffer observations locally to avoid
// perturbing parallel query execution. This generic lifecycle marker
// lets it publish once at the bounded worker-completion boundary; the
// runtime knows nothing about compiler phases or measurement schemas.
tracing::trace!(timing_flush = true, "registered query worker complete");
result
})
}

Expand Down
3 changes: 3 additions & 0 deletions crates/rue/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ export_file(
rue_binary(
name = "rue",
deps = _DEPS,
test_deps = [
"//crates/rue-query:rue-query",
],
rustc_flags = [
"--check-cfg=cfg(rue_benchmark_allocations)",
"--check-cfg=cfg(test)",
Expand Down
Loading