Skip to content

Commit

Permalink
[CM] Use correct stream index in fast path
Browse files Browse the repository at this point in the history
Fix the issue that incorrect context is used in fast path

Change-Id: I6a0092e86d3ec7c2d23a3de39a600c8df2a547c2
  • Loading branch information
HeFan2017 authored and intel-mediadev committed Aug 15, 2019
1 parent 9c28262 commit 08312a8
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions media_driver/agnostic/common/cm/cm_queue_rt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,11 @@ CM_RT_API int32_t CmQueueRT::Enqueue(
cmHalState->advExecutor->SwitchToFastPath(kernelArray) &&
cmHalState->cmHalInterface->IsFastPathByDefault())
{
return cmHalState->advExecutor->SubmitTask(this, kernelArray, event, threadSpace, (MOS_GPU_CONTEXT)m_queueOption.GPUContext);
uint32_t old_stream_idx = cmHalState->osInterface->streamIndex;
cmHalState->osInterface->streamIndex = m_streamIndex;
result = cmHalState->advExecutor->SubmitTask(this, kernelArray, event, threadSpace, (MOS_GPU_CONTEXT)m_queueOption.GPUContext);
cmHalState->osInterface->streamIndex = old_stream_idx;
return result;
}

if (threadSpaceRTConst && threadSpaceRTConst->IsThreadAssociated())
Expand Down Expand Up @@ -830,14 +834,18 @@ CM_RT_API int32_t CmQueueRT::EnqueueWithGroup( CmTask* task, CmEvent* & event, c
cmHalState->advExecutor->SwitchToFastPath(task) &&
cmHalState->cmHalInterface->IsFastPathByDefault())
{
uint32_t old_stream_idx = cmHalState->osInterface->streamIndex;
cmHalState->osInterface->streamIndex = m_streamIndex;
if (cmHalState->cmHalInterface->CheckMediaModeAvailability())
{
return cmHalState->advExecutor->SubmitGpgpuTask(this, task, event, threadGroupSpace, (MOS_GPU_CONTEXT)m_queueOption.GPUContext);
result = cmHalState->advExecutor->SubmitGpgpuTask(this, task, event, threadGroupSpace, (MOS_GPU_CONTEXT)m_queueOption.GPUContext);
}
else
{
return cmHalState->advExecutor->SubmitComputeTask(this, task, event, threadGroupSpace, (MOS_GPU_CONTEXT)m_queueOption.GPUContext);
result = cmHalState->advExecutor->SubmitComputeTask(this, task, event, threadGroupSpace, (MOS_GPU_CONTEXT)m_queueOption.GPUContext);
}
cmHalState->osInterface->streamIndex = old_stream_idx;
return result;
}

CmTaskRT *taskRT = static_cast<CmTaskRT *>(task);
Expand Down

0 comments on commit 08312a8

Please sign in to comment.