MCPcopy Create free account
hub / github.com/apache/tvm-ffi / RunLoop

Method RunLoop

src/ffi/extra/dataclass.cc:145–178  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

143 Derived& self() { return static_cast<Derived&>(*this); }
144
145 ResultT RunLoop() {
146 while (!stack_.empty()) {
147 auto& f = stack_.back();
148 bool pushed = false;
149 while (f.child_idx < f.NumChildren()) {
150 size_t idx = f.child_idx++;
151 ResultT r{};
152 if (self().TryVisitChild(f, idx, &r)) {
153 if (self().FeedChild(f, r)) {
154 return self().OnTerminate(std::move(r));
155 }
156 } else {
157 auto maybe = self().PushChildFrame(f, idx);
158 if (maybe.has_value()) {
159 if (self().FeedChild(f, *maybe)) {
160 return self().OnTerminate(std::move(*maybe));
161 }
162 } else {
163 pushed = true;
164 break;
165 }
166 }
167 }
168 if (pushed) continue;
169 ResultT result = self().FinalizeFrame(f);
170 self().OnFrameComplete(f);
171 stack_.pop_back();
172 if (stack_.empty()) return result;
173 if (self().FeedChild(stack_.back(), result)) {
174 return self().OnTerminate(std::move(result));
175 }
176 }
177 TVM_FFI_UNREACHABLE();
178 }
179
180 void EnumerateChildren(FrameBase& frame, const Any& value, const Object* obj, int32_t ti) {
181 using details::AnyUnsafe;

Callers 8

RunMethod · 0.80
RunMethod · 0.80
CreateFnReprMethod · 0.80
HashAnyMethod · 0.80
CreateFnHashMethod · 0.80
CompareAnyMethod · 0.80
CreateFnEqMethod · 0.80
CreateFnCompareMethod · 0.80

Calls 11

emptyMethod · 0.45
backMethod · 0.45
NumChildrenMethod · 0.45
TryVisitChildMethod · 0.45
FeedChildMethod · 0.45
OnTerminateMethod · 0.45
PushChildFrameMethod · 0.45
has_valueMethod · 0.45
FinalizeFrameMethod · 0.45
OnFrameCompleteMethod · 0.45
pop_backMethod · 0.45

Tested by

no test coverage detected