Skip to content

Commit 691a4ea

Browse files
Add blit copy implementation for L0
Change-Id: I327a4cf977e166cb648ee9f3a79374f7cefa7b1b Signed-off-by: Maciej Plewka <maciej.plewka@intel.com>
1 parent 3ce0450 commit 691a4ea

30 files changed

+961
-171
lines changed

level_zero/core/source/cmdlist/cmdlist.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,12 @@ void CommandList::eraseResidencyContainerEntry(NEO::GraphicsAllocation *allocati
7777
}
7878
}
7979

80+
bool CommandList::isCopyOnly() const {
81+
return isCopyOnlyCmdList;
82+
}
83+
8084
NEO::PreemptionMode CommandList::obtainFunctionPreemptionMode(Kernel *kernel) {
8185
auto functionAttributes = kernel->getImmutableData()->getDescriptor().kernelAttributes;
82-
8386
NEO::PreemptionFlags flags = {};
8487
flags.flags.disabledMidThreadPreemptionKernel = functionAttributes.flags.requiresDisabledMidThreadPreemption;
8588
flags.flags.usesFencesForReadWriteImages = functionAttributes.flags.usesFencesForReadWriteImages;

level_zero/core/source/cmdlist/cmdlist.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,10 @@ struct CommandList : _ze_command_list_handle_t {
117117
virtual ze_result_t appendMIBBEnd() = 0;
118118
virtual ze_result_t appendMINoop() = 0;
119119

120-
static CommandList *create(uint32_t productFamily, Device *device);
120+
static CommandList *create(uint32_t productFamily, Device *device, bool isCopyOnly);
121121
static CommandList *createImmediate(uint32_t productFamily, Device *device,
122122
const ze_command_queue_desc_t *desc,
123-
bool internalUsage);
123+
bool internalUsage, bool isCopyOnly);
124124

125125
static CommandList *fromHandle(ze_command_list_handle_t handle) {
126126
return static_cast<CommandList *>(handle);
@@ -147,6 +147,7 @@ struct CommandList : _ze_command_list_handle_t {
147147
void removeHostPtrAllocations();
148148
void eraseDeallocationContainerEntry(NEO::GraphicsAllocation *allocation);
149149
void eraseResidencyContainerEntry(NEO::GraphicsAllocation *allocation);
150+
bool isCopyOnly() const;
150151

151152
enum CommandListType : uint32_t {
152153
TYPE_REGULAR = 0u,
@@ -161,14 +162,15 @@ struct CommandList : _ze_command_list_handle_t {
161162
std::vector<Kernel *> printfFunctionContainer;
162163

163164
virtual ze_result_t executeCommandListImmediate(bool performMigration) = 0;
164-
virtual bool initialize(Device *device) = 0;
165+
virtual bool initialize(Device *device, bool isCopyOnly) = 0;
165166
virtual ~CommandList();
166167
NEO::CommandContainer commandContainer;
167168

168169
protected:
169170
std::map<const void *, NEO::GraphicsAllocation *> hostPtrMap;
170171
uint32_t commandListPerThreadScratchSize = 0u;
171172
NEO::PreemptionMode commandListPreemptionMode = NEO::PreemptionMode::Initial;
173+
bool isCopyOnlyCmdList = false;
172174
};
173175

174176
using CommandListAllocatorFn = CommandList *(*)(uint32_t);

level_zero/core/source/cmdlist/cmdlist_hw.h

Lines changed: 35 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ struct CommandListCoreFamily : CommandListImp {
3535

3636
using CommandListImp::CommandListImp;
3737

38-
bool initialize(Device *device) override;
38+
bool initialize(Device *device, bool isCopyOnly) override;
3939
virtual void programL3(bool isSLMused);
4040

4141
ze_result_t close() override;
@@ -124,26 +124,39 @@ struct CommandListCoreFamily : CommandListImp {
124124
ze_result_t executeCommandListImmediate(bool performMigration) override;
125125

126126
protected:
127-
ze_result_t appendMemoryCopyKernelWithGA(void *dstPtr, NEO::GraphicsAllocation *dstPtrAlloc,
128-
uint64_t dstOffset, void *srcPtr,
129-
NEO::GraphicsAllocation *srcPtrAlloc,
130-
uint64_t srcOffset, uint32_t size,
131-
uint32_t elementSize, Builtin builtin);
132-
133-
ze_result_t appendMemoryCopyKernel2d(const void *dstptr, const void *srcptr,
134-
Builtin builtin, const ze_copy_region_t *dstRegion,
135-
uint32_t dstPitch, size_t dstOffset,
136-
const ze_copy_region_t *srcRegion, uint32_t srcPitch,
137-
size_t srcOffset, ze_event_handle_t hSignalEvent,
138-
uint32_t numWaitEvents, ze_event_handle_t *phWaitEvents);
139-
140-
ze_result_t appendMemoryCopyKernel3d(const void *dstptr, const void *srcptr,
141-
Builtin builtin, const ze_copy_region_t *dstRegion,
142-
uint32_t dstPitch, uint32_t dstSlicePitch, size_t dstOffset,
143-
const ze_copy_region_t *srcRegion, uint32_t srcPitch,
144-
uint32_t srcSlicePitch, size_t srcOffset,
145-
ze_event_handle_t hSignalEvent, uint32_t numWaitEvents,
146-
ze_event_handle_t *phWaitEvents);
127+
MOCKABLE_VIRTUAL ze_result_t appendMemoryCopyKernelWithGA(void *dstPtr, NEO::GraphicsAllocation *dstPtrAlloc,
128+
uint64_t dstOffset, void *srcPtr,
129+
NEO::GraphicsAllocation *srcPtrAlloc,
130+
uint64_t srcOffset, uint32_t size,
131+
uint32_t elementSize, Builtin builtin);
132+
133+
MOCKABLE_VIRTUAL ze_result_t appendMemoryCopyBlit(NEO::GraphicsAllocation *dstPtrAlloc,
134+
uint64_t dstOffset,
135+
NEO::GraphicsAllocation *srcPtrAlloc,
136+
uint64_t srcOffset, uint32_t size);
137+
138+
MOCKABLE_VIRTUAL ze_result_t appendMemoryCopyBlitRegion(const void *srcptr,
139+
const void *dstptr,
140+
ze_copy_region_t srcRegion,
141+
ze_copy_region_t dstRegion, Vec3<size_t> copySize,
142+
size_t srcRowPitch, size_t srcSlicePitch,
143+
size_t dstRowPitch, size_t dstSlicePitch,
144+
size_t srcSize, size_t dstSize);
145+
146+
MOCKABLE_VIRTUAL ze_result_t appendMemoryCopyKernel2d(const void *dstptr, const void *srcptr,
147+
Builtin builtin, const ze_copy_region_t *dstRegion,
148+
uint32_t dstPitch, size_t dstOffset,
149+
const ze_copy_region_t *srcRegion, uint32_t srcPitch,
150+
size_t srcOffset, ze_event_handle_t hSignalEvent,
151+
uint32_t numWaitEvents, ze_event_handle_t *phWaitEvents);
152+
153+
MOCKABLE_VIRTUAL ze_result_t appendMemoryCopyKernel3d(const void *dstptr, const void *srcptr,
154+
Builtin builtin, const ze_copy_region_t *dstRegion,
155+
uint32_t dstPitch, uint32_t dstSlicePitch, size_t dstOffset,
156+
const ze_copy_region_t *srcRegion, uint32_t srcPitch,
157+
uint32_t srcSlicePitch, size_t srcOffset,
158+
ze_event_handle_t hSignalEvent, uint32_t numWaitEvents,
159+
ze_event_handle_t *phWaitEvents);
147160

148161
ze_result_t appendLaunchKernelWithParams(ze_kernel_handle_t hKernel,
149162
const ze_group_count_t *pThreadGroupDimensions,
@@ -160,7 +173,7 @@ struct CommandListCoreFamily : CommandListImp {
160173
void appendSignalEventPostWalker(ze_event_handle_t hEvent);
161174

162175
uint64_t getInputBufferSize(NEO::ImageType imageType, uint64_t bytesPerPixel, const ze_image_region_t *region);
163-
AlignedAllocationData getAlignedAllocation(Device *device, const void *buffer, uint64_t bufferSize);
176+
virtual AlignedAllocationData getAlignedAllocation(Device *device, const void *buffer, uint64_t bufferSize);
164177
ze_result_t addEventsToCmdList(ze_event_handle_t hEvent, uint32_t numWaitEvents, ze_event_handle_t *phWaitEvents);
165178
};
166179

0 commit comments

Comments
 (0)