15 #ifndef LLVM_EXECUTIONENGINE_ORC_ORCREMOTETARGETRPCAPI_H 16 #define LLVM_EXECUTIONENGINE_ORC_ORCREMOTETARGETRPCAPI_H 28 template <
typename ResourceIdT>
30 :
public ErrorInfo<ResourceNotFound<ResourceIdT>> {
35 std::string ResourceDescription =
"")
36 : ResourceId(
std::move(ResourceId)),
37 ResourceDescription(
std::move(ResourceDescription)) {}
44 OS << (ResourceDescription.empty()
45 ?
"Remote resource with id " 46 : ResourceDescription)
47 <<
" " << ResourceId <<
" not found";
51 ResourceIdT ResourceId;
52 std::string ResourceDescription;
55 template <
typename ResourceIdT>
62 : Src(Src), Dst(Dst), Size(Size) {}
64 const char *
getSrc()
const {
return Src; }
81 static const char *
getName() {
return "JITSymbolFlags"; }
84 template <
typename ChannelT>
97 Flags =
JITSymbolFlags(static_cast<JITSymbolFlags::FlagNames>(JITFlags),
105 static const char *
getName() {
return "DirectBufferWriter"; }
108 template <
typename ChannelT>
111 typename std::enable_if<
112 std::is_base_of<RawByteChannel, ChannelT>::value>
::type> {
129 char *Addr =
reinterpret_cast<char *
>(
static_cast<uintptr_t
>(Dst));
133 return C.readBytes(Addr, Size);
148 : NextId(
std::move(FirstValidId)) {}
151 if (!FreeIds.empty()) {
156 assert(NextId + 1 != ~0ULL &&
"All ids allocated");
164 std::vector<ResourceId> FreeIds;
173 void(JITTargetAddress Addr, uint32_t Size)> {
175 static const char *
getName() {
return "RegisterEHFrames"; }
181 void(JITTargetAddress Addr, uint32_t Size)> {
183 static const char *
getName() {
return "DeregisterEHFrames"; }
194 :
public rpc::Function<CallIntVoid, int32_t(JITTargetAddress Addr)> {
196 static const char *
getName() {
return "CallIntVoid"; }
202 :
public rpc::Function<CallMain, int32_t(JITTargetAddress Addr,
203 std::vector<std::string> Args)> {
205 static const char *
getName() {
return "CallMain"; }
211 :
public rpc::Function<CallVoidVoid, void(JITTargetAddress FnAddr)> {
213 static const char *
getName() {
return "CallVoidVoid"; }
224 void(ResourceIdMgr::ResourceId AllocatorID)> {
226 static const char *
getName() {
return "CreateRemoteAllocator"; }
232 void(ResourceIdMgr::ResourceId AllocatorID)> {
234 static const char *
getName() {
return "DestroyRemoteAllocator"; }
239 :
public rpc::Function<ReadMem, std::vector<uint8_t>(JITTargetAddress Src,
242 static const char *
getName() {
return "ReadMem"; }
248 JITTargetAddress(ResourceIdMgr::ResourceId AllocID,
249 uint64_t Size, uint32_t Align)> {
251 static const char *
getName() {
return "ReserveMem"; }
257 void(ResourceIdMgr::ResourceId AllocID,
258 JITTargetAddress Dst, uint32_t ProtFlags)> {
260 static const char *
getName() {
return "SetProtections"; }
265 :
public rpc::Function<WriteMem, void(remote::DirectBufferWriter DB)> {
267 static const char *
getName() {
return "WriteMem"; }
272 JITTargetAddress Val)> {
274 static const char *
getName() {
return "WritePtr"; }
285 void(ResourceIdMgr::ResourceId StubOwnerID)> {
287 static const char *
getName() {
return "CreateIndirectStubsOwner"; }
293 void(ResourceIdMgr::ResourceId StubsOwnerID)> {
295 static const char *
getName() {
return "DestroyIndirectStubsOwner"; }
302 std::tuple<JITTargetAddress, JITTargetAddress, uint32_t>(
303 ResourceIdMgr::ResourceId StubsOwnerID,
304 uint32_t NumStubsRequired)> {
306 static const char *
getName() {
return "EmitIndirectStubs"; }
312 static const char *
getName() {
return "EmitResolverBlock"; }
318 std::tuple<JITTargetAddress, uint32_t>()> {
320 static const char *
getName() {
return "EmitTrampolineBlock"; }
333 std::tuple<std::string, uint32_t, uint32_t, uint32_t, uint32_t>()> {
335 static const char *
getName() {
return "GetRemoteInfo"; }
341 JITTargetAddress(std::string SymbolName)> {
343 static const char *
getName() {
return "GetSymbolAddress"; }
349 RequestCompile, JITTargetAddress(JITTargetAddress TrampolineAddr)> {
351 static const char *
getName() {
return "RequestCompile"; }
357 static const char *
getName() {
return "TerminateSession"; }
367 : rpc::SingleThreadedRPCEndpoint<rpc::RawByteChannel>(C,
true) {}
375 #endif // LLVM_EXECUTIONENGINE_ORC_ORCREMOTETARGETRPCAPI_H
Call an 'int32_t()'-type function on the remote, returns the called function's return value...
Creates an indirect stub owner on the remote.
RPC function to emit the resolver block and return its address.
This class represents lattice values for constants.
static const char * getName()
Reserve a block of memory on the remote via the given allocator.
EmitIndirectStubs result is (StubsBase, PtrsBase, NumStubsEmitted).
Deregisters EH frames on the remote.
Interface for byte-streams to be used with RPC.
GetRemoteInfo result is (Triple, PointerSize, PageSize, TrampolineSize, IndirectStubsSize).
static const char * getName()
block Block Frequency true
std::error_code convertToErrorCode() const override
Convert this error to a std::error_code.
static const char * getName()
static const char * getName()
RPC function for destroying an indirect stubs owner.
std::error_code orcError(OrcErrorCode ErrCode)
Notify the remote and terminate the session.
Destroys a remote allocator, freeing any memory allocated by it.
static const char * getName()
Error serializeSeq(ChannelT &C, ArgTs &&... Args)
static const char * getName()
static const char * getName()
Call an 'int32_t(int32_t, char**)'-type function on the remote, returns the called function's return ...
uint64_t JITTargetAddress
Represents an address in the target process's address space.
EmitTrampolineBlock result is (BlockAddr, NumTrampolines).
JITTargetAddress getDst() const
static const char * getName()
The SerializationTraits<ChannelT, T> class describes how to serialize and deserialize an instance of ...
ResourceNotFound(ResourceIdT ResourceId, std::string ResourceDescription="")
static const char * getName()
static const char * getName()
Registers EH frames on the remote.
Creates a memory allocator on the remote.
Flags for symbols in the JIT.
static const char * getName()
static const char * getName()
const char * getSrc() const
Get the address of a remote symbol.
Request that the host execute a compile callback.
static const char * getName()
static Error deserialize(ChannelT &C, remote::DirectBufferWriter &DBW)
Template error for missing resources.
DirectBufferWriter(const char *Src, JITTargetAddress Dst, uint64_t Size)
static ErrorSuccess success()
Create a success value.
static const char * getName()
ResourceIdMgr(ResourceId FirstValidId)
UnderlyingType getRawFlagsValue() const
Get the underlying flags value as an integer.
static const char * getName()
Base class for user error types.
void log(raw_ostream &OS) const override
Print an error message to an output stream.
Calls a 'void()'-type function on the remote, returns when the called function completes.
Write to a remote pointer.
void release(ResourceId I)
static Error deserialize(ChannelT &C, JITSymbolFlags &Flags)
static Error serialize(ChannelT &C, const remote::DirectBufferWriter &DBW)
static const char * getName()
Error deserializeSeq(ChannelT &C, ArgTs &... Args)
TargetFlagsType & getTargetFlags()
Return a reference to the target-specific flags.
Read a remote memory block.
static const char * getName()
static Error serialize(ChannelT &C, const JITSymbolFlags &Flags)
OrcRemoteTargetRPCAPI(rpc::RawByteChannel &C)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
Set the memory protection on a memory block.
static const char * getName()
Lightweight error class with error context and mandatory checking.
Write to a remote memory block.
static const char * getName()
This class implements an extremely fast bulk output stream that can only output to a stream...
static const char * getName()
static const char * getName()
static const char * getName()
static const char * getName()