Skip to content

Commit b06769e

Browse files
committed
Update on "[devtool] introduce datasink class to etdump"
this diff introduce datasink class, the class for managing the customized debug data storage pipeline. Detials can be found in https://docs.google.com/document/d/1y_m32mKdj-OgLcLUz9TKhBW3PC3bBDYSBbeAH544EfM/edit?tab=t.0 Differential Revision: [D69583422](https://our.internmc.facebook.com/intern/diff/D69583422/) [ghstack-poisoned]
2 parents 9c23038 + 1608ab3 commit b06769e

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

devtools/etdump/buffer_data_sink.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <executorch/devtools/etdump/utils.h>
1111

1212
using ::executorch::runtime::Error;
13+
using ::executorch::runtime::Result;
1314

1415
namespace executorch {
1516
namespace etdump {

devtools/etdump/buffer_data_sink.h

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ class BufferDataSink : public DataSinkBase {
3333
explicit BufferDataSink(::executorch::runtime::Span<uint8_t> buffer)
3434
: debug_buffer_(buffer), offset_(0) {}
3535

36+
BufferDataSink(const BufferDataSink&) = delete;
37+
BufferDataSink& operator=(const BufferDataSink&) = delete;
38+
3639
/**
3740
* Write data into the debug buffer and return the offset of the starting
3841
* location of the data within the buffer.
@@ -45,7 +48,8 @@ class BufferDataSink : public DataSinkBase {
4548
* - An error code indicating the failure reason, if any issue
4649
* occurs during the write process.
4750
*/
48-
Result<size_t> write(const void* ptr, size_t length) override;
51+
::executorch::runtime::Result<size_t> write(const void* ptr, size_t length)
52+
override;
4953

5054
/**
5155
* Write tensor into the debug buffer and return the offset of the starting
@@ -57,14 +61,15 @@ class BufferDataSink : public DataSinkBase {
5761
* - An error code indicating the failure reason, if any issue
5862
* occurs during the write process.
5963
*/
60-
Result<size_t> write_tensor(const executorch::aten::Tensor& tensor);
64+
::executorch::runtime::Result<size_t> write_tensor(
65+
const executorch::aten::Tensor& tensor);
6166

6267
/**
6368
* Retrieves the total size of the buffer.
6469
*
6570
* @return A Result object containing the total size of the buffer in bytes.
6671
*/
67-
Result<size_t> get_storage_size() const override;
72+
::executorch::runtime::Result<size_t> get_storage_size() const override;
6873

6974
/**
7075
* Retrieves the number of bytes currently used in the buffer.

devtools/etdump/tests/buffer_data_sink_test.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ using namespace ::testing;
1717
using ::executorch::aten::ScalarType;
1818
using ::executorch::aten::Tensor;
1919
using ::executorch::runtime::Error;
20+
using ::executorch::runtime::Result;
2021
using ::executorch::runtime::Span;
2122
using torch::executor::testing::TensorFactory;
2223

0 commit comments

Comments
 (0)