mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-20 00:24:58 +08:00
Fix scratch in bindless mode
Signed-off-by: Maciej Plewka <maciej.plewka@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
024012c66c
commit
24a88d22aa
@@ -142,7 +142,9 @@ ze_result_t CommandQueueHw<gfxCoreFamily>::executeCommandLists(
|
||||
|
||||
interlockedMax(commandQueuePerThreadScratchSize, commandList->getCommandListPerThreadScratchSize());
|
||||
if (commandList->getCommandListPerThreadScratchSize() != 0) {
|
||||
heapContainer.push_back(commandList->commandContainer.getIndirectHeap(NEO::HeapType::SURFACE_STATE)->getGraphicsAllocation());
|
||||
if (commandList->commandContainer.getIndirectHeap(NEO::HeapType::SURFACE_STATE) != nullptr) {
|
||||
heapContainer.push_back(commandList->commandContainer.getIndirectHeap(NEO::HeapType::SURFACE_STATE)->getGraphicsAllocation());
|
||||
}
|
||||
for (auto element : commandList->commandContainer.sshAllocations) {
|
||||
heapContainer.push_back(element);
|
||||
}
|
||||
|
||||
@@ -773,6 +773,27 @@ HWTEST2_F(CommandQueueDestroy, givenCommandQueueAndCommandListWithSshAndScratchW
|
||||
alignedFree(alloc);
|
||||
}
|
||||
|
||||
HWTEST2_F(CommandQueueDestroy, givenCommandQueueAndCommandListWithWhenBindlessEnabledThenHeapContainerIsEmpty, CommandQueueExecuteTestSupport) {
|
||||
DebugManagerStateRestore dbgRestorer;
|
||||
DebugManager.flags.UseBindlessMode.set(1);
|
||||
neoDevice->bindlessHeapHelper = std::make_unique<MockBindlesHeapsHelper>(neoDevice->getMemoryManager(), neoDevice->getNumAvailableDevices() > 1, neoDevice->getRootDeviceIndex());
|
||||
ze_command_queue_desc_t desc = {};
|
||||
NEO::CommandStreamReceiver *csr;
|
||||
device->getCsrForOrdinalAndIndex(&csr, 0u, 0u);
|
||||
auto commandQueue = new MockCommandQueue<gfxCoreFamily>(device, csr, &desc);
|
||||
commandQueue->initialize(false, false);
|
||||
auto commandList = new CommandListCoreFamily<gfxCoreFamily>();
|
||||
commandList->initialize(device, NEO::EngineGroupType::Compute);
|
||||
commandList->commandListPerThreadScratchSize = 100u;
|
||||
auto commandListHandle = commandList->toHandle();
|
||||
|
||||
commandQueue->executeCommandLists(1, &commandListHandle, nullptr, false);
|
||||
|
||||
EXPECT_EQ(commandQueue->mockHeapContainer.size(), 0u);
|
||||
commandQueue->destroy();
|
||||
commandList->destroy();
|
||||
}
|
||||
|
||||
using ExecuteCommandListTests = Test<ContextFixture>;
|
||||
HWTEST2_F(ExecuteCommandListTests, givenExecuteCommandListWhenItReturnsThenContainersAreEmpty, CommandQueueExecuteTestSupport) {
|
||||
ze_command_queue_desc_t desc = {};
|
||||
|
||||
@@ -503,7 +503,8 @@ struct MockScratchController : public ScratchSpaceController {
|
||||
uint32_t currentTaskCount,
|
||||
OsContext &osContext,
|
||||
bool &stateBaseAddressDirty,
|
||||
bool &vfeStateDirty) override {
|
||||
bool &vfeStateDirty,
|
||||
NEO::ResidencyContainer &residency) override {
|
||||
}
|
||||
void reserveHeap(IndirectHeap::Type heapType, IndirectHeap *&indirectHeap) override{};
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2020 Intel Corporation
|
||||
* Copyright (C) 2018-2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -25,6 +25,8 @@ namespace ScratchSpaceConstants {
|
||||
constexpr size_t scratchSpaceOffsetFor64Bit = 4096u;
|
||||
}
|
||||
|
||||
using ResidencyContainer = std::vector<GraphicsAllocation *>;
|
||||
|
||||
class ScratchSpaceController {
|
||||
public:
|
||||
ScratchSpaceController(uint32_t rootDeviceIndex, ExecutionEnvironment &environment, InternalAllocationStorage &allocationStorage);
|
||||
@@ -63,7 +65,8 @@ class ScratchSpaceController {
|
||||
uint32_t currentTaskCount,
|
||||
OsContext &osContext,
|
||||
bool &stateBaseAddressDirty,
|
||||
bool &vfeStateDirty) = 0;
|
||||
bool &vfeStateDirty,
|
||||
ResidencyContainer &residency) = 0;
|
||||
|
||||
protected:
|
||||
MemoryManager *getMemoryManager() const;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2020 Intel Corporation
|
||||
* Copyright (C) 2018-2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -97,6 +97,7 @@ void ScratchSpaceControllerBase::programBindlessSurfaceStateForScratch(BindlessH
|
||||
uint32_t currentTaskCount,
|
||||
OsContext &osContext,
|
||||
bool &stateBaseAddressDirty,
|
||||
bool &vfeStateDirty) {
|
||||
bool &vfeStateDirty,
|
||||
ResidencyContainer &residency) {
|
||||
}
|
||||
} // namespace NEO
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2020 Intel Corporation
|
||||
* Copyright (C) 2018-2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -41,7 +41,8 @@ class ScratchSpaceControllerBase : public ScratchSpaceController {
|
||||
uint32_t currentTaskCount,
|
||||
OsContext &osContext,
|
||||
bool &stateBaseAddressDirty,
|
||||
bool &vfeStateDirty) override;
|
||||
bool &vfeStateDirty,
|
||||
ResidencyContainer &residency) override;
|
||||
|
||||
protected:
|
||||
void createScratchSpaceAllocation();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2020 Intel Corporation
|
||||
* Copyright (C) 2020-2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -140,8 +140,8 @@ void populatePointerKernelArg(ArgDescPointer &dst,
|
||||
|
||||
case KernelDescriptor::BindlessAndStateless:
|
||||
dst.bindful = undefined<SurfaceStateHeapOffset>;
|
||||
dst.stateless = stateless;
|
||||
dst.bindless = bindless;
|
||||
dst.stateless = undefined<CrossThreadDataOffset>;
|
||||
dst.bindless = stateless;
|
||||
dst.pointerSize = pointerSize;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2020 Intel Corporation
|
||||
* Copyright (C) 2020-2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -36,10 +36,12 @@ class MockScratchSpaceControllerBase : public ScratchSpaceControllerBase {
|
||||
uint32_t currentTaskCount,
|
||||
OsContext &osContext,
|
||||
bool &stateBaseAddressDirty,
|
||||
bool &vfeStateDirty) override {
|
||||
ScratchSpaceControllerBase::programBindlessSurfaceStateForScratch(heapsHelper, requiredPerThreadScratchSize, requiredPerThreadPrivateScratchSize, currentTaskCount, osContext, stateBaseAddressDirty, vfeStateDirty);
|
||||
bool &vfeStateDirty,
|
||||
NEO::ResidencyContainer &residency) override {
|
||||
ScratchSpaceControllerBase::programBindlessSurfaceStateForScratch(heapsHelper, requiredPerThreadScratchSize, requiredPerThreadPrivateScratchSize, currentTaskCount, osContext, stateBaseAddressDirty, vfeStateDirty, residencyContainer);
|
||||
programBindlessSurfaceStateForScratchCalled = true;
|
||||
}
|
||||
ResidencyContainer residencyContainer;
|
||||
bool programHeapsCalled = false;
|
||||
bool programBindlessSurfaceStateForScratchCalled = false;
|
||||
};
|
||||
@@ -70,14 +72,14 @@ HWTEST_F(ScratchComtrolerTests, givenCommandQueueWhenProgramHeapBindlessCalledTh
|
||||
csr.setupContext(*pDevice->getDefaultEngine().osContext);
|
||||
|
||||
ExecutionEnvironment *execEnv = static_cast<ExecutionEnvironment *>(pDevice->getExecutionEnvironment());
|
||||
std::unique_ptr<ScratchSpaceController> scratchController = std::make_unique<MockScratchSpaceControllerBase>(pDevice->getRootDeviceIndex(),
|
||||
*execEnv,
|
||||
*csr.getInternalAllocationStorage());
|
||||
std::unique_ptr<MockScratchSpaceControllerBase> scratchController = std::make_unique<MockScratchSpaceControllerBase>(pDevice->getRootDeviceIndex(),
|
||||
*execEnv,
|
||||
*csr.getInternalAllocationStorage());
|
||||
|
||||
bool gsbaStateDirty = false;
|
||||
bool frontEndStateDirty = false;
|
||||
HeapContainer heapContainer;
|
||||
scratchController->programBindlessSurfaceStateForScratch(nullptr, 0, 0, 0, *pDevice->getDefaultEngine().osContext, gsbaStateDirty, frontEndStateDirty);
|
||||
scratchController->programBindlessSurfaceStateForScratch(nullptr, 0, 0, 0, *pDevice->getDefaultEngine().osContext, gsbaStateDirty, frontEndStateDirty, scratchController->residencyContainer);
|
||||
|
||||
EXPECT_TRUE(static_cast<MockScratchSpaceControllerBase *>(scratchController.get())->programBindlessSurfaceStateForScratchCalled);
|
||||
}
|
||||
Reference in New Issue
Block a user