Skip to content
This repository has been archived by the owner on Jan 3, 2023. It is now read-only.

Commit

Permalink
A backend property request (#2281)
Browse files Browse the repository at this point in the history
* A backend property request

* Update backend.hpp

* PR2281. Add get property function to CPU backend

* Update backend.hpp
  • Loading branch information
shssf authored and diyessi committed Jan 22, 2019
1 parent e8b1ece commit af5340d
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/ngraph/runtime/backend.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,16 @@ class ngraph::runtime::Backend
/// \returns true if the op is supported, false otherwise.
virtual bool is_supported(const Node& node) const;

/// \brief A set of properties supported by a backend
enum class Property
{
memory_attach /// New tensor can use attached memory
};

/// \brief Test if a backend particular property is supported
/// \param prop is the feature to test.
/// \returns true if the property is supported, false otherwise.
virtual bool is_supported_property(const Property prop) const { return false; }
void validate(std::shared_ptr<const Function> func,
const std::vector<std::shared_ptr<runtime::Tensor>>& outputs,
const std::vector<std::shared_ptr<runtime::Tensor>>& inputs);
Expand Down
10 changes: 10 additions & 0 deletions src/ngraph/runtime/cpu/cpu_backend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,3 +150,13 @@ bool runtime::cpu::CPU_Backend::is_supported(const Node& op) const
{
return true;
}

bool runtime::cpu::CPU_Backend::is_supported_property(const Property prop) const
{
if (prop == Property::memory_attach)
{
return true;
}

return false;
}
1 change: 1 addition & 0 deletions src/ngraph/runtime/cpu/cpu_backend.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ namespace ngraph
get_performance_data(std::shared_ptr<Function> func) const override;

bool is_supported(const Node& node) const override;
bool is_supported_property(const Property prop) const override;

private:
class FunctionInstance
Expand Down
10 changes: 10 additions & 0 deletions src/ngraph/runtime/intelgpu/intelgpu_backend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2106,3 +2106,13 @@ void runtime::intelgpu::IntelGPUBackend::print_call_performance(

cout.flags(saved_stream_flags); // Restore stream configuration to leave it in original state
}

bool runtime::intelgpu::IntelGPUBackend::is_supported_property(const Property prop) const
{
if (prop == Property::memory_attach)
{
return true;
}

return false;
}
2 changes: 2 additions & 0 deletions src/ngraph/runtime/intelgpu/intelgpu_backend.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ class ngraph::runtime::intelgpu::IntelGPUBackend : public runtime::Backend
std::vector<PerformanceCounter>
get_performance_data(std::shared_ptr<Function> func) const override;

bool is_supported_property(const Property prop) const override;

private:
class FunctionInstance
{
Expand Down

0 comments on commit af5340d

Please sign in to comment.