Skip to content

fix: remove lifetime from RuntimeCache - #129

Merged
theHamsta merged 2 commits into
rustnn:mainfrom
theHamsta:fix-runtime-cache
Jul 30, 2026
Merged

fix: remove lifetime from RuntimeCache#129
theHamsta merged 2 commits into
rustnn:mainfrom
theHamsta:fix-runtime-cache

Conversation

@theHamsta

Copy link
Copy Markdown
Contributor

RuntimeCache can outlive an engine and be shared between engines.

@theHamsta theHamsta closed this Jul 21, 2026
@theHamsta theHamsta reopened this Jul 21, 2026
@theHamsta
theHamsta force-pushed the fix-runtime-cache branch from 82bc499 to f4659f1 Compare July 21, 2026 15:55
RuntimeCache can outlive an engine and be shared between engines.
@theHamsta
theHamsta force-pushed the fix-runtime-cache branch from f4659f1 to 2fa7f74 Compare July 30, 2026 11:26
RuntimeCache is internally synchronized with a shared mutex.
So all methods can be used safely with a shared reference.
Comment thread trtx-sys/build.rs
"void log(Severity severity, AsciiChar const* msg)",
"void log(int32_t severity, char const* msg)",
)
// RuntimeCache is internally synchronized via shared_mutex

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

a bit risky, but currently this just affects RuntimeCache. It avoids use transmuting in Rust code.

The semantics of the const would actually be given for the C++ object. RuntimeCache can be used safely with a shared reference.

@theHamsta
theHamsta requested a review from mtavenrath July 30, 2026 12:23

@mtavenrath mtavenrath 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.

remove the branch in cargo.toml in case this change for development purposes only. besides that approved.

Comment thread trtexec-rs/Cargo.toml

[dependencies]
rustnn = { git = "https://github.com/rustnn/rustnn/", features = [
rustnn = { git = "https://github.com/rustnn/rustnn/", branch = "update-trtx-1.6", features = [

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.

is this intended or just required during development?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

no, it needs to be done because of API break and also when we bump a release

@theHamsta
theHamsta merged commit 3c61301 into rustnn:main Jul 30, 2026
5 checks passed
@theHamsta
theHamsta deleted the fix-runtime-cache branch July 30, 2026 12:27
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