swap lines. This kind of kernels are using with combination of square transpose kernels to perform nonsqaure transpose this function assumes a 1:2 ratio
| 421 | //swap lines. This kind of kernels are using with combination of square transpose kernels to perform nonsqaure transpose |
| 422 | //this function assumes a 1:2 ratio |
| 423 | clfftStatus genSwapKernel(const FFTGeneratedTransposeNonSquareAction::Signature & params, std::string& strKernel, std::string& KernelFuncName, const size_t& lwSize, const size_t reShapeFactor) |
| 424 | { |
| 425 | strKernel.reserve(4096); |
| 426 | std::stringstream transKernel(std::stringstream::out); |
| 427 | |
| 428 | // These strings represent the various data types we read or write in the kernel, depending on how the plan |
| 429 | // is configured |
| 430 | std::string dtInput; // The type read as input into kernel |
| 431 | std::string dtOutput; // The type written as output from kernel |
| 432 | std::string dtPlanar; // Fundamental type for planar arrays |
| 433 | std::string tmpBuffType; |
| 434 | std::string dtComplex; // Fundamental type for complex arrays |
| 435 | |
| 436 | // NOTE: Enable only for debug |
| 437 | // clKernWrite( transKernel, 0 ) << "#pragma OPENCL EXTENSION cl_amd_printf : enable\n" << std::endl; |
| 438 | |
| 439 | //if (params.fft_inputLayout != params.fft_outputLayout) |
| 440 | // return CLFFT_TRANSPOSED_NOTIMPLEMENTED; |
| 441 | |
| 442 | switch (params.fft_precision) |
| 443 | { |
| 444 | case CLFFT_SINGLE: |
| 445 | case CLFFT_SINGLE_FAST: |
| 446 | dtPlanar = "float"; |
| 447 | dtComplex = "float2"; |
| 448 | break; |
| 449 | case CLFFT_DOUBLE: |
| 450 | case CLFFT_DOUBLE_FAST: |
| 451 | dtPlanar = "double"; |
| 452 | dtComplex = "double2"; |
| 453 | |
| 454 | // Emit code that enables double precision in the kernel |
| 455 | clKernWrite(transKernel, 0) << "#ifdef cl_khr_fp64" << std::endl; |
| 456 | clKernWrite(transKernel, 3) << "#pragma OPENCL EXTENSION cl_khr_fp64 : enable" << std::endl; |
| 457 | clKernWrite(transKernel, 0) << "#else" << std::endl; |
| 458 | clKernWrite(transKernel, 3) << "#pragma OPENCL EXTENSION cl_amd_fp64 : enable" << std::endl; |
| 459 | clKernWrite(transKernel, 0) << "#endif\n" << std::endl; |
| 460 | |
| 461 | break; |
| 462 | default: |
| 463 | return CLFFT_TRANSPOSED_NOTIMPLEMENTED; |
| 464 | break; |
| 465 | } |
| 466 | |
| 467 | // This detects whether the input matrix is rectangle of ratio 1:2 |
| 468 | |
| 469 | if ((params.fft_N[0] != 2 * params.fft_N[1]) && (params.fft_N[1] != 2 * params.fft_N[0])) |
| 470 | { |
| 471 | return CLFFT_TRANSPOSED_NOTIMPLEMENTED; |
| 472 | } |
| 473 | |
| 474 | if (params.fft_placeness == CLFFT_OUTOFPLACE) |
| 475 | { |
| 476 | return CLFFT_TRANSPOSED_NOTIMPLEMENTED; |
| 477 | } |
| 478 | |
| 479 | size_t smaller_dim = (params.fft_N[0] < params.fft_N[1]) ? params.fft_N[0] : params.fft_N[1]; |
| 480 |
nothing calls this directly
no test coverage detected