Method and apparatus for buffer initialization

A method, apparatus and computer program product are provided herein to enable buffer initialization and/or clearance to occur on, for example, a mobile terminal. In some example embodiments, a method is provided that comprises receiving an indication that a buffer has been initialized by a host. The method of this embodiment may also include receiving source code from the host. In some example embodiments, the source code is received from a program running on the host and is configured to cause the buffer that has been initialized by the host to be cleared. The method of this embodiment may also include executing the source code such that the buffer that has been initialized by the host is cleared.

TECHNOLOGICAL FIELD

Embodiments of the present invention relate generally to browsing technology and, more particularly, relate to a method, apparatus, and computer program product for buffer initialization by a compute device.

BACKGROUND

A web browser is a software application for retrieving, presenting, and traversing information resources on the World Wide Web (hereinafter “web”). A web browser can also be defined as an application software or program designed to enable users to access, retrieve and view documents and other resources on the Internet. When operating a web browser, security is crucial. Thus, when operating in a web environment, a user of a device, such as a mobile terminal, may not trust the code that is provided by a remote server for a particular website, document, service or the like. In some cases such code may be malicious.

For example, in some web based technologies (e.g. Hyper Text Markup Language (HTML) 5, JavaScript, Web-based Graphics Library (WebGL), Web-based Computing Language (WebCL)) code may be caused to be executed and/or stored in a buffer on a mobile terminal or other device. By granting access to a buffer and by allowing code to be executed in these buffers, the code may have access to machine specific data to include protected data. For example, the memory buffers that are reserved in WebCL, may contain machine specific data. In such case private data may be accessed and released in a way that would violate the privacy of the user of the device.

BRIEF SUMMARY

A method, apparatus and computer program product are therefore provided according to an example embodiment of the present invention to enable buffer initialization and/or clearance to occur on, for example, a mobile terminal. In particular, a compute device on a mobile terminal may be configured to receive instructions from a host in the form of a kernel or a shader that is built and/or compiled for the compute device. In some example embodiments, the kernel or shader, when executed by the compute device, is configured to cause a buffer to be cleared and/or initialized on the mobile terminal. The host and/or the kernel or shader may, in some embodiments, indicate a current buffer reserved location. Advantageously, for example, the method and systems disclosed herein result in improvement of performance by an example processor and/or a graphics processor.

In some example embodiments, a method is provided that comprises receiving an indication that a buffer has been initialized by a host. The method of this embodiment may also include receiving source code from the host. In some example embodiments, the source code is received from a program running on the host and is configured to cause the buffer that has been initialized by the host to be cleared. The method of this embodiment may also include executing the source code such that the buffer that has been initialized by the host is cleared.

In further example embodiments, an apparatus is provided that includes at least one processor and at least one memory including computer program code with the at least one memory and the computer program code being configured, with the at least one processor, to cause the apparatus to at least receive an indication that a buffer has been initialized by a host. The at least one memory and computer program code may also be configured to, with the at least one processor, cause the apparatus to receive source code from the host. In some example embodiments, the source code is received from a program running on the host and is configured to cause the buffer that has been initialized by the host to be cleared. The at least one memory and computer program code may also be configured to, with the at least one processor, cause the apparatus to execute the source code such that the buffer that has been initialized by the host is cleared.

In yet further example embodiments, a computer program product may be provided that includes at least one non-transitory computer-readable storage medium having computer-readable program instructions stored therein with the computer-readable program instructions including program instructions configured to receive an indication that a buffer has been initialized by a host. The computer-readable program instructions may also include program instructions configured to receive source code from the host. In some example embodiments, the source code is received from a program running on the host and is configured to cause the buffer that has been initialized by the host to be cleared. The computer-readable program instructions may also include program instructions configured to execute the source code such that the buffer that has been initialized by the host is cleared.

In yet further example embodiments, an apparatus is provided that includes means for receiving an indication that a buffer has been initialized by a host. The apparatus of this embodiment may also include means for receiving source code from the host. In some example embodiments, the source code is received from a program running on the host and is configured to cause the buffer that has been initialized by the host to be cleared. The apparatus of this embodiment may also include means for executing the source code such that the buffer that has been initialized by the host is cleared.

In some example embodiments, a method is provided that comprises generating source code configured for operation on a compute device. In some example embodiments, the source code comprises one or more arguments to be set. The method of this embodiment may also include causing a buffer to be initialized in the compute device. The method of this embodiment may also include causing the source code to be transmitted to the compute device. In some example embodiments, the source code is configured to cause the buffer to be cleared.

In further example embodiments, an apparatus is provided that includes at least one processor and at least one memory including computer program code with the at least one memory and the computer program code being configured, with the at least one processor, to cause the apparatus to at least generate source code configured for operation on a compute device. In some example embodiments, the source code comprises one or more arguments to be set. The at least one memory and computer program code may also be configured to, with the at least one processor, cause the apparatus to cause a buffer to be initialized in the compute device. The at least one memory and computer program code may also be configured to, with the at least one processor, cause the apparatus to cause the source code to be transmitted to the compute device. In some example embodiments, the source code is configured to cause the buffer to be cleared.

In yet further example embodiments, a computer program product may be provided that includes at least one non-transitory computer-readable storage medium having computer-readable program instructions stored therein with the computer-readable program instructions including program instructions configured to generate source code configured for operation on a compute device. In some example embodiments, the source code comprises one or more arguments to be set. The computer-readable program instructions may also include program instructions configured to cause a buffer to be initialized in the compute device. The computer-readable program instructions may also include program instructions configured to cause the source code to be transmitted to the compute device. In some example embodiments, the source code is configured to cause the buffer to be cleared.

In yet further example embodiments, an apparatus is provided that includes means for generating source code configured for operation on a compute device. In some example embodiments, the source code comprises one or more arguments to be set. The apparatus of this embodiment may also include means for causing a buffer to be initialized in the compute device. The apparatus of this embodiment may also include means for causing the source code to be transmitted to the compute device. In some example embodiments, the source code is configured to cause the buffer to be cleared.

DETAILED DESCRIPTION

Some example embodiments will now be described more fully hereinafter with reference to the accompanying drawings, in which some, but not all embodiments are shown. Indeed, the example embodiments may take many different forms and should not be construed as limited to the embodiments set forth herein; rather, these embodiments are provided so that this disclosure will satisfy applicable legal requirements. Like reference numerals refer to like elements throughout. The terms “data,” “content,” “information,” and similar terms may be used interchangeably, according to some example embodiments, to refer to data capable of being transmitted, received, operated on, and/or stored. Moreover, the term “exemplary”, as may be used herein, is not provided to convey any qualitative assessment, but instead merely to convey an illustration of an example. The term “kernel,” may refer to source code or an executable, and should be understood to encompass implementations using a general purpose programming model (such as the language C) and special purpose programming models (such as pixel shaders). Thus, use of any such terms should not be taken to limit the spirit and scope of embodiments of the present invention.

This definition of “circuitry” applies to all uses of this term in this application, including in any claims. As a further example, as used in this application, the term “circuitry” would also cover an implementation of merely a processor (or multiple processors) or portion of a processor and its (or their) accompanying software and/or firmware. The term “circuitry” would also cover, for example and if applicable to the particular claim element, a baseband integrated circuit or application specific integrated circuit for a mobile phone or a similar integrated circuit in a server, a cellular network device, or other network device.

In various computing systems, there is often a need to allocate memory buffers (that is, areas of memory) and initialize those buffers with zeros or some other predefined values. If an application were allowed to access uninitialized buffers, it could, for example, retrieve confidential information left behind by the process or application that was previously using that piece of memory. This scenario must be prohibited, particularly in environments where application code may be untrusted and potentially malicious. Such environments include, in particular, the web browser.

Some computing systems can be conceptually divided into a host, which is typically a CPU (central processing unit), and a set of compute devices. A compute device may be, for example, a GPU (graphics processing unit), a single-core, multi-core or many-core CPU, a DSP (Digital Signal Processor), a multimedia accelerator, or the like. The host processor itself may also be used as a compute device. These types of computing systems include, but are not limited to: OpenCL (Open Computing Language) and its derivatives such as WebCL; OpenGL (Open Graphics Library) and its derivatives such as OpenGL embedded systems (ES) and WebGL; Direct3D, DirectCompute, and other components of DirectX; Silverlight 3D; Macromedia Flash Stage3D; and many others. If these systems are made available to untrusted applications (such as in the web browser environment), it is important that no uninitialized memory buffers are exposed. In particular, it is not sufficient to clear any buffers that reside on the host processor's memory space: any buffers that reside on the compute devices' address space(s) must also be cleared.

Traditionally, memory buffers that reside on compute devices have been initialized by a piece of code that runs on the host processor and writes zeros (or any other values) to those buffers. This is illustrated by the following piece of pseudo code:

On line number 1, a buffer called “clear_buff” of size “clear_size” is reserved by the host. The buffer contents are initialized, in this example, to zero (e.g. could also be all bits as one or repeating any other known bit pattern). In some example implementations “clear_buff” may not be reserved each time that it is required, but instead may be reserved only once during a session. On line number 2, a buffer called “buff” of size “buff_size” is created into an area of memory that the compute device can access (instead of, or in addition to, the host). On lines 3-4, the “clear_buff” contents are written to the “buff” buffer in a loop (this example assumes that “clear_buff” is smaller than “buff”).

By way of further example, the following function in the application programming interface (API) of WebCL may be used to create a buffer that is accessible by a compute device:
var buff=ctx.createBuffer(bufSize);

In the implementation of the above createBuffer API function, the following steps may be included:1. Reserve “bufSize” bytes of memory from the compute device.2. Initialize that buffer.

Buffer reservation (step 1) may be accomplished, for example, by using the clCreateBuffer, clCreateSubBuffer, clCreateImage2D, or clCreateImage3D OpenCL host API function provided by the underlying OpenCL driver (e.g. buff=clCreateBuffer(ctx, CL_MEM_READ_WRITE, buff_size, NULL, &ciErrNum)). Buffer initialization may then be accomplished by using an OpenCL host API function such as clEnqueueWriteBuffer, which is configured to write blocks of data containing zeros to the device. This method of initialization is exemplified by the following code fragment:

There is a similar need to initialize memory buffers in other systems outside of OpenCL and WebCL. For example in WebGL, textures, vertex buffers, framebuffers, and others must be initialized before allowing application code to access them. This is typically done in the same way as shown above, using the API functions that are available in the underlying OpenGL, OpenGL ES, or Direct3D driver. For example, a texture can be cleared to zero by providing a suitably sized, zero-initialized buffer to the glTexImage2D function, or as another alternative, calling glTexSubImage2D multiple times with a smaller zero-initialized buffer as a parameter.

The traditional method of initializing device-side memory buffers, as explained in the above paragraphs, has at least two drawbacks: first, it may take a long time to complete on some systems, and second, it consumes extra memory on the host side. As a result, the traditional method may deteriorate system performance and ultimately the end-user's experience.

FIG. 1is an example block diagram of an example computing system for practicing embodiments of an example buffer initialization and clearing system110in accordance with an embodiment of the present invention. In particular the buffer initialization and clearing system110may be configured to initialize and clear a buffer on a device based on a kernel received from a host.

FIG. 1shows a system100that may be utilized to implement a buffer initialization and clearing system110. Note that one or more general purpose or special purpose computing systems may be used to implement the buffer initialization and clearing system110, such as but not limited to the mobile terminal10ofFIG. 2. In addition, the system100may comprise one or more distinct computing systems and may span distributed locations. Furthermore, each block shown may represent one or more such blocks as appropriate to a specific embodiment or may be combined with other blocks. For example, in some embodiments the system100may contain an OpenCL module112and/or a web browser module114. In other example embodiments, an OpenCL module112and/or a web browser module114may be configured to operate on separate systems (e.g. a mobile terminal and a remote server, multiple remote servers and/or the like). For example, the OpenCL module112and/or the web browser module114may be configured to operate on a mobile terminal, such as mobile terminal10ofFIG. 2. Also, the buffer initialization and clearing system110may be implemented in software, hardware, firmware, or in some combination to achieve the capabilities described herein.

The example OpenCL module112in some example embodiments that is configured to implement OpenCL programs. However, in other embodiments, the OpenCL module112may also be configured to execute WebCL; OpenGL and its derivatives such as OpenGL embedded systems (ES) and WebGL; Direct3D, DirectCompute or the like programs. For example the OpenCL module may include a host116, a global memory118and/or one or more compute devices120. The host116may take the form of or be embodied by a processor, such as processor124, and may be configured such that a host program running on a host may execute a kernel on a device. The host116may be configured to submit various commands to perform various computations on the compute device120. The compute device120may comprise or be embodied by the processor124, a graphics processing unit, a multicore processing unit, digital signal processing unit, hardware accelerator or the like. To execute the kernel, the host116may designate a number of work-groups and a number of work-items. The host116may also manipulate memory objects such as the global memory118. The global memory118in some embodiments may comprise or be embodied by memory126. The global memory118is a memory region that is accessible to all work items executed in the Compute Device120. Alternatively or additionally other memory types may be reserved, such as but not limited to local memory, private memory and/or constant memory.

In some example embodiments, the compute device120is configured to receive instructions relating to the creation and initialization of a buffer from the host116. The example compute device120may then be configured to clear a reserved buffer, for example buffer140in memory126using OpenCL kernel code, OpenGL shader code, or the like.

In some example embodiments, an example web browser module114embodied for example by a web browser, may be configured to receive WebCL code from a web server, such as web server134via a communications interface128. In some example embodiments, the web browser module114may receive a WebCL API function, such as ctx.createBuffer( ) from the web server134. The function is configured to reserve buffer space from the global memory118. The ctx.createBuffer( ) function may then be implemented in the web browser module114by using OpenCL specific functions that reserve and clear the memory buffer, such as buffer140.

While the system100may be employed, for example, by a mobile terminal and/or a stand-alone system (e.g. remote server), it should be noted that the components, devices or elements described below may not be mandatory and thus some may be omitted in certain embodiments. Additionally, some embodiments may include further or different components, devices or elements beyond those shown and described herein.

In some example embodiments, system100comprises a computer memory (“memory”)126, one or more processors124(e.g. processing circuitry) and a communications interface128. The buffer initialization and clearing system110is shown residing in memory126. In other embodiments, some portion of the contents, some or all of the components of the buffer initialization and clearing system110may be stored on and/or transmitted over other computer-readable media. The components of the buffer initialization and clearing system110preferably execute on one or more processors124. The modules may be implemented by, embodied by and/or configured to execute on the processor124. Other code or programs138(e.g., an administrative interface, a Web server, and the like) and potentially other data repositories, such as buffer140, also reside in the memory126, and preferably execute on processor124. Of note, one or more of the components inFIG. 1may not be present in any specific implementation.

In a typical embodiment, as described above, the buffer initialization and clearing system110may include an OpenCL module112and/or a web browser module114. The buffer initialization and clearing system110may interact via the network132via a communications interface128with web server134and/or with third-party content136. The network132may be any combination of media (e.g., twisted pair, coaxial, fiber optic, radio frequency), hardware (e.g., routers, switches, repeaters, transceivers), and protocols (e.g., TCP/IP, UDP, Ethernet, Wi-Fi, WiMAX) that facilitate communication between remotely situated humans and/or devices. In this regard, the communications interface128may be capable of operating with one or more air interface standards, communication protocols, modulation types, access types, and/or the like. More particularly, the system100, the communications interface128or the like may be capable of operating in accordance with various first generation (1G), second generation (2G), 2.5G, third-generation (3G) communication protocols, fourth-generation (4G) communication protocols, Internet Protocol Multimedia Subsystem (IMS) communication protocols (e.g., session initiation protocol (SIP)), and/or the like. For example, the mobile terminal may be capable of operating in accordance with 2G wireless communication protocols IS-136 (Time Division Multiple Access (TDMA)), Global System for Mobile communications (GSM), IS-95 (Code Division Multiple Access (CDMA)), and/or the like. Also, for example, the mobile terminal may be capable of operating in accordance with 2.5G wireless communication protocols General Packet Radio Service (GPRS), Enhanced Data GSM Environment (EDGE), and/or the like. Further, for example, the mobile terminal may be capable of operating in accordance with 3G wireless communication protocols such as Universal Mobile Telecommunications System (UMTS), Code Division Multiple Access 2000 (CDMA2000), Wideband Code Division Multiple Access (WCDMA), Time Division-Synchronous Code Division Multiple Access (TD-SCDMA), and/or the like. The system100may be additionally capable of operating in accordance with 3.9G wireless communication protocols such as Long Term Evolution (LTE) or Evolved Universal Terrestrial Radio Access Network (E-UTRAN) and/or the like. Additionally, for example, the mobile terminal may be capable of operating in accordance with fourth-generation (4G) wireless communication protocols and/or the like as well as similar wireless communication protocols that may be developed in the future.

In an example embodiment, components/modules of the buffer initialization and clearing system110may be implemented using standard programming techniques. For example, the buffer initialization and clearing system110may be implemented as a “native” executable running on the processor124, along with one or more static or dynamic libraries. In other embodiments, the buffer initialization and clearing system110may be implemented as instructions processed by a virtual machine that executes as one of the other programs138. In general, a range of programming languages known in the art may be employed for implementing such example embodiments, including representative implementations of various programming language paradigms, including but not limited to, object-oriented (e.g., Java, C++, C#, Visual Basic.NET, Smalltalk, and the like), functional (e.g., ML, Lisp, Scheme, and the like), procedural (e.g., C, OpenCL C, OpenGL shading language, Pascal, Ada, Modula, and the like), scripting (e.g., Perl, Ruby, Python, JavaScript, VBScript, and the like), and declarative (e.g., SQL, Prolog, and the like).

In addition, programming interfaces to the data stored as part of the buffer initialization and clearing system110, can be made available by standard mechanisms such as through C, C++, C#, and Java APIs; libraries for accessing files, databases, or other data repositories; through languages such as XML; or through Web servers, FTP servers, or other types of servers providing access to stored data. A data store may also be included and it may be implemented as one or more database systems, file systems, or any other technique for storing such information, or any combination of the above, including implementations using distributed computing techniques.

Furthermore, in some embodiments, some or all of the components of the buffer initialization and clearing system110may be implemented or provided in other manners, such as at least partially in firmware and/or hardware, including, but not limited to one or more application-specific integrated circuits (“ASICs”), standard integrated circuits, controllers executing appropriate instructions, and including microcontrollers and/or embedded controllers, field-programmable gate arrays (“FPGAs”), complex programmable logic devices (“CPLDs”), and the like. Some or all of the system components and/or data structures may also be stored as contents (e.g., as executable or other machine-readable software instructions or structured data) on a computer-readable medium (e.g., as a hard disk; a memory; a computer network or cellular wireless network or other data transmission medium; or a portable media article to be read by an appropriate drive or via an appropriate connection, such as a DVD or flash memory device) so as to enable or configure the computer-readable medium and/or one or more associated computing systems or devices to execute or otherwise use or provide the contents to perform at least some of the described techniques. Some or all of the system components and data structures may also be stored as data signals (e.g., by being encoded as part of a carrier wave or included as part of an analog or digital propagated signal) on a variety of computer-readable transmission mediums, which are then transmitted, including across wireless-based and wired/cable-based mediums, and may take a variety of forms (e.g., as part of a single or multiplexed analog signal, or as multiple discrete digital packets or frames). Such computer program products may also take other forms in other embodiments. Accordingly, embodiments of this disclosure may be practiced with other computer system configurations.

The system100may be embodied as and/or implemented such as, for example, by a desktop computer, laptop computer, mobile terminal, mobile computer, mobile phone, smartphone, mobile communication device, user equipment, tablet computing device, pad, game device, digital camera/camcorder, audio/video player, television device, radio receiver, digital video recorder, positioning device, wrist watch, portable digital assistant (PDA), fixed transceiver device (e.g., attached to traffic lights, energy meters, light bulbs, and/or the like), a chipset, an apparatus comprising a chipset, any combination thereof, and/or the like.

In some example embodiments, the system100, such as by the buffer initialization and clearing system110implementing the OpenCL module112may be configured to generate a kernel, executed by host116which may include but is not limited to:

Respectively, the kernel is depicted in pseudo code as follows, but is not limited to:

By way of example and as shown with reference to line number 1, the kernel may be compiled and built as kernel binary for a compute device120. In some example embodiments, the compile and build for the kernel may be executed once for the same kernel. Alternatively or additionally the kernel may be compiled prior to lines 2-8.

The kernel binary described herein may refer to real executable binary or some intermediate format that may be interpreted or further compiled before execution. For example, as shown with reference to line 2, the actual buffer, such as buffer140, may be caused to be created in the global memory118. For example, as shown with reference to lines 3 and 4, a kernel may be executed with thread_count equal to buffer size. In other words, the kernel may be executed “buff_size” times. In an instance in which the kernel is executed on the compute device120and in some example embodiments, the buffer “buff,” such as buffer140may be cleared in line number 7. Alternatively or additionally, a single address may be cleared in the buffer in line number 7. The kernel may then be executed for each of a various number of buffer addresses (e.g. executed same amount of times as the buffer size “buff_size”).

In some example embodiments, OpenCL host code is implemented in a web browser, such as web browser module114, and executed in Host116and may use OpenCL functions that reserve and clear a buffer, such as buffer140. The OpenCL host code may include but is not limited to:

In some example embodiments, the kernel may comprise but is not limited to:

As is described herein, the above referenced kernel is created by a Web Browser Module114, OpenCL Module112and/or host116and is in some example embodiments configured to be executed by the compute device120. For example, the kernel may be received by the system100, and when executed by the compute device120may cause a buffer to be cleared and/or initialized.

By way of example and with reference to lines 2 and 3, kernel arguments may be determined and are set, such as by host116. In lines 5 and 6, OpenCL specific local and global work sizes are defined, such as by processor124. In line 7, the kernel is sent for execution on the compute device120. In line 8, the execution on the host processor124is blocked for so long that the operations in the compute device120are finished. In some example embodiments, the operations are blocked to ensure that the buffer is cleared (before it may be read). Alternatively or additionally, in an instance in which the operations are done in a particular order (e.g. only a single in-order command queue in OpenCL), then, in some example embodiments, blocking may not be needed since any possible read operation always occurs after buffer clearance.

In some example embodiments, and in an instance in which the kernel is executed by the compute device120, a global identifier is extracted in line 10. With reference to lines 12 and 13, an example bound check is executed, such as by the compute device120or the like, because in some instances extra work items (extra threads) may be executed. In line number 16, the buffer, such as buffer140, may be initialized, such as by the compute device120, the OpenCL module112, or the like. In some example embodiments the kernel is executed buff_size/4 times. Division by four may be used because 32 bits (4 bytes) are initialized at a time in the kernel. Alternatively or additionally other values may be used based on a determined buffer size, characteristics of the device and/or the like.

In some example embodiments, a buffer initialization and clearing system110may be embodied as a mobile terminal, such as that illustrated inFIG. 2. In this regard,FIG. 2illustrates a block diagram of a mobile terminal10representative of one embodiment of a buffer initialization and clearing system110. It should be understood, however, that the mobile terminal10illustrated and hereinafter described is merely illustrative of one type of system (i.e., buffer initialization and clearing system110) that may implement and/or benefit from various embodiments and, therefore, should not be taken to limit the scope of the disclosure. While several embodiments of the electronic device are illustrated and will be hereinafter described for purposes of example, other types of electronic devices, such as mobile telephones, mobile computers, portable digital assistants (PDAs), pagers, laptop computers, desktop computers, gaming devices, televisions, and other types of electronic systems, may employ various embodiments of the invention.

As shown, the mobile terminal10may include an antenna12(or multiple antennas12) in communication with a transmitter14and a receiver16. The mobile terminal10may also include a processor20configured to provide signals to and receive signals from the transmitter and receiver, respectively. The processor20may, for example, be embodied as various means including circuitry, one or more microprocessors with accompanying digital signal processor(s), one or more processor(s) without an accompanying digital signal processor, one or more coprocessors, one or more multi-core processors, one or more controllers, processing circuitry, one or more computers, various other processing elements including integrated circuits such as, for example, an ASIC (application specific integrated circuit) or FPGA (field programmable gate array), or some combination thereof. Accordingly, although illustrated inFIG. 2as a single processor, in some example embodiments the processor20may comprise a plurality of processors. These signals sent and received by the processor20may include signaling information in accordance with an air interface standard of an applicable cellular system, and/or any number of different wireline or wireless networking techniques, comprising but not limited to Wi-Fi, wireless local access network (WLAN) techniques such as Bluetooth™ (BT), Ultra-wideband (UWB), Institute of Electrical and Electronics Engineers (IEEE) 802.11, 802.16, and/or the like. In addition, these signals may include speech data, user generated data, user requested data, and/or the like. In this regard, the mobile terminal may be capable of operating with one or more air interface standards, communication protocols, modulation types, access types, and/or the like. More particularly, the mobile terminal may be capable of operating in accordance with various first generation (1G), second generation (2G), 2.5G, third-generation (3G) communication protocols, fourth-generation (4G) communication protocols, Internet Protocol Multimedia Subsystem (IMS) communication protocols (for example, session initiation protocol (SIP)), and/or the like. For example, the mobile terminal may be capable of operating in accordance with 2G wireless communication protocols IS-136 (Time Division Multiple Access (TDMA)), Global System for Mobile communications (GSM), IS-95 (Code Division Multiple Access (CDMA)), and/or the like. Also, for example, the mobile terminal may be capable of operating in accordance with 2.5G wireless communication protocols General Packet Radio Service (GPRS), Enhanced Data GSM Environment (EDGE), and/or the like. Further, for example, the mobile terminal may be capable of operating in accordance with 3G wireless communication protocols such as Universal Mobile Telecommunications System (UMTS), Code Division Multiple Access 2000 (CDMA2000), Wideband Code Division Multiple Access (WCDMA), Time Division-Synchronous Code Division Multiple Access (TD-SCDMA), and/or the like. The mobile terminal may be additionally capable of operating in accordance with 3.9G wireless communication protocols such as Long Term Evolution (LTE) or Evolved Universal Terrestrial Radio Access Network (E-UTRAN) and/or the like. Additionally, for example, the mobile terminal may be capable of operating in accordance with fourth-generation (4G) wireless communication protocols such as LTE Advanced and/or the like as well as similar wireless communication protocols that may be developed in the future.

Some Narrow-band Advanced Mobile Phone System (VAMPS), as well as Total Access Communication System (TACS), mobile terminals may also benefit from embodiments of this invention, as should dual or higher mode phones (for example, digital/analog or TDMA/CDMA/analog phones). Additionally, the mobile terminal10may be capable of operating according to Wi-Fi or Worldwide Interoperability for Microwave Access (WiMAX) protocols.

It is understood that the processor20may comprise circuitry for implementing audio/video and logic functions of the mobile terminal10. For example, the processor20may comprise a digital signal processor device, a microprocessor device, an analog-to-digital converter, a digital-to-analog converter, and/or the like. Control and signal processing functions of the mobile terminal may be allocated between these devices according to their respective capabilities. The processor may additionally comprise an internal voice coder (VC)20a, an internal data modem (DM)20b, and/or the like. Further, the processor may comprise functionality to operate one or more software programs, which may be stored in memory. For example, the processor20may be capable of operating a connectivity program, such as a web browser. The connectivity program may allow the mobile terminal10to transmit and receive web content, such as location-based content, according to a protocol, such as Wireless Application Protocol (WAP), hypertext transfer protocol (HTTP), and/or the like. The mobile terminal10may be capable of using Transmission Control Protocol/Internet Protocol (TCP/IP) to transmit and receive web content across the internet or other networks.

The mobile terminal10may also comprise a user interface including, for example, an earphone or speaker24, a ringer22, a microphone26, a display28, a user input interface, and/or the like, which may be operationally coupled to the processor20. In this regard, the processor20may comprise user interface circuitry configured to control at least some functions of one or more elements of the user interface, such as, for example, the speaker24, the ringer22, the microphone26, the display28, and/or the like. The processor20and/or user interface circuitry comprising the processor20may be configured to control one or more functions of one or more elements of the user interface through computer program instructions (for example, software and/or firmware) stored on a memory accessible to the processor20(for example, volatile memory40, non-volatile memory42, and/or the like). Although not shown, the mobile terminal may comprise a battery for powering various circuits related to the mobile terminal, for example, a circuit to provide mechanical vibration as a detectable output. The user input interface may comprise devices allowing the mobile terminal to receive data, such as a keypad30, a touch display (not shown), a joystick (not shown), and/or other input device. In embodiments including a keypad, the keypad may comprise numeric (0-9) and related keys (#, *), and/or other keys for operating the mobile terminal.

As shown inFIG. 2, the mobile terminal10may also include one or more means for sharing and/or obtaining data. For example, the mobile terminal may comprise a short-range radio frequency (RF) transceiver and/or interrogator64so data may be shared with and/or obtained from electronic devices in accordance with RF techniques. The mobile terminal may comprise other short-range transceivers, such as, for example, an infrared (IR) transceiver66, a Bluetooth™ (BT) transceiver68operating using Bluetooth™ brand wireless technology developed by the Bluetooth™ Special Interest Group, a wireless universal serial bus (USB) transceiver70and/or the like. The Bluetooth™ transceiver68may be capable of operating according to low power/energy or ultra-low power/energy Bluetooth™ technology (for example, Wibree™) radio standards. In this regard, the mobile terminal10and, in particular, the short-range transceiver may be capable of transmitting data to and/or receiving data from electronic devices within a proximity of the mobile terminal, such as within 10 meters, for example. Although not shown, the mobile terminal may be capable of transmitting and/or receiving data from electronic devices according to various wireless networking techniques, including 6LoWpan, Wi-Fi, Wi-Fi low power, WLAN techniques such as IEEE 802.11 techniques, IEEE 802.15 techniques, IEEE 802.16 techniques, and/or the like.

FIGS. 3-6illustrate example flowcharts of the example operations performed by a method, apparatus and computer program product in accordance with an embodiment of the present invention. It will be understood that each block of the flowcharts, and combinations of blocks in the flowcharts, may be implemented by various means, such as hardware, firmware, processor, circuitry and/or other device associated with execution of software including one or more computer program instructions. For example, one or more of the procedures described above may be embodied by computer program instructions. In this regard, the computer program instructions which embody the procedures described above may be stored by a memory of an apparatus employing an embodiment of the present invention and executed by a processor in the apparatus. As will be appreciated, any such computer program instructions may be loaded onto a computer or other programmable apparatus (e.g., hardware) to produce a machine, such that the resulting computer or other programmable apparatus provides for implementation of the functions specified in the flowcharts' block(s). These computer program instructions may also be stored in a non-transitory computer-readable storage memory that may direct a computer or other programmable apparatus to function in a particular manner, such that the instructions stored in the computer-readable storage memory produce an article of manufacture, the execution of which implements the function specified in the flowcharts' block(s). The computer program instructions may also be loaded onto a computer or other programmable apparatus to cause a series of operations to be performed on the computer or other programmable apparatus to produce a computer-implemented process such that the instructions which execute on the computer or other programmable apparatus provide operations for implementing the functions specified in the flowcharts' block(s). As such, the operations ofFIGS. 3-6, when executed, convert a computer or processing circuitry into a particular machine configured to perform an example embodiment of the present invention. Accordingly, the operations ofFIGS. 3-6define an algorithm for configuring a computer or processing to perform an example embodiment. In some cases, a general purpose computer may be provided with an instance of the processor which performs the algorithms ofFIGS. 3-6to transform the general purpose computer into a particular machine configured to perform an example embodiment.

In some embodiments, certain ones of the operations herein may be modified or further amplified as described below. Moreover, in some embodiments additional optional operations may also be included. It should be appreciated that each of the modifications, optional additions or amplifications below may be included with the operations above either alone or in combination with any others among the features described herein.

FIG. 3is an example flowchart illustrating a method of hosting the buffer creation and clearance performed in accordance with an embodiment of the present invention. As shown in operation302, the OpenCL module112may include means, such as the host116or the like for causing a kernel to be compiled and built that has been generated for a compute device. As shown in operation304, the OpenCL module112may include means, such as the host116or the like for causing a buffer to be created in a memory. As shown in operation306, OpenCL module112may include means, such as the host116or the like for causing one or more kernel arguments to be set. As shown in operation308, the OpenCL module112may include means, such as the host116or the like for defining at least one work size, wherein the work size is at least one of a global work size or a local work size. As shown in operation310, OpenCL module112may include means, such as the host116or the like for causing the kernel to be transmitted to the compute device, wherein the buffer is cleared by executing the kernel.

FIG. 4is an example flowchart illustrating a method of operating a buffer initialization and clearing system performed in accordance with an embodiment of the present invention. As shown in operation402, the buffer initialization and clearing system110may include means, such as the Compute Device120, the processor124, the OpenCL module112, and the web browser module114or the like for receiving a kernel from a host. As shown in operation404, the buffer initialization and clearing system110may include means, such as the Compute Device120, the processor124, the OpenCL module112, the web browser module114or the like for causing a global identifier to be extracted. As shown in operation406, the buffer initialization and clearing system110may include means, such as the Compute Device120, the processor124, the OpenCL module112, the web browser module114or the like for causing a bound check to be performed. As shown in operation408, the buffer initialization and clearing system110may include means, such as the Compute Device120, the processor124, the OpenCL module112, the web browser module114or the like for causing a buffer to be initialized, wherein the buffer is configured such that mobile terminal specific information is cleared.

Alternatively or additionally, the systems and methods as described herein may be implemented using the clCreateSubBuffer function in the OpenCL API. Assume that a WebCL application requests a read-only buffer to be created, for example by calling createBuffer with the parameter CL_MEM_READ_ONLY. Now, the WebCL implementation may first create a read/write buffer by calling clCreateBuffer with the flag CL_MEM_READ_WRITE. Unlike a read-only buffer, a read/write buffer can be cleared by the kernel. Once the buffer has been cleared, the WebCL implementation may create a read-only “view” to the same buffer by calling clCreateSubBuffer with the flag CL_MEM_READ_ONLY. This read-only buffer is then returned to the application.

In WebGL, the equivalent to a WebCL kernel is called a shader. Thus, the methods ofFIGS. 3 and 4may be implemented in WebGL (seeFIGS. 5 and 6) and also in other programming frameworks.

FIG. 5is an example flowchart illustrating a method of hosting the buffer creation and clearance performed in WebGL and in accordance with an embodiment of the present invention. As shown in operation502, the buffer initialization and clearing system110may include means, such as the host116or the like for causing a shader to be compiled and built for a compute device. As shown in operation504, the buffer initialization and clearing system110may include means, such as the host116or the like for causing a buffer to be created in a memory. As shown in operation506, the buffer initialization and clearing system110may include means, such as the host116or the like for causing one or more shader arguments to be set. As shown in operation508, the buffer initialization and clearing system110may include means, such as the host116or the like for causing the shader to be transmitted to the compute device, wherein the buffer is cleared by executing the shader.

FIG. 6is an example flowchart illustrating a method of operating a buffer initialization and clearing system performed in WebGL and in accordance with an embodiment of the present invention. As shown in operation602, the buffer initialization and clearing system110may include means, such as the Compute Device120, the processor124, and the web browser module114or the like for receiving a shader from a host. As shown in operation604, the buffer initialization and clearing system110may include means, such as the Compute Device120, the processor124, the web browser module114or the like for causing a buffer to be initialized, wherein the buffer is configured such that mobile terminal specific information is cleared.

Advantageously, the systems and methods as described herein result in an improved performance when a buffer is initialized by the device. Additionally, no extra memory buffers need to be reserved from the host just for the purpose of storing zeros or other predefined values. While the kernel is compiled in some embodiments, such compilation may only occur once, for example.