-
Notifications
You must be signed in to change notification settings - Fork 4k
[OVEP] ORT 1.24 Release Patch #27238
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -19,10 +19,13 @@ | |||||||
| namespace onnxruntime { | ||||||||
| namespace openvino_ep { | ||||||||
|
|
||||||||
| class WeightFileManager; | ||||||||
|
|
||||||||
| class SharedContext : public std::enable_shared_from_this<SharedContext> { | ||||||||
| public: | ||||||||
| explicit SharedContext(std::filesystem::path bin_path); | ||||||||
| explicit SharedContext(const std::filesystem::path& bin_path); | ||||||||
| SharedContext() : SharedContext("") {} | ||||||||
| virtual ~SharedContext() {} | ||||||||
|
|
||||||||
| struct Metadata { | ||||||||
| struct Value { | ||||||||
|
|
@@ -83,7 +86,6 @@ class SharedContext : public std::enable_shared_from_this<SharedContext> { | |||||||
| return BinManager::GetBinPathForModel(model_path); | ||||||||
| } | ||||||||
|
|
||||||||
| private: | ||||||||
| struct WeightsFile { | ||||||||
| ORT_DISALLOW_COPY_AND_ASSIGNMENT(WeightsFile); | ||||||||
| WeightsFile() = delete; | ||||||||
|
|
@@ -104,7 +106,9 @@ class SharedContext : public std::enable_shared_from_this<SharedContext> { | |||||||
| std::map<std::string, MappingContainer> imported_device_tensors_; | ||||||||
| }; | ||||||||
|
|
||||||||
| void LoadTensorFromFile( | ||||||||
| private: | ||||||||
| void | ||||||||
| LoadTensorFromFile( | ||||||||
|
Comment on lines
+110
to
+111
|
||||||||
| void | |
| LoadTensorFromFile( | |
| void LoadTensorFromFile( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The WeightsFile struct lacks thread synchronization for its member access. With the introduction of WeightFileManager, WeightsFile instances are now shared across multiple SharedContext objects (line 128-137). This means multiple threads can concurrently call LoadWeights() and TryGetOrCreateDeviceMapping() on the same WeightsFile instance. The LoadWeights() method performs non-thread-safe operations on the file_ member (seekg and read), and TryGetOrCreateDeviceMapping() modifies imported_device_tensors_ without synchronization. Add a mutex member to WeightsFile and protect all member accesses to prevent race conditions.