Skip to content

Commit

Permalink
[ET-VK] Adding convenience functions in Compute graph to get PushCons…
Browse files Browse the repository at this point in the history
…tantDataInfo for various attributes of a tensor.

This diff adds convenience functions in the Compute graph to get PushConstantDataInfo for various attributes of a tensor.

Differential Revision: [D66853502](https://our.internmc.facebook.com/intern/diff/D66853502/)

ghstack-source-id: 256911528
Pull Request resolved: #7224
  • Loading branch information
trivedivivek committed Dec 6, 2024
1 parent 88a8aad commit a884ada
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions backends/vulkan/runtime/graph/ComputeGraph.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <executorch/backends/vulkan/runtime/graph/containers/SharedObject.h>
#include <executorch/backends/vulkan/runtime/graph/containers/Value.h>

#include <executorch/backends/vulkan/runtime/graph/ops/DispatchNode.h>
#include <executorch/backends/vulkan/runtime/graph/ops/ExecuteNode.h>
#include <executorch/backends/vulkan/runtime/graph/ops/PrepackNode.h>

Expand Down Expand Up @@ -350,6 +351,28 @@ class ComputeGraph final {
return values_.at(idx).toTensor().logical_limits_ubo();
}

inline PushConstantDataInfo sizes_pc_of(const ValueRef idx) const {
return PushConstantDataInfo(
values_.at(idx).toConstTensor().get_uniform_data(), api::kTensorSizes);
}

inline PushConstantDataInfo strides_pc_of(const ValueRef idx) const {
return PushConstantDataInfo(
values_.at(idx).toConstTensor().get_uniform_data(),
api::kTensorStrides);
}

inline PushConstantDataInfo logical_limits_pc_of(const ValueRef idx) const {
return PushConstantDataInfo(
values_.at(idx).toConstTensor().get_uniform_data(),
api::kTensorLogicalLimits);
}

inline PushConstantDataInfo numel_pc_of(const ValueRef idx) const {
return PushConstantDataInfo(
values_.at(idx).toConstTensor().get_uniform_data(), api::kTensorNumel);
}

//
// Scalar Value Extraction
//
Expand Down

0 comments on commit a884ada

Please sign in to comment.