MCPcopy Create free account
hub / github.com/clMathLibraries/clFFT / generateKernel

Method generateKernel

src/library/generator.copy.cpp:621–667  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

619using namespace CopyGenerator;
620
621clfftStatus FFTGeneratedCopyAction::generateKernel(FFTRepo& fftRepo, const cl_command_queue commQueueFFT )
622{
623
624 bool h2c, c2h;
625 h2c = ( (this->signature.fft_inputLayout == CLFFT_HERMITIAN_PLANAR) || (this->signature.fft_inputLayout == CLFFT_HERMITIAN_INTERLEAVED) );
626 c2h = ( (this->signature.fft_outputLayout == CLFFT_HERMITIAN_PLANAR) || (this->signature.fft_outputLayout == CLFFT_HERMITIAN_INTERLEAVED) );
627
628 bool general = !(h2c || c2h);
629
630 std::string programCode;
631 Precision pr = (this->signature.fft_precision == CLFFT_SINGLE) ? P_SINGLE : P_DOUBLE;
632 switch(pr)
633 {
634 case P_SINGLE:
635 {
636 CopyKernel<P_SINGLE> kernel(this->signature);
637 kernel.GenerateKernel(programCode);
638 } break;
639 case P_DOUBLE:
640 {
641 CopyKernel<P_DOUBLE> kernel(this->signature);
642 kernel.GenerateKernel(programCode);
643 } break;
644 }
645
646 cl_int status = CL_SUCCESS;
647 cl_device_id Device = NULL;
648 status = clGetCommandQueueInfo(commQueueFFT, CL_QUEUE_DEVICE, sizeof(cl_device_id), &Device, NULL);
649 OPENCL_V( status, _T( "clGetCommandQueueInfo failed" ) );
650
651 cl_context QueueContext = NULL;
652 status = clGetCommandQueueInfo(commQueueFFT, CL_QUEUE_CONTEXT, sizeof(cl_context), &QueueContext, NULL);
653 OPENCL_V( status, _T( "clGetCommandQueueInfo failed" ) );
654
655 OPENCL_V( fftRepo.setProgramCode( this->getGenerator(), this->getSignatureData(), programCode, Device, QueueContext ), _T( "fftRepo.setclString() failed!" ) );
656
657 if(general)
658 {
659 OPENCL_V( fftRepo.setProgramEntryPoints( this->getGenerator(), this->getSignatureData(), "copy_general", "copy_general", Device, QueueContext ), _T( "fftRepo.setProgramEntryPoint() failed!" ) );
660 }
661 else
662 {
663 OPENCL_V( fftRepo.setProgramEntryPoints( this->getGenerator(), this->getSignatureData(), "copy_c2h", "copy_h2c", Device, QueueContext ), _T( "fftRepo.setProgramEntryPoint() failed!" ) );
664 }
665
666 return CLFFT_SUCCESS;
667}

Callers 1

Calls 5

getSignatureDataMethod · 0.95
setProgramCodeMethod · 0.80
setProgramEntryPointsMethod · 0.80
GenerateKernelMethod · 0.45
getGeneratorMethod · 0.45

Tested by

no test coverage detected