@@ -36,6 +36,7 @@ using ::executorch::runtime::DelegateDebugIdType;
3636using ::executorch::runtime::Error;
3737using ::executorch::runtime::EValue;
3838using ::executorch::runtime::EventTracerEntry;
39+ using ::executorch::runtime::kUnsetDelegateDebugIntId ;
3940using ::executorch::runtime::LoggedEValueType;
4041using ::executorch::runtime::Span;
4142using ::executorch::runtime::Tag;
@@ -70,9 +71,7 @@ class ProfilerETDumpTest : public ::testing::Test {
7071 TensorFactory<ScalarType::Float>& tf) {
7172 ET_EXPECT_DEATH (
7273 gen->log_intermediate_output_delegate (
73- " test_event_tensor" ,
74- static_cast <torch::executor::DebugHandle>(-1 ),
75- tf.ones ({3 , 2 })),
74+ " test_event_tensor" , kUnsetDelegateDebugIntId , tf.ones ({3 , 2 })),
7675 " Must set data sink before writing tensor-like data" );
7776 }
7877
@@ -582,7 +581,7 @@ TEST_F(ProfilerETDumpTest, LogDelegateIntermediateOutput) {
582581 Result<bool > log_tensor_list_result =
583582 etdump_gen[i]->log_intermediate_output_delegate (
584583 nullptr ,
585- static_cast <torch::executor::DebugHandle>(- 1 ) ,
584+ kUnsetDelegateDebugIntId ,
586585 ArrayRef<Tensor>(tensors.data (), tensors.size ()));
587586
588587 Result<bool > log_int_result =
@@ -599,7 +598,7 @@ TEST_F(ProfilerETDumpTest, LogDelegateIntermediateOutput) {
599598
600599 Result<bool > log_bool_result =
601600 etdump_gen[i]->log_intermediate_output_delegate (
602- nullptr , static_cast <torch::executor::DebugHandle>(- 1 ) , 29.82 );
601+ nullptr , kUnsetDelegateDebugIntId , 29.82 );
603602
604603 ASSERT_EQ (log_tensor_result.error (), Error::InvalidArgument);
605604 ASSERT_EQ (log_tensor_list_result.error (), Error::InvalidArgument);
@@ -611,33 +610,25 @@ TEST_F(ProfilerETDumpTest, LogDelegateIntermediateOutput) {
611610
612611 // Log a tensor
613612 etdump_gen[i]->log_intermediate_output_delegate (
614- " test_event_tensor" ,
615- static_cast <torch::executor::DebugHandle>(-1 ),
616- tf.ones ({3 , 2 }));
613+ " test_event_tensor" , kUnsetDelegateDebugIntId , tf.ones ({3 , 2 }));
617614
618615 // Log a tensor list
619616 etdump_gen[i]->log_intermediate_output_delegate (
620617 " test_event_tensorlist" ,
621- static_cast <torch::executor::DebugHandle>(- 1 ) ,
618+ kUnsetDelegateDebugIntId ,
622619 ArrayRef<Tensor>(tensors.data (), tensors.size ()));
623620
624621 // Log an int
625622 etdump_gen[i]->log_intermediate_output_delegate (
626- " test_event_tensorlist" ,
627- static_cast <torch::executor::DebugHandle>(-1 ),
628- 10 );
623+ " test_event_tensorlist" , kUnsetDelegateDebugIntId , 10 );
629624
630625 // Log a double
631626 etdump_gen[i]->log_intermediate_output_delegate (
632- " test_event_tensorlist" ,
633- static_cast <torch::executor::DebugHandle>(-1 ),
634- 20.75 );
627+ " test_event_tensorlist" , kUnsetDelegateDebugIntId , 20.75 );
635628
636629 // Log a bool
637630 etdump_gen[i]->log_intermediate_output_delegate (
638- " test_event_tensorlist" ,
639- static_cast <torch::executor::DebugHandle>(-1 ),
640- true );
631+ " test_event_tensorlist" , kUnsetDelegateDebugIntId , true );
641632
642633 ETDumpResult result = etdump_gen[i]->get_etdump_data ();
643634 ASSERT_TRUE (result.buf != nullptr );
@@ -762,23 +753,18 @@ TEST_F(ProfilerETDumpTest, LogDelegateEvents) {
762753 etdump_gen[i]->log_profiling_delegate (
763754 nullptr , 278 , 1 , 2 , metadata, strlen (metadata) + 1 );
764755 EventTracerEntry entry = etdump_gen[i]->start_profiling_delegate (
765- " test_event" , static_cast <torch::executor::DebugHandle>(- 1 ) );
756+ " test_event" , kUnsetDelegateDebugIntId );
766757 EXPECT_NE (entry.delegate_event_id_type , DelegateDebugIdType::kNone );
767758 // Event 2
768759 etdump_gen[i]->end_profiling_delegate (
769760 entry, metadata, strlen (metadata) + 1 );
770761 // Event 3
771762 etdump_gen[i]->log_profiling_delegate (
772- " test_event" ,
773- static_cast <torch::executor::DebugHandle>(-1 ),
774- 1 ,
775- 2 ,
776- nullptr ,
777- 0 );
763+ " test_event" , kUnsetDelegateDebugIntId , 1 , 2 , nullptr , 0 );
778764 // Event 4
779765 etdump_gen[i]->log_profiling_delegate (
780766 " test_event" ,
781- static_cast <torch::executor::DebugHandle>(- 1 ) ,
767+ kUnsetDelegateDebugIntId ,
782768 1 ,
783769 2 ,
784770 metadata,
@@ -856,11 +842,11 @@ TEST_F(ProfilerETDumpTest, LogDelegateEvents) {
856842 std::string (delegate_debug_id_name, strlen (delegate_debug_id_name)),
857843 " test_event" );
858844 // Event 2 used a string delegate debug identifier, so delegate_debug_id_int
859- // should be -1 .
845+ // should be kUnsetDelegateDebugIntId .
860846 EXPECT_EQ (
861847 etdump_ProfileEvent_delegate_debug_id_int (
862848 etdump_Event_profile_event (event)),
863- - 1 );
849+ kUnsetDelegateDebugIntId );
864850 if (!etdump_gen[i]->is_static_etdump ()) {
865851 free (result.buf );
866852 }
0 commit comments