Correctly calculate size of the copy region

Since we adjust we adjust the start of the region, amd::BufferRect::end_ is no longer the size, just the offset as to where the region ends.

The actual size of the region is (amd::BufferRect::end_ - amd::BufferRect::start_).

Change-Id: I8425d8bdfb20f485740863813e762e8923d9ee94
Dieser Commit ist enthalten in:
Vlad Sytchenko
2020-04-13 15:07:40 -04:00
committet von Vladislav Sytchenko
Ursprung 88304c15e6
Commit f95cdb09c2
+8 -8
Datei anzeigen
@@ -1028,8 +1028,8 @@ hipError_t ihipMemcpyDtoD(void* srcDevice,
srcRect.end_ += srcOffset;
amd::Coord3D srcStart(srcRect.start_, 0, 0);
amd::Coord3D srcEnd(srcRect.end_, 1, 1);
if (!srcMemory->validateRegion(srcStart, srcEnd)) {
amd::Coord3D srcSize(srcRect.end_ - srcRect.start_, 1, 1);
if (!srcMemory->validateRegion(srcStart, srcSize)) {
return hipErrorInvalidValue;
}
@@ -1041,8 +1041,8 @@ hipError_t ihipMemcpyDtoD(void* srcDevice,
dstRect.end_ += dstOffset;
amd::Coord3D dstStart(dstRect.start_, 0, 0);
amd::Coord3D dstEnd(dstRect.end_, 1, 1);
if (!dstMemory->validateRegion(dstStart, dstEnd)) {
amd::Coord3D dstSize(dstRect.end_ - dstRect.start_, 1, 1);
if (!dstMemory->validateRegion(dstStart, dstSize)) {
return hipErrorInvalidValue;
}
@@ -1092,8 +1092,8 @@ hipError_t ihipMemcpyDtoH(void* srcDevice,
srcRect.end_ += srcOffset;
amd::Coord3D srcStart(srcRect.start_, 0, 0);
amd::Coord3D srcEnd(srcRect.end_, 1, 1);
if (!srcMemory->validateRegion(srcStart, srcEnd)) {
amd::Coord3D srcSize(srcRect.end_ - srcRect.start_, 1, 1);
if (!srcMemory->validateRegion(srcStart, srcSize)) {
return hipErrorInvalidValue;
}
@@ -1152,8 +1152,8 @@ hipError_t ihipMemcpyHtoD(const void* srcHost,
dstRect.end_ += dstOffset;
amd::Coord3D dstStart(dstRect.start_, 0, 0);
amd::Coord3D dstEnd(dstRect.end_, 1, 1);
if (!dstMemory->validateRegion(dstStart, dstEnd)) {
amd::Coord3D dstSize(dstRect.end_ - dstRect.start_, 1, 1);
if (!dstMemory->validateRegion(dstStart, dstSize)) {
return hipErrorInvalidValue;
}