/* * 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::programHostFunctionUserData(commandStream, hostFunctionData, userHostFunctionAddress, userDataAddress); HostFunctionHelper::programSignalHostFunctionStart(commandStream, hostFunctionData); HostFunctionHelper::programWaitForHostFunctionCompletion(commandStream, hostFunctionData); } template void HostFunctionHelper::programHostFunctionUserData(LinearStream &commandStream, const HostFunctionData &hostFunctionData, uint64_t userHostFunctionAddress, uint64_t userDataAddress) { auto hostFunctionAddressDst = reinterpret_cast(hostFunctionData.entry); auto userDataAddressDst = reinterpret_cast(hostFunctionData.userData); EncodeStoreMemory::programStoreDataImm(commandStream, hostFunctionAddressDst, getLowPart(userHostFunctionAddress), getHighPart(userHostFunctionAddress), true, false, nullptr); EncodeStoreMemory::programStoreDataImm(commandStream, userDataAddressDst, getLowPart(userDataAddress), getHighPart(userDataAddress), true, false, nullptr); } template void HostFunctionHelper::programSignalHostFunctionStart(LinearStream &commandStream, const HostFunctionData &hostFunctionData) { auto internalTagAddress = reinterpret_cast(hostFunctionData.internalTag); EncodeStoreMemory::programStoreDataImm(commandStream, internalTagAddress, static_cast(HostFunctionTagStatus::pending), 0u, false, false, nullptr); } template void HostFunctionHelper::programWaitForHostFunctionCompletion(LinearStream &commandStream, const HostFunctionData &hostFunctionData) { auto internalTagAddress = reinterpret_cast(hostFunctionData.internalTag); EncodeSemaphore::addMiSemaphoreWaitCommand( commandStream, internalTagAddress, static_cast(HostFunctionTagStatus::completed), GfxFamily::MI_SEMAPHORE_WAIT::COMPARE_OPERATION::COMPARE_OPERATION_SAD_EQUAL_SDD, false, false, false, false, nullptr); } } // namespace NEO