diff --git a/opencl/source/os_interface/linux/drm_command_stream.inl b/opencl/source/os_interface/linux/drm_command_stream.inl index 3b45f63eac..5307171e65 100644 --- a/opencl/source/os_interface/linux/drm_command_stream.inl +++ b/opencl/source/os_interface/linux/drm_command_stream.inl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2020 Intel Corporation + * Copyright (C) 2017-2021 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -108,9 +108,6 @@ void DrmCommandStreamReceiver::exec(const BatchBuffer &batchBuffer, u DEBUG_BREAK_IF(!bb); auto execFlags = static_cast(osContext)->getEngineFlag() | I915_EXEC_NO_RELOC; - if (DebugManager.flags.UseAsyncDrmExec.get() != -1) { - execFlags |= (EXEC_OBJECT_ASYNC * DebugManager.flags.UseAsyncDrmExec.get()); - } // Residency hold all allocation except command buffer, hence + 1 auto requiredSize = this->residency.size() + 1; diff --git a/opencl/test/unit_test/os_interface/linux/drm_buffer_object_tests.cpp b/opencl/test/unit_test/os_interface/linux/drm_buffer_object_tests.cpp index 23a70b4872..67317c3078 100644 --- a/opencl/test/unit_test/os_interface/linux/drm_buffer_object_tests.cpp +++ b/opencl/test/unit_test/os_interface/linux/drm_buffer_object_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2020 Intel Corporation + * Copyright (C) 2017-2021 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -441,4 +441,17 @@ TEST_F(DrmBufferObjectTest, givenBoMarkedForCaptureWhenFillingExecObjectThenCapt bo->fillExecObject(execObject, osContext.get(), 0, 1); EXPECT_TRUE(execObject.flags & EXEC_OBJECT_CAPTURE); +} + +TEST_F(DrmBufferObjectTest, givenAsyncDebugFlagWhenFillingExecObjectThenFlagIsSet) { + drm_i915_gem_exec_object2 execObject; + DebugManagerStateRestore restorer; + DebugManager.flags.UseAsyncDrmExec.set(1); + + memset(&execObject, 0, sizeof(execObject)); + bo->setAddress(0x45000); + bo->setSize(0x1000); + bo->fillExecObject(execObject, osContext.get(), 0, 1); + + EXPECT_TRUE(execObject.flags & EXEC_OBJECT_ASYNC); } \ No newline at end of file diff --git a/opencl/test/unit_test/os_interface/linux/drm_command_stream_tests.cpp b/opencl/test/unit_test/os_interface/linux/drm_command_stream_tests.cpp index 1059c17fcd..50188dbb3a 100644 --- a/opencl/test/unit_test/os_interface/linux/drm_command_stream_tests.cpp +++ b/opencl/test/unit_test/os_interface/linux/drm_command_stream_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2020 Intel Corporation + * Copyright (C) 2017-2021 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -703,35 +703,6 @@ HWTEST_TEMPLATED_F(DrmCommandStreamBatchingTests, givenCSRWhenFlushIsCalledThenP mm->freeGraphicsMemory(commandBuffer); } -HWTEST_TEMPLATED_F(DrmCommandStreamBatchingTests, givenDebugFlagSetWhenCallingExecIoctlThenPassAsyncFlag) { - DebugManagerStateRestore restore; - - auto commandBuffer = mm->allocateGraphicsMemoryWithProperties(MockAllocationProperties{csr->getRootDeviceIndex(), MemoryConstants::pageSize}); - LinearStream cs(commandBuffer); - - CommandStreamReceiverHw::addBatchBufferEnd(cs, nullptr); - CommandStreamReceiverHw::alignToCacheLine(cs); - BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 0, 0, nullptr, false, false, QueueThrottle::MEDIUM, QueueSliceCount::defaultSliceCount, cs.getUsed(), &cs, nullptr, false}; - - uint64_t baseFlags = static_cast(csr->getOsContext()).getEngineFlag() | I915_EXEC_NO_RELOC; - - { - DebugManager.flags.UseAsyncDrmExec.set(0); - csr->flush(batchBuffer, csr->getResidencyAllocations()); - - EXPECT_EQ(baseFlags, this->mock->execBuffer.flags); - } - - { - DebugManager.flags.UseAsyncDrmExec.set(1); - csr->flush(batchBuffer, csr->getResidencyAllocations()); - - EXPECT_EQ((baseFlags | EXEC_OBJECT_ASYNC), this->mock->execBuffer.flags); - } - - mm->freeGraphicsMemory(commandBuffer); -} - HWTEST_TEMPLATED_F(DrmCommandStreamBatchingTests, givenCsrWhenDispatchPolicyIsSetToBatchingThenCommandBufferIsNotSubmitted) { mock->reset(); csr->overrideDispatchPolicy(DispatchMode::BatchedDispatch); diff --git a/shared/source/os_interface/linux/drm_buffer_object.cpp b/shared/source/os_interface/linux/drm_buffer_object.cpp index 2c18599d90..a39ab01db1 100644 --- a/shared/source/os_interface/linux/drm_buffer_object.cpp +++ b/shared/source/os_interface/linux/drm_buffer_object.cpp @@ -115,6 +115,11 @@ void BufferObject::fillExecObject(drm_i915_gem_exec_object2 &execObject, OsConte execObject.alignment = 0; execObject.offset = this->gpuAddress; execObject.flags = EXEC_OBJECT_PINNED | EXEC_OBJECT_SUPPORTS_48B_ADDRESS; + + if (DebugManager.flags.UseAsyncDrmExec.get() != -1) { + execObject.flags |= (EXEC_OBJECT_ASYNC * DebugManager.flags.UseAsyncDrmExec.get()); + } + if (this->isMarkedForCapture()) { execObject.flags |= EXEC_OBJECT_CAPTURE; }