@@ -7621,14 +7621,20 @@ void CLIntercept::dumpCaptureReplayKernelInfo(
76217621 cl_device_id device = nullptr ;
76227622 dispatch ().clGetContextInfo (context, CL_CONTEXT_DEVICES, sizeof (cl_device_id), &device, nullptr );
76237623
7624- size_t sizeOfOptions = 0 ;
7625- dispatch (). clGetProgramBuildInfo (program, device, CL_PROGRAM_BUILD_OPTIONS, 0 , nullptr , &sizeOfOptions) ;
7624+ {
7625+ std::ofstream outputBuildOptions{dumpDirectory + " buildOptions.txt " } ;
76267626
7627- std::string optionsString (sizeOfOptions, ' ' ) ;
7628- dispatch ().clGetProgramBuildInfo (program, device, CL_PROGRAM_BUILD_OPTIONS, sizeOfOptions, &optionsString[ 0 ] , &sizeOfOptions );
7627+ size_t buildOptionsSize = 0 ;
7628+ dispatch ().clGetProgramBuildInfo (program, device, CL_PROGRAM_BUILD_OPTIONS, 0 , nullptr , &buildOptionsSize );
76297629
7630- std::ofstream outputBuildOptions{dumpDirectory + " buildOptions.txt" , std::ios::out | std::ios::binary};
7631- outputBuildOptions.write (optionsString.c_str (), optionsString.length () - 1 );
7630+ std::string buildOptions (buildOptionsSize, ' ' );
7631+ int error = dispatch ().clGetProgramBuildInfo (program, device, CL_PROGRAM_BUILD_OPTIONS, buildOptionsSize, &buildOptions[0 ], nullptr );
7632+ if ( error == CL_SUCCESS )
7633+ {
7634+ buildOptions.pop_back ();
7635+ outputBuildOptions << buildOptions << ' \n ' ;
7636+ }
7637+ }
76327638
76337639 std::string kernelName = getShortKernelName (kernel);
76347640 std::ofstream outputKernelName{dumpDirectory + " kernelName.txt" };
@@ -7642,14 +7648,15 @@ void CLIntercept::dumpCaptureReplayKernelInfo(
76427648 std::ofstream outputArgTypes{dumpDirectory + " ArgumentDataTypes.txt" };
76437649 for ( cl_uint idx = 0 ; idx != numArgs; ++idx )
76447650 {
7645- size_t argNameSize = 0 ;
7646- dispatch ().clGetKernelArgInfo (kernel, idx, CL_KERNEL_ARG_TYPE_NAME, 0 , nullptr , &argNameSize );
7651+ size_t argTypeNameSize = 0 ;
7652+ dispatch ().clGetKernelArgInfo (kernel, idx, CL_KERNEL_ARG_TYPE_NAME, 0 , nullptr , &argTypeNameSize );
76477653
7648- std::string argName (argNameSize , ' ' );
7649- int error = dispatch ().clGetKernelArgInfo (kernel, idx, CL_KERNEL_ARG_TYPE_NAME, argNameSize , &argName [0 ], nullptr );
7654+ std::string argTypeName (argTypeNameSize , ' ' );
7655+ int error = dispatch ().clGetKernelArgInfo (kernel, idx, CL_KERNEL_ARG_TYPE_NAME, argTypeNameSize , &argTypeName [0 ], nullptr );
76507656 if ( error == CL_SUCCESS )
76517657 {
7652- outputArgTypes << argName << ' \n ' ;
7658+ argTypeName.pop_back ();
7659+ outputArgTypes << argTypeName << ' \n ' ;
76537660 }
76547661 }
76557662 }
0 commit comments