From 58bd8617e8964c60e6fa69c2732c290fdebe24c1 Mon Sep 17 00:00:00 2001 From: Ben Sander Date: Sun, 6 Nov 2016 04:26:28 -0600 Subject: [PATCH] Fix tests to read warpSize from device props. Change-Id: I9583577793afad49f9eb1ee9069bd4c6963a6023 [ROCm/hip commit: 7106dc679616b984880e28f726e16f739beb044b] --- projects/hip/tests/src/deviceLib/hip_anyall.cpp | 14 +++++++++----- projects/hip/tests/src/deviceLib/hip_ballot.cpp | 8 +++++--- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/projects/hip/tests/src/deviceLib/hip_anyall.cpp b/projects/hip/tests/src/deviceLib/hip_anyall.cpp index aa025dad43..a562b7810e 100644 --- a/projects/hip/tests/src/deviceLib/hip_anyall.cpp +++ b/projects/hip/tests/src/deviceLib/hip_anyall.cpp @@ -45,11 +45,15 @@ int main(int argc, char *argv[]) { int warpSize, pshift; hipDeviceProp_t devProp; hipGetDeviceProperties(&devProp, 0); - if(strncmp(devProp.name,"Fiji",1)==0) -{ warpSize =64; - pshift =6; -} - else {warpSize =32; pshift=5;} + warpSize = devProp.warpSize; + + int w = warpSize; + pshift = 0; + while (w >>= 1) ++pshift; + + printf ("warpSize=%d pshift=%d\n", warpSize, pshift); + + int anycount =0; int allcount =0; int Num_Threads_per_Block = 1024; diff --git a/projects/hip/tests/src/deviceLib/hip_ballot.cpp b/projects/hip/tests/src/deviceLib/hip_ballot.cpp index d6df069351..236ceb57fe 100644 --- a/projects/hip/tests/src/deviceLib/hip_ballot.cpp +++ b/projects/hip/tests/src/deviceLib/hip_ballot.cpp @@ -48,9 +48,11 @@ int main(int argc, char *argv[]) hipDeviceProp_t devProp; hipGetDeviceProperties(&devProp, 0); - if(strncmp(devProp.name,"Fiji",1)==0) - {warpSize = 64; pshift =6;} - else {warpSize =32; pshift =5;} + warpSize = devProp.warpSize; + + int w = warpSize; + pshift = 0; + while (w >>= 1) ++pshift; unsigned int Num_Threads_per_Block = 512; unsigned int Num_Blocks_per_Grid = 1;