| 175 | * run the test case |
| 176 | */ |
| 177 | template <typename ElemType> bool |
| 178 | GemmPerformanceTest<ElemType>::areResourcesSufficient(TestParams *params) |
| 179 | { |
| 180 | clMath::BlasBase *base; |
| 181 | size_t gmemSize, allocSize, maxMatrSize; |
| 182 | bool ret = true; |
| 183 | size_t m = params->M, n = params->N, k = params->K; |
| 184 | |
| 185 | if((A_ == NULL) || (backC_ == NULL) || (C_ == NULL) || (B_ == NULL)) |
| 186 | { |
| 187 | return 0; |
| 188 | } |
| 189 | |
| 190 | base = clMath::BlasBase::getInstance(); |
| 191 | gmemSize = (size_t)base->availGlobalMemSize(0); |
| 192 | allocSize = (size_t)base->maxMemAllocSize(); |
| 193 | |
| 194 | if (base->useImages()) { |
| 195 | maxMatrSize = gmemSize / 5; |
| 196 | ret = (k < base->scratchImageWidth() * |
| 197 | sizeof(cl_float4) / sizeof(ElemType)); |
| 198 | } |
| 199 | else { |
| 200 | maxMatrSize = gmemSize / 3; |
| 201 | } |
| 202 | maxMatrSize = std::min(maxMatrSize, allocSize); |
| 203 | |
| 204 | if (ret) { |
| 205 | ret = ((std::max(m, n) * k * sizeof(ElemType) < maxMatrSize) && |
| 206 | (m * n * sizeof(ElemType) < maxMatrSize)); |
| 207 | } |
| 208 | |
| 209 | return ret; |
| 210 | } |
| 211 | |
| 212 | template <typename ElemType> int |
| 213 | GemmPerformanceTest<ElemType>::prepare(void) |
no test coverage detected