 So I'm too little bit, I'm going to talk about OpenCL in LibreOffice and how it has been used and how it is used and how it could perhaps be used in the future. And I work for Collabora. I don't know how many of you know what OpenCL is, but it is a vendor-neutral programming language that is supposed to be used for calculations that can be sped up by using massively parallel commutations. And you would use it when you have, for instance, GPUs that have several, maybe even dozens of these computational units available. OpenCL is not very new. It has been around for maybe five years or even more. But anyway, it's clearly newer than OpenGL, and it's not really not that much related, even if its name is almost the same. So some people confuse them sometimes. And OpenCL is available on all the desktop platforms that we use, but in practice it's perhaps mostly relevant only for Windows anyway. Because on the Mac, I think that Apple, even if Apple was one of the vendors that initially started, the OpenCL thing, they don't seem to be that horribly interested in it anymore. And on Linux again, it's always complicated. We never know what drivers for which hardware have the support on which not, and so on. So this is the next slide. So OpenCL, as a programming language, it looks quite much like C. It has a few extra keywords and types and so on. And some library functions that are then used for typical numerical calculations and for manipulating data types and for moving data. And then out of, or between the actual host program and the OpenCL program. And the things that you actually run in OpenCL are called kernels. They are quite similar to the concept of shader in OpenGL. And occasionally one even talks about or uses shader, the term shader also for this, but the correct name is kernel. And just like these OpenGL shaders, also OpenCL kernels are compiled at runtime. You have the OpenCL source code inside your C++ or C program as a string or in a file or whatever, or you construct it at runtime. And then you compile it into some totally platform-specific code and then execute it. But you can also save these binaries in a file if you like. And we actually do that for our OpenCL code. The typical implementations of OpenCL, they have a separate one for the instruction set on the CPU and also one then for a GPU. And depending on whether you have like a separate discrete graphics card or an integrated GPU in the same chip. There are different OpenCL devices for this. And OpenCL calculations can be quite fast, like 100 times faster than using C++. But of course moving large amounts of data to a discrete GPU can be slow. So for those cases then it's of course much better if both the GPU and CPU have access to the same memory than you don't need to actually move anything. Or it's not the calling host code that would do the move anyway, it's the implementation. And this is quite small, so I guess you don't really see it. But this is some sample OpenCL code from Wikipedia to calculate some Fourier transform. This looks quite much like C code, it has comments and it is, well this one is not indented, because there are no if statements, but anyway it is clearly written by hand and so on. And then the host code to call it looks like this. Where is the pointer, is it the same? Anyway, you create a context first for the computation and then you create a command queue. Oh, okay. Yeah, and you create a command queue and you allocate some buffers. And you create the program from some source code that's not included here, but it's one of the parameters there. And then you build the program and create the kernel and set the arguments for it and then you call it. So it's quite a lot of code to call this one OpenCL kernel. Now then in LibreOffice we don't use like kernels that would have been written by hand beforehand, but we generate them at runtime from these calc formulas. So depending on how the formula looks, the generated OpenCL code will be quite different. And both our code that generates OpenCL and then the generated OpenCL itself can be quite hard to understand. Even if you don't start experimenting with it, you can actually particularly notice what does what and do some modifications to it. Debugging OpenCL is not really straightforward, at least in LibreOffice. The only way I have found out to do it is to have this C++ code that generates OpenCL, insert these printf statements into the generated OpenCL. And this will be then printed out when the code is, when the OpenCL is run, when the kernel is run. There are some more traditional interactive GUI debugging tools for OpenCL, but they are quite hard, would be quite hard to like take into use in a typical LibreOffice development environment. Because they are, would be typical use if you like write the OpenCL code from scratch yourself and so on. And here is a sample of the code in LibreOffice that generates OpenCL. OpenCL, if you see there this stream SS, it outputs into the stream these fragments of what looks like C code, but is then the OpenCL code like first it outputs the name of the function it is generating. And then the arguments and then a block of code, there are some variables and then it continues generating more, more code. And it is quite confusing because it mixes this actual C++ code and then the OpenCL code that goes into the generated kernel. You have to look carefully to, carefully to see which things are actually C++ and which are OpenCL. And here is then the corresponding result. This is not the actual kernel entry point, but it's a function used, used by the kernel and the code we generate for, this is for a call of the average function in a calc formula. And there are, I left out quite many of those steps but there are quite many equal or almost equal segments. So if you then want to debug what is actually going on when you are using the average function in OpenCL, you need to modify this previous code to emit print of statements that then will be, would appear in this code. And then you can see what's going on when you run the calc formula. In order to use OpenCL, the thing that had to be done was to introduce this formula group concept. That means that this is like, this was done already three years ago I think. That if you have identical formulas in a column in calc or in a sheet and there are enough of them, then you instead get one formula group. And this formula group can also be used by the so called software interpreter, which is not really OpenCL but it's a bit related. And then during 2013 and 14, we got or there was written OpenCL implementations for most of the operators and functions in calc and even for string functions. Unfortunately, we had not very complete unit tests for them, so there were lots of corner cases that we didn't notice were incorrectly implemented. And then to make this situation a bit better, we decided to start using OpenCL only for those cases that we know that actually work or where it makes sense. To restrict it to only formula statutes, only op codes that are from a small subset and only if the formula group is large enough. And the op codes in this subset are like basic arithmetic operators, average some minimum maximum and some statistical functions and trigonometrical functions. In the beginning, these were made into options that were even visible to the user, that turned out perhaps not to be a good idea, so it was changed later. And then we also had like white lists and black lists of which vendor and driver version combinations that were known to be good or known to be bad. But it was a bit unclear whether end users actually found much use for this, so trust them later, later removed. And the current situation is that most, I hope, of these corner case bugs have been fixed and we no longer even tried to use OpenCL in any way for operations or formulas that involves string data. And these OpenCL, I mean op codes, not implementations that are trusted have been quite fairly, quite well tested. We do need to extend the unit tests a bit more still and we dropped, as I said, these options because they were not really, really useful after all. And we now, now in 5.1, we actually, when the user first starts a fresh installation of LibreOffice, we test the implementation of OpenCL, how correct it is. And if it doesn't work as it should, we just turn OpenCL off automatically and without any message or anything. And now we come to the actual title of the talk which is very short because as far as I see, so we can continue to use OpenCL as we use it now. And we could also use it for some other calculations not related to formula single. Those that have come first to mind would be like image format encoding and decoding. In those cases, those can be implemented in OpenCL and image scaling also. We currently use OpenGL for that, but OpenCL might be a better fit actually. And yes, there's collaboration and that's it.