@@ -353,6 +353,17 @@ static void generatePatchTokens(const cmc_kernel_info *info, CMKernel& kernel)
353353 // Setup argument to BTI mapping.
354354 kernel.m_kernelInfo .m_argIndexMap .clear ();
355355
356+ for (unsigned i = 0 ; i < info->num_print_strings ; i++) {
357+ assert (info->print_string_descs );
358+ cmc_ocl_print_string& SI = info->print_string_descs [i];
359+ iOpenCL::PrintfStringAnnotation* stringAnnotation = new iOpenCL::PrintfStringAnnotation;
360+ stringAnnotation->Index = i;
361+ stringAnnotation->StringSize = sizeof (SI.s );
362+ stringAnnotation->StringData = new char [cmc_ocl_print_string::max_width];
363+ std::copy (SI.s , SI.s + cmc_ocl_print_string::max_width, stringAnnotation->StringData );
364+ kernel.m_kernelInfo .m_printfStringAnnotations .push_back (stringAnnotation);
365+ }
366+
356367 for (unsigned i = 0 ; i < info->num_args ; ++i) {
357368 assert (info->arg_descs );
358369 cmc_arg_info& AI = info->arg_descs [i];
@@ -397,6 +408,14 @@ static void generatePatchTokens(const cmc_kernel_info *info, CMKernel& kernel)
397408 kernel.createImageAnnotation (AI.index , AI.BTI , 3 , isWriteable);
398409 kernel.m_kernelInfo .m_argIndexMap [AI.index ] = AI.BTI ;
399410 break ;
411+ case cmc_arg_kind::PrintBuffer:
412+ kernel.m_kernelInfo .m_printfBufferAnnotation = new iOpenCL::PrintfBufferAnnotation ();
413+ kernel.m_kernelInfo .m_printfBufferAnnotation ->AnnotationSize = sizeof (kernel.m_kernelInfo .m_printfBufferAnnotation );
414+ kernel.m_kernelInfo .m_argIndexMap [AI.index ] = 255 ;
415+ kernel.m_kernelInfo .m_printfBufferAnnotation ->PayloadPosition = AI.offset - constantPayloadStart;
416+ kernel.m_kernelInfo .m_printfBufferAnnotation ->Index = 0 ;
417+ kernel.m_kernelInfo .m_printfBufferAnnotation ->DataSize = 8 ;
418+ break ;
400419 }
401420 }
402421
0 commit comments