Adding a Scripting Language to CodeXL

One of the goals of the LPGPU2 project is to provide an application to enable developers to target non AMD low power devices running open standard APIs like Vulkan or OpenCL to analyse GPU performance versus efficiency with their applications in order to allow them to write code is efficient manner extending battery life.

CodeXL was chosen as the base tool for the LPGPU2 project for many reasons, but we can highlight a few important ones:

  • It is open source
  • It has a wide range of functionality already implemented
  • It is cross-platform
  • It is already familiar to developers as a profiling tool

CodeXL has a quite large code base. It can be considered a mature and established tool with many features but one key feature is missing in its architecture is a component to perform scripting. Adding a scripting component would allow an easy extension to existing functionality while also opening up the possibility to query CodeXL profiling sessions and the data with.

In this post, we are going to explore the process of adding Lua as a scripting language for LPGPU2 CodeXL in order to facilitate the advanced analysis of power profiling sessions is in quick customisable manner.

The choice of Lua as a scripting language

From the Lua website we read:

Lua is a powerful, efficient, lightweight, embeddable scripting language. It supports procedural programming, object-oriented programming, functional programming, data-driven programming, and data description.

Compared to other scripting languages, Lua is very compact with no external dependencies. It was designed to be embedded in applications and it has a simple but powerful C interface. With this in mind, we can easily expose CodeXL API to Lua scripts. In the summary table below you can see a breakdown by lines of code of the Lua component:

Language Files Blank lines Comment lines Code lines
C 35 2787 2481 14585
C/C++ Headers 26 1111 1132 2010
Make 1 39 10 148
Sum 62 3937 3623 16743

This data was obtained using CLOC 1.72 (http://cloc.sourceforge.net/), and the Lua version is 5.3.4.

As you can see not much to add a new language and open up the possibility for automation or other capabilities.

What will Lua developers have access to inside CodeXL

Currently, the Lua component has been embedded in the CodeXL project to expose the LPGPU2 extended CodeXL database layer to Lua so that it can have access to the power profiling session data. The database layer of CodeXL provides the abstraction of an SQLite database used to store data for profiling sessions. Lua scripts will have access to the database allowing it to read and write the data collected during a profiling session. Figure 1 has a diagram showing how the Feedback Engine was positioned inside CodeXL.

Figure1: Diagram showing where the Feedback Engine was inserted into CodeXL.

What the LPGPU2 project is doing with Lua

Samsung, a LPGPU2 consortium partner, is developing a Lua Feedback Engine. The goal of the Feedback Engine is to provide an in-depth analysis of an application’s power profile session that came from running on a remote device’s profile such as a standard Samsung Galaxy S7 phone. The user performs a power profile analysis session after which the user can ask the Feedback Engine to analyse the data and suggest optimisations. In real time, the profile data displayed and stored in an LPGPU2 modified CodeXL database (it remains standard CodeXL compatible) which the Feedback Engine has access too. This is one of the many achievements of the work carried out by the LPGPU2 project shown in the following video. In order to provide a more detailed analysis of an application, we extended CodeXL’s Power Profiling mode to allow the capture of different GPU API calls with the objective to associate power consumption data with their respective function calls. With this data in their hands assisted by the Feedback Engine, developers can easily find hotspots regarding power consumption and quickly iterate to lower power consumption, therefore delivering a polished application to their users that will last longer on battery powered devices.

https://www.youtube.com/watch?v=7ZDQWUQiTI0

Compiling Lua

The compilation process of Lua is straightforward. On Visual Studio, just create a new project inside your solution, add all the files from the source folder and you are done. In order to modularize the code, we decided to build Lua as a DLL on Windows. For this one just need to define the preprocessor macro LUA_BUILD_AS_DLL on both the project that generates the DLL and the projects that are going to use the DLL.

On Linux, there is the possibility to use the provided Makefile to build Lua with a simple make command, but CodeXL uses the SCons build system. Like Visual Studio, it was just a matter of creating a custom SConscript file to generate the Lua library to be used across CodeXL modules.

Conclusion

Scripting is powerful tool anyone can add to an application in order to provide easy extension and development. Scripts don’t require compilation and linking, therefore they allow for a very fast iteration cycle with a rapid prototype of new functionality. In the case of LPGPU2 CodeXL, the ability to have scripted behaviour has allowed the LPGPU2 project to provide rapid development of advanced features within the tool, in particular, we are enabling advanced analysis of an application power profiling data in order to allow developers to extract maximum performance whilst keeping the battery of mobile devices alive.

 

 

Windows support coming online for LPGPU2!

Samsung and Codeplay have been working together very closely on the LPGPU2 fork of AMD’s CodeXL. In the last day or so we performed the first captures from an Android device (Samsung S6) from a Windows host!

Timeline view (click image to zoom)

Regions of Interest (ROI) view (click image to zoom)

These visualizations are still in flux and are intended to give a ‘feel’ of the final version rather than being definitive.

 

PEGPUM 2018 Deadline extended!

The deadline for paper submission for the PEGPUM 2018 workshop at HiPEAC 2018 in Manchester has been extended to the 4th of December. We invite you to submit original and unpublished 6-page papers or 2-page extended abstracts.

Samsung’s Game Developer page now active!

Samsung have launched a page to track resources for game developers on Samsung devices. I’m sure the LPGPU2 tool suite will be added once it’s publically available!

Find out more here: http://developer.samsung.com/game

 

Think Silicon @ Synopsys ARC Processor Summit Beijing

Think Silicon with great pleasure participated in the Synopsys ARC Processor Summit Beijing held on Wednesday, 15 November 2017 in Beijing, China.
The prototype, which was created by Think Silicon and Synopsys, of an ultra-low power Internet of Things (IoT) platform designed for connected wearable, mobile, and embedded display devices was showcased at this event. The prototype combines the best of Synopsys® technology sporting a DesignWare® ARC EM5D Processor with Think Silicon® products including NEMA®|p, NEMA®|DC, and NEMA®|GFX-API, resulting in a developer solution aimed at ultra-low power connected wearables and low-power embedded applications. Both companies have tools to assist developers in creating world-class products for a wide variety of markets. The Power Models of NEMA® GPUs (part of the NEMA® SW toolchain) were developed as part of the LPGPU2 EU-funded project.
Also, Dr. Iakovos Stamoulis, CTO at Think Silicon, made a presentation titled “Ultra-low Power 3D Micro-GPU for IoT-Class Devices” addressing how the emerging Internet of Things (IoT) market adds design challenges for engineers while discussing how the NEMA® Series of ultra-low power micro-GPU cores bridges this gap.

LPGPU2 paper accepted at DATE 2018 conference

The paper “Optimal DC/AC Data Bus Inversion Coding” by Jan Lucas, Sohan Lal and Ben Juurlink has been accepted as regular paper at the DATE 2018 conference. In the paper a new method for data encoding is presented that reduces the energy consumption of the data transfer between CPU or GPU by up to 6%.  DATE (Design, Automation and Test in Europe) will held in March at the International Congress Center Dresden. The selection process was very competitive with an acceptance rate of regular papers of only 23.7%.

Optimal DBI Encoding as a shortest path problem

Spin Digital at InterBEE 2017 in Tokyo

Spin Digital Video will participate at InterBEE 2017 from November 15-17 at the Makuhari Messe in Tokyo, at the booth 8105.

Spin Digital at InterBEE Tokyo

Spin Digital is going to present demonstrations of the new versions of its HEVC solutions including: 8K media player and SDK. Read more »

Codeplay add OpenCL kernel code coverage!

 

AMD’s opinion of LPGPU2

Codeplay recently reached out to AMD, and asked for their thoughts on what we are doing with LPGPU2 and how we are leveraging their open source CodeXL tool.

AMD stated “The LPGPU2 project validates AMD’s decision 2 years ago to create GPUOpen and open up the source code to our tools and libraries.  Seeing CodeXL evolve through 3rd party participation to be used in new markets is very satisfying and a clear endorsement of our strategy.”

We at LPGPU2 are very pleased to base our work on the technologies made freely available by AMD’s forward looking decision to open source CodeXL.

 

Ben Juurlink and Georgios Keramidas guest editors of special issue of International Journal of Reconfigurable Computing

Ben Juurlink, coordinator of LPGPU2, and Georgios Keramides, technical coordinator of LPGPU2, are lead guest editor and resp. guest editor of the special issue on “Approximating (Deep) Neural Networks and Approximate Computing Using Reconfigurable Hardware” of the International Journal of Reconfigurable Computing. The International Journal of Reconfigurable Computing is published by Hindawi, which is one of the world’s largest publishers of peer-reviewed, fully Open Access journals. The EU strongly supports Open Access publications. Other guest editors of this special issue are Stephan Wong of TU Delft in the Netherlands; Antonio Beck of Federal University of Rio Grande do Sul in Porto Alegre in Brazil; and Chao Wang of the University of Science and Technology China in Suzhou, China. The Call for Papers can be found here https://www.hindawi.com/journals/ijrc/si/258652/cfp/.

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close