Merge "fix_testcase" into amd-master

[ROCm/hip commit: ab54c15930]
This commit is contained in:
Maneesh Gupta
2016-06-10 12:44:05 -04:00
committad av Gerrit Code Review
förälder aff1391fc2 d9063c015e
incheckning ca375e2d2c
4 ändrade filer med 111 tillägg och 155 borttagningar
+9 -19
Visa fil
@@ -134,32 +134,35 @@ int main() {
HIP_ASSERT(hipMemcpy(hostA, deviceA, NUM*sizeof(unsigned int), hipMemcpyDeviceToHost)); HIP_ASSERT(hipMemcpy(hostA, deviceA, NUM*sizeof(unsigned int), hipMemcpyDeviceToHost));
HIP_ASSERT(hipMemcpy(hostC, deviceC, NUM*sizeof(unsigned long long int), hipMemcpyDeviceToHost)); HIP_ASSERT(hipMemcpy(hostC, deviceC, NUM*sizeof(unsigned long long int), hipMemcpyDeviceToHost));
// verify the results // verify the results
errors = 0; errors = 0;
for (i = 0; i < NUM; i++) { for (i = 0; i < NUM; i++) {
printf("gpu_brev =%d, cpu_brev =%d \n",hostA[i],bitreverse(hostB[i]));
if (hostA[i] != bitreverse(hostB[i])) { if (hostA[i] != bitreverse(hostB[i])) {
errors++; errors++;
} }
} }
if (errors!=0) { if (errors!=0) {
printf("FAILED: %d errors\n",errors); cout << "__brev() FAILED\n" << endl;
return -1;
} else { } else {
printf ("__brev() PASSED!\n"); cout << "__brev() checked!" << endl;
} }
errors = 0; errors = 0;
for (i = 0; i < NUM; i++) { for (i = 0; i < NUM; i++) {
printf("gpu_brevll =%llu, cpu_brevll =%llu \n",hostC[i],bitreverse(hostD[i]));
if (hostC[i] != bitreverse(hostD[i])) { if (hostC[i] != bitreverse(hostD[i])) {
errors++; errors++;
} }
} }
if (errors!=0) { if (errors!=0) {
printf("FAILED: %d errors\n",errors); cout << "__brevll() FAILED" << endl;
return -1;
} else { } else {
printf ("__brevll() PASSED!\n"); cout << "__brevll() checked!" << endl;
} }
cout << "__brev() and __brevll() PASSED!" << endl;
HIP_ASSERT(hipFree(deviceA)); HIP_ASSERT(hipFree(deviceA));
HIP_ASSERT(hipFree(deviceB)); HIP_ASSERT(hipFree(deviceB));
HIP_ASSERT(hipFree(deviceC)); HIP_ASSERT(hipFree(deviceC));
@@ -170,19 +173,6 @@ int main() {
free(hostC); free(hostC);
free(hostD); free(hostD);
//hipResetDefaultAccelerator();
return errors; return errors;
} }
+16 -26
Visa fil
@@ -171,56 +171,59 @@ int main() {
HIP_ASSERT(hipMemcpy(hostC, deviceC, NUM*sizeof(unsigned int), hipMemcpyDeviceToHost)); HIP_ASSERT(hipMemcpy(hostC, deviceC, NUM*sizeof(unsigned int), hipMemcpyDeviceToHost));
HIP_ASSERT(hipMemcpy(hostE, deviceE, NUM*sizeof(unsigned int), hipMemcpyDeviceToHost)); HIP_ASSERT(hipMemcpy(hostE, deviceE, NUM*sizeof(unsigned int), hipMemcpyDeviceToHost));
HIP_ASSERT(hipMemcpy(hostG, deviceG, NUM*sizeof(unsigned int), hipMemcpyDeviceToHost)); HIP_ASSERT(hipMemcpy(hostG, deviceG, NUM*sizeof(unsigned int), hipMemcpyDeviceToHost));
// verify the results // verify the results
errors = 0; errors = 0;
for (i = 0; i < NUM; i++) { for (i = 0; i < NUM; i++) {
printf("gpu_clz_u =%d, cpu_clz_u =%d \n",hostA[i],firstbit_u32(hostB[i]));
if (hostA[i] != firstbit_u32(hostB[i])) { if (hostA[i] != firstbit_u32(hostB[i])) {
errors++; errors++;
} }
} }
if (errors!=0) { if (errors!=0) {
printf("FAILED: %d errors\n",errors); cout << "FAILED clz" << endl;
return -1;
} else { } else {
printf ("__clz_u() for unsigned PASSED!\n"); cout << "__clz_u() for unsigned checked!" << endl;
} }
errors = 0; errors = 0;
for (i = 0; i < NUM; i++) { for (i = 0; i < NUM; i++) {
printf("gpu_clzll_u =%d, cpu_clzll_u =%d \n",hostC[i],firstbit_u64(hostD[i]));
if (hostC[i] != firstbit_u64(hostD[i])) { if (hostC[i] != firstbit_u64(hostD[i])) {
errors++; errors++;
} }
} }
if (errors!=0) { if (errors!=0) {
printf("FAILED: %d errors\n",errors); cout << "FAILED clz" << endl;
return -1;
} else { } else {
printf ("__clzll_u() for unsigned PASSED!\n"); cout << "__clzll_u() for unsigned checked!" << endl;
} }
errors = 0; errors = 0;
for (i = 0; i < NUM; i++) { for (i = 0; i < NUM; i++) {
printf("gpu_clz_s =%d, cpu_clz_s =%d \n",hostE[i],firstbit_s32(hostF[i]));
if (hostE[i] != firstbit_s32(hostF[i])) { if (hostE[i] != firstbit_s32(hostF[i])) {
errors++; errors++;
} }
} }
if (errors!=0) { if (errors!=0) {
printf("FAILED: %d errors\n",errors); cout << "FAILED clz\n" << endl;
return -1;
} else { } else {
printf ("__clz_s() PASSED!\n"); cout << "__clz_s() checked!" << endl;
} }
errors = 0; errors = 0;
for (i = 0; i < NUM; i++) { for (i = 0; i < NUM; i++) {
printf("gpu_clzll_s =%d, cpu_clzll_s =%d \n",hostG[i],firstbit_s64(hostH[i]));
if (hostG[i] != firstbit_s64(hostH[i])) { if (hostG[i] != firstbit_s64(hostH[i])) {
errors++; errors++;
} }
} }
if (errors!=0) { if (errors!=0) {
printf("FAILED: %d errors\n",errors); cout << "FAILED clz" << endl;
return -1;
} else { } else {
printf ("__clzll_s() PASSED!\n"); cout << "__clzll_s() checked!" << endl;
} }
cout << "clz test PASSED!" << endl;
HIP_ASSERT(hipFree(deviceA)); HIP_ASSERT(hipFree(deviceA));
HIP_ASSERT(hipFree(deviceB)); HIP_ASSERT(hipFree(deviceB));
HIP_ASSERT(hipFree(deviceC)); HIP_ASSERT(hipFree(deviceC));
@@ -239,19 +242,6 @@ int main() {
free(hostG); free(hostG);
free(hostH); free(hostH);
return errors;
//hipResetDefaultAccelerator();
//return errors;
} }
+9 -23
Visa fil
@@ -72,8 +72,6 @@ HIP_kernel(hipLaunchParm lp,
} }
using namespace std; using namespace std;
int main() { int main() {
@@ -115,7 +113,6 @@ int main() {
HIP_ASSERT(hipMalloc((void**)&deviceB, NUM * sizeof(unsigned int))); HIP_ASSERT(hipMalloc((void**)&deviceB, NUM * sizeof(unsigned int)));
HIP_ASSERT(hipMalloc((void**)&deviceC, NUM * sizeof(unsigned int))); HIP_ASSERT(hipMalloc((void**)&deviceC, NUM * sizeof(unsigned int)));
HIP_ASSERT(hipMalloc((void**)&deviceD, NUM * sizeof(unsigned long long int))); HIP_ASSERT(hipMalloc((void**)&deviceD, NUM * sizeof(unsigned long long int)));
;
HIP_ASSERT(hipMemcpy(deviceB, hostB, NUM*sizeof(unsigned int), hipMemcpyHostToDevice)); HIP_ASSERT(hipMemcpy(deviceB, hostB, NUM*sizeof(unsigned int), hipMemcpyHostToDevice));
HIP_ASSERT(hipMemcpy(deviceD, hostD, NUM*sizeof(unsigned long long int), hipMemcpyHostToDevice)); HIP_ASSERT(hipMemcpy(deviceD, hostD, NUM*sizeof(unsigned long long int), hipMemcpyHostToDevice));
@@ -133,29 +130,31 @@ int main() {
// verify the results // verify the results
errors = 0; errors = 0;
for (i = 0; i < NUM; i++) { for (i = 0; i < NUM; i++) {
printf("gpu_ffs =%d, cpu_ffs =%d \n",hostA[i],lastbit(hostB[i]));
if (hostA[i] != lastbit(hostB[i])) { if (hostA[i] != lastbit(hostB[i])) {
errors++; errors++;
} }
} }
if (errors!=0) { if (errors!=0) {
printf("FAILED: %d errors\n",errors); cout << "FAILED: ffs" << endl;
return -1;
} else { } else {
printf ("__ffs() for unsigned PASSED!\n"); cout << "__ffs() for unsigned checked!" << endl;
} }
errors = 0; errors = 0;
for (i = 0; i < NUM; i++) { for (i = 0; i < NUM; i++) {
printf("gpu_ffsll =%d, cpu_ffsll =%d \n",hostC[i],lastbit(hostD[i]));
if (hostC[i] != lastbit(hostD[i])) { if (hostC[i] != lastbit(hostD[i])) {
errors++; errors++;
} }
} }
if (errors!=0) { if (errors!=0) {
printf("FAILED: %d errors\n",errors); cout << "FAILED: ffs" << endl;
return -1;
} else { } else {
printf ("__ffsll() for unsigned PASSED!\n"); cout << "__ffsll() for unsigned checked!" << endl;
} }
cout << "ffs test PASSED!" << endl;
HIP_ASSERT(hipFree(deviceA)); HIP_ASSERT(hipFree(deviceA));
HIP_ASSERT(hipFree(deviceB)); HIP_ASSERT(hipFree(deviceB));
HIP_ASSERT(hipFree(deviceC)); HIP_ASSERT(hipFree(deviceC));
@@ -167,19 +166,6 @@ int main() {
free(hostC); free(hostC);
free(hostD); free(hostD);
return errors;
//hipResetDefaultAccelerator();
//return errors;
} }
+9 -19
Visa fil
@@ -129,28 +129,31 @@ int main() {
// verify the results // verify the results
errors = 0; errors = 0;
for (i = 0; i < NUM; i++) { for (i = 0; i < NUM; i++) {
printf("gpu_popc =%d, cpu_popc =%d \n",hostA[i],popcountCPU(hostB[i]));
if (hostA[i] != popcountCPU(hostB[i])) { if (hostA[i] != popcountCPU(hostB[i])) {
errors++; errors++;
} }
} }
if (errors!=0) { if (errors!=0) {
printf("FAILED: %d errors\n",errors); cout << "FAILED: popc" << endl;
return -1;
} else { } else {
printf ("__popc() PASSED!\n"); cout << "__popc() checked!" << endl;
} }
errors = 0; errors = 0;
for (i = 0; i < NUM; i++) { for (i = 0; i < NUM; i++) {
printf("gpu_popcll =%d, cpu_popcll =%d \n",hostC[i],popcountCPU(hostD[i]));
if (hostC[i] != popcountCPU(hostD[i])) { if (hostC[i] != popcountCPU(hostD[i])) {
errors++; errors++;
} }
} }
if (errors!=0) { if (errors!=0) {
printf("FAILED: %d errors\n",errors); cout << "FAILED:popc" << endl;
return -1;
} else { } else {
printf ("__popcll() PASSED!\n"); cout << "__popcll() checked!" << endl;
} }
cout << "popc test PASSED!" << endl;
HIP_ASSERT(hipFree(deviceA)); HIP_ASSERT(hipFree(deviceA));
HIP_ASSERT(hipFree(deviceB)); HIP_ASSERT(hipFree(deviceB));
HIP_ASSERT(hipFree(deviceC)); HIP_ASSERT(hipFree(deviceC));
@@ -161,19 +164,6 @@ int main() {
free(hostC); free(hostC);
free(hostD); free(hostD);
//hipResetDefaultAccelerator();
return errors; return errors;
} }