/* * Copyright (C) 2025 Intel Corporation * * SPDX-License-Identifier: MIT * */ #include "shared/source/command_container/command_encoder.h" #include "shared/source/command_stream/host_function.h" #include "shared/source/memory_manager/multi_graphics_allocation.h" namespace NEO { template void HostFunctionHelper::programHostFunction(LinearStream &commandStream, const HostFunctionData &hostFunctionData, uint64_t userHostFunctionAddress, uint64_t userDataAddress) { HostFunctionHelper::programHostFunctionAddress(&commandStream, nullptr, hostFunctionData, userHostFunctionAddress); HostFunctionHelper::programHostFunctionUserData(&commandStream, nullptr, hostFunctionData, userDataAddress); HostFunctionHelper::programSignalHostFunctionStart(&commandStream, nullptr, hostFunctionData); HostFunctionHelper::programWaitForHostFunctionCompletion(&commandStream, nullptr, hostFunctionData); } template void HostFunctionHelper::programHostFunctionAddress(LinearStream *commandStream, void *cmdBuffer, const HostFunctionData &hostFunctionData, uint64_t userHostFunctionAddress) { using MI_STORE_DATA_IMM = typename GfxFamily::MI_STORE_DATA_IMM; auto hostFunctionAddressDst = reinterpret_cast(hostFunctionData.entry); EncodeStoreMemory::programStoreDataImmCommand(commandStream, static_cast(cmdBuffer), hostFunctionAddressDst, getLowPart(userHostFunctionAddress), getHighPart(userHostFunctionAddress), true, false); } template void HostFunctionHelper::programHostFunctionUserData(LinearStream *commandStream, void *cmdBuffer, const HostFunctionData &hostFunctionData, uint64_t userDataAddress) { using MI_STORE_DATA_IMM = typename GfxFamily::MI_STORE_DATA_IMM; auto userDataAddressDst = reinterpret_cast(hostFunctionData.userData); EncodeStoreMemory::programStoreDataImmCommand(commandStream, static_cast(cmdBuffer), userDataAddressDst, getLowPart(userDataAddress), getHighPart(userDataAddress), true, false); } template void HostFunctionHelper::programSignalHostFunctionStart(LinearStream *commandStream, void *cmdBuffer, const HostFunctionData &hostFunctionData) { using MI_STORE_DATA_IMM = typename GfxFamily::MI_STORE_DATA_IMM; auto internalTagAddress = reinterpret_cast(hostFunctionData.internalTag); EncodeStoreMemory::programStoreDataImmCommand(commandStream, static_cast(cmdBuffer), internalTagAddress, static_cast(HostFunctionTagStatus::pending), 0u, false, false); } template void HostFunctionHelper::programWaitForHostFunctionCompletion(LinearStream *commandStream, void *cmdBuffer, const HostFunctionData &hostFunctionData) { using MI_SEMAPHORE_WAIT = typename GfxFamily::MI_SEMAPHORE_WAIT; auto internalTagAddress = reinterpret_cast(hostFunctionData.internalTag); EncodeSemaphore::programMiSemaphoreWaitCommand(commandStream, static_cast(cmdBuffer), internalTagAddress, static_cast(HostFunctionTagStatus::completed), GfxFamily::MI_SEMAPHORE_WAIT::COMPARE_OPERATION::COMPARE_OPERATION_SAD_EQUAL_SDD, false, true, false, false, false); } } // namespace NEO