Skip to content

feat(dag): add per-node WCET estimation - #785

Open
romancardenas wants to merge 2 commits into
tier4:mainfrom
romancardenas:dag/per-node-wcet
Open

romancardenas wants to merge 2 commits into
tier4:mainfrom
romancardenas:dag/per-node-wcet

Conversation

@romancardenas

Copy link
Copy Markdown
Contributor

Description

@atsushi421 this is the third PR from #738

It adds per-node timing information. Users can now optionally provide WCET estimates per node. With them, when validating the DAG, Awkernel will compute estimated earliest start, estimated latest finish, and whether the node belongs to the critical path. If the DAG seems unfeasible, the validation will return an error.

Earliest Start Time

For source nodes, ES = 0
For other nodes, ES = max over predecessors p (ES(p) + WCET(p)

Latest Finish Time

For sink nodes, LF = Deadline
For other nodes, LF = min over successors p (LF(p) - WCET(p))

We can now check if, a priori, the DAG scheduling is feasible

ES + WCET <= LF

How was this PR tested?

  • scripts/ci.sh passes on my machine.

@atsushi421 atsushi421 left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest adding wcet: Option<Duration> as an argument to the three register_*_reactor() functions, instead of a separate set_node_wcet() call. None means no estimate, and the analysis treats it as zero, as in this PR. The reasons are:

  • Both current callers know the execution time at registration. rd_gen_to_dags already has execution_time for each node, and Some(convert_duration(execution_time)) gives the WCET. This PR does not update it, so its WCETs stay zero and the new check always passes. With the argument, every caller must pass Some(...) or None explicitly.
  • period and relative_deadline are already registration arguments.
  • The register functions no longer need to return a public NodeIndex. This removes two misuses. An index from one DAG passed to another DAG can silently change the WCET of a different node, and a set_node_wcet() call after finish_create_dags() stores a value that is never validated.
  • None keeps "no estimate" apart from an estimate of zero.

With this change, set_node_wcet(), the unused get_node_wcet(), and the per-node .map_err(...) calls in test_dag can go. If a later use case needs to update a WCET after registration, a setter can come back then.

@romancardenas

Copy link
Copy Markdown
Contributor Author

@atsushi421 I addressed your comments.

Comment thread awkernel_async_lib/src/dag.rs Resolved
Comment thread userland/src/lib.rs Outdated
test_dag::run().await; // test for DAG
test_dag::run()
.await
.map_err(|errors| Cow::Owned(alloc::format!("DAG test failed: {errors:?}")))?; // test for DAG

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With ?, a failure in test_dag now skips test_dvfs, test_raspi_dvfs, test_voluntary_preemption, and test_edf. The errors also appear only once, in Debug form such as [InfeasibleWcet(1, 0)], instead of through the Display impl that test_dag::run() used before. Can you keep the previous log-and-continue handling in test_dag::run(), as rd_gen_to_dags/src/lib.rs does, and leave this file unchanged?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The skipped tests and the Debug output are fixed, thanks. Can you still move the log-and-continue handling back into test_dag::run() and leave userland/src/lib.rs unchanged, as rd_gen_to_dags does?

Comment thread awkernel_async_lib/src/dag.rs Resolved
Comment thread awkernel_async_lib/src/dag.rs Resolved
Comment thread awkernel_async_lib/src/dag.rs Resolved
Comment thread awkernel_async_lib/src/dag.rs Resolved
Comment thread awkernel_async_lib/src/dag.rs Resolved
Comment thread awkernel_async_lib/src/dag.rs Outdated
//! rejects estimates whose longest dependency path exceeds the sink's relative deadline.
//!
//! WCET estimates are used for feasibility validation only. They do not change interval-tick job
//! release times or the existing GEDF deadline assignment: GEDF continues to use the job release

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the only "GEDF" in the tree. The scheduler is SchedulerType::EDF, and DAGs also run under other schedulers, for example PrioritizedFIFO in rd_gen_to_dags. Can you write "the DAG deadline assignment used by the EDF scheduler" and number this heading ## 4. like its siblings?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"EFG" is a typo for "EDF", and the heading still needs the ## 4. number like its siblings.

@romancardenas

romancardenas commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor Author

@atsushi421 I addressed your comments. I pushed them in a new commit. Let me know if it is OK and, after approval, I will squash commits.

Also, I left the comments unresolved so you can go to the points of interest and check whether they are resolved.

@romancardenas

Copy link
Copy Markdown
Contributor Author

@atsushi421 sorry for the remaining issues. They should be fixed now.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants