Skip to content

Commit d3e2acd

Browse files
allightcopybara-github
authored andcommitted
Store AotPackageEntrypointsProto within JIT wrappers.
This change modifies BlockBaseJitWrapper, FunctionBaseJitWrapper, and ProcBaseJitWrapper to store the AotPackageEntrypointsProto used during their creation from AOT data. A new accessor method is added to retrieve the stored proto. PiperOrigin-RevId: 860316111
1 parent 456e0d0 commit d3e2acd

File tree

3 files changed

+27
-3
lines changed

3 files changed

+27
-3
lines changed

xls/jit/block_base_jit_wrapper.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,11 +157,19 @@ class BaseBlockJitWrapper {
157157
XLS_ASSIGN_OR_RETURN(
158158
auto jit, BlockJit::CreateFromAot(proto.entrypoint(0),
159159
proto.data_layout(), entrypoint));
160-
return std::unique_ptr<RealType>(new RealType(std ::move(jit)));
160+
161+
auto res = std::unique_ptr<RealType>(new RealType(std ::move(jit)));
162+
res->aot_entrypoints_proto_ = std::move(proto);
163+
return res;
164+
}
165+
166+
const AotPackageEntrypointsProto& aot_entrypoints_proto() const {
167+
return aot_entrypoints_proto_;
161168
}
162169

163170
private:
164171
std::unique_ptr<BlockJit> jit_;
172+
AotPackageEntrypointsProto aot_entrypoints_proto_;
165173
};
166174

167175
} // namespace xls

xls/jit/function_base_jit_wrapper.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,18 @@ class BaseFunctionJitWrapper {
7474
XLS_ASSIGN_OR_RETURN(auto jit, FunctionJit::CreateFromAot(
7575
proto.entrypoint(0), proto.data_layout(),
7676
unpacked_entrypoint, packed_entrypoint));
77-
return std::unique_ptr<RealType>(
77+
78+
auto res = std::unique_ptr<RealType>(
7879
new RealType(std::move(jit),
7980
MatchesImplicitToken(entrypoint_proto.function_metadata()
8081
.function_interface()
8182
.parameters())));
83+
res->aot_entrypoints_proto_ = std::move(proto);
84+
return res;
85+
}
86+
87+
const AotPackageEntrypointsProto& aot_entrypoints_proto() const {
88+
return aot_entrypoints_proto_;
8289
}
8390

8491
// Matches the parameter signature for an "implicit token/activation taking"
@@ -137,6 +144,7 @@ class BaseFunctionJitWrapper {
137144

138145
std::unique_ptr<FunctionJit> jit_;
139146
const bool needs_fake_token_;
147+
AotPackageEntrypointsProto aot_entrypoints_proto_;
140148
};
141149

142150
} // namespace xls

xls/jit/proc_base_jit_wrapper.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,14 @@ class BaseProcJitWrapper {
9898
XLS_ASSIGN_OR_RETURN(auto* man, aot->GetJitChannelQueueManager());
9999
JitRuntime& runtime = man->runtime();
100100

101-
return std::unique_ptr<RealType>(
101+
auto result = std::unique_ptr<RealType>(
102102
new RealType(std::move(package), proc, std::move(aot), runtime));
103+
result->aot_entrypoints_proto_ = std::move(proto);
104+
return result;
105+
}
106+
107+
const AotPackageEntrypointsProto& aot_entrypoints_proto() const {
108+
return aot_entrypoints_proto_;
103109
}
104110

105111
Package* package() const { return package_.get(); }
@@ -203,6 +209,8 @@ class BaseProcJitWrapper {
203209
Proc* proc_;
204210
std::unique_ptr<ProcRuntime> runtime_;
205211
JitRuntime& jit_runtime_;
212+
// Filled in after initialization. The entrypoints we wrap.
213+
AotPackageEntrypointsProto aot_entrypoints_proto_;
206214

207215
private:
208216
std::tuple<std::unique_ptr<Package>, std::unique_ptr<ProcRuntime>>

0 commit comments

Comments
 (0)