Skip to content

Commit

Permalink
[VP] Add L0 Mode for KernelBinToSource
Browse files Browse the repository at this point in the history
Enable level zero mode for KernelBinToSourceNativeForAdvKrnl
  • Loading branch information
peiyigu-intel authored and intel-mediadev committed Oct 30, 2023
1 parent 0147a3a commit 25422ea
Show file tree
Hide file tree
Showing 4 changed files with 125 additions and 1 deletion.
1 change: 1 addition & 0 deletions media_softlet/agnostic/common/vp/hal/features/vp_filter.h
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@ using VEBOX_CSC_PARAMS = _VEBOX_CSC_PARAMS;
using PVEBOX_CSC_PARAMS = VEBOX_CSC_PARAMS *;

using KERNEL_ARGS = std::vector<KRN_ARG>;
using KERNEL_BTIS = std::map<uint32_t,uint32_t>;

struct _VEBOX_UPDATE_PARAMS
{
Expand Down
22 changes: 22 additions & 0 deletions media_softlet/agnostic/common/vp/hal/packet/vp_render_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,28 @@ struct KRN_ARG
KRN_ARG_KIND eArgKind;
};

//for L0 use only
struct KRN_BTI
{
uint32_t uIndex;
uint32_t uBTI;
};

//for L0 use only
struct KRN_EXECUTE_ENV
{
uint32_t uBarrierCount;
bool bDisableMidThreadPreemption;
uint32_t uGrfCount;
bool bHasGlobalAtomics;
bool bHasNoStatelessWrite;
uint32_t uInlineDataPayloadSize;
uint32_t uOffsetToSkipPerThreadDataLoad;
uint32_t uSimdSize;
uint32_t uSubgroupIndependentForwardProgress;
uint32_t uEuThreadCount;
};

using SurfaceIndex = uint32_t;
using SamplerIndex = uint32_t;
using KernelIndex = uint32_t; // index of current kernel in KERNEL_PARAMS_LIST
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -674,3 +674,64 @@ void VpPlatformInterface::DisableRender()
VP_PUBLIC_NORMALMESSAGE("Disable Render.");
m_isRenderDisabled = true;
}

//for L0 use only
MOS_STATUS VpRenderKernel::SetKernelExeEnv(KRN_EXECUTE_ENV &exeEnv)
{
VP_FUNC_CALL();
m_kernelExeEnv = exeEnv;
return MOS_STATUS_SUCCESS;
}

//for L0 use only
MOS_STATUS VpRenderKernel::AddKernelBti(KRN_BTI &bti)
{
VP_FUNC_CALL();
m_kernelBtis.emplace(bti.uIndex, bti.uBTI);
return MOS_STATUS_SUCCESS;
}

//for L0 use only
MOS_STATUS VpRenderKernel::SetKernelCurbeSize(uint32_t size)
{
VP_FUNC_CALL();

m_curbeSize = size;
return MOS_STATUS_SUCCESS;
}

//for L0 use only
void VpPlatformInterface::InitVpDelayedNativeAdvKernel(
const uint32_t *kernelBin,
uint32_t kernelBinSize,
KRN_ARG *kernelArgs,
uint32_t kernelArgSize,
uint32_t kernelCurbeSize,
KRN_EXECUTE_ENV &kernelExeEnv,
KRN_BTI *kernelBtis,
uint32_t kernelBtiSize,
std::string kernelName)
{
VP_FUNC_CALL();

VpRenderKernel vpKernel;

vpKernel.SetKernelBinPointer((void *)kernelBin);
vpKernel.SetKernelName(kernelName);
vpKernel.SetKernelBinOffset(0x0);
vpKernel.SetKernelBinSize(kernelBinSize);
vpKernel.SetKernelExeEnv(kernelExeEnv);
vpKernel.SetKernelCurbeSize(kernelCurbeSize);

for (uint32_t i = 0; i < kernelArgSize; ++i)
{
vpKernel.AddKernelArg(kernelArgs[i]);
}

for (uint32_t i = 0; i < kernelBtiSize; ++i)
{
vpKernel.AddKernelBti(kernelBtis[i]);
}

m_kernelPool.insert(std::make_pair(vpKernel.GetKernelName(), vpKernel));
}
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,29 @@ class VpRenderKernel
return m_kernelArgs;
}


//for L0 use only
uint32_t &GetCurbeSize()
{
return m_curbeSize;
}

MOS_STATUS SetKernelExeEnv(KRN_EXECUTE_ENV &exeEnv);

MOS_STATUS SetKernelCurbeSize(uint32_t size);

MOS_STATUS AddKernelBti(KRN_BTI &bti);

KERNEL_BTIS GetKernelBtis()
{
return m_kernelBtis;
}

KRN_EXECUTE_ENV &GetKernelExeEnv()
{
return m_kernelExeEnv;
}

protected:
// Compositing Kernel DLL/Search state
const Kdll_RuleEntry *m_kernelDllRules = nullptr;
Expand All @@ -122,13 +145,18 @@ class VpRenderKernel
uint32_t m_kernelBinSize = 0;
// CM Kernel Execution Code Offset
uint32_t m_kernelBinOffset = 0;
// CM Kernel Arguments
// CM Kernel Arguments or L0 Kernel Arguments
KERNEL_ARGS m_kernelArgs;
std::string m_kernelName = {};
// CM Compositing Kernel patch file buffer and size
const void *m_fcPatchBin = nullptr;
uint32_t m_fcPatchBinSize = 0;

//for L0 use only
uint32_t m_curbeSize = 0;
KERNEL_BTIS m_kernelBtis;
KRN_EXECUTE_ENV m_kernelExeEnv = {};

public:
const static std::string s_kernelNameNonAdvKernels;

Expand Down Expand Up @@ -320,6 +348,18 @@ class VpPlatformInterface
uint32_t kernelBinSize,
std::string kernelName);

//for L0 kernel use only
virtual void InitVpDelayedNativeAdvKernel(
const uint32_t *kernelBin,
uint32_t kernelBinSize,
KRN_ARG *kernelArgs,
uint32_t kernelArgSize,
uint32_t kernelCurbeSize,
KRN_EXECUTE_ENV& kernelExeEnv,
KRN_BTI *kernelBtis,
uint32_t kernelBtiSize,
std::string kernelName);

virtual void AddNativeAdvKernelToDelayedList(
DelayLoadedKernelType kernelType,
DelayLoadedFunc func);
Expand Down

0 comments on commit 25422ea

Please sign in to comment.