//
// Automatically generated by ipdlc.
// Edit at your own risk
//
#include "mozilla/hwinference/TextGenerationTypes.h"
#include "ipc/IPCMessageUtils.h"
#include "ipc/IPCMessageUtilsSpecializations.h"
#include "nsIFile.h"
#include "mozilla/ipc/Endpoint.h"
#include "mozilla/ipc/ProtocolMessageUtils.h"
#include "mozilla/ipc/ProtocolUtils.h"
#include "mozilla/ipc/ShmemMessageUtils.h"
#include "mozilla/ipc/TaintingIPCUtils.h"
//-----------------------------------------------------------------------------
// Method definitions for the IPDL type |struct ChatMessage|
//
namespace mozilla {
namespace hwinference {
} // namespace hwinference
} // namespace mozilla
namespace IPC {
auto ParamTraits<::mozilla::hwinference::ChatMessage>::Write(
IPC::MessageWriter* aWriter,
const paramType& aVar) -> void
{
IPC::WriteParam(aWriter, (aVar).role());
// Sentinel = 'role'
(aWriter)->WriteSentinel(72745395);
IPC::WriteParam(aWriter, (aVar).content());
// Sentinel = 'content'
(aWriter)->WriteSentinel(197853948);
}
auto ParamTraits<::mozilla::hwinference::ChatMessage>::Read(IPC::MessageReader* aReader) -> IPC::ReadResult<paramType>
{
auto maybe___role = IPC::ReadParam<::mozilla::dom::TextGenerationRole>(aReader);
if (!maybe___role) {
aReader->FatalError("Error deserializing 'role' (TextGenerationRole) member of 'ChatMessage'");
return {};
}
auto& _role = *maybe___role;
// Sentinel = 'role'
if ((!((aReader)->ReadSentinel(72745395)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'role' (TextGenerationRole) member of 'ChatMessage'");
return {};
}
auto maybe___content = IPC::ReadParam<::nsCString>(aReader);
if (!maybe___content) {
aReader->FatalError("Error deserializing 'content' (nsCString) member of 'ChatMessage'");
return {};
}
auto& _content = *maybe___content;
// Sentinel = 'content'
if ((!((aReader)->ReadSentinel(197853948)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'content' (nsCString) member of 'ChatMessage'");
return {};
}
IPC::ReadResult<paramType> result__{
std::in_place,
std::move(_role),
std::move(_content)};
return result__;
}
} // namespace IPC
//-----------------------------------------------------------------------------
// Method definitions for the IPDL type |struct LogitBias|
//
namespace mozilla {
namespace hwinference {
auto LogitBias::StaticAssertions() const -> void
{
static_assert(
(offsetof(LogitBias, bias_) - offsetof(LogitBias, token_)) == 4,
"Bad assumptions about field layout!");
}
} // namespace hwinference
} // namespace mozilla
namespace IPC {
auto ParamTraits<::mozilla::hwinference::LogitBias>::Write(
IPC::MessageWriter* aWriter,
const paramType& aVar) -> void
{
(aWriter)->WriteBytes((&((aVar).token())), 8);
// Sentinel = 'token | bias'
(aWriter)->WriteSentinel(499909757);
}
auto ParamTraits<::mozilla::hwinference::LogitBias>::Read(IPC::MessageReader* aReader) -> IPC::ReadResult<paramType>
{
IPC::ReadResult<paramType> result__{
std::in_place,
::int32_t{0},
float{0}};
if ((!((aReader)->ReadBytesInto((&((result__)->token())), 8)))) {
aReader->FatalError("Error bulk reading fields from int32_t");
return {};
}
// Sentinel = 'token | bias'
if ((!((aReader)->ReadSentinel(499909757)))) {
mozilla::ipc::SentinelReadError("Error bulk reading fields from int32_t");
return {};
}
return result__;
}
} // namespace IPC
//-----------------------------------------------------------------------------
// Method definitions for the IPDL type |struct Sampler|
//
namespace mozilla {
namespace hwinference {
auto Sampler::StaticAssertions() const -> void
{
static_assert(
(offsetof(Sampler, seed_) - offsetof(Sampler, topK_)) == 12,
"Bad assumptions about field layout!");
}
} // namespace hwinference
} // namespace mozilla
namespace IPC {
auto ParamTraits<::mozilla::hwinference::Sampler>::Write(
IPC::MessageWriter* aWriter,
const paramType& aVar) -> void
{
IPC::WriteParam(aWriter, (aVar).type());
// Sentinel = 'type'
(aWriter)->WriteSentinel(75760067);
IPC::WriteParam(aWriter, (aVar).logitBias());
// Sentinel = 'logitBias'
(aWriter)->WriteSentinel(307233695);
(aWriter)->WriteBytes((&((aVar).topK())), 16);
// Sentinel = 'topK | topP | temp | seed'
(aWriter)->WriteSentinel(1922959565);
}
auto ParamTraits<::mozilla::hwinference::Sampler>::Read(IPC::MessageReader* aReader) -> IPC::ReadResult<paramType>
{
auto maybe___type = IPC::ReadParam<::mozilla::dom::TextGenerationSamplerType>(aReader);
if (!maybe___type) {
aReader->FatalError("Error deserializing 'type' (TextGenerationSamplerType) member of 'Sampler'");
return {};
}
auto& _type = *maybe___type;
// Sentinel = 'type'
if ((!((aReader)->ReadSentinel(75760067)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'type' (TextGenerationSamplerType) member of 'Sampler'");
return {};
}
auto maybe___logitBias = IPC::ReadParam<nsTArray<::mozilla::hwinference::LogitBias>>(aReader);
if (!maybe___logitBias) {
aReader->FatalError("Error deserializing 'logitBias' (LogitBias[]) member of 'Sampler'");
return {};
}
auto& _logitBias = *maybe___logitBias;
// Sentinel = 'logitBias'
if ((!((aReader)->ReadSentinel(307233695)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'logitBias' (LogitBias[]) member of 'Sampler'");
return {};
}
IPC::ReadResult<paramType> result__{
std::in_place,
std::move(_type),
::int32_t{0},
float{0},
float{0},
::uint32_t{0},
std::move(_logitBias)};
if ((!((aReader)->ReadBytesInto((&((result__)->topK())), 16)))) {
aReader->FatalError("Error bulk reading fields from int32_t");
return {};
}
// Sentinel = 'topK | topP | temp | seed'
if ((!((aReader)->ReadSentinel(1922959565)))) {
mozilla::ipc::SentinelReadError("Error bulk reading fields from int32_t");
return {};
}
return result__;
}
} // namespace IPC
//-----------------------------------------------------------------------------
// Method definitions for the IPDL type |struct GenerateRequest|
//
namespace mozilla {
namespace hwinference {
auto GenerateRequest::StaticAssertions() const -> void
{
static_assert(
(offsetof(GenerateRequest, bufferLength_) - offsetof(GenerateRequest, maxTokens_)) == 4,
"Bad assumptions about field layout!");
}
} // namespace hwinference
} // namespace mozilla
namespace IPC {
auto ParamTraits<::mozilla::hwinference::GenerateRequest>::Write(
IPC::MessageWriter* aWriter,
const paramType& aVar) -> void
{
IPC::WriteParam(aWriter, (aVar).messages());
// Sentinel = 'messages'
(aWriter)->WriteSentinel(253363033);
IPC::WriteParam(aWriter, (aVar).samplers());
// Sentinel = 'samplers'
(aWriter)->WriteSentinel(255525736);
IPC::WriteParam(aWriter, (aVar).stopTokens());
// Sentinel = 'stopTokens'
(aWriter)->WriteSentinel(393282619);
IPC::WriteParam(aWriter, (aVar).stopOnEndOfGenerationTokens());
// Sentinel = 'stopOnEndOfGenerationTokens'
(aWriter)->WriteSentinel(2515274448);
(aWriter)->WriteBytes((&((aVar).maxTokens())), 8);
// Sentinel = 'maxTokens | bufferLength'
(aWriter)->WriteSentinel(1949108563);
}
auto ParamTraits<::mozilla::hwinference::GenerateRequest>::Read(IPC::MessageReader* aReader) -> IPC::ReadResult<paramType>
{
auto maybe___messages = IPC::ReadParam<nsTArray<::mozilla::hwinference::ChatMessage>>(aReader);
if (!maybe___messages) {
aReader->FatalError("Error deserializing 'messages' (ChatMessage[]) member of 'GenerateRequest'");
return {};
}
auto& _messages = *maybe___messages;
// Sentinel = 'messages'
if ((!((aReader)->ReadSentinel(253363033)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'messages' (ChatMessage[]) member of 'GenerateRequest'");
return {};
}
auto maybe___samplers = IPC::ReadParam<nsTArray<::mozilla::hwinference::Sampler>>(aReader);
if (!maybe___samplers) {
aReader->FatalError("Error deserializing 'samplers' (Sampler[]) member of 'GenerateRequest'");
return {};
}
auto& _samplers = *maybe___samplers;
// Sentinel = 'samplers'
if ((!((aReader)->ReadSentinel(255525736)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'samplers' (Sampler[]) member of 'GenerateRequest'");
return {};
}
auto maybe___stopTokens = IPC::ReadParam<nsTArray<::int32_t>>(aReader);
if (!maybe___stopTokens) {
aReader->FatalError("Error deserializing 'stopTokens' (int32_t[]) member of 'GenerateRequest'");
return {};
}
auto& _stopTokens = *maybe___stopTokens;
// Sentinel = 'stopTokens'
if ((!((aReader)->ReadSentinel(393282619)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'stopTokens' (int32_t[]) member of 'GenerateRequest'");
return {};
}
auto maybe___stopOnEndOfGenerationTokens = IPC::ReadParam<bool>(aReader);
if (!maybe___stopOnEndOfGenerationTokens) {
aReader->FatalError("Error deserializing 'stopOnEndOfGenerationTokens' (bool) member of 'GenerateRequest'");
return {};
}
auto& _stopOnEndOfGenerationTokens = *maybe___stopOnEndOfGenerationTokens;
// Sentinel = 'stopOnEndOfGenerationTokens'
if ((!((aReader)->ReadSentinel(2515274448)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'stopOnEndOfGenerationTokens' (bool) member of 'GenerateRequest'");
return {};
}
IPC::ReadResult<paramType> result__{
std::in_place,
std::move(_messages),
::uint32_t{0},
::uint32_t{0},
std::move(_samplers),
std::move(_stopTokens),
std::move(_stopOnEndOfGenerationTokens)};
if ((!((aReader)->ReadBytesInto((&((result__)->maxTokens())), 8)))) {
aReader->FatalError("Error bulk reading fields from uint32_t");
return {};
}
// Sentinel = 'maxTokens | bufferLength'
if ((!((aReader)->ReadSentinel(1949108563)))) {
mozilla::ipc::SentinelReadError("Error bulk reading fields from uint32_t");
return {};
}
return result__;
}
} // namespace IPC
//-----------------------------------------------------------------------------
// Method definitions for the IPDL type |struct Timings|
//
namespace mozilla {
namespace hwinference {
auto Timings::StaticAssertions() const -> void
{
static_assert(
(offsetof(Timings, decodeMs_) - offsetof(Timings, prefillMs_)) == 8,
"Bad assumptions about field layout!");
}
} // namespace hwinference
} // namespace mozilla
namespace IPC {
auto ParamTraits<::mozilla::hwinference::Timings>::Write(
IPC::MessageWriter* aWriter,
const paramType& aVar) -> void
{
(aWriter)->WriteBytes((&((aVar).prefillMs())), 16);
// Sentinel = 'prefillMs | decodeMs'
(aWriter)->WriteSentinel(1355220879);
}
auto ParamTraits<::mozilla::hwinference::Timings>::Read(IPC::MessageReader* aReader) -> IPC::ReadResult<paramType>
{
IPC::ReadResult<paramType> result__{
std::in_place,
double{0},
double{0}};
if ((!((aReader)->ReadBytesInto((&((result__)->prefillMs())), 16)))) {
aReader->FatalError("Error bulk reading fields from double");
return {};
}
// Sentinel = 'prefillMs | decodeMs'
if ((!((aReader)->ReadSentinel(1355220879)))) {
mozilla::ipc::SentinelReadError("Error bulk reading fields from double");
return {};
}
return result__;
}
} // namespace IPC
//-----------------------------------------------------------------------------
// Method definitions for the IPDL type |struct LoadSuccess|
//
namespace mozilla {
namespace hwinference {
} // namespace hwinference
} // namespace mozilla
namespace IPC {
auto ParamTraits<::mozilla::hwinference::LoadSuccess>::Write(
IPC::MessageWriter* aWriter,
const paramType& aVar) -> void
{
(aWriter)->WriteBytes((&((aVar).loadMs())), 8);
// Sentinel = 'loadMs'
(aWriter)->WriteSentinel(141951585);
}
auto ParamTraits<::mozilla::hwinference::LoadSuccess>::Read(IPC::MessageReader* aReader) -> IPC::ReadResult<paramType>
{
IPC::ReadResult<paramType> result__{
std::in_place,
double{0}};
if ((!((aReader)->ReadBytesInto((&((result__)->loadMs())), 8)))) {
aReader->FatalError("Error bulk reading fields from double");
return {};
}
// Sentinel = 'loadMs'
if ((!((aReader)->ReadSentinel(141951585)))) {
mozilla::ipc::SentinelReadError("Error bulk reading fields from double");
return {};
}
return result__;
}
} // namespace IPC
//-----------------------------------------------------------------------------
// Method definitions for the IPDL type |struct LoadError|
//
namespace mozilla {
namespace hwinference {
} // namespace hwinference
} // namespace mozilla
namespace IPC {
auto ParamTraits<::mozilla::hwinference::LoadError>::Write(
IPC::MessageWriter* aWriter,
const paramType& aVar) -> void
{
IPC::WriteParam(aWriter, (aVar).message());
// Sentinel = 'message'
(aWriter)->WriteSentinel(197198566);
}
auto ParamTraits<::mozilla::hwinference::LoadError>::Read(IPC::MessageReader* aReader) -> IPC::ReadResult<paramType>
{
auto maybe___message = IPC::ReadParam<::nsCString>(aReader);
if (!maybe___message) {
aReader->FatalError("Error deserializing 'message' (nsCString) member of 'LoadError'");
return {};
}
auto& _message = *maybe___message;
// Sentinel = 'message'
if ((!((aReader)->ReadSentinel(197198566)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'message' (nsCString) member of 'LoadError'");
return {};
}
IPC::ReadResult<paramType> result__{
std::in_place,
std::move(_message)};
return result__;
}
} // namespace IPC
//-----------------------------------------------------------------------------
// Method definitions for the IPDL type |union LoadResult|
//
namespace mozilla {
namespace hwinference {
auto LoadResult::MaybeDestroy() -> void
{
if ((mType) == (T__None)) {
return;
}
switch (mType) {
case TLoadSuccess:
{
(ptr_LoadSuccess())->~LoadSuccess__tdef();
break;
}
case TLoadError:
{
(ptr_LoadError())->~LoadError__tdef();
break;
}
default:
{
mozilla::ipc::LogicError("not reached");
break;
}
}
}
MOZ_IMPLICIT LoadResult::LoadResult(const LoadSuccess& aOther)
{
new (mozilla::KnownNotNull, ptr_LoadSuccess()) LoadSuccess(aOther);
mType = TLoadSuccess;
}
MOZ_IMPLICIT LoadResult::LoadResult(LoadSuccess&& aOther)
{
new (mozilla::KnownNotNull, ptr_LoadSuccess()) LoadSuccess(std::move(aOther));
mType = TLoadSuccess;
}
MOZ_IMPLICIT LoadResult::LoadResult(const LoadError& aOther)
{
new (mozilla::KnownNotNull, ptr_LoadError()) LoadError(aOther);
mType = TLoadError;
}
MOZ_IMPLICIT LoadResult::LoadResult(LoadError&& aOther)
{
new (mozilla::KnownNotNull, ptr_LoadError()) LoadError(std::move(aOther));
mType = TLoadError;
}
MOZ_IMPLICIT LoadResult::LoadResult(const LoadResult& aOther)
{
(aOther).AssertSanity();
switch ((aOther).type()) {
case TLoadSuccess:
{
new (mozilla::KnownNotNull, ptr_LoadSuccess()) LoadSuccess((aOther).get_LoadSuccess());
break;
}
case TLoadError:
{
new (mozilla::KnownNotNull, ptr_LoadError()) LoadError((aOther).get_LoadError());
break;
}
case T__None:
{
break;
}
default:
{
mozilla::ipc::LogicError("unreached");
return;
}
}
mType = (aOther).type();
}
MOZ_IMPLICIT LoadResult::LoadResult(LoadResult&& aOther)
{
(aOther).AssertSanity();
Type t = (aOther).type();
switch (t) {
case TLoadSuccess:
{
new (mozilla::KnownNotNull, ptr_LoadSuccess()) LoadSuccess(std::move((aOther).get_LoadSuccess()));
(aOther).MaybeDestroy();
break;
}
case TLoadError:
{
new (mozilla::KnownNotNull, ptr_LoadError()) LoadError(std::move((aOther).get_LoadError()));
(aOther).MaybeDestroy();
break;
}
case T__None:
{
break;
}
default:
{
mozilla::ipc::LogicError("unreached");
return;
}
}
(aOther).mType = T__None;
mType = t;
}
LoadResult::~LoadResult()
{
MaybeDestroy();
}
auto LoadResult::operator=(const LoadSuccess& aRhs) -> LoadResult&
{
MaybeDestroy();
new (mozilla::KnownNotNull, ptr_LoadSuccess()) LoadSuccess(aRhs);
mType = TLoadSuccess;
return (*(this));
}
auto LoadResult::operator=(LoadSuccess&& aRhs) -> LoadResult&
{
MaybeDestroy();
new (mozilla::KnownNotNull, ptr_LoadSuccess()) LoadSuccess(std::move(aRhs));
mType = TLoadSuccess;
return (*(this));
}
auto LoadResult::operator=(const LoadError& aRhs) -> LoadResult&
{
MaybeDestroy();
new (mozilla::KnownNotNull, ptr_LoadError()) LoadError(aRhs);
mType = TLoadError;
return (*(this));
}
auto LoadResult::operator=(LoadError&& aRhs) -> LoadResult&
{
MaybeDestroy();
new (mozilla::KnownNotNull, ptr_LoadError()) LoadError(std::move(aRhs));
mType = TLoadError;
return (*(this));
}
auto LoadResult::operator=(const LoadResult& aRhs) -> LoadResult&
{
(aRhs).AssertSanity();
Type t = (aRhs).type();
switch (t) {
case TLoadSuccess:
{
MaybeDestroy();
new (mozilla::KnownNotNull, ptr_LoadSuccess()) LoadSuccess((aRhs).get_LoadSuccess());
break;
}
case TLoadError:
{
MaybeDestroy();
new (mozilla::KnownNotNull, ptr_LoadError()) LoadError((aRhs).get_LoadError());
break;
}
case T__None:
{
MaybeDestroy();
break;
}
default:
{
mozilla::ipc::LogicError("unreached");
break;
}
}
mType = t;
return (*(this));
}
auto LoadResult::operator=(LoadResult&& aRhs) -> LoadResult&
{
(aRhs).AssertSanity();
Type t = (aRhs).type();
switch (t) {
case TLoadSuccess:
{
MaybeDestroy();
new (mozilla::KnownNotNull, ptr_LoadSuccess()) LoadSuccess(std::move((aRhs).get_LoadSuccess()));
(aRhs).MaybeDestroy();
break;
}
case TLoadError:
{
MaybeDestroy();
new (mozilla::KnownNotNull, ptr_LoadError()) LoadError(std::move((aRhs).get_LoadError()));
(aRhs).MaybeDestroy();
break;
}
case T__None:
{
MaybeDestroy();
break;
}
default:
{
mozilla::ipc::LogicError("unreached");
break;
}
}
(aRhs).mType = T__None;
mType = t;
return (*(this));
}
} // namespace hwinference
} // namespace mozilla
namespace IPC {
auto ParamTraits<::mozilla::hwinference::LoadResult>::Write(
IPC::MessageWriter* aWriter,
const paramType& aVar) -> void
{
typedef ::mozilla::hwinference::LoadResult union__;
int type = (aVar).type();
IPC::WriteParam(aWriter, type);
// Sentinel = 'LoadResult'
(aWriter)->WriteSentinel(352912384);
switch (type) {
case union__::TLoadSuccess:
{
IPC::WriteParam(aWriter, (aVar).get_LoadSuccess());
// Sentinel = 'TLoadSuccess'
(aWriter)->WriteSentinel(488965294);
return;
}
case union__::TLoadError:
{
IPC::WriteParam(aWriter, (aVar).get_LoadError());
// Sentinel = 'TLoadError'
(aWriter)->WriteSentinel(339477471);
return;
}
default:
{
aWriter->FatalError("unknown variant of union LoadResult");
return;
}
}
}
auto ParamTraits<::mozilla::hwinference::LoadResult>::Read(IPC::MessageReader* aReader) -> IPC::ReadResult<paramType>
{
typedef ::mozilla::hwinference::LoadResult union__;
auto maybe__type = IPC::ReadParam<int>(aReader);
if (!maybe__type) {
aReader->FatalError("Error deserializing type of union LoadResult");
return {};
}
auto& type = *maybe__type;
// Sentinel = 'LoadResult'
if ((!((aReader)->ReadSentinel(352912384)))) {
mozilla::ipc::SentinelReadError("Error deserializing type of union LoadResult");
return {};
}
switch (type) {
case union__::TLoadSuccess:
{
auto maybe__tmp = IPC::ReadParam<::mozilla::hwinference::LoadSuccess>(aReader);
if (!maybe__tmp) {
aReader->FatalError("Error deserializing variant TLoadSuccess of union LoadResult");
return {};
}
auto& tmp = *maybe__tmp;
// Sentinel = 'TLoadSuccess'
if ((!((aReader)->ReadSentinel(488965294)))) {
mozilla::ipc::SentinelReadError("Error deserializing variant TLoadSuccess of union LoadResult");
return {};
}
return std::move(tmp);
}
case union__::TLoadError:
{
auto maybe__tmp = IPC::ReadParam<::mozilla::hwinference::LoadError>(aReader);
if (!maybe__tmp) {
aReader->FatalError("Error deserializing variant TLoadError of union LoadResult");
return {};
}
auto& tmp = *maybe__tmp;
// Sentinel = 'TLoadError'
if ((!((aReader)->ReadSentinel(339477471)))) {
mozilla::ipc::SentinelReadError("Error deserializing variant TLoadError of union LoadResult");
return {};
}
return std::move(tmp);
}
default:
{
aReader->FatalError("unknown variant of union LoadResult");
return {};
}
}
}
} // namespace IPC
//-----------------------------------------------------------------------------
// Method definitions for the IPDL type |struct Usage|
//
namespace mozilla {
namespace hwinference {
auto Usage::StaticAssertions() const -> void
{
static_assert(
(offsetof(Usage, generatedTokens_) - offsetof(Usage, promptTokens_)) == 8,
"Bad assumptions about field layout!");
}
} // namespace hwinference
} // namespace mozilla
namespace IPC {
auto ParamTraits<::mozilla::hwinference::Usage>::Write(
IPC::MessageWriter* aWriter,
const paramType& aVar) -> void
{
IPC::WriteParam(aWriter, (aVar).timings());
// Sentinel = 'timings'
(aWriter)->WriteSentinel(200868604);
(aWriter)->WriteBytes((&((aVar).promptTokens())), 12);
// Sentinel = 'promptTokens | promptCharacters | generatedTokens'
(aWriter)->WriteSentinel(3847885652);
}
auto ParamTraits<::mozilla::hwinference::Usage>::Read(IPC::MessageReader* aReader) -> IPC::ReadResult<paramType>
{
auto maybe___timings = IPC::ReadParam<::mozilla::hwinference::Timings>(aReader);
if (!maybe___timings) {
aReader->FatalError("Error deserializing 'timings' (Timings) member of 'Usage'");
return {};
}
auto& _timings = *maybe___timings;
// Sentinel = 'timings'
if ((!((aReader)->ReadSentinel(200868604)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'timings' (Timings) member of 'Usage'");
return {};
}
IPC::ReadResult<paramType> result__{
std::in_place,
::uint32_t{0},
::uint32_t{0},
::uint32_t{0},
std::move(_timings)};
if ((!((aReader)->ReadBytesInto((&((result__)->promptTokens())), 12)))) {
aReader->FatalError("Error bulk reading fields from uint32_t");
return {};
}
// Sentinel = 'promptTokens | promptCharacters | generatedTokens'
if ((!((aReader)->ReadSentinel(3847885652)))) {
mozilla::ipc::SentinelReadError("Error bulk reading fields from uint32_t");
return {};
}
return result__;
}
} // namespace IPC
//-----------------------------------------------------------------------------
// Method definitions for the IPDL type |struct ResourceSnapshot|
//
namespace mozilla {
namespace hwinference {
auto ResourceSnapshot::StaticAssertions() const -> void
{
static_assert(
(offsetof(ResourceSnapshot, memoryBytes_) - offsetof(ResourceSnapshot, cpuTimeMs_)) == 8,
"Bad assumptions about field layout!");
}
} // namespace hwinference
} // namespace mozilla
namespace IPC {
auto ParamTraits<::mozilla::hwinference::ResourceSnapshot>::Write(
IPC::MessageWriter* aWriter,
const paramType& aVar) -> void
{
(aWriter)->WriteBytes((&((aVar).cpuTimeMs())), 16);
// Sentinel = 'cpuTimeMs | memoryBytes'
(aWriter)->WriteSentinel(1773209844);
}
auto ParamTraits<::mozilla::hwinference::ResourceSnapshot>::Read(IPC::MessageReader* aReader) -> IPC::ReadResult<paramType>
{
IPC::ReadResult<paramType> result__{
std::in_place,
::uint64_t{0},
::uint64_t{0}};
if ((!((aReader)->ReadBytesInto((&((result__)->cpuTimeMs())), 16)))) {
aReader->FatalError("Error bulk reading fields from uint64_t");
return {};
}
// Sentinel = 'cpuTimeMs | memoryBytes'
if ((!((aReader)->ReadSentinel(1773209844)))) {
mozilla::ipc::SentinelReadError("Error bulk reading fields from uint64_t");
return {};
}
return result__;
}
} // namespace IPC
//-----------------------------------------------------------------------------
// Method definitions for the IPDL type |struct ResourceUsage|
//
namespace mozilla {
namespace hwinference {
} // namespace hwinference
} // namespace mozilla
namespace IPC {
auto ParamTraits<::mozilla::hwinference::ResourceUsage>::Write(
IPC::MessageWriter* aWriter,
const paramType& aVar) -> void
{
IPC::WriteParam(aWriter, (aVar).before());
// Sentinel = 'before'
(aWriter)->WriteSentinel(142148212);
IPC::WriteParam(aWriter, (aVar).after());
// Sentinel = 'after'
(aWriter)->WriteSentinel(102367763);
}
auto ParamTraits<::mozilla::hwinference::ResourceUsage>::Read(IPC::MessageReader* aReader) -> IPC::ReadResult<paramType>
{
auto maybe___before = IPC::ReadParam<::mozilla::hwinference::ResourceSnapshot>(aReader);
if (!maybe___before) {
aReader->FatalError("Error deserializing 'before' (ResourceSnapshot) member of 'ResourceUsage'");
return {};
}
auto& _before = *maybe___before;
// Sentinel = 'before'
if ((!((aReader)->ReadSentinel(142148212)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'before' (ResourceSnapshot) member of 'ResourceUsage'");
return {};
}
auto maybe___after = IPC::ReadParam<::mozilla::hwinference::ResourceSnapshot>(aReader);
if (!maybe___after) {
aReader->FatalError("Error deserializing 'after' (ResourceSnapshot) member of 'ResourceUsage'");
return {};
}
auto& _after = *maybe___after;
// Sentinel = 'after'
if ((!((aReader)->ReadSentinel(102367763)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'after' (ResourceSnapshot) member of 'ResourceUsage'");
return {};
}
IPC::ReadResult<paramType> result__{
std::in_place,
std::move(_before),
std::move(_after)};
return result__;
}
} // namespace IPC
//-----------------------------------------------------------------------------
// Method definitions for the IPDL type |struct GenerateResult|
//
namespace mozilla {
namespace hwinference {
} // namespace hwinference
} // namespace mozilla
namespace IPC {
auto ParamTraits<::mozilla::hwinference::GenerateResult>::Write(
IPC::MessageWriter* aWriter,
const paramType& aVar) -> void
{
IPC::WriteParam(aWriter, (aVar).content());
// Sentinel = 'content'
(aWriter)->WriteSentinel(197853948);
IPC::WriteParam(aWriter, (aVar).reason());
// Sentinel = 'reason'
(aWriter)->WriteSentinel(148112009);
IPC::WriteParam(aWriter, (aVar).usage());
// Sentinel = 'usage'
(aWriter)->WriteSentinel(108003862);
IPC::WriteParam(aWriter, (aVar).resources());
// Sentinel = 'resources'
(aWriter)->WriteSentinel(325649372);
}
auto ParamTraits<::mozilla::hwinference::GenerateResult>::Read(IPC::MessageReader* aReader) -> IPC::ReadResult<paramType>
{
auto maybe___content = IPC::ReadParam<::nsCString>(aReader);
if (!maybe___content) {
aReader->FatalError("Error deserializing 'content' (nsCString) member of 'GenerateResult'");
return {};
}
auto& _content = *maybe___content;
// Sentinel = 'content'
if ((!((aReader)->ReadSentinel(197853948)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'content' (nsCString) member of 'GenerateResult'");
return {};
}
auto maybe___reason = IPC::ReadParam<::mozilla::dom::TextGenerationFinishReason>(aReader);
if (!maybe___reason) {
aReader->FatalError("Error deserializing 'reason' (TextGenerationFinishReason) member of 'GenerateResult'");
return {};
}
auto& _reason = *maybe___reason;
// Sentinel = 'reason'
if ((!((aReader)->ReadSentinel(148112009)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'reason' (TextGenerationFinishReason) member of 'GenerateResult'");
return {};
}
auto maybe___usage = IPC::ReadParam<::mozilla::hwinference::Usage>(aReader);
if (!maybe___usage) {
aReader->FatalError("Error deserializing 'usage' (Usage) member of 'GenerateResult'");
return {};
}
auto& _usage = *maybe___usage;
// Sentinel = 'usage'
if ((!((aReader)->ReadSentinel(108003862)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'usage' (Usage) member of 'GenerateResult'");
return {};
}
auto maybe___resources = IPC::ReadParam<::mozilla::hwinference::ResourceUsage>(aReader);
if (!maybe___resources) {
aReader->FatalError("Error deserializing 'resources' (ResourceUsage) member of 'GenerateResult'");
return {};
}
auto& _resources = *maybe___resources;
// Sentinel = 'resources'
if ((!((aReader)->ReadSentinel(325649372)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'resources' (ResourceUsage) member of 'GenerateResult'");
return {};
}
IPC::ReadResult<paramType> result__{
std::in_place,
std::move(_content),
std::move(_reason),
std::move(_usage),
std::move(_resources)};
return result__;
}
} // namespace IPC
//-----------------------------------------------------------------------------
// Method definitions for the IPDL type |struct GenerateError|
//
namespace mozilla {
namespace hwinference {
} // namespace hwinference
} // namespace mozilla
namespace IPC {
auto ParamTraits<::mozilla::hwinference::GenerateError>::Write(
IPC::MessageWriter* aWriter,
const paramType& aVar) -> void
{
IPC::WriteParam(aWriter, (aVar).message());
// Sentinel = 'message'
(aWriter)->WriteSentinel(197198566);
}
auto ParamTraits<::mozilla::hwinference::GenerateError>::Read(IPC::MessageReader* aReader) -> IPC::ReadResult<paramType>
{
auto maybe___message = IPC::ReadParam<::nsCString>(aReader);
if (!maybe___message) {
aReader->FatalError("Error deserializing 'message' (nsCString) member of 'GenerateError'");
return {};
}
auto& _message = *maybe___message;
// Sentinel = 'message'
if ((!((aReader)->ReadSentinel(197198566)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'message' (nsCString) member of 'GenerateError'");
return {};
}
IPC::ReadResult<paramType> result__{
std::in_place,
std::move(_message)};
return result__;
}
} // namespace IPC
//-----------------------------------------------------------------------------
// Method definitions for the IPDL type |union GenerateResponse|
//
namespace mozilla {
namespace hwinference {
auto GenerateResponse::MaybeDestroy() -> void
{
if ((mType) == (T__None)) {
return;
}
switch (mType) {
case TGenerateResult:
{
(ptr_GenerateResult())->~GenerateResult__tdef();
break;
}
case TGenerateError:
{
(ptr_GenerateError())->~GenerateError__tdef();
break;
}
default:
{
mozilla::ipc::LogicError("not reached");
break;
}
}
}
MOZ_IMPLICIT GenerateResponse::GenerateResponse(const GenerateResult& aOther)
{
new (mozilla::KnownNotNull, ptr_GenerateResult()) GenerateResult(aOther);
mType = TGenerateResult;
}
MOZ_IMPLICIT GenerateResponse::GenerateResponse(GenerateResult&& aOther)
{
new (mozilla::KnownNotNull, ptr_GenerateResult()) GenerateResult(std::move(aOther));
mType = TGenerateResult;
}
MOZ_IMPLICIT GenerateResponse::GenerateResponse(const GenerateError& aOther)
{
new (mozilla::KnownNotNull, ptr_GenerateError()) GenerateError(aOther);
mType = TGenerateError;
}
MOZ_IMPLICIT GenerateResponse::GenerateResponse(GenerateError&& aOther)
{
new (mozilla::KnownNotNull, ptr_GenerateError()) GenerateError(std::move(aOther));
mType = TGenerateError;
}
MOZ_IMPLICIT GenerateResponse::GenerateResponse(const GenerateResponse& aOther)
{
(aOther).AssertSanity();
switch ((aOther).type()) {
case TGenerateResult:
{
new (mozilla::KnownNotNull, ptr_GenerateResult()) GenerateResult((aOther).get_GenerateResult());
break;
}
case TGenerateError:
{
new (mozilla::KnownNotNull, ptr_GenerateError()) GenerateError((aOther).get_GenerateError());
break;
}
case T__None:
{
break;
}
default:
{
mozilla::ipc::LogicError("unreached");
return;
}
}
mType = (aOther).type();
}
MOZ_IMPLICIT GenerateResponse::GenerateResponse(GenerateResponse&& aOther)
{
(aOther).AssertSanity();
Type t = (aOther).type();
switch (t) {
case TGenerateResult:
{
new (mozilla::KnownNotNull, ptr_GenerateResult()) GenerateResult(std::move((aOther).get_GenerateResult()));
(aOther).MaybeDestroy();
break;
}
case TGenerateError:
{
new (mozilla::KnownNotNull, ptr_GenerateError()) GenerateError(std::move((aOther).get_GenerateError()));
(aOther).MaybeDestroy();
break;
}
case T__None:
{
break;
}
default:
{
mozilla::ipc::LogicError("unreached");
return;
}
}
(aOther).mType = T__None;
mType = t;
}
GenerateResponse::~GenerateResponse()
{
MaybeDestroy();
}
auto GenerateResponse::operator=(const GenerateResult& aRhs) -> GenerateResponse&
{
MaybeDestroy();
new (mozilla::KnownNotNull, ptr_GenerateResult()) GenerateResult(aRhs);
mType = TGenerateResult;
return (*(this));
}
auto GenerateResponse::operator=(GenerateResult&& aRhs) -> GenerateResponse&
{
MaybeDestroy();
new (mozilla::KnownNotNull, ptr_GenerateResult()) GenerateResult(std::move(aRhs));
mType = TGenerateResult;
return (*(this));
}
auto GenerateResponse::operator=(const GenerateError& aRhs) -> GenerateResponse&
{
MaybeDestroy();
new (mozilla::KnownNotNull, ptr_GenerateError()) GenerateError(aRhs);
mType = TGenerateError;
return (*(this));
}
auto GenerateResponse::operator=(GenerateError&& aRhs) -> GenerateResponse&
{
MaybeDestroy();
new (mozilla::KnownNotNull, ptr_GenerateError()) GenerateError(std::move(aRhs));
mType = TGenerateError;
return (*(this));
}
auto GenerateResponse::operator=(const GenerateResponse& aRhs) -> GenerateResponse&
{
(aRhs).AssertSanity();
Type t = (aRhs).type();
switch (t) {
case TGenerateResult:
{
MaybeDestroy();
new (mozilla::KnownNotNull, ptr_GenerateResult()) GenerateResult((aRhs).get_GenerateResult());
break;
}
case TGenerateError:
{
MaybeDestroy();
new (mozilla::KnownNotNull, ptr_GenerateError()) GenerateError((aRhs).get_GenerateError());
break;
}
case T__None:
{
MaybeDestroy();
break;
}
default:
{
mozilla::ipc::LogicError("unreached");
break;
}
}
mType = t;
return (*(this));
}
auto GenerateResponse::operator=(GenerateResponse&& aRhs) -> GenerateResponse&
{
(aRhs).AssertSanity();
Type t = (aRhs).type();
switch (t) {
case TGenerateResult:
{
MaybeDestroy();
new (mozilla::KnownNotNull, ptr_GenerateResult()) GenerateResult(std::move((aRhs).get_GenerateResult()));
(aRhs).MaybeDestroy();
break;
}
case TGenerateError:
{
MaybeDestroy();
new (mozilla::KnownNotNull, ptr_GenerateError()) GenerateError(std::move((aRhs).get_GenerateError()));
(aRhs).MaybeDestroy();
break;
}
case T__None:
{
MaybeDestroy();
break;
}
default:
{
mozilla::ipc::LogicError("unreached");
break;
}
}
(aRhs).mType = T__None;
mType = t;
return (*(this));
}
} // namespace hwinference
} // namespace mozilla
namespace IPC {
auto ParamTraits<::mozilla::hwinference::GenerateResponse>::Write(
IPC::MessageWriter* aWriter,
const paramType& aVar) -> void
{
typedef ::mozilla::hwinference::GenerateResponse union__;
int type = (aVar).type();
IPC::WriteParam(aWriter, type);
// Sentinel = 'GenerateResponse'
(aWriter)->WriteSentinel(900597371);
switch (type) {
case union__::TGenerateResult:
{
IPC::WriteParam(aWriter, (aVar).get_GenerateResult());
// Sentinel = 'TGenerateResult'
(aWriter)->WriteSentinel(773391871);
return;
}
case union__::TGenerateError:
{
IPC::WriteParam(aWriter, (aVar).get_GenerateError());
// Sentinel = 'TGenerateError'
(aWriter)->WriteSentinel(671352202);
return;
}
default:
{
aWriter->FatalError("unknown variant of union GenerateResponse");
return;
}
}
}
auto ParamTraits<::mozilla::hwinference::GenerateResponse>::Read(IPC::MessageReader* aReader) -> IPC::ReadResult<paramType>
{
typedef ::mozilla::hwinference::GenerateResponse union__;
auto maybe__type = IPC::ReadParam<int>(aReader);
if (!maybe__type) {
aReader->FatalError("Error deserializing type of union GenerateResponse");
return {};
}
auto& type = *maybe__type;
// Sentinel = 'GenerateResponse'
if ((!((aReader)->ReadSentinel(900597371)))) {
mozilla::ipc::SentinelReadError("Error deserializing type of union GenerateResponse");
return {};
}
switch (type) {
case union__::TGenerateResult:
{
auto maybe__tmp = IPC::ReadParam<::mozilla::hwinference::GenerateResult>(aReader);
if (!maybe__tmp) {
aReader->FatalError("Error deserializing variant TGenerateResult of union GenerateResponse");
return {};
}
auto& tmp = *maybe__tmp;
// Sentinel = 'TGenerateResult'
if ((!((aReader)->ReadSentinel(773391871)))) {
mozilla::ipc::SentinelReadError("Error deserializing variant TGenerateResult of union GenerateResponse");
return {};
}
return std::move(tmp);
}
case union__::TGenerateError:
{
auto maybe__tmp = IPC::ReadParam<::mozilla::hwinference::GenerateError>(aReader);
if (!maybe__tmp) {
aReader->FatalError("Error deserializing variant TGenerateError of union GenerateResponse");
return {};
}
auto& tmp = *maybe__tmp;
// Sentinel = 'TGenerateError'
if ((!((aReader)->ReadSentinel(671352202)))) {
mozilla::ipc::SentinelReadError("Error deserializing variant TGenerateError of union GenerateResponse");
return {};
}
return std::move(tmp);
}
default:
{
aReader->FatalError("unknown variant of union GenerateResponse");
return {};
}
}
}
} // namespace IPC
//-----------------------------------------------------------------------------
// Method definitions for the IPDL type |struct TextGenerationOptions|
//
namespace mozilla {
namespace hwinference {
auto TextGenerationOptions::StaticAssertions() const -> void
{
static_assert(
(offsetof(TextGenerationOptions, ubatchSize_) - offsetof(TextGenerationOptions, contextSize_)) == 16,
"Bad assumptions about field layout!");
}
} // namespace hwinference
} // namespace mozilla
namespace IPC {
auto ParamTraits<::mozilla::hwinference::TextGenerationOptions>::Write(
IPC::MessageWriter* aWriter,
const paramType& aVar) -> void
{
IPC::WriteParam(aWriter, (aVar).kvCacheDtype());
// Sentinel = 'kvCacheDtype'
(aWriter)->WriteSentinel(508232892);
IPC::WriteParam(aWriter, (aVar).flashAttn());
// Sentinel = 'flashAttn'
(aWriter)->WriteSentinel(303432614);
(aWriter)->WriteBytes((&((aVar).contextSize())), 20);
// Sentinel = 'contextSize | numThreads | numThreadsDecoding | batchSize | ubatchSize'
(aWriter)->WriteSentinel(3079150227);
}
auto ParamTraits<::mozilla::hwinference::TextGenerationOptions>::Read(IPC::MessageReader* aReader) -> IPC::ReadResult<paramType>
{
auto maybe___kvCacheDtype = IPC::ReadParam<::mozilla::dom::TextGenerationKVCacheDtype>(aReader);
if (!maybe___kvCacheDtype) {
aReader->FatalError("Error deserializing 'kvCacheDtype' (TextGenerationKVCacheDtype) member of 'TextGenerationOptions'");
return {};
}
auto& _kvCacheDtype = *maybe___kvCacheDtype;
// Sentinel = 'kvCacheDtype'
if ((!((aReader)->ReadSentinel(508232892)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'kvCacheDtype' (TextGenerationKVCacheDtype) member of 'TextGenerationOptions'");
return {};
}
auto maybe___flashAttn = IPC::ReadParam<bool>(aReader);
if (!maybe___flashAttn) {
aReader->FatalError("Error deserializing 'flashAttn' (bool) member of 'TextGenerationOptions'");
return {};
}
auto& _flashAttn = *maybe___flashAttn;
// Sentinel = 'flashAttn'
if ((!((aReader)->ReadSentinel(303432614)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'flashAttn' (bool) member of 'TextGenerationOptions'");
return {};
}
IPC::ReadResult<paramType> result__{
std::in_place,
::uint32_t{0},
::uint32_t{0},
::uint32_t{0},
::uint32_t{0},
::uint32_t{0},
std::move(_kvCacheDtype),
std::move(_flashAttn)};
if ((!((aReader)->ReadBytesInto((&((result__)->contextSize())), 20)))) {
aReader->FatalError("Error bulk reading fields from uint32_t");
return {};
}
// Sentinel = 'contextSize | numThreads | numThreadsDecoding | batchSize | ubatchSize'
if ((!((aReader)->ReadSentinel(3079150227)))) {
mozilla::ipc::SentinelReadError("Error bulk reading fields from uint32_t");
return {};
}
return result__;
}
} // namespace IPC