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>
90 return serializeSeq(C, static_cast<JITSymbolFlags::UnderlyingType>(Flags),
99 Flags =
JITSymbolFlags(static_cast<JITSymbolFlags::FlagNames>(JITFlags),
107 static const char *
getName() {
return "DirectBufferWriter"; }
110 template <
typename ChannelT>
113 typename std::enable_if<
114 std::is_base_of<RawByteChannel, ChannelT>::value>
::type> {
131 char *Addr =
reinterpret_cast<char *
>(
static_cast<uintptr_t
>(Dst));
135 return C.readBytes(Addr, Size);
150 : NextId(
std::move(FirstValidId)) {}
153 if (!FreeIds.empty()) {
158 assert(NextId + 1 != ~0ULL &&
"All ids allocated");
166 std::vector<ResourceId> FreeIds;
175 void(JITTargetAddress Addr, uint32_t Size)> {
177 static const char *
getName() {
return "RegisterEHFrames"; }
183 void(JITTargetAddress Addr, uint32_t Size)> {
185 static const char *
getName() {
return "DeregisterEHFrames"; }
196 :
public rpc::Function<CallIntVoid, int32_t(JITTargetAddress Addr)> {
198 static const char *
getName() {
return "CallIntVoid"; }
204 :
public rpc::Function<CallMain, int32_t(JITTargetAddress Addr,
205 std::vector<std::string> Args)> {
207 static const char *
getName() {
return "CallMain"; }
213 :
public rpc::Function<CallVoidVoid, void(JITTargetAddress FnAddr)> {
215 static const char *
getName() {
return "CallVoidVoid"; }
226 void(ResourceIdMgr::ResourceId AllocatorID)> {
228 static const char *
getName() {
return "CreateRemoteAllocator"; }
234 void(ResourceIdMgr::ResourceId AllocatorID)> {
236 static const char *
getName() {
return "DestroyRemoteAllocator"; }
241 :
public rpc::Function<ReadMem, std::vector<uint8_t>(JITTargetAddress Src,
244 static const char *
getName() {
return "ReadMem"; }
250 JITTargetAddress(ResourceIdMgr::ResourceId AllocID,
251 uint64_t Size, uint32_t Align)> {
253 static const char *
getName() {
return "ReserveMem"; }
259 void(ResourceIdMgr::ResourceId AllocID,
260 JITTargetAddress Dst, uint32_t ProtFlags)> {
262 static const char *
getName() {
return "SetProtections"; }
267 :
public rpc::Function<WriteMem, void(remote::DirectBufferWriter DB)> {
269 static const char *
getName() {
return "WriteMem"; }
274 JITTargetAddress Val)> {
276 static const char *
getName() {
return "WritePtr"; }
287 void(ResourceIdMgr::ResourceId StubOwnerID)> {
289 static const char *
getName() {
return "CreateIndirectStubsOwner"; }
295 void(ResourceIdMgr::ResourceId StubsOwnerID)> {
297 static const char *
getName() {
return "DestroyIndirectStubsOwner"; }
304 std::tuple<JITTargetAddress, JITTargetAddress, uint32_t>(
305 ResourceIdMgr::ResourceId StubsOwnerID,
306 uint32_t NumStubsRequired)> {
308 static const char *
getName() {
return "EmitIndirectStubs"; }
314 static const char *
getName() {
return "EmitResolverBlock"; }
320 std::tuple<JITTargetAddress, uint32_t>()> {
322 static const char *
getName() {
return "EmitTrampolineBlock"; }
335 std::tuple<std::string, uint32_t, uint32_t, uint32_t, uint32_t>()> {
337 static const char *
getName() {
return "GetRemoteInfo"; }
343 JITTargetAddress(std::string SymbolName)> {
345 static const char *
getName() {
return "GetSymbolAddress"; }
351 RequestCompile, JITTargetAddress(JITTargetAddress TrampolineAddr)> {
353 static const char *
getName() {
return "RequestCompile"; }
359 static const char *
getName() {
return "TerminateSession"; }
369 : rpc::SingleThreadedRPCEndpoint<rpc::RawByteChannel>(C,
true) {}
377 #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.
Compute iterated dominance frontiers using a linear time algorithm.
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)
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()
constexpr char Size[]
Key for Kernel::Arg::Metadata::mSize.
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()