Skip to content

Conversation

@xiaofeihan1
Copy link
Contributor

GenAI does not support profiling within a specific time range. This PR addresses it.

This PR introduces start_profiling() and end_profiling() APIs in the Model class, allowing developers to perform profiling only within a selected time span.

A Model owns an ONNX Runtime Session and the relationship is 1:1. Since profiling in ORT operates at the session level, we expose these APIs at the Model layer to make profiling control more accessible.

Note: We don't want to expose these in Generator layer. Because we have a concern for Generator A start profiling and Generator B end profiling.

}

void SessionInfo::Add(OrtSession& session) {
sessions_.push_back(&session);
Copy link

Choose a reason for hiding this comment

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

Do you need to remove the session from sessions_ if the session is deleted or removed? Otherwise the pointer will be dangerous since the session it points has been removed or destroyed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the callout. There is no SessionInfo::Remove(OrtSession& session). UUIC, A model own a session_info_ and multiple sessions. They are the same lifetime. That means when a session is destoryed, sessions_ is also destoryed.

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.

3 participants