Home
User Manual: OpenCL™ Code builder for Intel® Media Server
Contents
1. Changing the Target Build Architecture options enables viewing assembly code of different instruction set architectures and generating program binaries for different hardware platforms NOTE Target Build Architecture options are available for the CPU device only Configuring General Options Open the Session Options menu via selecting CODE BUILDER The General Options tab enables defining the target session s platform architecture x86 or x64 94 Preview Features new_session Session Options Cancel Building and Compiling OpenCL Program To build an OpenCL program via the Kernel Development Framework feature of the OpenCL Code Builder do the following 1 Select the session with the code that you would like to build 2 Go to CODE BUILDER gt Kernel Development Framework gt Build Program Or click the Build Program button in Code Builder Build toolbar menu CODE BUILDER ANALYZE WINDOW HELP OpenCL Kernel Development t E New Session OpenCL Debugger d Open Session OpenCL Application Analysis Save Session ij Platform Info Build Program Help d d Compile Program E Session O ptions Windows Le Settings The build log appears in the Console Output dialog 95 User Manual OpenCL Code builder for Intel Media Server Studio 2015 show output from OpenCl Build z E a Setting target instruction set architecture to Default Advanced Vector Extension 2 AVA OpenCL
2. Standard Deviation Mininmur Maxinnum 0 il d 5 Jl 512 0 Jl 512 0 Variables View 0 787904 0 765334 Lz Iterations Total Queue Submit Execution 0 767904 O 0006152 O 0076256 0 706325 2 1162 0000467 O 0049952 2 10125 1 43124 00003212 O 0061612 1 41708 1 1569 00004068 0 00365 1 14365 1 00209 00004088 00034748 0 990143 0 93767 0000408 M0033872 0 926253 0 925757 00003504 00035624 0 914164 Submit Queue Execution 0 0078250 O 00NG1s2 0 766325 0 00292 0 000584 0 752922 00513801 00140444 00004964 0 034652 0 753944 0 891768 0 891706 U fooadd Of 6066 0 705332 1 64 0 10 1 i465 0 10 0 002628 0000292 OF4sied 0 049932 0002044 Oepsd4dd 0 049932 0 002044 0 791028 0 004088 0 000SE4 O f54256 0 00292 O 000584 0 74698 0 002628 0 000292 0 751608 0 921932 0 000438 0 004029 0 904908 0 937116 00003212 0 0034164 0 925674 The Variable View table enables you to see read and read back times for each variable as well as the output file path for output parameters Clicking on this input output path pops up its content images and buffers 99 User Manual OpenCL Code builder for Intel Media Server Studio 2015 sobelFilter_Lcbreport select Report Variables view Gx Gy Gz Lx Ly 512 51 0 512 512 0 5l 512 0 Read Time Read Back Time Input Output 0 448804 i CrUserstcvectest Desktop lab contentylab sessionllena brmp 0 468368 0 12556 CiUserskcvectest 4ppData localy Te
3. OpenCL Code builder for Intel Media Server Studio 2015 User Manual Copyright 2010 2014 Intel Corporation All Rights Reserved Contents LEJarTATOFM Ooo shepa a Sa stersicgc ate ape wie ean E E enemies eecddeceaeneds 5 GettING Help and SUD BOE cisesctescictwesecaeewe sane case E i a aa a a sameanioedeauts 7 Code Editing and Building with Visual Studio Plug in ssssssns22222220222222202202u202220222022 2 nn 8 OpenCL API Offline Compiler Plug in for Microsoft Visual Studio IDE ccccce cece eee ees 8 Configuring Microsoft Visual Studio DE susana A 8 Converting Existing Project into OpenCL Project sssssssresrrrsrrrsrrnrrrrrrrerrrerrrrrrerrrerrrsrere 9 Buding OpenCL Pro CCE serisinin E i a SE aD E G E S a A a EA E D E 9 Using OpenGL Build Properties cs caseansisceerednaetetacnernisdnc ad NE a AA ERRA a RER 9 Selecting Target OpenCL Device s ssssssrssrrrsrrrerrrrrerrrrsrrrsrrrrrrerrrenrrrrrrrrrenrrererrrrerrrenan 10 Generating and Viewing Assembly Code ssssssssssresrrssrrrsrrnrrrerrrsrrrrrrrrrrerrrerrrrrerrrrerrrenan 10 Generating and Viewing LLVM Code sssssssssrrssrrsrrensrrrsrrrsrrnrrrnrrrerrrrrrrrrrerrrsrrrrrrrrrrerrrenan 11 Generating Intermediate Program Binaries with Offline Compiler Plug in ccceeeeee eee e nena 12 Configuring OpeaCk Build OPUONS siccisiecteauscescnesedianardainoGlacheneccnan seen bedecaienexcaneeneeenuden 12 Code Editing
4. We can also disable dumping raw data by unchecking Enable Dumping Raw Data Notes e To display the data the plug in has to perform background activities such as fetching the data and converting it into a displayable format which might impact performance when using the Enable Dumping I mages or Enable Dumping Raw Data options Take into account that profiling performance measured by either clGetEventProfilingInfo runtime API call any other method for measuring execution time or occupied host memory might entail certain performance degradation To get more accurate profiling results use the runtime directly by pushing CtrI F5 Start w o Debugging or disabling API Debugger in the plug in configuration menu 64 Debugging with Visual Studio Plug in Memory objects above 2GB are not supported and are not displayed e Buffers Sub Buffers that are set as parameters to kernels via clSetKernelArg are fetched into API Debugger after each kernel enqueue operation regardless of the memory flags they were created with This means that even buffers created with CL_MEM_READ_ONLY are fetched behind the scenes See Also Enabling the API Debugger Memory Tracing Memory tracing enables the user to capture the session of the debugging into a file and also to load a previously stored state into the views The stored state contains e State of all the views this includes all the data that is filled in the various views of the plug in e
5. Saving and Loading SesSlOMe i rairenirre ii E E EE Da a a 18 LLVM SPIR and Assembly Code VieW sssssssrrssresrrrsrrrsrrrerrrrrrsrrrerrrrrenrrrerrrerrrsrene 19 Generating Intermediate Program Binaries ssssssssrssrrserrsrrrsrrrerrrerrrrrrsrrrsrrrerrerrrene 19 Linking Program BIN GGICS icciccenscuebinionsseteks isn e a ia 20 CONT UTIN OPHION iera aE a E sec eeouoneectuesaeccousaeegdees 20 Conngu uring Linkage ODNOMS sraxserisinaniineeika n a 23 Kernel Perlormance Analy SIS eases a NNA A NEEE 26 Analyzing OpenCL Kernel Performance s sssssssrrnrrrsrrrerrrererrrrsrrrsrrrrrrerrrerrrrrrrrrrene 26 Mano GING Wailea les ae E E E S 27 Viewing Analysis RESUS 2055220 eisndcasetayscauiasemnacneenainenshseen a a a a 34 Deep Kernel Analysis in Kernel Builder snossssnnnsrnnsrrnrrssrrrsrrnrrrsrrrerrrsrrnrrrerrrsrrrrrene 35 Building with Kernel Builder Command Line I nterfaCe ssnssss22 222222u222222u222225220222 22 05 39 OpenCL Debugger for LINUX QS siciivievescewtevendinssrenweenceeendcnesernesbewesdewaewsemnniessssnemuneesseains 41 Debugging with Visual Studio Plug in sssssssssu222222222222022202220220u202u20unnuunnnnnnnnnnnnnnnnnnnnnnnnn 44 Open PREDUGO roire anana AEE ETE E EN EE E E ENA 44 Enabling Debugging in OpenCL Runtime ssssssrserrssrrnrrrsrrrsrrrsrrrrrrerrrerrrrrerrrrerrrerrrrrene 44 COMMOUTING DCOUGQG ET ccc cecan apenre e EE Er EEEE EEEE EEEE EE AEAEE EE EENE OES 45 Chan
6. Specific computer systems components software operations and functions Any change to any of those factors may cause the results to vary You should consult other information and performance tests to assist you in fully evaluating your contemplated purchases including the performance of that product when combined with other products User Manual OpenCL Code builder for Intel Media Server Studio 2015 Intel Intel logo Intel Core VTune Xeon are trademarks of Intel Corporation in the U S and other countries This document contains information on products in the design phase of development Other names and brands may be claimed as the property of others OpenCL and the OpenCL logo are trademarks of Apple Inc used by permission from Khronos Microsoft product screen shot s reprinted with permission from Microsoft Corporation Copyright 2010 2014 Intel Corporation All rights reserved Getting Help and Support To get support visit the product support forum at http software intel com en us forums intel opencl sdk For information on SDK requirements Known issues and limitations refer to the Release Notes Code Editing and Building with Visual Studio Plug in OpenCL API Offline Compiler Plug in for Microsoft Visual Studio IDE OpenCL API Offline Compiler plug in for Microsoft Visual Studio IDE enables you to develop OpenCL applications with Visual Studio IDE The plug in supports the following
7. the OpenCL kernel code must exist in a text file separate from the code of the host Debugging OpenCL code that appears only in a string embedded in the host application is not supported Create your OpenCL project with the OpenCL Offline Compiler plug in for Microsoft Visual Studio to get seamless integration with the Debugger Configuring Debugger To configure the OpenCL Debugger plug in for Microsoft Visual Studio IDE do the following 1 Run the Visual Studio IDE 2 Select CODE BUILDER gt OpenCL Debugger gt Options 3 Check Enable OpenCL Kernel Debugging 4 Set applicable values in the Select Work Items fields The values specify its 3D coordinates You can select only one work item NOTE If NDRange is not 3D leave unused dimension values at 0 Changing Debugging Port If you receive a Protocol error message change your firewall settings or change debugging port in the OpenCL Debugger plug in for Microsoft Visual Studio IDE NOTE Default debugging port is 56203 To change the debugging port number do the following 45 User Manual OpenCL Code builder for Intel Media Server Studio 2015 1 Run the Visual Studio IDE 2 Select CODE BUILDER gt OpenCL Debugger gt Options 3 Switch to the Advanced Settings tab 4 Check the Use Custom Debugging Port check box 5 Inthe Debugging Port Number field enter the port you need NOTE If the Use Custom Debugging Port check box is unavai
8. 86 Preview Features choose a wiew API Calls analysis session from captuing duration Avg Duration ps Min Duration prs Max Duration ps Api Name Count Errors Total Time ps clBuildProgram 1 0 1103853 1103853 1103853 1103853 clCreateButfer 1 0 1 8 178 178 178 clCreateCommandQueve 1 0 202 202 202 202 clCreateContext 1 0 1830318 1830318 1830318 1630318 clCreateKernel 1 0 2636 2636 2636 2636 clCreateProgramWithSource 1 0 134 134 134 134 clEnqueueNDRangeKernel 3 W 140446 468 a2 filter curently displayed X out of Y Api Name Start Time ps End Time ps Error code clEnqueveNDRangeKernel 173244896626 173244896918 g clEnqueueNDRangeKernel 173244925994 173244926235 0 clEnqueueNDRangeKernel 173244942159 175244942590 g clEnqueueNDRangeKernel 173244964033 173244964272 0 clEnqueueNDRangeKernel 173244979774 175244979996 g clEnqueueNDRangeKernel 173245003709 173245003942 0 clEnqueueNDRangeKernel 173245025703 173245025945 0 clEngueveNDRangeKkernel 173245041886 173245042106 li clGetDevicelDs 2 0 10 5 4 6 clGetDevicelnfo 5 0 122 24 3 45 clGetPlatformIDs 2 0 2 1 1 1 clGetPlatforminfo 2 0 6 3 3 3 clSetKernelArg 326 0 11727 35 I7 11 Kernel Launch Commands shows every OpenCL kernel that was launched during program execution Each row shows the time of execution and work size data for each launch analysis session from captuing duration Kernel Name Latency ps Run Duration ps
9. 89 0 54 0 49 1 00 0 87 0 54 0 52 1 00 0 67 0 53 0 50 1 00 0 89 0 54 0 49 1 00 0 89 0 54 0 49 1 00 0 87 0 54 0 52 1 00 0 67 0 53 0 50 1 00 0 89 0 54 0 49 1 00 0 89 0 54 0 49 1 00 0 87 0 54 0 52 1 00 0 67 0 53 0 50 1 00 0 89 0 54 0 49 1 00 0 89 0 54 0 49 1 00 0 87 0 54 0 52 1 00 0 67 0 53 0 50 1 00 0 89 0 55 0 48 1 00 0 89 0 55 0 48 1 00 0 89 0 51 0 44 7 00 0 67 0 51 0 44 1 00 0 89 0 55 0 47 1 00 0 89 0 53 0 47 1 00 0 88 0 55 0 45 1 00 0 66 0 52 0 45 1 00 Data View Image View Problems view Trace View Command Queue Properties View Properties The history drop down enables viewing various states of the selected memory object where each State is a result of an API call Consider the situation of a host application that calculates a histogram of a grayscale image For example use a buffer with 256 bins for each color of the image to calculate the histogram As a first step issue an NDRange kernel called bzero to initialize the buffer with zeros __ kernel void bzero _ global unsigned int outBuft __ const unsigned int cols i size t row get _ global id size t col get global id 1 outBuf row cols col 8 Examine the buffer contents on the grid and see that all buffer elements are set to zero Data View Data View Image View Problems wiew Trace View Command Queue Properties View Properties Now as a second step issue a 2
10. Command Queue View window Command Queue lal Save As Sy Unify Queues Sort By Time Ascending CommandQueue 1 CPU In Order Submitted Running Completed NDRANGE KERNEL O Data View Image View Problems view Trace View Command Queue 2 Open the Properties view Properties View Buffer 1 HE 4 Basic Information Reference Count 0 Key A6B1 DAS 4 Other Information Memory Type CL MEM_OBJECT_BUFFER Flags 0 CL_MEM_READ_ONLY 1 CL_MEM_USE_HOST_PTR Size Bytes 30720000 Host Pointer O08 CDO080 Map Count 0 Memory Type Not Available Properties View Properties See Also Enabling the API Debugger 53 User Manual OpenCL Code builder for Intel Media Server Studio 2015 Command Queue View OpenCL API Debugger plug in for Microsoft Visual Studio IDE provides Command Queue View which enables tracking the execution status of enqueued commands issued by clEnqueue API call The status for a command can be either of the following options e Submitted e Running e Completed The Command Queue View also displays events for a particular command queue Separate Queues or for all events from all queues Unify Queues Access the Command Queue View by selecting CODE BUILDER gt OpenCL Debugger gt Command Queue View Command Queue lal Save As dy Unify Queues Sort By Time Ascending CommandQueue 1 CPU In Order Submitted Running Completed NDRANGE KERN
11. Fill the Name Location and Solution name fields and click OK In the Code Builder wizard for OpenCL API dialog you can select the basic settings for the behavior of the OpenCL application and kernel The parameters that can be set are platform name device type kernel type images or buffer manipulation build options and local work group size behavior Each field has a short tool tip explanation Code Builder weai Basic Settings Platform Name Intel Device Type GPU Create Kemel with Images Create Kemel with Buffers Build Options 7 i Use explicit Local Work Group Size p a Click Finish to create the default template project or click Next to open the Advanced Settings screen enabling you to set some advanced options like whether to enable profiling queue and the kernel s arguments memory source type For CPU device type you can also set the out of order execution mode and debug mode for the kernel 73 User Manual OpenCL Code builder for Intel Media Server Studio 2015 Advanced Settings Enable Profiling Queue Input Memory Source Use Host Memory InoutB Memory Source Use Host Memory i z B o h Next gt C M 7 Click Finish to create the default template project or click Previous to return the Basic Settings screen Create a New OpenCL Project from OpenCL Project Template for Android To create an OpenCL template project for Android de
12. Intel CPU device was found Device name Intel R Core TM i7 4770K CPU 3 5 GHz Device version OpenCL 1 2 Build 71 Device vendor Intel R Corporation Device profile FULL_PROFILE Linking done Device build started Device build done Kernel lt SobelFilter gt was not vectorized Done r im b Output Breakpoints Error List Build Artifacts Once OpenCL program build is completed the build artifacts appear under the Builds Artifacts note in the Code Builder Session Explorer The list of artifacts includes e Generated LLVM code lt file_name gt 11 e Generated assembly code for CPU and Xeon Phi only lt filen_name gt asm e Program s intermediate program s binary lt file_name gt ir e 32 bit version of generate SPIR LLVM code lt file_name gt _x86 11 e 64 bit version of generate SPIR LLVM code lt file_name gt _x64 11 e 32 bit version of the SPIR binary lt file_name gt _x86 spir e 32 bit version of the SPIR binary lt file_name gt _x64 spir 4 CY Session SobelFilter 1 files 4 FS OpenCL Files obelFilter cl 4 Build Artifacts B SobelFilterI SobelFilter asm SobelFilter ir P SobelFilter_x 6 spir SobelFilter_x64 spir B SobelFilter_x86 1I B SobelFilter_x64 1l All build artifacts are stored in the sessions folder You can double click the LLVM Assembly code to see its content in the IDE s editor You can open the containing folder by right clicking one of the files and selecting Op
13. NDRange command that calculates the histogram of the image using the buffer as bins counter 62 Debugging with Visual Studio Plug in Data View Data View Image View Problems wiew Trace View Command Queue Properties View Properties This example has 22 pixel elements with grayscale value 5 and 27 pixels with grayscale value 9 and SO On Use the Type box to select the underlying data type for example cl_uint cl_double cLlong clLulong cl_float cl_double The Save As button enables saving a CSV representation of the data to disk When exporting Buffer SubBuffer you get each buffer cell in a separated line The Buffer SubBuffer values are interpreted as a contiguous memory chunk containing unsigned chars as its elements When exporting an Image as a CSV the number of rows in the output CSV is the height of the image number of rows and each row represents all columns of that row joined and delimited by commas The values in the cells are interpreted according to the image channel data type so for example an Image that has CL_SIGNED_INT32 as its data type causes the resulting output to display each row as an array of signed 32 bit integers Each state is related to the API call that caused the change and is in the following format ID API Call Where ID is the number of API call that caused the change and API Call is the OpenCL API call that affected changed the object This is the same API call tha
14. PARTS Intel may make changes to specifications and product descriptions at any time without notice Designers must not rely on the absence or characteristics of any features or instructions marked reserved or undefined Intel reserves these for future definition and shall have no responsibility whatsoever for conflicts or incompatibilities arising from future changes to them The information here IS Subject to change without notice Do not finalize a design with this information The products described in this document may contain design defects or errors known as errata which may cause the product to deviate from published specifications Current characterized errata are available on request Contact your local Intel sales office or your distributor to obtain the latest specifications and before placing your product order Copies of documents which have an order number and are referenced in this document or other Intel literature may be obtained by calling 1 800 548 4725 or go to http www intel com design literature htm Intel processor numbers are not a measure of performance Processor numbers differentiate features within each processor family not across different processor families Go to http www intel com products processor_number Software and workloads used in performance tests may have been optimized for performance only on Intel microprocessors Performance tests such as SYSmark and MobileMark are measured using
15. Start Time ps Global Work Size Local Work Size Global Work Offset Queue ID BitonicSort 183084 22881120 172808198523476 8388608 0 1 BitonicSort 147752 13237236 172808227764648 4194304 0 1 p BitonicSort 124392 18392496 172808243862316 8388608 0 1 Oueued Time us 172808243737924 Started Time us 172808243862316 Ended Time us 172808262254812 Duration us 18392496 Return Value 0 Command Tvpe CL_COMMAND_NDRANGE_KERNEL BitonicSort 134612 13173288 172808265695740 4194304 0 1 BitonicSort 115340 12774708 172808281376432 4194304 0 1 BitonicSort 134320 18800420 172808305273420 8388608 0 1 BitonicSort 124684 13634064 172808327202912 4194304 0 1 BitonicSort 121472 13165112 172808343336788 4194304 0 1 BitonicSort 122348 13130656 172808359015436 4194304 0 1 BitonicSort 122640 13162192 172808374592176 8388608 0 1 BitonicSort 124684 12785512 172808391066232 4194304 0 1 BitonicSort 122056 13265268 172808406210228 4194304 0 1 Memory Commands shows every memory command executed in your application 87 User Manual OpenCL Code builder for Intel Media Server Studio 2015 choose a view Memory Commands v BitonicSort Command Name Return Value Size byte Duration ps Latency ps Start Time ps Memory Type CL COMMAND_MAP_BUFFER 0 134217728 4380 102492 177359259530056 CL_MEM_OBJECT_BUFFER CL_MEM_USE_HOST_PTR Queued Time us 17735
16. To generate and view the assembly code do the following 1 Build the OpenCL code from the Eclipse editor 2 Click the Show Assembly button or right click the ci file in the Project Explorer and select Intel OpenCL gt View Assembly Navigate Search Project Intel OpenCL m i be ee Al IL els ee See Also Building and Compiling Kernels in Eclipse IDE Linking Program Binaries in Eclipse IDE OpenCL API Offline Compiler plug in for Eclipse IDE enables linking several compiled files To link binaries do the following 1 Build code in the Eclipse editor 2 Click the Link button or select Intel OpenCL gt Link Navigate Search Project Intel OpenCLl ip age Ue ee Al e T i 3 Click Browse select the input files to link and click OK 4 Type the output file destination into the Output File text box or click Browse to specify the path using graphics user interface 5 Specify OpenCL device type and Architecture in the Target Configuration group box and click OK See Also Configuring Offline Compiler for Eclipse IDE Building and Compiling Kernels in Eclipse IDE Saving and Loading OpenCL Code in Eclipse IDE Create a C C eclipse project to open or link c1 files in Eclipse IDE 15 User Manual OpenCL Code builder for Intel Media Server Studio 2015 NOTE Install the Eclipse C C Development Tool CDT to work with the Offline Compiler capabilities To save a c1 fil
17. Visual Studio IDE OpenCL API Offline Compiler for Eclipse IDE Converting Existing Project into OpenCL Project OpenCL Scholar Hints OpenCL Scholar suggests several hints for OpenCL code optimization Use Floating Point over Integers for Calculations Scholar notifies about each integer calculation that can be implemented with floating point instead Floating point calculations are generally faster than the integer equivalents and have more bandwidth Still the optimization might negatively affect code readability The message location is the beginning of the left hand operand of the operation and its content is prefer floating Point calculations bo integer Calculations Consider the following code korne F yvord Gropa ant a en eo E e a a TO Mora a i cave For the code above Scholar provides the following hint message vaceieguedlate Ie she e oae helan prere r loa ng POI cue ula Weighs ee Abel eecisie siecle De eine aS Use the Restrict Qualifier for Kernel Arguments Scholar recommends using the restrict qualifier on kernel arguments that may alias other arguments if you are sure that this aliasing can never actually occur Such optimization helps the compiler limit the effects of pointer aliasing while aiding the caching optimizations 78 Preview Features The message location is the parameter name and its content is parameter lt param name gt should be marked as restrict if it never shar
18. a non exclusive royalty free license to any patent claim thereafter drafted which includes subject matter disclosed herein INFORMATION IN THIS DOCUMENT IS PROVIDED IN CONNECTION WITH INTEL PRODUCTS NO LICENSE EXPRESS OR IMPLIED BY ESTOPPEL OR OTHERWISE TO ANY INTELLECTUAL PROPERTY RIGHTS IS GRANTED BY THIS DOCUMENT EXCEPT AS PROVIDED IN INTEL S TERMS AND CONDITIONS OF SALE FOR SUCH PRODUCTS INTEL ASSUMES NO LIABILITY WHATSOEVER AND INTEL DISCLAIMS ANY EXPRESS OR IMPLIED WARRANTY RELATING TO SALE AND OR USE OF INTEL PRODUCTS INCLUDING LIABILITY OR WARRANTIES RELATING TO FITNESS FOR A PARTICULAR PURPOSE MERCHANTABILITY OR INFRINGEMENT OF ANY PATENT COPYRIGHT OR OTHER INTELLECTUAL PROPERTY RIGHT A Mission Critical Application is any application in which failure of the Intel Product could result directly or indirectly in personal injury or death SHOULD YOU PURCHASE OR USE INTEL S PRODUCTS FOR ANY SUCH MISSION CRITICAL APPLICATION YOU SHALL INDEMNIFY AND HOLD INTEL AND ITS SUBSIDIARIES SUBCONTRACTORS AND AFFILIATES AND THE DIRECTORS OFFICERS AND EMPLOYEES OF EACH HARMLESS AGAINST ALL CLAIMS COSTS DAMAGES AND EXPENSES AND REASONABLE ATTORNEYS FEES ARISING OUT OF DIRECTLY OR INDIRECTLY ANY CLAIM OF PRODUCT LIABILITY PERSONAL INJ URY OR DEATH ARISING IN ANY WAY OUT OF SUCH MISSION CRITICAL APPLICATION WHETHER OR NOT INTEL OR ITS SUBCONTRACTOR WAS NEGLIGENT IN THE DESIGN MANUFACTURE OR WARNING OF THE INTEL PRODUCT OR ANY OF ITS
19. and local variables views NOTE Debugging is available only for CPU device If the code should run on Intel Graphics debug on CPU device during development phase then change the target device For debugger limitations and known issues refer to the Intel SDK for OpenCL Applications 2014 Release Notes Enabling Debugging in OpenCL Runtime To enable debugging mode in the Intel OpenCL runtime for compiling OpenCL code using OpenCL Debugger plug in for Microsoft Visual Studio IDE do the following 1 Add the g flag to the build options string parameter in the clBuildProgram function 2 Specify full path to the file in the build options string parameter to the clBuildProgram function accordingly including the CL file name S lt Pull path Eo the pen L source trile gt If the path includes spaces enclose the entire path with double quotes NOTE Relative path to the CL file is not supported For example err ClBbudl ar rogram 44 Debugging with Visual Studio Plug in g_program 0 NULL DE E S a a a NULL NULL According to the OpenCL standard work items execute OpenCL kernels simultaneously The Debugger requires setting in advance the global ID of the work item to debug which is before debugging session starts The Debugger stops on breakpoints in OpenCL code only when the pre set work item reaches them NOTE To work with the OpenCL Debugger plug in for Microsoft Visual Studio IDE
20. appearance on the graph on the right Viewing Execution Statistics of Deep Kernel Analysis The following tables of the Kernel Builder for OpenCL API Deep Kernel Analysis Results tabs show textual tables with execution data 38 EU Statistics data on the execution units on the Intel Processor Graphics physical location SIMD width and number of activations of the hardware threads to run the kernel Full Kernel Execution Statistics reflects total kernel execution time on each EU including Statistics per execution unit and their averages o Average o Median o Minimum amp maximum o Standard deviation Timestamps Statistics reflects total execution time for each of the selected lines Building with Kernel Builder Command Line Interface Kernel Builder for OpenCL API provides a command line interface The tool supports Intel processors Intel Graphics and Intel Xeon Phi coprocessors also providing full offline OpenCL language compilation which includes e Creating executable Intermediate Representation IR from source code e Creating compiled object from source code e Creating executable IR or library from object IR and libraries The command line tool is located in INTELOCLSDKROOT bin under x86 or x64 folder depending on OS To use the Offline Compiler command line interface 1 Start the command line 2 Type ioc 4 to run 64 bit version Type the run parameters in the following sequence T
21. button and select Open Press Ctri O Select File gt Open Drag and drop file into the code editor window Saving and Loading Session Kernel Builder for OpenCL API enables saving the current session A Session is all the open tabs including their configured options and analysis configurations To save the session click the Save As G button and select Save Session Fa To load a saved session click the Open button and select Load Session NOTE Following an unsuccessful shutdown the Kernel Builder for OpenCL API prompts you to restore one of the last 5 auto saved sessions 18 Building and Analyzing with Kernel Builder LLVM SPIR and Assembly Code View Kernel Builder for OpenCL API enables viewing the generated LLVM SPIR and Assembly intermediate representation IR of the OpenCL code To view the LLVM SPIR or Assembly code do the following 1 Build your kernel ros oy lt gt 2 Click Show LLVM or Show Assembly You can view the SPIR representation by selecting the corresponding tab in the LLVM View window LLVM View 0 x ModuleID Program T target datalayout e p 64 6 _ target triple x86 64 pc wL Function Attrs nounwind declare void BitonicSort b Function Attrs nounwind re _ a a mu vT To hide the view windows click the corresponding button again NOTE Assembly code view is available for the CPU device only See Also Build
22. debugging with F5 5 Open the needed API Debugger views by selecting CODE BUILDER gt OpenCL Debugger and select the view you need The API Debugger updates the view panes when e The Debugger hits a breakpoint in Microsoft Visual Studio IDE e One of the views behavior changes which means you click a buttons e The host application execution ends So to see data in the views 1 Insert some breakpoints in your application in different API calls or run the application with Start Debugging F5 2 Then open the needed views via CODE BUILDER gt OpenCL Debugger 47 User Manual OpenCL Code builder for Intel Media Server Studio 2015 CODE BUILDER ANALYZE WINDOW HELP OpenCL Kernel Development d OpenCL Debugger t 38 Objects Tree View OpenCL Application Analysis t Gh Command Queue View Eb Platform Info Properties View Help a Trace View Problems View Fl Image View Data View Options Ctrl 1 See Also Trace View Objects Tree View Properties View Command Queue View Problems View Image View Data View Memory Tracing Trace View The trace view contains trace of all OpenCL API Calls during the execution API call arguments returned values and time of execution To access the trace view select CODE BUILDER gt OpenCL Debugger gt Trace View Trace View Return Value 29 clReleaseContext Conte CL_SUCCESS 17 48 26 720 28 clReleaseCommandQue CL SUCCESS 17 48 21 219 2 clReleaseP
23. features New project templates New OpenClL file c1 template Syntax highlighting Types and functions auto completion Offline compilation and build of OpenCL kernels LLVM code view Assembly code view Program IR generation Selection of target OpenCL device CPU or Intel Graphics NOTE To work with the plug in features create an OpenCL project template or convert an existing project into the OpenCL project See Also Converting Existing Projects into OpenCL Projects Configuring Microsoft Visual Studio IDE To configure the OpenCL API Offline Compiler plug in for Microsoft Visual Studio IDE do the following 1 Inthe Visual Studio software select Project gt Properties 2 Inthe C C gt General property page under Additional Include Directories enter the full path to the directory where the OpenCL header files are located INTELOCLSDKROOT include Configuration Active Debug Platform Active Win32 Configuration Manager a C C a Additional Include Directories SCNTELOCLSDKROOT include General Additional Fusing Directories Optimization Debug Information Format Program Database for Edit And Continue Z1 3 Inthe Linker gt General property page under Additional Library Directories enter the full path to the directory where the OpenCL run time import library file is located For example for 64 bit application Code Editing and Building with Visual Studio Plug in INT
24. following command ado s lt mulbaronu name gt pUSsteIneel heel Sy7sicm veoncdo w Kimonos pemely vomadoms NOTE If you close the emulator you must reinstall the OpenCL runtime after you run it again See Also Configuring the Environment Creating an Android Application To create a new application do the following 70 Run the Eclipse IDE from the SDK installation folder o On Windows OS run c sdk adt bundle windows x86_64 20130219 eclipse eclipse o On Ubuntu OS run sdk adt bundle linux x86_64 eclipse eclipse Specify the Android NDK location in Eclipse 1 Goto Window gt Preferences gt Android gt NDK 2 Enter the Android NDK path Create a new Android project 1 Goto File gt New gt Project gt Android gt Android Application Project 2 Add the appropriate information For example OpenCL Development for Android OS New Androld Application New Android Application Ay The prefix com example is meant as a placeholder and should not be used Application Name OpencCLFirstApp Project Name OpencLFirstapp Package Name 4 com example opencifirstapp Minimum Required SDK 0 API 16 Android 4 1 Jelly Bean Target SDK 0 APL 17 Android 4 2 Jelly Bean Compile With API 17 Android 4 2 Jelly Bean Theme Holo Light with Dark Action Bar m O Choose the highest API level that the application is known to work with This attribute informs the system
25. is the number of API call that caused the change and API Call is the OpenCL API call that affected changed the object This is the same API call that it shown in the Trace View When selecting an Image from the drop down or alternatively selecting an Image state the Trace View automatically highlights the API call that is related to that state aod pee Trace View bel Save O Load Session E 42 clEnqueueWritelmage ve clEnqueueReadimage C CL_SUCCESS 00 03 24 187 clFinish CommandQue 00 03 24 1185 clEnqueueNDRangeKer clEnqueueNDRangeKer CL SUCCESS 00 03 24 027 mmand Queue The Save As button in the Image View enables saving a copy of the displayed image to disk as bitmap The number of states to save per each memory object Image Buffers and SubBuffers can be configured via 59 User Manual OpenCL Code builder for Intel Media Server Studio 2015 CODE BUILDER gt OpenCL Debugger gt API Debugger gt I mages amp Buffers gt Number of previous states Code Builder Debugger Configuration Advanced Settings API Debugger W Enable OpenCL API Debugger Images amp Buffers Enable Dumping Images W Enable Dumping Raw Data Number of previous states 5 Other settings Auto generate session Output Folder C Users
26. lt you_account gt Docur z You can also disable dumping images by unchecking Enable Dumping I mages Notes e To display the data the plug in has to perform background activities such as fetching the data and converting it into a displayable format which might impact performance when using the Enable Dumping I mages or Enable Dumping Raw Data options Take into account that profiling performance measured by either clGetEventProfilingInfo runtime API call any other method for measuring execution time or occupied host memory might entail certain performance degradation To get more accurate profiling results use the runtime directly by pushing CtrI F5 Start w o Debugging or disabling API Debugger in the plug in configuration menu e Only 2D images are supported for viewing which is memory objects that contain CL_MEM_OBJECT_IMAGE2D In their image_type field inside their descriptor cl_image_desc Images above 2GB are not supported and will not be displayed e The bitmaps shown in the Image View are merely an 8 bit RGBA approximation of the underlying pixel array of the associated images Behind the scenes the plug in does a liner color conversion from the input range of the pixels which can be any type supported by the OpenCL runtime for example CL_SNORM_INTS8 CL_UNSIGNED_INT16 and so on to the 0 255 range As a result the presented colors might not accurately represent the bitmap as expected See Also Enabling the AP
27. of kernels available for debugging Select a kernel to debug by clicking the kernel name from the pull down menu If only one kernel IS available it is selected automatically 5 Assign parameters for the debug session and click Debug nied Upong clicking the Debug button the tab with the Debugger controls opens automatically ao 35 int X get global id 0 5 36 int get global id 1 a7 38 Read image coordinates O EEE int22 PizelCoords X Y Empty red circles O appear in the kernel code editor next to the executable lines suggesting the locations where you can set breakpoints for kernel debugging Yellow and Blue arrows T appear next to the executable line of the selected kernel The yellow arrow is the next line to execute in a work item while the blue arrow is the next line to execute in a work group See Also Using Kernel Builder Assigning Debug Parameters To set kernel arguments for the debug session refer to the Assign Parameters tab on the Debug Board Click cells in the Assigned Variable column to create or add variables as kernel arguments Use immediate values for primitive types like int float char half and so on Add comma separated immediate values for example 2 4 6 8 for a given uint4 argument for vector type If the given values don t correspond to the vector size of the given type the last specified value iS propagated to the correct size For example if you type 2 as a value to an
28. reports These are the types of files in a capture directory o csv capture reports in CSV format o bin capture reports in binary format you can open such reports in Visual Studio from the Analyze Sessions Explorer In addition a session file is created in the session directory This file stores the data about session configuration You can use it to create and run another similar session Configuring the Analyze Tool You can use the Analyze Session Settings dialog to change the reports directory and also to change the connection info for the analyze sessions To open the Analyze Session Setting dialog go to CODE BUILDER gt OpenCL Application Analysis gt Settings 88 Preview Features E Analyze Session oo EF Reports Location Place the output reports in the solution directory when a solution is opened Use this location to place the output reports when there is no opened solution C PerfLogs n Connection Find available port in this range From Port Number 20000 To Port Number 60000 OK Cancel Report Location full path to the directory that contains analyze reports You can mark the Place output reports in the solution directory check button In this case if you open a solution in Visual Studio the Analyze Tool ignores the specified directory and places the analysis reports into the solution directory Connection range of ports number for the Analyze Tool
29. that you have tested against the target version and the system should not enable any compatibility behaviors to maintain your app s forward compatibility with the target version The application is still able to run on older versions down to minSdkVersion Your application may look dated if you are not a 3 Click Next in all remaining forms 4 Click Finish 4 Run the created emulator 5 Install the OpenCL runtime on the emulator or device 6 Develop the application and run it using the Intel OpenCL software technology implementation 1 Right click the project name in the Project Explorer 2 Click Run As gt 1 Android Application NOTE Install the Intel Hardware Accelerated Execution Manager HAXM to accelerate the emulator performance on Windows OS Parent topic Developing OpenCL Applications for Android OS See Also Installing OpenCL Runtime on Android OS 71 Preview Features OpenCL New Project Wizard About the OpenCL New Project Wizard OpenCL New Project wizard is a plug in for Microsoft Visual Studio software enables developing Windows and Android OpenCL applications with Visual Studio IDE either from scratch empty project or based on template projects The wizard kit supports the following features e Create a new empty OpenCL project for Windows platforms e Create a new OpenCL project from OpenCL project template for Windows platforms e Create a new OpenCL project from OpenCL p
30. to find an available port The Analyze Tool uses a port in the specified range to establish connection with Visual Studio Kernel Development Framework About Kernel Development Framework Kernel Development Framework is preview feature of native integrated development environment in the Microsoft Visual Studio that enables you to build and analyze OpenCL kernels The framework supports Intel Architecture processors Intel Processor Graphics and Intel Xeon Phi coprocessors as well as remote development on Android devices The tool provides full offline OpenCL language compilation which includes OpenCL syntax checker Cross platform compilation Low Level Virtual Machine LLVM viewer Assembly code viewer Intermediate program binary Generator The feature also provides a way to assign input to the kernel test the correctness and analyze kernel performance based on group size build options and target device 89 User Manual OpenCL Code builder for Intel Media Server Studio 2015 B SobelFilter asm Gx Gy Gz Lx Ly liz Iterations Total pT Submit Execution IO Mode Input SobelFilter ir SobelFilter_x86 spir k SobelFilter_x64 spir H 32320 1 2 10 B SobelFilter_x86 Il l B SobelFilter_x64 ll 5125120 11 0 10 2 08097 0 0004088 0 0048472 2 06794 a Memory Flags CL_MEM_USE_HOST_PTR 4 buffer_1 Data Type int Size 1024 Source Random Values 1 48698 0 0004088 0 0049932 1 47334 og Sob
31. 1 Click the Analyze es button 2 Switch to the Analysis Results tab 3 Right click the table and choose the action you need to perform i Export Selected Configuration 36 Export All Configurations 36 Show All Configurations Statistics for Each Configuration The Execution Statistics table in the Analysis Results tab of the Kernel Builder for OpenCL API enables you to see statistical analysis results for a selected configuration The statistics consists of the following iteration execution time values for the selected configuration Median Average Standard deviation Maximum Minimum To open the Execution Statistics table do the following H 1 Click the Analyze button 2 Switch to the Analysis Results tab 3 Click Execution statistics Statistics per Iteration The Execution Iteration Times ms table in the Analysis Results tab of the Kernel Builder for OpenCL API enables you to see the total run time the breakdown to queue submit and execute times per iteration for the given configuration To open the Execution Iteration Times ms table do the following 34 Building and Analyzing with Kernel Builder 3 1 Click the Analyze button 2 Switch to the Analysis Results tab 3 Click Execution Iteration Times ms Variable Handling The Variable Handling table in the Analysis Results tab of the Kernel Builder for OpenCL API enables you to see read and read back times for ea
32. 9259427564 Other Information Map Count 0 Started Time us 177359259530056 Ended Time us 177359259534436 Duration us 4380 Context ID 1 Queue ID 1 CL COMMAND_UNMAP_MEM_OBJECT 0 134217728 4088 84388 177359262258212 CL_MEM_OBJECT_BUFFER CL_MEM_USE_HOST_PTR Revising Code and Rerunning Session After you optimize your code you can rerun the profiling session and compare the data to see how your changes improve your application performance To rerun an analyze session do the following 1 Open the Analyze Sessions Explore from CODE BUILDER gt OpenCL Application Analysis gt Windows gt Analyze Session Explorer 2 Inthe Analyze Sessions Explorer right click the analyze session that you want to rerun and select Rerun 3 A new analyze session is created and launched and the profiled application starts 4 After the application is finished the new analyze session appears in the Analyze Explorer window and new reports are generated Output Files For each analysis session the analysis tool creates a session directory named with application s name the date and an incrementing session number When profiling begins and also each time you pause and resume the data collection during the session a new capture subdirectory is created in the session directory The capture directory is called capture and an incrementing number for example capture_1 capture_2 and so on The files in that directory comprise the capture
33. CL Device type o Intel CPU o Intel Graphics o Intel Xeon Phi coprocessor o Intel CPU on Experimental OpenCL 2 0 Platform NOTE Intel Graphics support is available on Windows OS only Building and Compiling Kernels in Eclipse IDE To build or compile an OpenCL kernel using the OpenCL API Offline Compiler plug in for Eclipse IDE do the following 1 Write code into the Eclipse code editor or load code from file 2 Click the Build or Compile L button at the tool bar or right click the file in the project explorer and select Intel OpenCL gt Build or Compile After compilation completes the output appears in the Console tab of the Eclipse IDE E Problems 2 Tasks EE Console 3 E Prope OpenCL Build Console Device name Intel R CPU Device version OpenCL 1 2 Build 75216 Device vendor Intel R Corporation Kernel was not vectorized Done Build succeeded Error and warning messages appear in the Problems tab J Tasks fi Problems 2 E Properties l error 1 warning 0 others Description a Errors 1 item use of undeclared identifier this a amp Warnings Litern Fwarning this is a warning See Also Saving and Loading OpenCL Code in Eclipse IDE 14 Code Editing and Building with Eclipse Plug in Generating Assembly Code in Eclipse IDE OpenCL API Offline Compiler plug in for Eclipse IDE enables generating and viewing files with assembly code of the input c1 files
34. E On Windows only one device can be running at installation time NOTE Installation of the OpenCL runtime for Android via scripts is supported only on emulator NOTE Root permissions are required on Android emulator To configure the emulator manually 1 Copy the following files from the SDK installation folder to system vendor 1lib using the Android Debug Bridge _ oOcl_svml_g9 so __ocl_svml_n8 so __ocl_svml_s9 so __ocl_svml_v8 so clot HGI SEEL cloIrtcTtngo img ebk lt 6 Clotting amg COkertl clbltfnn8 rtl elod ona cleromen nlc mme Glare cl bilernns amg COk rtl clblitfns9 rtl elortfna o img ebk 0 Cl Olt mS Img Cok ruil clbltfnv8 rtl cloleTavsimg CUk 6 CLE et ive img cbk ru libcl_logger so libclang_compiler so libcpu_device so libgnustl_shared so libintelocl so libOclCpuBackEnd so libOclCpuDebugging so i bOpenCh S O4 2 libtask _executor so libtbb_preview so libtbbmalloc so opencl_ pch O O O O O O O O O O O O O O OO OOOOOOOOOOOO Use the following command to copy the files 69 User Manual OpenCL Code builder for Intel Media Server Studio 2015 adb s lt Emulator Name gt push lt filel gt system lib In the system 1ib folder on the Android device create two links ado Ss Emulator Neue sli Ved system y ndor ile lin SS Ili CjoeinC lin Se IL rib Ooenein sO eeii eS eleilloCm cme lp c a Om cil ila Copy the intel icd file to system vendor Khronos OpenCL vendors folder Use the
35. EL 0 VIAF D 5 Data View Image View Problems view Trace View Command Queue Use the following buttons to control the Command Queue View e Save As enables dumping the current status of commands to a text file for a later investigation e Unify Queues enables to view all commands across all queues Also note the following o When working in the Unified queues mode each entry is added a suffix of the form co NUMBER which indicates the command queue number with which the command is associated o For example TASK 3 CQ 1 Indicates that the 3rd command enqueued to some queue is a clEnqueueTask command and is associated with Command Queue 1 o Each queue has a color and all its corresponding commands have the color of the queue Such differentiation makes it easy to spot in the eye the corresponding queues of the commands in question 54 Debugging with Visual Studio Plug in Objects Tree i Sort By cy Show Objects 5 Platform 1 Intel R OpenCL D E Context 1 E Dewice 1 ad ote P Program 1 Built El Context 2 a Hee Device 2 GPU a2 Command Queue 2 In Order CommandQueue 3 An Order 5 Program 2 Built i ab Kernel 2 SobelFilter Object Sahin Toa Cas Vv Proper Proper Command queues in the Objects Tree view share the same color in the view as their color in the Command Queue view o The Unify Queues button changes into Separate Queues button a
36. ELOCLSDKROOT lib x64 Confiquration Active Debug Platform ActiveWin32 O Configuration Manager 4 Linker Additional Library Directories S INTELOCLSDKROOT ib x64 General Link Library Dependencies Yes Input Use Library Dependency Inputs No 4 Inthe Linker gt Input property page under Additional Dependencies enter the name of the OpenCL ICD import library file OpencL 1ib Configuration Active Debug Platform ActiveWin32 O Configuration Manager 4 Linker Additional Dependencies OpenCL lib General Ignore All Default Libraries Input Ignore Specific Default Libraries Manifest File Module Definition File Converting Existing Project into OpenCL Project OpenCL API Offline Compiler plug in for Microsoft Visual Studio IDE enables you to convert a Standard C C project to an OpenCL project and vice versa To convert your project do the following 1 Right click the project you want to convert in the Solution Explorer 2 Inthe project menu click Convert to a project for OpenCL API Building OpenCL Project To build the solution using OpenCL API Offline Compiler plug in for Microsoft Visual Studio IDE click Build gt Build Solution When building solution Intel OpenCL compiler automatically builds attached OpenCL kernels See the build result in the Output build dialog of the Microsoft Visual Studio IDE Output eee eee ee ene ory ary dry aryhene tun
37. I Debugger Data View The Data View enables visual displaying on a grid of all the OpenCL Memory Objects Images Buffers and SubBuffers that were instantiated in the host application 60 Debugging with Visual Studio Plug in Each Memory Object is added to the Objects View and by double clicking Buffers SubBuffers you can display the buffer contents or by double clicking an Image you can view the raw pixel data associated with the image Objects Tree Platform 1 Intel R OpenCL E Context 1 CO Program 1 Built S lgp Kernel 1 RowFilter fee src E dst ig width a height a srcStride sa dstStride fa filterKernel 2 Buffer 1 Heure 2 Buffer 3 Objects Tree Solution Ex Team Explo Class View Double click the Buffer you need and Data View window appears with the latest state of the buffer sub buffer Data View Memory Object Buffer 2 History 39 clEnqueueNDRangeKerne Type Pe iat Data View Image View Problems wiew Trace View Command Queue Properties View Properties From the Memory Objects drop down select any memory object and the view shows the raw data associated with the object 61 User Manual OpenCL Code builder for Intel Media Server Studio 2015 Data View Memory Object Image 1 History 42 clEnqueueWritelmage 1 Ree RE Re 0 89 0 54 0 49 1 00 0 87 0 54 0 52 17 00 0 87 0 53 0 50 1 00 0 89 0 54 0 49 1 00 0
38. Images bitmaps if Enable Dumping I mages is on e Memory objects raw data if Enable Raw Data is on The state can be stored by either of the following ways e Automatically when host application ends e Manually by going to Trace View gt Save gt Save Session trace The automatic memory tracing contains e State of all the views e CSV of all API calls that occurred during the execution And can be enabled via CODE BUILDER gt OpenCL Debugger gt API Debugger gt Other settings gt Auto generate session This option creates a separate directory for each captured session of the plug in The directory is stored under the Output Folder specified in the same window See Also Enabling the API Debugger 65 OpenCL Development for Android OS Configuring the Environment To develop OpenCL applications for Android OS you need to configure your system the following way Download Android SDK Put lt Android_ SDK_Install gt sdk platform tools in PATH environment variable Enable Intel Virtualization Technology vt x in BIOS Windows OS only Run Android SDK Manager from lt Android_SDK_Install gt sdk tools android bat Mark and install o Android 4 2 2 API 17 gt Intel x86 Atom System I mage o Extras gt Google USB Driver o Extras gt Intel x86 Emulator Accelerator HAXM Windows only 6 Install the OpenCL runtime on an Android device or emulator UBBWNEF NOTE Root permissions are requ
39. L kernels LLVM code generation Assembly code generation program IR generation Target OpenCL device selection Configuring OpenCL API Offline Compiler Plug in for Eclipse IDE To enable the OpenCL API Offline Compiler plug in for Eclipse IDE do the following 1 Copy the plug in jar file from INTELOCLSDKROOT bin eclipse plug in to S ECLIPSEROOT dropins On Linux OS add INTELOCLSDKROOT bin tO LD_LIBRARY_PATH Run Eclipse IDE Select Window gt Preferences Switch to the Intel OpenCL dialog and set OpenCL binary directorys INTELOCLSDKROOT bin ae INTELOCLSDKROOT represents SDK installation root folder ECLIPSEROOT represents the Eclipse root folder To configure other options select Intel OpenCL gt Options Configuring Options In the OpenCL API Offline Compiler Plug in for Eclipse IDE go to Intel OpenCL gt Options and configure the needed options e Type the build options into the Build Options text box or click to add options from list Hold Ctrl to select several options e Select the target architecture o x86 for 32 bit architecture o x64 for 64 bit architecture e Select the target instruction set o Streaming SIMD Extension 4 2 SSE4 2 o Advanced Vector Extensions Intel AVX o Advanced Vector Extensions 2 Intel AVX2 13 User Manual OpenCL Code builder for Intel Media Server Studio 2015 e Select the build type o Debug o Build e Select the Open
40. OC VOOr TOn Cma lt commamd gt lt argqumeme gt lt OpErons gt Offline Compiler supports the following commands Command Use Description Creates executable IR from source code Default command in case nothing is specified cmd build cmd compile Creates compiled object IR from source code comd 1ink Creates executable IR or library from object IR and libraries Offline Compiler supports the following arguments Argument Use Description Builds OpenCL code from the input_file_path file Use the input argument with the build and compile commands input lt input_file_path gt binary lt binary_files gt Links comma separated binary files Use with the link command version Shows the tool version Shows help menu containing the list of available commands hel arguments and options Offline Compiler supports the following options Option Use Description 39 User Manual OpenCL Code builder for Intel Media Server Studio 2015 device lt device_type gt targetos lt 0s gt simd lt instruction_set_arch gt output lt output_file_path gt asm lt file_path gt livm lt file_path gt vines Ole oA Tk Me palh llvm spir64 lt file_path gt ir lt file_path gt spir32 lt file_path gt spir64 lt file_path gt scholar bo lt bui L d opelons gt 40 Selects target device type e cpu Intel CPU device which is Defaul
41. a Half Shee 0 EU 1 Half Sioe 0 EU 2 a Half Sice 0 EU 3 Half Sice 0 EU 4 a Half Sice 0 EUS Half Sice 0 EU S Half Sice 0 EU 10 a Half Shoe 0 EU 11 Half Sice 0 EU 12 a Half Sice 1 EU O Half Slice 1 EU 1 a Half Slice 1 EU 2 Half Slice 1 EU 3 at a Half Slice 1 EU 4 Half Sice 1 BUS Half Sice 1 EU 9 a Half Shoe 1 EU 10 a Half Sice 1 EU i1 0 Half Sice 1 BU 12 95 63 Active HW threads a B Es lt E htt s CACI ELIP ME A ce a O6SERr 2 OFS OGGEOC iT naa 3 Gy i hs Zi 66802 0 m OO Tt iT ino aS PEESI GSE i a oo a ha E E ben OO OO O imma oo fs rhl0Gt 68o i bane a E6CO6 h6iSch mE TOR 61S a mmm mm oe a T6LSS C6 a BAr ENERO ld aa Execution Duration EU Statistics Ful Kernel Execution Statistics Timestamps Siadet The chart shows 12 bars of utilization across the profiling time Each color represents a specific EU while the average time of an EU utilization over time range determines the height of each color on each bar Double clicking any of the colored parts opens a dialog showing the hardware thread activations across time 37 User Manual OpenCL Code builder for Intel Media Server Studio 2015 Half Slice 0 EU 8 fn EU Hardware Thread Thread 1 Ti Eg Z ial 245950 247035 246146 2992544 250353 Time GPU Cycles mk EOG dal LD Click the legend to the left to toggle each hardware thread
42. ach OpenCL resource programs buffers images and so on that is not released e API call failures when an OpenCL API call fails an error entry is added to the problems view You can right click the entry to jump to the line item in the trace view that caused the failure Double clicking an error in the Problems View opens the compilation error log message in the code editing area D ToneMapping_2012 Microsoft Visual Studio FILE EDIT VIEW GIT PROJECT BUILD DEBUG TEAM TOOLS TEST ANALYZE G O fl ke p P Local Windows Debugger Debug ff _ TE Ta ee tee eat eels ler eee 1 Pcosco bs9c 437 a e45le6l2alcs log Compilation started 1 166 1 error expected identifier or Compilation failed x 2 eea to o compi Program l 1 for Device 7 CPU Double click here to see t par AG feces a was Ere Data View Image View Problems view Trace View Command Queue See Also Enabling the API Debu Image View This view enables visual displaying of the OpenCL Image objects in the host application Each Image object is added to the Objects View and by double clicking each Image object the bitmap is displayed the underlying pixel array gets translated into bitmap 56 Debugging with Visual Studio Plug in 7 Sort By L Show Objects Se 4 Platform 1 ntel R OpenCL E Context 1 BARR Device 1 CPU Command Queue 1 In On 4 0 Program 1 Bu
43. adjacent buffer elements Coalesced memory accesses are translated to wide loads and stores while non coalesced accesses translate to gathers and scatters Wide loads and stores outperform gathers and scatters The message location is the beginning of the statement in which the memory access occurs and its content is non coalesced memory access Consider the following code korno haor on a ooa aane aa aa aa e ne e e e o O Ploae Poa ell akcl S For the code above Scholar provides the following hint message mykernel cl 3 3 Scholar non coalesced memory access Refer to the product Optimization Guide for more optimization hints and explanations See Also Intel SDK for OpenCL Applications Optimization Guide Debugging Kernels on Intel Graphics About Kernel Debugger Kernel Debugger is a preview feature that enables OpenCL kernel debugging on Intel Graphics device through the interface of the Kernel Builder for OpenCL API The Debugger supports e Running OpenCL kernels on the Intel Graphics device step by step e Setting breakpoints e Viewing variable values To enable the Kernel Debugger set the CL_GPU_KERNEL_DEBUGGER_ENABLED environment to True 80 Preview Features To start debugging 1 Open an existing OpenCL file or write a new kernel in the Kernel Builder code editor i 3 Click the Debug button L or select Analyze gt Debug board Click the Refresh kernel s button to get the list
44. agement Or click cells in the Assigned Variable column of the Analyze Board Right click a variable name Click Edit variable properties Change the desired properties and click Done Viewing Variable Contents To view buffer or image contents when using the Kernel Builder for OpenCL API do the following 1 Select Analyze gt Variable management Or click cells in the Assigned Variable column of the Analyze Board 2 Right click a buffer or image name you want to view 3 Click Show variable contents Deleting Variables To delete variables when using the Kernel Builder for OpenCL API do the following L 2 3 Select Analyze gt Variable management Or click cells in the Assigned Variable column of the Analyze Board Right click a variable name Click Delete variable or Delete all variables 33 User Manual OpenCL Code builder for Intel Media Server Studio 2015 Viewing Analysis Results Best and Worst Configurations The Analysis Results tab of the Kernel Builder for OpenCL API enables you to see the tested global and local size best and the worst configurations based on median execution time In case only one configuration exists the result appears in both result windows Best Configuration 6f640 480 03 L128 1 05 Execution Time trish 1 10407 Worst Configuration 6f640 480 03 L01 480 05 Execution Time rst 1 61366 To export or view the analysis results do the following F
45. alysis feature of the Kernel Builder for OpenCL API do the following 1 Run the Kernel Builder 2 Open an OpenCL code file or type in your code in the editor 35 User Manual OpenCL Code builder for Intel Media Server Studio 2015 3 Click the Analyze button press the Refresh Kernel s button and select a kernel for analysis 4 Atthe Assign Parameters tab assign parameters from previously defined variables or create them on the fly from the popup dialog 5 Define group sizes for the analysis and press the Deep Analysis button to start profiling s If desired mark any of the possible OpenCL code lines for profiling by clicking the red circles on the left of your code lines The marking can be undone by clicking the filled circles toggling on and off NOTE Do not use the Auto feature for best local group size configuration with Deep Kernel Analysis Define a single group size for both global and local for each dimension used Viewing Deep Kernel Analysis Results After the profiling is done the data is collected and is shown in a graph and a few tables Execution Duration 36 Building and Analyzing with Kernel Builder Select Kernel to Analyze SodselFitter Refresh eels Assign Parameters Analysis Results Deep Kernel Analysis Results Profiling Results for group size 5 X 512 3 Y 512 4 HV Thread utiization on the EUs acess time Lf a Half Sice 0 EU
46. ames and values e Filter enables filtering out API calls by name Start typing device for example to get only API calls with device in their name Trace View led Save 9 Load Session a SUCCESS Filter device API Return Value Time 14 clGetDevicelnfo Dewice 1 412 CL_SUCCESS IRFS clGetDevicelnfo Device 1 413 CL_SUCCESS 17 47 54 771 GetDevicelnfo Device 1 413 CL SUCCESS LARA TTL GetDevicelDs Platform 1 42 CLSUCCESS 17 47 54 770 Data View Image View Problems view Trace View Command Queue e Right click context menu enables toggling between various display modes of arguments Hex Decimal and show raw values for example 0x2 instead of CL_DEVICE_TYPE_CPU gti Show values in Hex Show values in Decimal Show raw values seston et ol fh eros j q 2 To enable automatic trace generation select CODE BUILDER gt OpenCL Debugger gt API Debugger gt Auto generate session Traces are saved in the folder that is specified in the Output Folder text box Automatic trace generation is an equivalent to clicking Save after the host application ended See Also Enabling the API Debugger 49 User Manual OpenCL Code builder for Intel Media Server Studio 2015 Objects Tree View OpenCL API Debugger plug in for Microsoft Visual Studio IDE Objects Tree view enables e Getting a better understandin
47. and Building with EclipSe Plug in ssssnnsnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn 13 OpenCL API Offline Compiler for Eclipse IDE cccc ccc ccceceeee eee reese eee eeeeeeeeeee nee enegaaas 13 Configuring OpenCL API Offline Compiler Plug in for Eclipse IDE ccc ccceeeeee eee eee eeeees 13 COREN OPEO M aer erea EN ened asoten ssa EEE E E E EE 13 Building and Compiling Kernels in EclipSe IDE cc ccccccce cece cece eee ee seen seen eee eeeeeeeneeeneneeeees 14 Generating Assembly Code in Eclipse IDE ccc ccccccccc cece cece eee e eee e esse ee eeeeeeeeeeeeeeeeeneeaaas 15 Linking Program Binaries in EclipSe IDE c ccc cece cece eee aE a R aAa 15 Saving and Loading OpenCL Code in EclipsSe IDE ccccccccec cece eee eeeeeeeeeeeeeeeeeeesseeannneees 15 Saving Intermediate Representation Code in Eclipse IDE cccce ccc cesses eee sense eeeeseaeneeees 16 Building and Analyzing with Kernel Builder ccccessccccceeeeeeessnneesseeeeeeeeeeeesasaeeeneeeeeeeneneenas 17 Kerne Builder for OpenCL API ccccacvnsutecenmacienwunterdiaateeaenewnwsteaan ene a a EA EAA 17 Using Kornel BUGET ccccuseesrsacrtrcmtnacdseecvereuestedeos a E E E E E EERE 17 Building and Compiling Kernels ssssssrsssnnsrenrrrsrrrsrrnrrrerrrerrrrrrnrrrerrrerrrrrrerrrerrrerent 17 Saving and Loading COUE rewscenrscsesecssauenraieeswandeewseeswesqvecasdanarenunaseenaecetavauseeeanastauiass 18
48. artifacts o Generated LLVM code o Assembly code o Intermediate binary files e OpenCL kernels with assigned variables and analysis reports Creating a New Session To create a new session do the following 1 Go to CODE BUILDER gt Kernel Development Framework gt New Sessions Or click the New Session button te in the Code Builder Build toolbar menu 90 Preview Features 2 Specify the session name path to the folder to store the session file and the content of the session can be either empty session or with pre defined OpenCL code Name new _ session Location C Code Session Content Empty session Duplicate files to session folder Done Cancel 3 Click Done Once the session is created the new session appears in the Code Builder Session Explorer Dialog Code Builder Session Explorer Pew Session new session 1 files OpenCL Files program cl Build Artifacts Kernels Reports If you don t see the Code Builder Session Explorer dialog go to CODE BUILDER gt Kernel Development Framework gt Windows gt Code Builder Session Explorer Creating Session from Existing OpenCL Code The Kernel Development Framework enables you to create a session from an existing application that contains OpenCL code files If you have a project in Microsoft Visual Studio that contains such files s you can do the following e Right click the OpenCL file and select Create Code Builder Sessi
49. bins 0 0 844172 0 028616 0 002044 0 792196 g A BB Reports 1 1 00886 0 010804 0 000876 0 98696 Arg Memory Space Access Qualifier Data Type Arg Name lt A SobelFilter_0 cbreport 2 0 785772 0 003504 0 000584 0 77234 0 _private NONE sampler_t Sam san SobelFilter_1 cbreport 3 0 759492 0 003212 0 000292 0 748688 SobelFilter 2cbrepor Kaatsen ananasen nannan a nena J J Session newcsessian Liles 52520 1 4 0 10 1 14476 0 0003504 00040004 113179 Y Output Ax Show output from OpenCL Build 7 Workgroup size definitions Setting target instruction set architecture to Default Advanced Vectc a Global size Local size OpenCL Intel CPU device was found X 512 12 4 Auto Device name Intel R Core TM i7 477 K CPU 3 5 GHz Device version OpenCL 1 2 Build 71 Y 512 Auto 7 Auto Device vendor Intel R Corporation Device profile FULL_PROFILE y Z 0 0 Auto 4 b 4 gt Number of iterations 10 Code Soluti Class Prope Team Output Find Results 1 Breakpoints Error List NOTE All screenshots in this user manual originate from Microsoft Visual Studio 2012 The Kernel Development Framework is also supported in Visual Studio versions 2010 and 2013 Kernel Development Framework Session About the Development Sessions Work in the Kernel Development Framework is managed through session To create build or analyze an OpenCL kernel you need to create a session A session contains e A file with an OpenCL program e Build
50. bjects of a specific type only o Select Show Objects gt uncheck Show All o Select Show Objects gt select the object type to display e Open Source Code in a new tab enables viewing the source code associated with the program object Right click any Program object in the tree then click Open Source Code in a new tab Objects Tree Li Sort By 4 Show Objects e Platform 1 Intel R OpenCL Ee Context 1 Buffer 1 wie Buffer 2 e Save Binaries enables dumping binary files that were built for the program object with use of clBuildProgram Or clCreateProgramWithBinaries Right click any built program object in the tree then click Save Binaries and select the location to save the binaries See Also Enabling the API Debugger Properties View OpenCL API Debugger plug in for Microsoft Visual Studio IDE exposes miscellaneous properties for each OpenCL object or Command Queue event Properties view pre fetches information about OpenCL objects or events and displays it when a particular object is selected Access the Properties View by selecting CODE BUILDER gt OpenCL Debugger gt Properties View All properties in the Properties View are read only OpenCL Objects Properties To view properties for an OpenCL object do the following 1 Select left click some object from the Objects View window 2 Open the Properties view The OpenCL Objects Properties view is an alternative to calling API calls such a
51. cations entry exists for OpenCL projects with cl source files attached If the entry does not exist convert an existing standard project into the OpenCL project See Also Creating an Empty OpenCL Project Converting Existing Project into OpenCL Project Selecting Target OpenCL Device OpenCL API Offline Compiler plug in for Microsoft Visual Studio IDE enables you to choose the target device when building your OpenCL code Intel CPU Intel Graphics Intel Xeon Phi coprocessor Intel CPU on Experimental OpenCL 2 0 Platform The default device is CPU To choose a target device do the following Go to Project gt Properties Click Configuration Properties gt I ntel SDK for OpenCL Applications gt General Change the Device option according your needs Click OK ee Generating and Viewing Assembly Code OpenCL API Offline Compiler plug in for Microsoft Visual Studio IDE enables generating assembly representation of the OpenCL code To enable generating and viewing the assembly code do the following 1 Goto Project gt Properties 2 Click Configuration Properties gt I ntel SDK for OpenCL Applications gt General 10 Code Editing and Building with Visual Studio Plug in 3 Change the Generate Assembly Code option to Yes Configuration Active Debug Platform Configuration Manager t Common Properties Include 4 Configuration Properties Device CPU device CPL 4 Intel SDK for O
52. ce CPL 4 Intel SDE for OpenCl Appl SIMD Default simd default General a Generate assembly code No en ae Generate Ilvm code No Warnings Command Line Generate binary file iD ee ee ee 4 Click OK Configuring OpenCL Build Options OpenCL API Offline Compiler plug in for Microsoft Visual Studio IDE enables configuring build options for the OpenCL code To configure the build options do the following 1 Goto Project gt Properties 2 Click Configuration Properties gt I ntel SDK for OpenCL Applications gt General 3 Add build options into the Additional build options line Configuration Active Debug Platform Active Win32 Configuration Manager gt Common Properties Include 4 Configuration Properties Device CPU device CPU a Intel SDK for OpenCL Appl SIMD Default simd default General Generate assembly code Yes asm Math Optimizations Generate Ilvm code Yes llvm Warnings Generate binary file Yes ir Cirina Tene cl single precision contant cl denorms are zero 4 Click OK 12 Code Editing and Building with Eclipse Plug in OpenCL API Offline Compiler for Eclipse IDE OpenCL API Offline Compiler plug in for Eclipse IDE enables developing OpenCL kernels with the Eclipse IDE The Offline Compiler plug in supports Eclipse versions 4 2 Juno 4 3 Kepler and 4 4 Luna The plug in supports the following features Offline compilation build and link of OpenC
53. ch variable as well as the output file path for output parameters Clicking on this input output path pops up its content images and buffers To open the Variable Handling table do the following H 1 Click the Analyze button 2 Switch to the Analysis Results tab 3 Click Variable Handling NOTE The analysis results restore each time you select the kernel from the kernel list Deep Kernel Analysis in Kernel Builder About the Deep Kernel Analysis Deep Kernel Analysis feature of the Kernel Builder for OpenCL API enables getting profiling data for OpenCL kernels running on Intel Graphics The data includes Exact kernel runtime for each execution unit and hardware thread in GPU cycles Exact execution time for selected OpenCL code lines in GPU cycles e Execution units occupancy and hardware thread utilization across the execution The new feature uses the Kernel Builder automatic host application feature so you only need to write an OpenCL kernel assign variables to its arguments and define the global and local group sizes You may also mark specific OpenCL code lines as IL profiling points and then use the Deep Analysis button to run the analysis NOTE To work with the Deep Kernel Analysis feature add the following key in the registry HKEY_LOCAL_MACHINE SOFTWARE Intel KMD DisableDOPClockGating dword 00000001 Profiling Kernels for Deep Kernel Analysis To profile kernels using the Deep Kernel An
54. de builder for Intel Media Server Studio 2015 Code Builder wizard for OpenCL API E Es Welcome to Code Builder wizard for OpenCL API Advanced Settings rofiling Queue InputA Memory Source 7 Click Finish to create the default template project or click Previous to return the Basic Settings screen NOTE You need the Android NDK installed on your system to use the Create a New OpenCL Project feature for Android OpenCL Scholar About OpenCL Scholar OpenCL Scholar is a preview feature that reports potential problems and optimization opportunities in OpenCL kernels Upon enabling the scholar mode compiling the kernel provides hints on improving the kernel performance Use Scholar prior to applying any other performance tuning actions such as profiling and right after making sure the kernel works as expected 76 Preview Features fix performance bottlenecks apply Scholar hints fix failing tests Unt a OE aikas ee aS Correct Code Tuned Code Code debug Optimized aTe See Also Enabling OpenCL Scholar OpenCL Scholar Hints Enabling OpenCL Scholar You can enable the OpenCL Scholar feature in Intel tools for OpenCL code development NOTE Generating Assembly IR LLVM and SPIR output is not supported in the Scholar mode Scholar in Kernel Builder Command Line Interface In the Kernel Builder for OpenCL API command line interface add the sc
55. e using OpenCL API Offline Compiler plug in for Eclipse IDE do the following 1 Inthe Eclipse user interface select File gt Save As 2 Enter or select folder to save the file 3 Type the file name and click OK To load OpenCL code from file into the Eclipse IDE code editor do the following Right click the target C C project and select Import Go to General gt File system and click Next Click Browse select the folder with the files you need to import and click OK Select the files you need to import and click Finish i ea Saving Intermediate Representation Code in Eclipse IDE To save the Intermediate Representation code using the OpenCL API Offline Compiler plug in for Eclipse IDE do the following 1 Compile an c1 file using the Offline Compiler plug in for Eclipse IDE 2 Select Intel OpenCL gt Save IR Binary add file name select path and click Save 16 Building and Analyzing with Kernel Builder Kernel Builder for OpenCL API The Kernel Builder for OpenCL API is the standalone version of the OpenCL Code Builder It enables you to build and analyze OpenCL kernels The tool supports Intel processors Intel Graphics and Intel Xeon Phi coprocessors The tool provides full offline OpenCL language compilation which includes OpenCL syntax checker Cross platform compilation Low Level Virtual Machine LLVM viewer Assembly code viewer Intermediate program binary generator Wit
56. ed to use the Setup option each time you start an emulator device OpenCL Device group box enables selecting the target platform and device for the selected machine Intel CPU Intel R Graphics Intel Xeon Phi tm coprocessor Intel CPU on experimental OpenCL2 0 Platform Network Settings group box enables configuring the network port range Configuring Build Options Open the Session Options menu via selecting CODE BUILDER gt OpenCL Kernel Development gt Session Options 93 User Manual OpenCL Code builder for Intel Media Server Studio 2015 The Build Options tab provides several configuration options new _session Session Options Build Options General Options OpenCL Optians Target Build Architectures Use Current Plattonm Architecture Target Operating System Current Operating System Target Instruction Set Advanced Vector Extension AVX Cancel OpenCL Options group box which enables typing the options into the text box Target Build Architecture group box enables Using the current platform architecture Configuring the build architecture manually by unchecking the Use current platform architecture check box and selecting o Select Target operating system Current Operating System Android Operating System available on Windows OS only o Choosing the Target instruction set Streaming SIMD Extension 4 2 SSE4 2 Advanced Vector Extension AVX Advanced Vector Extension AVX2
57. el Development ifs New Session els Ka OpenCL Plat OpenCL Debugger f Open Session OpenCL Appl ication Analysis F Save Session SEALT ts i Build Program Help i dhi Compile Program Session Options Windows t FE Analysis Input ES Setti Migs 1 Variable Ma nagement 2 amp 5 Code Builder Session Explorer 2 Click the Add button Ed in the Code Builder Variable Management dialog and choose Sampler in the opened context menu sampler Varlable Name sampler_1 Addressing Mode CLADDRESS_MIRRORED_REPEAT Filtering Mode CL_FILTER_NEAREST E Normalized Coordinates Selecting Memory Options You can change memory options of buffers or images using Kernel Development Framewokr Refer to the relevant sections of this guide for guidelines on creating or editing variables NOTE You are not limited in selecting options Avoid selecting the option combinations that are forbidden by the OpenCL 1 2 specification otherwise you may encounter errors upon analysis To choose buffers and images memory options do the following 1 Open the variable properties by right clicking an image or buffer variable in the Code Builder Variable Management window and selecting Edit Variable Open the combobox next to Memory flags to use Select options and click Done U N 105 User Manual OpenCL Code builder for Intel Media Server Studio 2015 Memory flags to use Get output butter da
58. elFilter4pp Microsoft Visual Studio Administrator Quick Launch Ctrl Q P 5 x FILE EDIT IEW PROJECT BUILD DEBUG TEAM SQL TOOLS TEST CODE BUILDER ANALYZE WINDOW HELP O iD 8 aa gt Local Windows Debugger Debug Win32 aA BBA Bue a OpenCL Platform Intel R Corporation OpenCL Device Intel CPU TargetArchitechture x86 z Select Kernel SobelFilter bd 5 z Code Builder Session Explorer 1x HAAA A ee SobelFilter cl Code Builder Variable Management vy ax A Fra Se x z E Session session_0 1 files Select Report Execution View z C3 Add C3 Delete amp Delete All Bg 4 9 Session SobelFilter 1 files 4 Buffers o 4 OpenCL Files Best Configuration 512 512 0 4 0 0 Average execution time s 0 7105 4 buffer_0 3 SobelFilter cl Data Type char i 4 Build Artifacts Worst Configuration 512 512 0 1 1 0 Average execution time ms 2 0809 Size 155 B SobelFilter II Source Random Values 9 D 5 2 a i T Measurment Iterations Total Submit Queue Execution 4 Kernels Average 0 79789 O 0063072 0 0005548 0 782239 IO Mode Input 4 45 SobelFilter Median 0 765186 0 003066 0 000292 0 754382 Memory Flags CL_MEM_USE_HOST_PTR 4 Arguments Standard Deviation 0 0745105 0 00781251 0 00052964 0 069475 _private NONE sampler Minimum 0 758032 0 002336 0 000292 0 748688 S Ei Sp Maximum 1 00886 0 028616 0 002044 0 98696 AaS am se S global NONE int
59. enCL Containing Folder Kernel Arguments Once OpenCL program build is completed successfully you are able to see all built kernels with arguments under the Kernels node in the Code Builder Session Explorer 96 Preview Features Pe Session SobelFilter 1 files 4 OpenCL Files sobelFilter cl F3 Build Artifacts al kernels d gb SobelFilter F Arguments Ka _ private MOME sampler_t Sam c _ global READ_ONLY imaged _t Input c _ global WRITE_ONLY image d_t Output C _ global NONE int Mask cl ed ll Code Builder Build Toolbar To show the toolbar go to VIEW gt Toolbars and make sure that the Code Builder Build option is checked WE Bue You can use the Code Builder Build toolbar to perform basic operations on sessions such as Create new session Load session Save session Build session Compile session Open session s settings dialog Analyzing Kernel Performance Using the Code Builder Analysis Toolbar To show the toolbar go to VIEW gt Toolbars and make sure that Code Builder Analysis option is checked Select Kernel No Kernels x Ka You can use the Code Builder Analysis toolbar to perform analysis operations on sessions such as Selecting the OpenCL kernel to execute analysis on Start Analysis Open Code Buidler Analysis Input window Open Code Builder Variable Management windows Analyzing Input To assign analysis inputs for an OpenCL kernel do the following 1 Select the d
60. enCL data type like int4 float16 and so on with a value in each column to satisfy the type size For example for a longs at least eight columns of long numbers should exist in each line The size of the buffer is used as the number of lines to read from csv The csv file may hold more columns or lines than needed for a specific buffer but not fewer e When using binary files the content should be a concatenation of the OpenCL data type and as with using csv files the file may hold more data than indicated by the Size argument NOTE Output buffers do not need a value assigned to them If a value is assigned it is ignored 27 User Manual OpenCL Code builder for Intel Media Server Studio 2015 Create Buffer Variable Name 512 float input I0 Mode Memory Space Data type Size Memory flags to use Get output buffers data Initialization options Input file CSV or binary Use random values Zero the entire buffer See Also Creating Images Creating Samplers Choosing Memory Options Creating Images To create images using Kernel Builder for OpenCL API do the following e Select Analyze gt Variable management Or click cells in the Assigned Variable column of the Analyze Board e Inthe Variable Management dialog click Add In the Select Variable Type dialog choose Image from the Type combo box Use input bitmap files and the parameters to create images Create output images with the co
61. ernel in its designed conditions set a single value e To find the local size that provides higher performance results click Auto or set a list of comma separated values e To improve the analysis accuracy run each global and local work size combination several times by increasing the Number of iterations value Several iterations minimize the impact of other system processes or tasks on the kernel execution time e Use the Device Information appropriate device for the kernel e When running analysis on Experimental OpencL 2 0 Platform you may use local WG size as described in OpenCL 2 0 specification o Local work group size doesn t have to be a divisor of the global WG size o When choosing auto all global work group size devisors and all powers of 2 smaller than the global work group size ran in the analysis dialog to compare device properties and choose the 26 Building and Analyzing with Kernel Builder See Also Creating Variables Managing Variables Creating Variables Creating Buffers To create buffers using Kernel Builder for OpenCL API do the following e Select Analyze gt Variable management Or click cells in the Assigned Variable column of the Analyze Board e Inthe Variable Management dialog click Add e Inthe Select Variable Type dialog choose Buffer from the Type combo box Use csv or binary files random values or zeroes to create buffers e When using csv files each line represents one Op
62. ers aggre wh Chas hh PhS CP MLA RUE RR mmm eee ecg A Er Tene E Ne Neg yee eee Ohara ar Puree genres pm gan CNS 8s GAS Us ORLA CR BORIS REP ee rare elt Irene ee ee ra ence ee q x Show output from Build k rel gt Rebuild All started Project ConsoleApplicationl Configuration Debug Win3 ry l gt stdafx cpp l gt ConsoleApplicationl cpp 1 gt ConsoleApplicationl vcxproj gt c visual studio 20 12 Projects ConsoleApplication1 Debug ConsoleApplicationl exe Rebuild All 1 succeeded failed skipped Using OpenCL Build Properties OpenCL Build properties page in the Microsoft Visual Studio IDE enables you to set compilation flags and change target device when building an OpenCL kernel To change the settings do the following 1 Goto Project gt Properties User Manual OpenCL Code builder for Intel Media Server Studio 2015 2 Click the Intel SDK for OpenCL Applications entry under the Configuration Properties Configuration Active Debug Platform Active Win32 Configuration Manager gt Common Properties Include 4 Configuration Properties Device CPU device CPU General SIMD Default simd default 4 Intel SDK for OpenCL Appl Generate assembly code No General Generate Ivm code No Math piman Generate binary file Mo Warnings Additional build options 3 Modify properties and click OK NOTE The Intel SDK for OpenCL Appli
63. es memory with other arguments Consider the following code kerne avor piri co boba a oae wel resol olor Ia eos a wena IOE Gh Ces opa E aO ET E E E O a leh Rebeka E e Coa all For the code above Scholar provides the following hint message mykernel cl 1 46 Scholar parameter b should be marked as restrict if it never shares memory with other arguments Consider native_ and half_ Versions of Builtins Scholar reports the following math builtins usage as potentially inefficient when the native_ and half_ versions might be used instead e sin e COs o exp e log native_ and half_ versions use hardware instructions directly potentially greatly decreasing the time needed for these calculations The message location is the beginning of the name of the called function and its content is using native_ lt name gt or half_ lt name gt can provide greater performance at some accuracy COSE Consider the following code kerno Caor TEO Ik leyctlwaliahe a ae Ine Gid S oxo fe ovo oban L AO A e ES etleatel For the code above Scholar provides the following hint message 79 User Manual OpenCL Code builder for Intel Media Server Studio 2015 mykerncl cll o 7 ehoar lS tine sala Sin or Nhal f oin can provide oreater Perrormance ar some accuracy Cost Avoid Non Coalesced Memory Access Scholar suggests avoiding non coalesced memory accesses Such memory accesses occur when adjacent work items access non
64. esirable kernel from the session s kernels list in the Code Builder Session Explorer or from the Select Kernel combobox in the Code Builder Analysis toolbar 97 User Manual OpenCL Code builder for Intel Media Server Studio 2015 2 Open the Code Builder Analysis Input window from CODE BUILDER gt Kernel Development Framework gt Windows gt Code Builder Analysis Input or by clicking the Open Analysis Input button in the Code Builder Analysis toolbar 3 Assign a variable for each kernel argument in the Kernel Arguments table by clicking the Click here to assign link under the Assigned Variable column You can assign one dimensional variables Such aS integer float char half and so on on the fly by typing single values into the table See section Creating Variables for details Running Analysis To start the analysis go to CODE BUILDER gt Kernel Development Framework gt Run Analysis or click the button P in the Code Builder Analysis toolbar Viewing the Analysis Results Analysis Results Overview Once analysis is completed several reports are being generated A new report is being generated for each analysis run The reports are available under the Reports node in the Code Builder Session Explorer window a Session SobelFilter 1 files PJ OpencL Files FJ Build Artifacts FJ Kernels d gt Reports SobelFilterO chreport obelFilter Lcbreport obelFilter_2 chreport Each report contains several vie
65. evelopment Ey New Session els el OpenCL Plat OpenCL Debugger Open Session OpenCL Application Analysis Save Session i Platform Info i Build Program Help ol o Compile Program F Session Options Windows Fi Settings 2 Click the Add button Ea in the Code Builder Variable Management dialog and choose I mage in the opened context menu Use input bitmap files and the parameters to create images Create output images with the correct size type channel order and so on NOTE In this version of the tool only 2 dimensional images with CL _UNORM_INT8 channel data type and CL_BGRA channel order are supported 103 User Manual OpenCL Code builder for Intel Media Server Studio 2015 Image Variable Name image_5 10 Mode upu i Data Type imaged t Source Width Height Depth Array Size Row Pitch 0 Slice Pitch 0 Channel Data Type CL UNORM _INTS Channel Order CL BGRA Access Qualifier __write_only Memory flags to use Get output image data Done Cancel The Get output image data checkbox disables reading back the output buffer or image It means that you can try more than one combination of global or local work sizes where there is no need to read the same output for all the combinations Creating Sampler Variables To create new sampler variable 1 Open the variable management dialog 104 Preview Features CODE BUILDER ANALYZE WINDOW HELP OpenCL Kern
66. fter being clicked which does the opposite operation and shows events status per queue e Separate Queues appears when working in Unified mode after clicking Unify Queues and does the opposite to Unify Queues operation which is showing the commands per queue First select the queue from the drop down list under the Save As button then the view updates with the commands that are associated with the selected queue See Also Enabling the API Debugger Problems View OpenCL API Debugger plug in for Microsoft Visual Studio IDE provides the Problems View that summarizes into a single view all errors and warnings that occurred during the execution To access the view select CODE BUILDER gt OpenCL Debugger gt Problems View Problems view Decription i Save As ENES Resource leak Kaaa 1 was not released Data View Image View Problems view Trace View Command Queue 55 User Manual OpenCL Code builder for Intel Media Server Studio 2015 Problems View supports the following features e Displaying warnings and errors of kernel compilation Showing uninitialized kernel arguments each one of them is set by calling clSetKernelArg for each argument e Releasing OpenCL objects in the out of order mode for example when you release a program object before releasing its kernels clReleaseProgram before clReleaseKernel e Resource leaks at the end of the program an error entry is added for e
67. g System Target instruction set Advanced Vector Extension AVX EH Stripped LLVM Replace meaningful names with arbitrary ones orenci Options group box which enables e Typing the options into the text box e Selecting options from the list available on clicking the button To select several options from the list hold Ctrl Or arset Build Architecture group box which enables e Using the current platform architecture e Configuring the build architecture manually by unchecking the Use current platform architecture check box and selecting o Select Target operating system Current Operating System Android Operating System available on Windows OS only o Choosing the Target instruction set Streaming SIMD Extension 4 2 SSE4 2 Advanced Vector Extension AVX Advanced Vector Extension AVX2 Name of the selected instruction set architecture appears in the main window top bar as an indicator next to the file name Kernel Builder Local Intel CPU 64 bit alyze Help Changing the Target Build Architecture options enables viewing assembly code of different Instruction set architectures and generating program binaries for different hardware platforms 22 Building and Analyzing with Kernel Builder NOTE Target Build Architecture options are available for the CPU device only enable Stripped LLVM generation check the Replace meaningful names with arbitrary one checkbox Configur
68. g of which objects are alive released at any given point of time e Showing hierarchy and dependencies of various OpenCL objects API Debugger also reflects the OpenCL objects that exist in memory during application execution Platform Devices Context Buffer and so on Objects Tree AT Sort By L Show Objects o Platform 1 Intel R OpenCL Ee Context 1 BCH Device 1 CPU 4 Program 1 Built db Kernel 1 BitonicSort e 1 theArray fa dir stage So stage passOfStage Se passOfStage te stage passOfStage 7 passOfStage passOfStage tarne Objects Solution Team Ex Class View When creating an OpenCL context for with for example clCreateContext API call the Objects Tree updates immediately with the new context object Objects dim when become released by for example clRelease Use the following buttons to control the Objects Tree view e Sort By enables toggling the way data is displayed o Sort by Context all entities that are associated with a specific context are displayed as context successors o Sort by Device all contexts are displayed as children of the devices e Show Objects enables displaying only a subset of the OpenCL objects Use it when you have a lot of OpenCL objects that are alive at some given moment and you need to see status of only 50 Debugging with Visual Studio Plug in several objects or object types To view o
69. ging DepDugging cj aan een ne nen ee ee ee ee ne ee ee eee ere 45 Legal Information Troubleshooting the Debugger seis its sunt cand aataraciwndedcewdl iat AEEA A EEN aged eae 46 API DeEDUGGING IN ViSUal StudiO sorrera torere boi hacen hic ehh ota hieades Oita leah hal e tanya 46 OpenCL API DEDUOO Cl carterae aaa peae aden tenasascunnck a ta oven cee SDi 46 Enabling the AP DeCDUGQO Cai iscwuccienisertddnacteieaveiwincsccsaolsniendiddnrcioiesescaneneolesivente 47 Trace VEW eA OEA nae o latedaaea nei ueatoundaenscemenaidlctidnieankesaaalee ete 48 ODJ ects TCG VIEW 24 se uedariieka ues cece a caek duane a a Satan de phan eee ee a 50 Properties VIEW acct vous decuiarebeesieddanannanevewbcal dedemeenrebusnengee pune e a a A aa al 51 Command Queue VIEW curso ana A EA E a Ra 54 PFODIGINS 7 VIGW ites ccdaun n ata E TETE E E TEE 55 Hage VEW geront eE EE EEN EEEE EE E EN AEE 56 Data VICW czasccuausaurensensdcaaunde weeutweeaiad NE EEE ENEAN naan SEEE NEAR 60 Memory TraCINO siena a e E E E A EE E E E E AE NA 65 OpenCL Development for Android OS sssssssssun222202222222222022202u20un20unununnnnnnnnnnnnnnnnnnnnnn 66 CONTIGUFING the EAVFONMEN E arenen aaa n EEE E E AEEA ETE ANA N 66 Creating an ANdroid EMUlAtOr e neiirs inansa a ener E OTENE N E E AEE EA 67 Installing OpenCL Runtime on Android Emulator ssssssssssrssrensrrnrrrsrrrerrrerrerrrsrererrrerent 68 Creating an Android ADPICALIO Nacre e E E N AA AA TN 70 PrEVIEW Feature
70. h the Analyze Board of the Kernel Builder you can e Assign input to the kernel and test its correctness Analyze kernel performance based on o Group size o Build options o Device e Perform Deep Kernel Analysis NOTE Intel Graphics support is available on Windows OS only Using Kernel Builder Building and Compiling Kernels To build or compile an OpenCL kernel using the Kernel Builder for OpenCL API do the following 1 Write your code into the code editor or load code from file 2 Click Build or Compile If you succeed the Console window background color turns green otherwise it turns red In case of failure the Kernel Builder reports the number of the problematic line Double click the error line in the Console text box to jump to the relevant line in the code You can save the compiled binary by clicking the Create Program Binary button 17 User Manual OpenCL Code builder for Intel Media Server Studio 2015 See Also Loading Code from File Saving and Loading Code Kernel Builder for OpenCL API enables saving and loading the generated OpenCL LLVM SPIR LLVM Assembly and source code To save the code click the Save As e button and select code type to save H e amp 2 Save Source Ctri Save LLVM As Save SPIR LLVM 32 bit As Save SPIR LLVM 64 bit As Save ASM As Save Session To load OpenCL code from file do one of the following E Click the Open
71. holar command line option For example ioc64 input mykernel cl device gpu scholar The tool prints optimization hints in the following format lt filename gt lt line gt lt column gt Scholar lt message gt Scholar in Offline Compiler for Eclipse To use Scholar in Eclipse 1 Goto Intel OpenCL gt Options 2 Check the Enable Scholar Support check box under the Scholar Configuration group box 3 Build an OpenCL kernel file to see Scholar hints highlighted light blue in the Console View The hints also appear with an info marker in the Problems View An info marker appears in the editor for each Scholar hint Scholar in Offline Compiler for Visual Studio To use Scholar in the Miscrosoft Visual Studio 1 Right click your project and open the project properties 77 User Manual OpenCL Code builder for Intel Media Server Studio 2015 2 Go to Configuration Properties gt Intel SDK for OpenCL Applications gt General 3 Set Generate Scholar Messages to Yes 4 Build the project to see the Scholar hints as warnings for each cL kernel code file of the project The Scholar hints appear in the Output View of the build log as well as in the Error List view NOTE The Intel SDK for OpenCL Applications group appears in the Configuration Properties only if our project is an OpenCL API project See Also Building with Kernel Builder Command Line Interface OpenCL API Offline Compiler plug in for Microsoft
72. i TM Coprocessor Drarget Machine group box which enables selecting the target machine 20 Building and Analyzing with Kernel Builder e Local Machine e Remote Machine To use the Remote Machine option you need to 1 Connect an Android device with Intel processor or an emulator based on Intel x86 System Image 2 Copy OpenCL runtime to the Android device or emulator See section Installing OpenCL Runtime on Android OS Emulator 3 Click Setup to copy OpenCL tools to the device NOTE You need to use the Setup option each time you start an emulator device orenci Device group box which enables selecting the target device for the selected machine e Intel CPU e Intel R Graphics e Intel Xeon Phi tm coprocessor e Intel CPU on Experimental OpenCL 2 0 Platform NOTE Intel Graphics support is available on Windows OS only The selected device options can be found in the program window title Kernel Builder Local Intel CPU 64 bit alyze Help NOTE Select the target device for each Code editor tab separately CPU device is default for all open tabs Configuring Build Options The Build Options tab provides several configuration options 21 User Manual OpenCL Code builder for Intel Media Server Studio 2015 Device Options Build Options Advanced Options OpenCL Options 2 Target Build Architecture Use current platform architecture Target operating system Current Operatin
73. iew retrieves common information per each OpenCL object Command Queue View tracks the execution status of the enqueued commands Problems View summarizing all error and warning messages 46 Debugging with Visual Studio Plug in Image View viSually displays all 2D image objects as bitmaps Data View visually displays buffer data and 2D image pixel arrays on a grid e Save Load session enables capturing a state snapshot of all views of the plug in saving it on disk and also loading the stored sessions e Memory Tracing enables storing OpenCL Images and Buffers content and visually examining either by Bitmap or Grid view the contents of the underlying data associated with the memory object throughout the various API calls that affected it NOTE Concurrent debugging sessions are not supported with the OpenCL API Debugger This includes attaching the debugger to more than one process or opening multiple instances of the Visual Studio and debugging processes concurrently See Also Trace View Objects Tree View Properties View Command Queue View Problems View Image View Data View Memory Tracing Enabling the API Debugger To use the API Debugger do the following 1 Start the Microsoft Visual Studio IDE 2 Goto CODE BUILDER gt OpenCL Debugger gt Options gt API Debugger 3 Check Enable OpenCL API Debugger 4 Insert breakpoints in the application in different OpenCL API calls and then start
74. ilt E db Kernel 1 SobelFilter i sam Sampler 2 Buffer 2 Context 2 Objects Solution Team Ex Class View Double click the Image you need and wait for the Image View to appear with the latest state of the image Image Image 1 History fd Save As ip lagaj Data View Image Vi Problem Trace Vi Comma Properti Properties From the Images drop down select any Image The view displays the image as bitmap 57 User Manual OpenCL Code builder for Intel Media Server Studio 2015 The history drop down enables viewing various states of the selected image where each state is a result of an API call If for instance you create an image with all pixels set to 0 you see on Image creation the following view Image View Image Image 1 Histor 23 clCreatelmage save As Data View Image Vi Problem Trace Vi Comma Properti Properties Now after running the kernel on the selected Image you can observe that it was updated indirectly by clEnqueueNDRange API call therefore causing the kernel to run 58 Debugging with Visual Studio Plug in Image View Image Image 1 r History 43 clEnqueueNDRa d Save As Data View Image Vi Problem Trace Vi Comma Properti Properties Each state is related to the API call that caused the change and is in the following format ID API Call Where ID
75. ing Advanced Options The Advanced Options tab provides several configuration options Options Device Options Build Options Advanced Options L ll amp Nehvork Settings Minium Fort 5010 Hamun Port 5999 E android Support Android Debug Bridge edb Path 1917 SDK PLATFORM TOOLS adb exe cae Oa etwork Settings group box which enables configuring the network port range Banaroia Support text box which enables specifying the path to the Android Debug Bridge adb See Also Configuring the Environment Installing OpenCL Runtime on Android Emulator Configuring Linkage Options To configure device options for linkage of the OpenCL code use the Linkage Options menu of the ie Kernel Builder for OpenCL API Open the Linkage Options menu by clicking Linkage button Gt gt Link Options Configuring Device Options for Linkage The Device Options tab provides several configuration options 23 User Manual OpenCL Code builder for Intel Media Server Studio 2015 Device Options Advanced Options Gi Target Machine Local Machine VEARTOSH MOBL3 O Remote Android Machine OpenCl Device Intel CPU Intel R Graphics 6 Intel R Xeon Phi TM Coprocessor Drarget Machine group box which enables selecting the target machine e Local Machine e Remote Machine To use the Remote Machine option you need to 1 Connect an Android device with Intel processor
76. ing and Compiling Kernels Generating Intermediate Program Binaries The Kernel Builder for OpenCL API enables generating program binaries of OpenCL code An application can use generated program binaries to create program from binaries later clCreateProgramFromBinary 1 Build the code 2 Click the Create Program Binary ss button and select o Create Program Binary o Create linked program s binary IR See Also Building and Compiling Kernels 19 User Manual OpenCL Code builder for Intel Media Server Studio 2015 Linking Program Binaries To link OpenCL program binaries with Kernel Builder for OpenCL API do the following 1 Click the Link dba button 2 Inthe Select IR Files window click Choose Files and select the compiled objects and libraries to link 3 Click Done If the linkage succeeds the Console window background color turns green otherwise it turns red When linkage completes you can save the created executable or library by clicking the Create a ey ar Program Binary button Configuring Options To configure the Kernel Builder for OpenCL API options open the Options menu by selecting Tools gt Options Configuring Device Options The Device Options tab provides several configuration options Device Options Link Options amp Target Machine Local Machine Remote Android Machine E OpenCl Device Intel CPU Intel R Graphics 6 Intel R Xeon Ph
77. int4 variable it turns automatically to 2 2 2 2 For complex types like arrays images and samples use the Variable Managment window which you can open by clicking cells with Click Here To Assign In the Variable Managment window select appropriate variables and click Assign 81 User Manual OpenCL Code builder for Intel Media Server Studio 2015 Select ere to Analyze mran Assign Parameters Kernel Arguments Arg Memory 5pace Access Quailifier Data Type Name Assigned Variable _ global NONE int4 the rray Click Here To Assign _ private NONE uint stage 2468 o _ private NONE uint passOfStage 2 _ private NONE uint dir 2222 You can set group sizes by typing the requested global and local work group sizes in the Workgroup size definition group box on the Assign Parameters tab of the Kernel Debugger NOTE If a kernel contains input buffer argument or input image argument the global and local sizes are set automatically according to the sizes of the buffer image You can change these values manually Workgroup size definitions Global size s Local size s Mi 512 16 Y 512 16 2 g 0 See Also Using Kernel Builder Kernel Debugger Controls You can control the debugging process using the Debug tab of the Kernel Debugger The debugger control panel contains several buttons that you can use to control the debugging process Using step over and continue commands you can perform kernel debugging in three
78. ioe Build Program Help i al 0 Compile Program Session Options Windows F Z Analysis Input E Setti NGS 1 Variable Ma nagement RS Code Builder Session Explorer 2 Click the Add button 4 in the Code Builder Variable Management dialog and choose Buffer in the opened context menu Use csv or binary files random values or zeroes to create buffers e When using csv files each line represents one OpenCL data type like int4 float16 and so on with a value in each column to satisfy the type size For example for a long8 at least eight columns of long numbers should exist in each line The size of the buffer is used as the number of lines to read from csv The csv file may hold more columns or lines than needed for a specific buffer but not fewer e When using binary files the content should be a concatenation of the OpenCL data type and as with using csv files the file may hold more data than indicated by the Size argument NOTE Output buffers do not need a value assigned to them If a value is assigned it is ignored 102 Preview Features Buffer Variable Mame l0 Mode Data Type Size Memory flags to use Get output butter data Initialization options Input file CSV or binary O Use random values Zero the entire buffer Creating Image Variables To create a new image variable 1 Open the variable management dialog CODE BUILDER ANALYZE WINDOW HELP OpenCL Kernel D
79. ired on Android devices and emulator To make the Android device be accessible without root permissions 1 Identify the Intel devices by running lsusb command for example tS exe ClUletinate tr gt lsusb Output reduced Bus 00S Device 00S ID S027 0a Intel Coro 2 Following the example above you can either change the ownership of the device file and or give permissions to the file o Change ownership of the device file to the desired user and group via the following command sudo chown USER GROUP dev bus usb 003 008 where USER and GROUP are the target user and group to have permissions to the device o Give permissions to everyone Sudo chmod 666 dev bus usb 003 008 Udev configuration files should be edited to enable full permissions without sudo 66 OpenCL Development for Android OS 3 Edit any file s that conform to the following convention etc udev rules d N android rules and append the following line SUBSYSTEM usb ATIRS idVendon s087 ATTRS idProduct 0a21 MODE 0666 If nO android rules file are present in etc udev rules d create the following file etc udev rules d 51l android rules 4 Next step enables read and write opetations on an Android device Call adb root and then call adb remount See Also Installing OpenCL Runtime on Android OS Creating an Android Emulator To create a new Android emulator 1 Run Android SDK Manager from lt Android_SDK_I
80. lable switch to the Basic Settings tab and check the Enable OpenCL Kernel Debugging check box Troubleshooting the Debugger In case of issues with kernel debugging 1 Set the following environment variables TUTETE C DECI C lhl Och DSC shOCunmii es remo e st 2 Restart the Microsoft Visual Studio IDE 3 Continue debugging Using these environment variables you generate a log file Use it to determine the root cause of the issue You can submit the generated log at http software intel com en us forums intel opencl sdk API Debugging in Visual Studio OpenCL API Debugger The interface of the Microsoft Visual Studio IDE provides standard debugging capabilities for the host side of OpenCL applications while the OpenCL Debugger plug in of the Code Builder enables debugging OpenCL kernels The stitch between simultaneous debugging of OpenCL kernel and host application might be complicated in different stages API Debugging feature of the Code Builder Debugger plug in for Microsoft Visual Studio covers the stitch The API Debugging feature enables monitoring and understanding OpenCL environment of applications throughout execution The feature supports the following e API Tracing lists a trace of all OpenCL API calls that occurred during the execution list of trace arguments return values and execution time OpenCL Objects View shows all OpenCL objects that exist in memory during the execution Properties V
81. levels e Work item level e Work group level e Kernel level 82 Preview Features Work Item Level On the work item level the Debugger runs commands for a single work item Click the ean mo nn Click the button or push F9 to use the continue command for the selected work item Work Group Level On the work group level the Debugger runs commands for a selected work group For example if the local work group size is 10 the debugger runs 10 work items that belong to the selected work group Click the button or push F6 to use the step over command for the selected work group Click the button or push F10 to use the continue command for the selected work group Kernel Level On the kernel level the Debugger runs commands for the whole set of work items as defined in the global size Click the button or push F7 to use the step over command for all work items Click the button or push F11 to use the continue command for all work items Finish the debugging session by clicking the button or pushing Ctri F5 NOTE Any combination of commands on different levels is possible during debug session See Also Using Kernel Builder Selecting Work Items and Work Groups to Debug You can select a work item to debug via e Selecting the global work item 1 Select the Select Work Item box 2 Select the requested global work item 3 Click Select e Or via selecting a local work group and
82. lysis Analyzing OpenCL Kernel Performance To analyze OpenCL kernel performance with the Kernel Builder for OpenCL API do the following 1 Click the Analyze 2 Click Refresh kernel s to get the list of kernels in the currently open c1 file 3 Select the target kernel from pull down menu If only one kernel is available it is selected by default 4 Click cells in the Assigned Variables column to create or add variables as kernel arguments You can assign one dimensional variables Such aS integer float char half and so on on the fly by typing single values into the table See section Creating Variables for details 5 Set number of iterations global size and local sizes per workload dimension in the Workgroup size definitions group box 6 Click Analyze to wrap a specific kernel and execute analyses You can use the local size s text boxes for several different test configurations Set single size value for a single test Add several comma separated sizes for multiple tests Set 0 to utilize the default framework assigned local size Click Auto to enable the Kernel Builder iterate on all sizes that are smaller than global size and device maximum local size Workgroup size definitions Global size Local sizets Sio 1024 a Auto Y 1024 Autko Auto Zi 1024 1 2 3 64 ato Number of iterations i Also consider the following e Using each option is available for each dimension To analyze the k
83. mown O E g Struct Name PENA struct Types Type Name 1 char ia E 2 uchar b E3 After defining the struct you can select is as type when creating a buffer variable 30 Building and Analyzing with Kernel Builder I0 Mode Data type Size Memory flags to use Get output butters data Initialization options Input file CSV or bin Use random values Zero the entire buffer A csv file for a struct buffer should have the following format e Line numbers should be greated or equal to the buffer size e Each line should contain all concatenated data fields For example EVpeCder Seruce Poine LNE X IROA cloar values For a buffer of size 4 the csv file contains Oy ley So iG ee I Cee IO lore O70 4 52 Zero and random values are available as with regular type buffers You can edit a struct In such case any buffer using the struct reinitializes with the new data 31 User Manual OpenCL Code builder for Intel Media Server Studio 2015 You can delete a struct as long as other structures or buffer variables do not use it When working with uniform variables fill the values in the pop up dialog for every field to insert values for the struct For example Arg Memory Space Access Quailifier Data Type Mame Assigned Variable 1 _global MONE point out Click Here To Assign 2 _ global MONE uint structsize Click Here To Assign p
84. mp Outputsl2_1 512_2 img 0 016352 0 gls 512 0 giz 512 0 gls 512 0 gls 512 0 l 512 0 gl 512 0 Variable Management Variable Management Overview You can manage variables in Kernel Development Framework via the Code Builder Variable Management dialog To open the dialog go to CODE BUILDER gt Kernel Development Framework gt Windows gt Variable Management or click the Variable Management button In the Code Builder Analysis toolbar 100 Code Builder Variable Management 4 Add CA Delete Delete All 4 Buffers Data Type char size 155 source Random Values TO Mode Input Memory Flags CL_MEM_USE HOST_PTR d mages l Ee image_l d ejirmmage_1 Data Type imaged t Width 5123 Height 5125 Depth 1 Array size 1 Row Pitch 0 slice Pitch 0 Channel Data Type CLUNORM_INTS Channel Order CL_BORA IO Mode Output Memory Flags CLMEM_COPY HOST_PTR b Ee image_2 b ke image_3 b e image_4 d Samplers 4 sampler Normalized Coordinates false Addressing Mode CL_40DRESS_ MIRRORED REPEAT Filtering Mode CL_FILTER_WESREST Creating Buffer Variables To create new buffer variable 1 Open the variable management dialog Preview Features 101 User Manual OpenCL Code builder for Intel Media Server Studio 2015 CODE BUILDER ANALYZE WINDOW HELP OpenCL Kernel Development ifs New Session els Ka OpenCL Plat OpenCL Debugger Open Session OpenCL Application Analysis e ij Platform Info
85. n delete all buffers images or samples by right clicking the corresponding node Buffers Images or Samplers respectively 106
86. nch 4 Your application starts and the profiler starts to collect data 5 Exercise the functionality that might contain performance issues 6 While the application is running a new Session Run tab is opened in the main Visual Studio window 7 Click Pause Resume analyze button in the Session Run tab to pause or resume data collection 8 Click Close analyze or close the application 85 User Manual OpenCL Code builder for Intel Media Server Studio 2015 Ee OpenCL Analyze Session oO eS Application Setting Which application would you like to analyze Application Arguments Working Directory m Start Automaticly on Process Launch o Application full path to the target application Arguments command line arguments to use when starting the target application o Working Directory working directory for the target application to be started If no working directory is specified the default is the directory that contains the target application O Analyzing the Data After you finish running the application the new analyze session that you created appears in the Analyze Explorer window and the following reports are generated and appear in the main Visual Studio window e API Call lists statistics of calls made to the OpenCL API including the number of times the API call was called the number of times error returned and statistics on the elapsed time each API call took while executing
87. nstall gt sdk tools android bat 2 In Android SDK Manager select Tools gt Manage AVDs and define new emulator 67 User Manual OpenCL Code builder for Intel Media Server Studio 2015 Edit Android Virtual rae kest_emulator 4 7 WXGA 1280 x 720 xhdpi Android 4 2 2 API Level 17_ Intel Atorn x26 Keyboard Hardware keyboard present Skin Display a skin with hardware controls Front Camera None i Back Camera None Memory Options RAM 512 VM Heap 128 Internal Storage SD Card Emulation Options Snapshot Use Host GPU Chrernde the easing AND with the same name To run the created emulator use the following command GN ocheoiwe SDK tostelil gt sdk tceols eumlatoe exe aycd test _ emulator oaceLclen size 1024 Parent topic Developing OpenCL Applications for Android OS Installing OpenCL Runtime on Android Emulator To install the Intel OpenCL runtime on Android Emulator using script do the following 1 Goto the android preinstall subfolder of the Intel SDK for OpenCL Applications 2014 installation folder 2 Use the OpenCL_Android_Install script to configure the emulator or Android device or use the following options to start the emulator manually 68 OpenCL Development for Android OS o On Ubuntu OS OpenCL_Android_Install h The script requests root password o On Windows OS oOpencL_Android_Install d lt your device emulator gt NOT
88. oint pointfink x 1 pointiint oO pointiFloat value 3 56 mre NOTE You must define structs with the same names as used in the code to enable the Kernel Builder to assign a variable to the argument See Also Creating Variables Editing Variables Choosing Memory Options You can change memory options of buffers or images using Kernel Builder for OpenCL API Refer to the relevant sections of this guide for guidelines on creating or editing variables NOTE You are not limited in selecting options Avoid selecting the option combinations that are forbidden by the OpenCL 1 2 specification otherwise you may encounter errors upon analysis To choose buffers and images memory options do the following 1 Open the variable properties by right clicking an image or buffer variable in the Variables Management window 2 Click the button next to Memory flags to use 3 Select options and click Done 32 Select d_mem_flag to use Building and Analyzing with Kernel Builder Memory options CL_MEM_READ WRITE CL _MEM_WRITE_ONLY CL_MEM_READ ONLY ICL MEM_USE_HOST PTR CL MEM_ALLOC HOST PTR L_MEM_COPY_HOST_PTR L MEM HOST READ ONLY L MEM_HOST_NO_ACCESS CL MEM_HOST_WRITE_ONLY C See Also Creating Variables Editing Variables Editing Variables To edit the variables in the system using the Kernel Builder for OpenCL API do the following L 2 3 4 Select Analyze gt Variable man
89. on Ey Create Code Builder Session e Anew Session is created and becomes available in the Code Builder Session Explorer dialog Saving and Loading Sessions To save your session go to CODE BUILDER gt Kernel Development Framework gt Save Session Or click the Save Session button in the Code Builder Build toolbar menu New sessions are saved under the New Session Default Directory defined in the Kernel Development Framework s Settings See Kernel Development Framework Settings chapter on how to change these settings 91 User Manual OpenCL Code builder for Intel Media Server Studio 2015 To load a saved session do the following 1 Goto CODE BUILDER gt Kernel Development Framework gt Load Session Or click the Load Session button in the Code Builder Build toolbar menu 2 Select the session to load in the Open File dialog and click Open Removing Sessions To remove a session from the Code Builder Session Explorer dialog right click the session that you want to remove and select Remove Session Keep local files Configuring Sessions e To configure the session open the Session Options menu by selecting CODE BUILDER gt Kernel Development Framework gt Session Options The Session Configuration window enables you to define e Target device to perform build or analysis operations e Build options e Target platform architecture Code Builder Configuration Toolbar You can control some of the Session s option
90. or an emulator based on Intel x86 System Image 2 Copy OpenCL runtime to the Android device or emulator See sections Installing OpenCL Runtime on Android OS Emulator and Configuring the Environment 3 Click Setup to copy OpenCL tools to the device NOTE You need to use the Setup option each time you start an emulator device orenci Device group box which enables selecting the target device for the selected machine Intel CPU Intel R Graphics Intel Xeon Phi tm coprocessor Intel CPU on Experimental OpenCL 2 0 Platform 24 Building and Analyzing with Kernel Builder NOTE Intel Graphics support is available on Windows OS only The selected device options can be found in the program window title Kernel Builder Local Intel CPU 64 bit alyze Help NOTE Select the target device for each Code editor tab separately CPU device is default for all open tabs Configuring Link Options The Link Options tab provides several configuration options Link Options Advanced Options OpenCL Options orenci Options group box which enables e Typing the options into the text box e Selecting options from the list available on clicking the button To select several options from the list hold Ctrl See Also Configuring the Environment Installing OpenCL Runtime on Android Emulator 25 User Manual OpenCL Code builder for Intel Media Server Studio 2015 Kernel Performance Ana
91. penCL Appl SIMD Default simd default General Generate assembly code Yes asm eee Cipla alione Generate Ilvm code No hamri f Generate binary file No Command Line ee a E E 4 Click OK After the build you can open the generated assembly file in the Visual Studio editor by double clicking the message in the Output view Output 1x Show output from Build Z ER n l gt Build succeeded ae l gt ct wisual studio 2012 Projects ConsoleApplication1l ConsoleApplicationl Debug OpenCLFile asm Generated assemt l gt ct wisual studio 2012 Projects ConsoleApplication1l ConsoleApplicationl Debug OpenCLFile out Generated build l gt ConsoleApplicationl vexproj gt c visual studio 276127 Projects ConsoleApplicationl Debug ConsoleApplicationl e 4 e Generating and Viewing LLVM Code OpenCL API Offline Compiler plug in for Microsoft Visual Studio IDE enables generating LLVM representation of the OpenCL code To enable generating and viewing LLVM code do the following 1 Goto Project gt Properties 2 Click Configuration Properties gt I ntel SDK for OpenCL Applications gt General 3 Change the Generate LLVM Code option to Yes Configuration Active Debug Platform Active Wins2 Configuration Manager 4 Intel SDK for OpenCL Appl Include General Device CPU device CPU Math Optimizations SIMD Default simd default Warnings Generate assembly code No Command Line Generate lym code Yes llvm b Code Analysis Genera
92. penCL devices altogether To enable GDB debugging of an OpenCL kernel in the build options string parameter in the clBuildProgram function 1 Add the g flag 2 Specify the full path to the file s lt full path to the OpenCL source file gt NOTE Relative path to the CL file is not supported Enclose the entire path with double quotes if the path includes spaces For example err clBuildProgram lt your_cl_program_name gt 0 NOR E ENS ae a eoo E e o Ss G er NOL E NULL 3 Invoke your application that executes the target OpenCL kernel in GDB oa patar EO cl 6 cla cum lt cloommMcina e cuacte 41 User Manual OpenCL Code builder for Intel Media Server Studio 2015 4 Place a breakpoint in the host application after compiling the OpenCL code and then execute the kernel Consider using clEnqueueNDRangeKernel 5 Once you hit the breakpoint place another breakpoint in the target kernel and issue a run command gdb b square Broakpoant gt ar Ox 00000 ss Filer 6 Continue the run until the GDB stops inside the kernel and then query the symbols gaby ee 1 __kernel void square 2 o e ine Aoo 2 ee Ere EDL E 4 const unsigned int nElems 6 int index get_global_id Q0 7 if index lt nElems 8 Se e Ene S a a e e a o e E oea 2 FO gdb p nElems e ad GPAD ENA 40 SZ na gdb 7 You can also examine the call stack and variables in the calling frames Fo
93. r example SdP lone 0 square input Ox3t7e3ce0 cutpurt Uxseced900 nElems 1024 at Simple _sgquare cl 6 TA Osc OOOO VE 7 UC O CO Ee tint ss are 42 OpenCL Debugger for Linux OS To Ox00007 think eA paR a wivwokekernel params SIze pParameters pEntryPont at ii gbd When the kernel compilation completes and GDB receives a notification of the kernel code the GDB stops inside a kernel After that you can find the source files GDB recognizes including the files that contain the OpenCL kernels by issuing the i sources command to GDB The path is the full route to the OpenCL source file provided with the s flag while building the kernel During the debugging session all work items execute simultaneously which means that different work items hit a breakpoint multiple times To examine a specific segment of code for a single work item you should manually insert a condition on get_global_id 43 Debugging with Visual Studio Plug in OpenCL Debugger OpenCL Debugger plug in for Microsoft Visual Studio IDE enables debugging OpenCL kernels using the Microsoft Visual Studio software debugger GUI The Debugger enables debugging host code and OpenCL kernels in a single Microsoft Visual Studio debug session Debugger supports existing Microsoft Visual Studio debugging windows such as Breakpoints e Memory view Watch variables including OpenCL types like float4 int4 and so on e Call stack Auto
94. rogram Progr CL SUCCESS 17 48 21 218 26 cIReleaseKernel Kernel CL_ SUCCESS 17 48 21 215 5 clReleaseMemObject Bu fe _SUCCESS 17 48 00 7757 l 24 cIReleaseMemObject Bu CL_SUCCESS 17 48 00 757 Data View Image View Problems wiew Trace View Command Queue Use the following buttons to control the view e Save enables saving the current state of all views with live OpenCL objects API trace command queue and so on o to either a binary file trace that can be later loaded with the Load Session button o or you can export a list trace of all API calls into a csv file e Load Session enables restoring the state of the views from a previously saved trace file either using Save As or Generate trace file option in the API Debugger settings 48 Debugging with Visual Studio Plug in NOTE This feature is available only when Visual Studio IDE is not in debug mode as views are synced with the application you debug e Success Errors enables filtering successful or failed API calls e API Display Mode toggles between views o Function name only o Function name and arguments o Function name with argument names and values lay Mode nction names only Program 1 num_device e context Context 1 c Functions with arguments Functions with arguments n
95. roject template for Android devices See Also Creating an empty OpenCL Project Create a new OpenCL project from OpenCL project template Creating an Empty OpenCL Project for Windows To create an empty OpenCL project for Microsoft Visual Studio IDE do the following 1 Goto File gt New gt Project 2 Select OpenCL templates from the Templates tree view a 5 eVa o O O T ala b Recent NET Framework 4 5 Sort by Default Search Installed Templates Ctrl E p 4 Installed CodeBuilder Project for Windows Visual C Type Visual C 4 Templates An OpenCL Project b Visual Basic 4 Empty OpenCL Project for Windows Visual C b Visual C 4 Wienal Cie 3 Select Empty OpenCL Project for Windows 4 Fill the Name Location and Solution name fields and click OK Create a New OpenCL Project from OpenCL Project Template for Windows To create an OpenCL template project for Windows platforms in Microsoft Visual Studio IDE do the following 1 Goto File gt New gt Project 2 Select OpenCL templates from the Templates tree view 3 Select Code Builder Project for Windows 72 iam Preview Features NET Framework 4 5 Sort by Default FF Search Installed Templates Ctrl E P 4 Installed f s CodeBuilder Project for Windows Type Visual C 4 Templates An OpenCL Project b Visual Basic Empty OpenCL Project for Windows Visual C b Visual C 4 Wievesl a
96. rrect size type channel order and so on 28 Building and Analyzing with Kernel Builder Create Image Vanable Name output_bitmap Access Qualifier Data type imagezd t Height 430 Channel Data Type Channel Order Access Mode Get output image data Width 4g The Get output image data checkbox disables reading back the output buffer or image It means that you can try more than one combination of global or local work sizes where there is no need to read the same output for all the combinations See Also Creating Buffers Creating Samplers Choosing Memory Options Creating Samplers To create samplers using Kernel Builder for OpenCL API do the following e Select Analyze gt Variable management Or click cells in the Assigned Variable column of the Analyze Board In the Variable Management dialog click Add e Inthe Select Variable Type dialog choose Sampler from the Type combo box Create Sampler Variable Name Addressing Mode Filtering Mode Normalized Coordinates 29 User Manual OpenCL Code builder for Intel Media Server Studio 2015 See Also Creating Images Creating Buffers Using Structs Kernel Builder for OpenCL API supports user defined structs To use structs for kernel analysis you need to define them Go to Analyze gt Struct Management Choose data type and enter fill name Click Add to add a new field Click OK to save the created field a ji
97. s clGetDevicelInfo 51 User Manual OpenCL Code builder for Intel Media Server Studio 2015 Command Queue Events Properties To view properties for an OpenCL command queue event do the following 1 Select left click an event from the Command Queue View window Objects Tree 4 Sort By T Show Objects o Platform 1 intel R OpenCL T Context 1 E Device 1 CPU FA CommandQueue 1 In Order eC Program 1 Built d le Kernel 1 ToneMappingPerPixel inputlmage A ilma geWidth Ua ai Buffer 1 Butter 2 Buffer 3 Objects Tree Solution Explorer Team Explorer Class View 2 Open the Properties view Properties View Buffer 1 4 Basic Information Reference Count 0 Key 6B1DA8 4 Other Information Memory Type CL MEM_OBJECT_BUFFER Flags 0 CL_MEM_READ_ONLY 1 CL_MEM_USE_HOST_PTR Size Bytes 30720000 Host Pointer O08 CDO080 Map Count 0 Memory Type Not Available Properties View Properties 52 Debugging with Visual Studio Plug in The Command Queue Events Properties view is an alternative to retrieving execution time by adding the CL_QUEUE_PROFILING_ENABLE parameter to clCreateCommandQueue when creating the command queue to which the commands are enqueued and then querying the enqueued events execution times using clGetEventProfilingInfo To view properties for an OpenCL command queue event 1 Select left click some event from the
98. s sraa a a aa aaa e aaa aiaia 72 OpenGL NeW Projecte Wizard rarotirs inneni aa A OAE UO ETE EAN ANA 72 About the OpenCL New Project Wizard s ssssssssssrrsrrrsrrrerenrresrrrsrrrrrrrrrrerrrerrrerere 72 Creating an Empty OpenCL Project for WiNdOWS ssssssssrssrrrsrrnerrnrrrerrrerrerrrsrrrerne 72 Create a New OpenCL Project from OpenCL Project Template for Windows 72 Create a New OpenCL Project from OpenCL Project Template for Android 74 ore a S e S 6g 0 gaia Rene attr eer Weer eee ta ne te een Ten rate er nee ee eee eee 76 ADOUL OpenGL T SENO area a a i eades eee eres teace ae teaces thera etewereeks 76 EnanlingvOpenGle SCnOlal aitaa a aa dubs a a aa aAA 77 OPencL S Cholar HIMES sueina aeniea aa A a E A E geen ceases 78 Debugging Kernels on Intel Graphics sarnriieiisern teie e E E Aa 80 ADOUE Kennel DCDUGO Ci s oiif a E a a uuie oe ciak one 80 ASSIGNING Debug ParaMelers ivesietccividesesecntedeancreznwuwesallgad ubieuaewtecedeenduee weenewneseniebeayenn 81 Kernel Debugger Controls aliere iaa E E E E E AE E A 82 Selecting Work Items and Work Groups to Debug s sssssrsssrrsrrrsrrrerrrrrrsrrrerrrerrerrrene 83 Watching Variables and Kernel Arguments s ssesrssrrsrrrsrrrsrrrrrenrrrsrrrerrrrrrerrrerrrsrene 84 OpenCL AnalysiS TOO vewsiennierereds aiin a eE E E E E A A EAEE 85 ADOUt the OpenGL Analyze TOOL aesae E RR ues A A RD 85 Creating and Launching New Analy
99. s through the Code Builder Config toolbar To show the toolbar go to VIEW gt Toolbars and make sure that Code Builder Config is checked OpenCL Platform Intel R Corporation OpenCL Device Intel CPU Target Architechture x86 is The Code Builder Config toolbar enables you to Select the target OpenCL Platform Currently only Intel s platform is supported Select the target OpenCL Device Select the target platform architecture Show the platform info dialog Configuring Device Options Open the Session Options menu via selecting CODE BUILDER gt OpenCL Kernel Development gt Session Options The Device Options tab provides several configuration options 92 Preview Features new _session Session Options Device Options Build Options General Options Target Machine Local Machine VKARTOSH MOBL3 Remote Android Machine Fe OpenCL Device OpenCL Platform Intel R Corporation OpenCL Device Intel CPU Network Settings Minimum Port Maximum Fort Cancel g m Target Machine group box enables selecting the target machine e Local Machine e Remote Machine To use the Remote Machine option you need to 1 Connect an Android device with Intel processor or an emulator based on Intel x86 System Image 2 Copy OpenCL runtime to the Android device or emulator See section Installing OpenCL Runtime on Emulator 3 Click Setup to copy OpenCL tools to the device NOTE You ne
100. t e gpu Intel Graphics device e co Intel Xeon Phi coprocessor device e cpu_2_0 Intel CPU device on Experimental OpenCL 2 0 Platform Set target operating system if it is different from current android use with cpu device only The command is supported only in 32 bit version of the tool Selects target instruction set architecture Available on CPU device only The following instruction set architectures are available e sse42 Streaming SIMD Extensions 4 2 e avx Intel Advanced Vector Extensions Intel AVX e avx2 Intel Advanced Vector Extensions 2 Intel AVX2 Writes build log into the output_file_path When this option is specified the build log does not appear in the command line Generates assembly code Generates LLVM code Generates 32 bit LLVM SPIR code Generates 64 bit LLVM SPIR code Generates intermediate representation binary Generates 32 bit SPIR code Generates 64 bit SPIR code Enables performance hints Adds comma separated build options OpenCL Debugger for Linux OS OpenCL Debugger for Linux OS enables debugging OpenCL kernels with the GNU Project Debugger GDB NOTE Debugger supports kernel debugging on CPU device only To debug OpenCL kernels with the Debugger you need the GNU Project Debugger GDB version 7 3 1 or higher with Python support Directly link your application to libpthread so Do not use LD_PRELOAD since LD_PRELOAD fails loading the Intel O
101. t it shown in the Trace View When selecting a memory object from the drop down list or alternatively selecting a memory object state the Trace View automatically highlights the API call that is related to that state 63 User Manual OpenCL Code builder for Intel Media Server Studio 2015 Trace View led Save o gt Load Session a SUCCESS x Errors Filter a Return Value 28 clEnqueueNDRangeKernel CommandQue CL_SUCCESS 00 39 37 529 27 clFinish CommandQueue 1 CL SUCCESS clEnqueueNDRangeKernel CommandQue CL SUCCESS 25 clSetKernelArg Kerel 2 2 4 1CFDEC CL_SUCCESS 24 clSetKernelArg Kernel 2 1 8 1CE3D8 CL SUCCESS clSetKernelArg Kernel 2 0 8 1CE3B8 CL_SUCCESS clSetKernelArg Kernel 1 1 4 1CFDEC CL_SUCCESS 21 clSetKernelArg Kernel 1 0 8 1CESD8 CL SUCCESS Data View Image View Problems wiew Trace View Command Queue Properties View Properties The number of states to save per each memory object Image Buffers and SubBuffers can be configured via CODE BUILDER gt OpenCL Debugger gt API Debugger gt Images amp Buffers gt Number of previous states Code Builder Debugger Configuratio Stings Advanced Setings API Debugger Enable OpenCL AFI Debugger Images amp Buffers Enable Dumping Images Enable Dumping Raw Data Number of previous states 5 73 i Other settings Auto generate session Output Folder C Users lt you_account gt Docur
102. ta E CL MEM_WRITE_ONLY E CL MEM_READ ONLY CL MEM_USE HOST PTR CL MEM_ALLOC HOST PTR CL MEM_COPY_HOST FTR CL MEM_HOST WRITE_ONLY CL MEM_HOST READ ONLY CL MEM_HOST_ NO ACCESS Tr T Initialization options Input file CSV or bin Use random values Zero the entire buffe Editing the Variables To edit the variables in the system using the Kernel Development Framework do the following Open the Code Builder Variable management window Right click a variable name Click Edit Variable Change the desired properties and click Done PMD Viewing Contents of the Variables To view buffer or image contents when using the Kernel Development Framework do the following 1 Open the Code Builder Variable management window 2 Right click a buffer or image name you want to view 3 Click View Variable Copying Variables To create a copy of buffer image or sampler varialbe when using the Kernel Development Framework do the following 1 Open the Code Builder Variable management window 2 Right click a buffer image or sampler name you want to copy 3 Click Copy Variable Removing Variables To delete variables when using the Kernel Development Framework do the following 1 Open the Code Builder Variable management window 2 Right click a variable name 3 Click Delete variable or Delete all variables You ca
103. te binary file No After the build you can open the generated LLVM file in the Visual Studio editor by double clicking the message in the Output view Output IX Show output from Build z SBE n 1 gt Build succeeded A 1 gt c visual studio 2612 Projects ConsoleApplication1l ConsoleApplication1 Debug OpenCLFile 11 Generated assemt l gt ct visual studio 2612 Projects ConsoleApplication1l ConsoleApplication1 Debug OpenCLFile out Generated build l gt ConsoleApplicationl vcxproj gt c visual studio 2612 Projects ConsoleApplication1 Debug ConsoleApplicationl e Build 1 succeeded failed up to date skipped 4 l 11 User Manual OpenCL Code builder for Intel Media Server Studio 2015 Generating Intermediate Program Binaries with Offline Compiler Plug in OpenCL API Offline Compiler plug in for Microsoft Visual Studio IDE generating program binaries of the OpenCL code An application can use generated program binaries to create program from binaries later clCreateProgramFromBinary To generate intermediate program binaries do the following 1 Goto Project gt Properties 2 Click Configuration Properties gt I ntel SDK for OpenCl Applications gt General 3 Change the Create Program Binary option to Yes Configuration Active Debug Platform Active Win32 Configuration Manager gt Common Properties Include 4 Configuration Properties Device CPU devi
104. vices in Microsoft Visual Studio 2012 only do the following 1 Goto File gt New gt Project 2 Select OpenCL templates from the Templates tree view 3 Select CodeBuilder Project for Android i b Recent NET Framework 4 5 Sort by Default X Sai Search Installed Templates Ctrl E Pp T Visual C s CodeBuilder Project for Android Visual C ype Visual C 4 Templates An OpenCL Project b Visual Basic CodeBuilder Project for Windows Visual C b Visual C 4 Visual C Empty OpenCL Project for Windows Visual C ATI Fill the Name Location and Solution name fields and click OK In the Code Builder wizard for OpenCL API dialog you can select the basic settings for the behavior of the OpenCL application and kernel The parameters that can be set are platform name device type kernel type images or buffer manipulation build options and local work group size behavior Each field has a short tool tip explanation a 74 Preview Features Basic Settings Platform Name Intel Device Type CPL Create Kemel with Images Create Kemel with Buffers a Previous Click Finish to create the default template project or click Next to open the Advanced Settings screen enabling you to set some advanced options like whether to enable profiling queue and the kernel s arguments memory source type For CPU device type you can also set the out of order execution mode 75 User Manual OpenCL Co
105. view Features OpenCL Analysis Tool About the OpenCL Analyze Tool OpenCL Analyze Tool is a preview feature that provides basic performance information for OpenCL applications The Analyze Tool enables to collect trace data of OpenCL APIS OpenCL kernels and OpenCL memory operations You can use the Analyze Tool to find out the time of execution the frequency and the work size data of each OpenCL kernel that was launched during your program s execution You can also find statistics of all OpenCL API calls and data about memory commands executed in your program When you use the Analyze Tool you create an Analyze Session which contains the configuration data for collecting performance information and the results of the analyze run You can explore all the analyze sessions that you created in the Analyze Session Explorer window Analyze Sessions Explorer ix 4 Profiling Sessions 4 BrtonicSort_20140728 d capture capture_l capture_2 capture_s BitonicSort_20140728 1 BitonicSort_20140728_ 10 Parent topic Preview Features Creating and Launching New Analyze Session To create and run an Analyze session do the following 1 Goto CODE BUILDER gt OpenCL Application Analysis gt New Analyze Session 2 Inthe OpenCL Analyze Session dialog specify information about the application that you want to analyze 3 Make sure that the Start Automatically on Process Launch check box is selected and then click Lau
106. work item 83 User Manual OpenCL Code builder for Intel Media Server Studio 2015 1 Select Select Local Work Group box 2 Select the requested local work group and local work item 3 Click Select Select Work Item E Select Local Workgroup Global Work Item Local Work Group Local Work Item X o3 3 X lo AERE a3 Y o 0 Y 0 al ojo 0 Zi 0 Select z 0 lo lo T o Select Upon selecting the global work item the corresponding local work group and local work item entries appear in the Local work group box and vice versa You can change the selected work item or work group during the debug session via selecting the requested work item or work group and clicking Select Work item and work group dimensions availability is determined by the group size set in the Assign Parameters tab of the Kernel Debugger debug board If the kernel is one dimensional the X value is bigger than 0 while Y and Z are set to 0 then only X axis is available when selecting work item or work group See Also Using Kernel Builder Watching Variables and Kernel Arguments The Watch Variable box contains variable names and values used by the kernel being debugged Watch Variables Variable Coords fSobel horizontal Buffers and images passed as kernel arguments appear in the Arguments box Mame input_image output_image Click any variable name to see its content See Also Using Kernel Builder 84 Pre
107. ws e Execution View provide information on execution times statistics and on the best and worst configurations e Variables View provide information on the read and read back time of the memory object being used in the kernel and allows you to see their content You can toggle between the views through the Report Selection combobox located at the top of the report s layout Execution View The top part of the Execution View enables you to see the tested global and local size best and the worst configurations based on median execution time In case only one configuration exists the result appears in both result windows The table below enables you to see statistical analysis results for all configurations The statistics consists of the following iteration execution time values for the selected configuration Median Average Standard deviation Maximum Minimum 98 Preview Features Expending each row in the table enables you to see the total run time the breakdown to queue submit and execute times per iteration for the given configuration SobelFilter_O cbreport 12 512 0 40 05 Average execution timetmsy 0 703660 Best Configuration Worst Configuration Gx Gy Gz Lx si 512 0 Ile 312 M gi 512 0 51 ale M gi 512 0 sl S12 0 1 1 1 1 1 1 1 y 512 512 0 1 1 0 Average execution timeimsi 2 1162 10 10 10 10 10 10 10 Measurmentfiterations Total hMedian
108. ze Session s sssssssssrrnrrrsrrrerrrerrnrrrsrrrerrrerrerrrene 85 Analyzing NG Data icies yerna E E EEEN E E EAEE dnteasmmereneense 86 Revising Code and Rerunning Session sssssssrssrrrerrnerrrerrrerrrrrrrrrrerrrerrrrrrerrrerrrsrert 88 Configuring the Analy Ze TOO lisinin A E EA A 88 Kernel Development Framework s seissde aden cadaetaswass EEE E E ETNEA EET 89 About Kernel Development FraMework cccccccccceeeeeee eee cece eee eeeeeeeeeeeeeeeeeeeesegggannnnnes 89 Kernel Development Framework SESSION s sssssrrssrrnrrrsrrrerrrrrrrrrrsrrrerrrrrrerrrsrrrsrent 90 Building and Compiling OpenCL Program cccccccc ccc ceeceeeee eee ee ee essen eeeeeeeeeee ene eeennaaas 95 BUNG UARUITACUS minnan iA EE tare anna EEA E e E E A 96 Keme ARGUING iraa a aa a a a a a a A EA 96 Code Builder Bulla TOOWalsiccainttinictccemtelenaeccennidean a a E A E A EA 97 Analyzing Kernel PernrormanCe vicaiwelnceasarten iendw aetan eo a aeta e eae 97 User Manual OpenCL Code builder for Intel Media Server Studio 2015 Variable Manag Ment musin aien Gisway tas eave eae ates E ade coc naw ead eee eee Legal Information Legal Information By using this document in addition to any agreements you have with Intel you accept the terms set forth below You may not use or facilitate the use of this document in connection with any infringement or other legal analysis concerning Intel products described herein You agree to grant Intel
Download Pdf Manuals
Related Search
Related Contents
SPX Cooling Technologies HP7000 User's Manual 1AC II - Master USER MANUAL 緊急地震速報警報盤(OXY−EEW) 取扱説明書 ePlans User Manual Copyright © All rights reserved.
Failed to retrieve file