SWDEV-301823 - Optimize hipMemset2D/3D

Change-Id: Ibe560149a263c2ac6b08e4eb1a1d331d2aeac78c
This commit is contained in:
Sarbojit Sarkar
2021-09-17 09:29:28 +00:00
committed by Saleel Kudchadker
orang tua cbb8d82bdb
melakukan 22a847f3ce
2 mengubah file dengan 24 tambahan dan 6 penghapusan
+17 -4
Melihat File
@@ -2211,10 +2211,23 @@ void VirtualGPU::submitFillMemory(amd::FillMemoryCommand& cmd) {
amd::ScopedLock lock(execution());
profilingBegin(cmd);
if (!fillMemory(cmd.type(), &cmd.memory(), cmd.pattern(), cmd.patternSize(), cmd.origin(),
cmd.size())) {
cmd.setStatus(CL_INVALID_OPERATION);
size_t width = cmd.size().c[0];
size_t height = cmd.size().c[1];
size_t depth = cmd.size().c[2];
size_t pitch = cmd.surface().c[0];
amd::Coord3D origin = cmd.origin();
amd::Coord3D region{cmd.surface().c[1], cmd.surface().c[2], depth};
amd::BufferRect rect;
rect.create(static_cast<size_t*>(origin), static_cast<size_t*>(region),
pitch, 0);
for (size_t slice = 0; slice < depth; slice++) {
for (size_t row = 0; row < height; row++) {
const size_t rowOffset = rect.offset(0, row, slice);
if (!fillMemory(cmd.type(), &cmd.memory(), cmd.pattern(), cmd.patternSize(),
amd::Coord3D{rowOffset, 0, 0}, amd::Coord3D{width, 1, 1})) {
cmd.setStatus(CL_INVALID_OPERATION);
}
}
}
profilingEnd(cmd);
}
+7 -2
Melihat File
@@ -601,16 +601,18 @@ class FillMemoryCommand : public OneMemoryArgCommand {
private:
Coord3D origin_; //!< Origin of the region to write to.
Coord3D size_; //!< Size of the region to write to.
Coord3D surface_; //!< Total surface
char pattern_[MaxFillPatterSize]; //!< The fill pattern
size_t patternSize_; //!< Pattern size
public:
FillMemoryCommand(HostQueue& queue, cl_command_type cmdType, const EventWaitList& eventWaitList,
Memory& memory, const void* pattern, size_t patternSize, Coord3D origin,
Coord3D size)
Memory& memory, const void* pattern, size_t patternSize, const Coord3D& origin,
const Coord3D& size, const Coord3D& surface)
: OneMemoryArgCommand(queue, cmdType, eventWaitList, memory),
origin_(origin),
size_(size),
surface_(surface),
patternSize_(patternSize) {
// Sanity checks
assert(pattern != NULL && "pattern cannot be null");
@@ -632,6 +634,9 @@ class FillMemoryCommand : public OneMemoryArgCommand {
//! Return the region size
const Coord3D& size() const { return size_; }
//! Return the surface
const Coord3D& surface() const { return surface_; }
//! Return true if the entire memory object is written.
bool isEntireMemory() const;
};