mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 14:55:24 +08:00
feature: stateless enqueueCopyBufferToImage
Related-to: NEO-11859 Signed-off-by: Damian Tomczak <damian.tomczak@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
d8f0b1c17d
commit
9dbace61eb
@@ -6,6 +6,8 @@
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "shared/source/helpers/compiler_product_helper.h"
|
||||
|
||||
#include "opencl/source/command_queue/command_queue_hw.h"
|
||||
#include "opencl/source/helpers/mipmap.h"
|
||||
#include "opencl/source/mem_obj/buffer.h"
|
||||
@@ -25,9 +27,12 @@ cl_int CommandQueueHw<GfxFamily>::enqueueCopyBufferToImage(
|
||||
const cl_event *eventWaitList,
|
||||
cl_event *event) {
|
||||
|
||||
const bool useStateless = forceStateless(srcBuffer->getSize());
|
||||
bool isStateless = device->getCompilerProductHelper().isForceToStatelessRequired();
|
||||
if (srcBuffer->getSize() >= 4ull * MemoryConstants::gigaByte) {
|
||||
isStateless = true;
|
||||
}
|
||||
const bool useHeapless = false;
|
||||
auto builtInType = EBuiltInOps::adjustBuiltinType<EBuiltInOps::copyBufferToImage3d>(useStateless, useHeapless);
|
||||
auto builtInType = EBuiltInOps::adjustBuiltinType<EBuiltInOps::copyBufferToImage3d>(isStateless, useHeapless);
|
||||
|
||||
auto &builder = BuiltInDispatchBuilderOp::getBuiltinDispatchInfoBuilder(builtInType,
|
||||
this->getClDevice());
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#include "shared/source/gen_common/reg_configs_common.h"
|
||||
#include "shared/source/helpers/basic_math.h"
|
||||
#include "shared/source/helpers/compiler_product_helper.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/helpers/unit_test_helper.h"
|
||||
#include "shared/test/common/libult/ult_command_stream_receiver.h"
|
||||
@@ -213,14 +214,17 @@ HWTEST_P(MipMapCopyBufferToImageTest, GivenImageWithMipLevelNonZeroWhenCopyBuffe
|
||||
auto imageType = (cl_mem_object_type)GetParam();
|
||||
auto builtIns = new MockBuiltins();
|
||||
MockRootDeviceEnvironment::resetBuiltins(pCmdQ->getDevice().getExecutionEnvironment()->rootDeviceEnvironments[pCmdQ->getDevice().getRootDeviceIndex()].get(), builtIns);
|
||||
|
||||
const EBuiltInOps::Type builtInType = pCmdQ->getDevice().getCompilerProductHelper().isForceToStatelessRequired() ? EBuiltInOps::copyBufferToImage3dStateless : EBuiltInOps::copyBufferToImage3d;
|
||||
|
||||
auto &origBuilder = BuiltInDispatchBuilderOp::getBuiltinDispatchInfoBuilder(
|
||||
EBuiltInOps::copyBufferToImage3d,
|
||||
builtInType,
|
||||
pCmdQ->getClDevice());
|
||||
|
||||
// substitute original builder with mock builder
|
||||
auto oldBuilder = pClExecutionEnvironment->setBuiltinDispatchInfoBuilder(
|
||||
rootDeviceIndex,
|
||||
EBuiltInOps::copyBufferToImage3d,
|
||||
builtInType,
|
||||
std::unique_ptr<NEO::BuiltinDispatchInfoBuilder>(new MockBuiltinDispatchInfoBuilder(*builtIns, pCmdQ->getClDevice(), &origBuilder)));
|
||||
|
||||
cl_int retVal = CL_SUCCESS;
|
||||
@@ -272,7 +276,7 @@ HWTEST_P(MipMapCopyBufferToImageTest, GivenImageWithMipLevelNonZeroWhenCopyBuffe
|
||||
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
|
||||
auto &mockBuilder = static_cast<MockBuiltinDispatchInfoBuilder &>(BuiltInDispatchBuilderOp::getBuiltinDispatchInfoBuilder(EBuiltInOps::copyBufferToImage3d,
|
||||
auto &mockBuilder = static_cast<MockBuiltinDispatchInfoBuilder &>(BuiltInDispatchBuilderOp::getBuiltinDispatchInfoBuilder(builtInType,
|
||||
pCmdQ->getClDevice()));
|
||||
auto params = mockBuilder.getBuiltinOpParams();
|
||||
|
||||
@@ -281,7 +285,7 @@ HWTEST_P(MipMapCopyBufferToImageTest, GivenImageWithMipLevelNonZeroWhenCopyBuffe
|
||||
// restore original builder and retrieve mock builder
|
||||
auto newBuilder = pClExecutionEnvironment->setBuiltinDispatchInfoBuilder(
|
||||
rootDeviceIndex,
|
||||
EBuiltInOps::copyBufferToImage3d,
|
||||
builtInType,
|
||||
std::move(oldBuilder));
|
||||
EXPECT_NE(nullptr, newBuilder);
|
||||
}
|
||||
@@ -357,7 +361,7 @@ HWTEST_F(EnqueueCopyBufferToImageStatelessTest, givenGpuHangAndBlockingCallAndBi
|
||||
|
||||
using EnqueueCopyBufferToImageStatefulTest = EnqueueCopyBufferToImageHw;
|
||||
|
||||
HWTEST_F(EnqueueCopyBufferToImageStatefulTest, givenBigBufferWhenCopyingBufferToImageStatefulThenSuccessIsReturned) {
|
||||
HWTEST2_F(EnqueueCopyBufferToImageStatefulTest, givenBigBufferWhenCopyingBufferToImageStatefulThenSuccessIsReturned, IsStatefulBufferPreferredForProduct) {
|
||||
auto cmdQ = std::make_unique<CommandQueueStateful<FamilyType>>(context.get(), device.get());
|
||||
if (cmdQ->getHeaplessModeEnabled()) {
|
||||
GTEST_SKIP();
|
||||
|
||||
Reference in New Issue
Block a user