SWDEV-306947 - Add mode combination tests (#2447)

Address modes are valid for array rather than linear
memory. Comment out codes of address test for linear
memory.
Add tests of mode combination(address, linear and
normorlized coordinates) in 1D, 2D and 3D.

Change-Id: I9e7e97d9bf619743c311f68f51d5bf115fdd534d

[ROCm/hip commit: e05f98967e]
Bu işleme şunda yer alıyor:
TomSang
2022-02-17 16:48:45 -05:00
işlemeyi yapan: GitHub
ebeveyn 73130808d8
işleme f1ed56ab72
8 değiştirilmiş dosya ile 653 ekleme ve 24 silme
+6 -6
Dosyayı Görüntüle
@@ -32,8 +32,7 @@ THE SOFTWARE.
#include "test_common.h"
#include <math.h>
#define SIZE 10
#define EPSILON 0.00001
#define THRESH_HOLD 0.01 // For filter mode
#include "hipTextureHelper.hpp"
static float getNormalizedValue(const float value,
const hipChannelFormatDesc& desc) {
@@ -104,8 +103,8 @@ bool textureVerifyFilterModeLinear(float *hOutputData, float *expected, size_t
bool testResult = true;
for (int i = 0; i < size; i++) {
float mean = (fabs(expected[i]) + fabs(hOutputData[i])) / 2;
float ratio = fabs(expected[i] - hOutputData[i]) / (mean + EPSILON);
if (ratio > THRESH_HOLD) {
float ratio = fabs(expected[i] - hOutputData[i]) / (mean + HIP_SAMPLING_VERIFY_EPSILON);
if (ratio > HIP_SAMPLING_VERIFY_RELATIVE_THRESHOLD) {
printf("mismatch at output[%d]:%f expected[%d]:%f, ratio:%f\n", i,
hOutputData[i], i, expected[i], ratio);
testResult = false;
@@ -131,7 +130,7 @@ bool textureTest(texture<T, hipTextureType1D, hipReadModeNormalizedFloat> *tex)
{
hipChannelFormatDesc desc = hipCreateChannelDesc<T>();
hipArray_t dData;
HIPCHECK(hipMallocArray(&dData, &desc, SIZE, 1, hipArrayDefault));
HIPCHECK(hipMallocArray(&dData, &desc, SIZE));
T hData[] = {65, 66, 67, 68, 69, 70, 71, 72, 73, 74};
HIPCHECK(hipMemcpy2DToArray(dData, 0, 0, hData, sizeof(T)*SIZE, sizeof(T)*SIZE, 1, hipMemcpyHostToDevice));
@@ -196,7 +195,8 @@ int main(int argc, char** argv)
status = runTest<hipFilterModePoint>();
} else if(textureFilterMode == 1) {
printf("Test hipFilterModeLinear\n");
printf("THRESH_HOLD:%f, EPSILON:%f\n", THRESH_HOLD, EPSILON);
printf("THRESH_HOLD:%f, EPSILON:%f\n", HIP_SAMPLING_VERIFY_RELATIVE_THRESHOLD,
HIP_SAMPLING_VERIFY_EPSILON);
status = runTest<hipFilterModeLinear>();
} else {
printf("Wrong argument!\n");