SWDEV-441603 - Add hipDrvMemcpy2DUnaligned test

Change-Id: I44b65867cabeb369fda8a82984fe3f694499942c
This commit is contained in:
Marko Arandjelovic committed 2024-08-01 17:44:26 -04:00
1 förälder 5d042c80fa
incheckning 639a9c2996
3 files changed
+190 -83

No files matched your search

+9 -3
Visa fil
@@ -165,12 +165,18 @@ template <typename T> class LinearAllocGuardMultiDim {
const hipExtent extent_;
};
template <typename T> class LinearAllocGuard2D : public LinearAllocGuardMultiDim<T> {
template <typename T, bool unaligned = false>
class LinearAllocGuard2D : public LinearAllocGuardMultiDim<T> {
public:
LinearAllocGuard2D(const size_t width_logical, const size_t height)
: LinearAllocGuardMultiDim<T>{make_hipExtent(width_logical * sizeof(T), height, 1)} {
HIP_CHECK(hipMallocPitch(&this->pitched_ptr_.ptr, &this->pitched_ptr_.pitch,
this->extent_.width, this->extent_.height));
if (unaligned) {
this->pitched_ptr_.pitch = width_logical * sizeof(T);
HIP_CHECK(hipMalloc(&this->pitched_ptr_.ptr, this->pitched_ptr_.pitch * height));
} else {
HIP_CHECK(hipMallocPitch(&this->pitched_ptr_.ptr, &this->pitched_ptr_.pitch,
this->extent_.width, this->extent_.height));
}
}
LinearAllocGuard2D(const LinearAllocGuard2D&) = delete;