16 #ifndef LLVM_EXECUTIONENGINE_ORC_ORCREMOTETARGETRPCAPI_H 17 #define LLVM_EXECUTIONENGINE_ORC_ORCREMOTETARGETRPCAPI_H 29 template <
typename ResourceIdT>
31 :
public ErrorInfo<ResourceNotFound<ResourceIdT>> {
36 std::string ResourceDescription =
"")
37 : ResourceId(
std::move(ResourceId)),
38 ResourceDescription(
std::move(ResourceDescription)) {}
45 OS << (ResourceDescription.empty()
46 ?
"Remote resource with id " 47 : ResourceDescription)
48 <<
" " << ResourceId <<
" not found";
52 ResourceIdT ResourceId;
53 std::string ResourceDescription;
56 template <
typename ResourceIdT>
63 : Src(Src), Dst(Dst), Size(Size) {}
65 const char *
getSrc()
const {
return Src; }
82 static const char *
getName() {
return "JITSymbolFlags"; }
85 template <
typename ChannelT>
98 Flags =
JITSymbolFlags(static_cast<JITSymbolFlags::FlagNames>(JITFlags),
106 static const char *
getName() {
return "DirectBufferWriter"; }
109 template <
typename ChannelT>
112 typename std::enable_if<
113 std::is_base_of<RawByteChannel, ChannelT>::value>
::type> {
130 char *Addr =
reinterpret_cast<char *
>(
static_cast<uintptr_t
>(Dst));
134 return C.readBytes(Addr, Size);
149 : NextId(
std::move(FirstValidId)) {}
152 if (!FreeIds.empty()) {
157 assert(NextId + 1 != ~0ULL &&
"All ids allocated");
165 std::vector<ResourceId> FreeIds;
174 void(JITTargetAddress Addr, uint32_t Size)> {
176 static const char *
getName() {
return "RegisterEHFrames"; }
182 void(JITTargetAddress Addr, uint32_t Size)> {
184 static const char *
getName() {
return "DeregisterEHFrames"; }
195 :
public rpc::Function<CallIntVoid, int32_t(JITTargetAddress Addr)> {
197 static const char *
getName() {
return "CallIntVoid"; }
203 :
public rpc::Function<CallMain, int32_t(JITTargetAddress Addr,
204 std::vector<std::string> Args)> {
206 static const char *
getName() {
return "CallMain"; }
212 :
public rpc::Function<CallVoidVoid, void(JITTargetAddress FnAddr)> {
214 static const char *
getName() {
return "CallVoidVoid"; }
225 void(ResourceIdMgr::ResourceId AllocatorID)> {
227 static const char *
getName() {
return "CreateRemoteAllocator"; }
233 void(ResourceIdMgr::ResourceId AllocatorID)> {
235 static const char *
getName() {
return "DestroyRemoteAllocator"; }
240 :
public rpc::Function<ReadMem, std::vector<uint8_t>(JITTargetAddress Src,
243 static const char *
getName() {
return "ReadMem"; }
249 JITTargetAddress(ResourceIdMgr::ResourceId AllocID,
250 uint64_t Size, uint32_t Align)> {
252 static const char *
getName() {
return "ReserveMem"; }
258 void(ResourceIdMgr::ResourceId AllocID,
259 JITTargetAddress Dst, uint32_t ProtFlags)> {
261 static const char *
getName() {
return "SetProtections"; }
266 :
public rpc::Function<WriteMem, void(remote::DirectBufferWriter DB)> {
268 static const char *
getName() {
return "WriteMem"; }
273 JITTargetAddress Val)> {
275 static const char *
getName() {
return "WritePtr"; }
286 void(ResourceIdMgr::ResourceId StubOwnerID)> {
288 static const char *
getName() {
return "CreateIndirectStubsOwner"; }
294 void(ResourceIdMgr::ResourceId StubsOwnerID)> {
296 static const char *
getName() {
return "DestroyIndirectStubsOwner"; }
303 std::tuple<JITTargetAddress, JITTargetAddress, uint32_t>(
304 ResourceIdMgr::ResourceId StubsOwnerID,
305 uint32_t NumStubsRequired)> {
307 static const char *
getName() {
return "EmitIndirectStubs"; }
313 static const char *
getName() {
return "EmitResolverBlock"; }
319 std::tuple<JITTargetAddress, uint32_t>()> {
321 static const char *
getName() {
return "EmitTrampolineBlock"; }
334 std::tuple<std::string, uint32_t, uint32_t, uint32_t, uint32_t>()> {
336 static const char *
getName() {
return "GetRemoteInfo"; }
342 JITTargetAddress(std::string SymbolName)> {
344 static const char *
getName() {
return "GetSymbolAddress"; }
350 RequestCompile, JITTargetAddress(JITTargetAddress TrampolineAddr)> {
352 static const char *
getName() {
return "RequestCompile"; }
358 static const char *
getName() {
return "TerminateSession"; }
368 : rpc::SingleThreadedRPCEndpoint<rpc::RawByteChannel>(C,
true) {}
376 #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()