-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement GetSizeFromTensorTypeProo Wire in accounting Make CUDA EP resource aware and account on assignment Fix missing accountant for Ort format Remove redundant functions Remove unnecessary interface Fix DML issue, minor fixes Fix alert DEMO changes
- Loading branch information
1 parent
80f686e
commit b2bb641
Showing
60 changed files
with
775 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
#pragma once | ||
|
||
#include <optional> | ||
#include <variant> | ||
|
||
namespace onnxruntime { | ||
#ifndef SHARED_PROVIDER | ||
class Graph; | ||
#else | ||
struct Graph; | ||
#endif | ||
|
||
// Common holder for potentially different resource accounting | ||
// for different EPs | ||
using ResourceCount = std::variant<size_t>; | ||
|
||
/// <summary> | ||
/// This class is used for graph partitioning by EPs | ||
/// It stores the cumulative amount of the resource such as | ||
/// memory that would be consumed by the graph nodes if it is assigned to the EP. | ||
/// | ||
/// It provides interfaces to add, remove and query the resource consumption. | ||
/// | ||
/// Each provider may assign its own meaning to the resource according to its constraints. | ||
/// </summary> | ||
class IResourceAccountant { | ||
protected: | ||
IResourceAccountant() = default; | ||
IResourceAccountant(const ResourceCount& threshold) : threshold_(threshold) {} | ||
Check warning on line 32 in include/onnxruntime/core/framework/resource_accountant.h GitHub Actions / Optional Lint C++
|
||
|
||
public: | ||
virtual ~IResourceAccountant() = default; | ||
virtual ResourceCount GetConsumedAmount() const = 0; | ||
virtual void AddConsumedAmount(const ResourceCount& amount) = 0; | ||
virtual void RemoveConsumedAmount(const ResourceCount& amount) = 0; | ||
virtual ResourceCount ComputeResourceCount(const Graph&, size_t node_index) const = 0; | ||
|
||
std::optional<ResourceCount> GetThreshold() const { | ||
return threshold_; | ||
} | ||
|
||
void SetStopAssignment() { | ||
stop_assignment_ = true; | ||
} | ||
|
||
bool IsStopIssued() const noexcept { return stop_assignment_; } | ||
|
||
private: | ||
bool stop_assignment_ = false; | ||
std::optional<ResourceCount> threshold_; | ||
}; | ||
|
||
} // namespace onnxruntime |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.