SWDEV-534207 - solve phoenix mem test failures (#218)
* make sure symbolStatus after hipGetProcAddress() is the expected in the tests that are failing on Phoenix * fix that calls to hipMemset2DAsync() and hipMemset2DAsync_spt() to set values on submatrices where not taking into account the pitch, causing test failures on Phoenix * before testing whether hipMemset2DAsync() works, initialize the whole matrix to a known value. This makes sure the test fails even if the uninitialized memory returned after hipMallocPitch() happens to have the expected value * Sbefore testing whether hipMemset2DAsync_spt() works, initialize the whole matrix to a known value. This makes sure the test fails even if the uninitialized memory returned after hipMallocPitch() happens to have the expected value * fix up compiler error: dyn_hipMemset2DAsync_ptr should have been dyn_hipMemset2DAsync_spt_ptr * when Unit_hipMalloc3D_Basic fails due to a potential memory leak, print the values that hipMemGetInfo() returns before and after the allocation/deallocation pair. * Also print intermediate free memory * Make sure Unit_hipMalloc3D_Basic allocates at least PalSettings::subAllocationChunkSize_ on Windows. Otherwise hipMemGetInfo() will not report an increase on available memory after hipFree() is called, as the minimum amount of memory that cause a call to the CoarseMemorySubAllocator::Create() is that chunk size * Fix up previous commit; allocated too much memory * skip some extent sizes in Unit_hipFreeMipmappedArrayImplicitSyncArray if allocating them would be require more memory than the actual totalGlobalMem of the device * Do not expect an exact match when comparing the memory available memory before and after hipMalloc3D() + hipFree() * Do not allocate more memory than the total GPU memory in Unit_hipFreeMipmappedArrayImplicitSyncArray * fix expected available memory amount comparison in hipMalloc3D - Basic * use SUCCEED() macro in Unit_hipFreeMipmappedArrayImplicitSyncArray to log more information when there is not enough memory for the mipmapped array to be allocated * fix formatting
This commit is contained in:
committed by
GitHub
orang tua
0c318b4ca5
melakukan
4b2ed7653f
@@ -24,21 +24,24 @@ THE SOFTWARE.
|
||||
#include <hip_test_common.hh>
|
||||
#include "hipArrayCommon.hh"
|
||||
#include "utils.hh"
|
||||
#include <array>
|
||||
|
||||
|
||||
/*
|
||||
* hipFreeMipmappedArray API test scenarios
|
||||
* 1. Check that hipFreeMipmappedArray implicitly synchronises the device.
|
||||
* 2. Perform multiple allocations and then call hipFreeMipmappedArray on each pointer concurrently (from unique
|
||||
* threads) for different memory types and different allocation sizes.
|
||||
* 2. Perform multiple allocations and then call hipFreeMipmappedArray on each pointer concurrently
|
||||
* (from unique threads) for different memory types and different allocation sizes.
|
||||
* 3. Pass nullptr as argument and check that correct error code is returned.
|
||||
* 4. Call hipFreeMipmappedArray twice on the same pointer and check that the implementation handles the second
|
||||
* call correctly.
|
||||
* 4. Call hipFreeMipmappedArray twice on the same pointer and check that the implementation handles
|
||||
* the second call correctly.
|
||||
*/
|
||||
|
||||
TEMPLATE_TEST_CASE("Unit_hipFreeMipmappedArrayImplicitSyncArray", "", char, float) {
|
||||
hipMipmappedArray_t arrayPtr{};
|
||||
hipExtent extent{};
|
||||
hipChannelFormatDesc desc = hipCreateChannelDesc<TestType>();
|
||||
hipDeviceProp_t props;
|
||||
std::array<unsigned int, 3> levels = {1, 5, 7};
|
||||
|
||||
#if HT_AMD
|
||||
const unsigned int flags = hipArrayDefault;
|
||||
@@ -50,16 +53,30 @@ TEMPLATE_TEST_CASE("Unit_hipFreeMipmappedArrayImplicitSyncArray", "", char, floa
|
||||
extent.height = GENERATE(64, 256, 1024);
|
||||
extent.depth = GENERATE(0, 64, 256, 1024);
|
||||
|
||||
const unsigned int numLevels = GENERATE(1, 5, 7);
|
||||
HIP_CHECK(hipGetDeviceProperties(&props, 0))
|
||||
|
||||
HIP_CHECK_IGNORED_RETURN(hipMallocMipmappedArray(&arrayPtr, &desc, extent, numLevels, flags),
|
||||
hipErrorNotSupported);
|
||||
for (auto numLevels : levels) {
|
||||
if (extent.width * extent.height * extent.depth * numLevels * sizeof(TestType) >
|
||||
props.totalGlobalMem) {
|
||||
// some devices will not have enough memory allocate the 6GB required for the biggest extent
|
||||
// We skip the test in that case (and no warning is needed)
|
||||
SUCCEED(
|
||||
"Device does not have enough global memory to allocate a mipmapped array using this "
|
||||
" extent: ("
|
||||
<< extent.width << ", " << extent.height << ", " << extent.depth << ") and " << numLevels
|
||||
<< " levels");
|
||||
continue;
|
||||
}
|
||||
|
||||
LaunchDelayKernel(std::chrono::milliseconds{50}, nullptr);
|
||||
// make sure device is busy
|
||||
HIP_CHECK_ERROR(hipStreamQuery(nullptr), hipErrorNotReady);
|
||||
HIP_CHECK(hipFreeMipmappedArray(arrayPtr));
|
||||
HIP_CHECK(hipStreamQuery(nullptr));
|
||||
HIP_CHECK_IGNORED_RETURN(hipMallocMipmappedArray(&arrayPtr, &desc, extent, numLevels, flags),
|
||||
hipErrorNotSupported);
|
||||
|
||||
LaunchDelayKernel(std::chrono::milliseconds{50}, nullptr);
|
||||
// make sure device is busy
|
||||
HIP_CHECK_ERROR(hipStreamQuery(nullptr), hipErrorNotReady);
|
||||
HIP_CHECK(hipFreeMipmappedArray(arrayPtr));
|
||||
HIP_CHECK(hipStreamQuery(nullptr));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("Unit_hipFreeMipmappedArray_Negative_Nullptr") {
|
||||
@@ -111,14 +128,13 @@ TEMPLATE_TEST_CASE("Unit_hipFreeMipmappedArrayMultiTArray", "", char, int) {
|
||||
|
||||
int i = 0;
|
||||
for (; i < ptrs.size(); i++) {
|
||||
if (hipErrorOutOfMemory == hipMallocMipmappedArray(&ptrs[i], &desc, extent,
|
||||
numLevels, flags)) {
|
||||
if (hipErrorOutOfMemory == hipMallocMipmappedArray(&ptrs[i], &desc, extent, numLevels, flags)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (int j = 0; j < i; j++) {
|
||||
threads.emplace_back([ptrs,j] {
|
||||
threads.emplace_back([ptrs, j] {
|
||||
if (hipSuccess != hipFreeMipmappedArray(ptrs[j])) {
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user