Computer implementation methods, computer systems, computer programs (simplification of conditional structures for loop optimization)
By generating a condition tree and slicing multidimensional tables to create new conditional statements, the method addresses the limitations of existing loop optimization techniques, enhancing loop execution efficiency and reducing code size and control overhead.
Patent Information
- Authority / Receiving Office
- JP · JP
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2025-07-14
- Publication Date
- 2026-03-18
AI Technical Summary
Existing loop optimization techniques, such as loop splitting and full loop unrolling, do not consistently provide optimal performance improvements due to increased program size and instruction buffer constraints, limiting their applicability.
A processor set generates a condition tree, multidimensional table, and slices it to create multiple sequences with new conditional statements, reducing code size and control overhead by modifying loops with multiple conditional statements.
The method reduces code size and control overhead, ensuring efficient execution of loops by aligning values and eliminating pre-defined issues, thereby improving computer performance.
Smart Images

Figure 2026049653000001_ABST
Abstract
Description
Technical Field
[0001] This disclosure generally relates to improved computer systems, and more particularly to loop modification of program instructions.
[0002] Loop optimization is used in computer programming to increase the execution of loops in program instructions. A loop is a repetitive block of program instructions that includes multiple conditional statements and can be used to perform an operation on data several times. These operations can include performing calculations, conversions, or other data title operations.
[0003] Loop splitting is a technique used to optimize the execution of loops in program instructions. This method involves dividing a single loop into multiple loops, such that each of the multiple loops processes a portion of the workload of the original loop. In this case, loop splitting can improve parallelism, reduce branch mispredictions, and improve cache utilization. By splitting the loop, the computer system can utilize the capabilities of modern processors to execute multiple program instructions simultaneously and reduce execution time.
[0004] Full loop unrolling is another loop optimization technique that replicates the body of a loop multiple times to remove control overhead. Instead of iterating through the loop, the loop iterations are manually expanded and the loop is replaced with a sequence of repeated program instructions. Full loop unrolling improves the execution of program instructions by reducing the number of branch instructions and loop control logic.
Summary of the Invention
Problems to be Solved by the Invention
[0005] As illustrated, these types of loop optimization techniques can yield improved performance for many conventional workloads. However, these different types of loop optimization may not provide the desired optimization of loops in program instructions in all situations. [Means for solving the problem]
[0006] According to an exemplary embodiment, a computer implementation method is provided for generating a modified loop for a loop having multiple conditional statements. A processor set generates a condition tree based on the multiple conditional statements in the loop. Values are determined by evaluating each conditional statement in the multiple conditional statements. The processor set generates a multidimensional table based on the values from the multiple conditional statements. The processor set determines the inductive variables of the modified loop. The processor set slices the multidimensional table to generate multiple slices. The processor set generates multiple sequences by splitting the values in each slice. The processor set generates multiple new conditional statements based on the determined inductive variables and the values and strides in at least the multiple sequences. The processor set generates a modified loop based on the multiple new conditional statements. According to another exemplary embodiment, a computer system and computer program product are provided for generating a modified loop for a loop having multiple conditional statements. [Brief explanation of the drawing]
[0007] [Figure 1] This is a block diagram of a computing environment according to an exemplary embodiment.
[0008] [Figure 2] A block diagram of a program instruction management environment according to an exemplary embodiment is shown.
[0009] [Figure 3A]A diagram illustrating the generation of a modified loop for a loop having multiple conditional statements according to an exemplary embodiment is provided. [Figure 3B] A diagram illustrating the generation of a modified loop for a loop having multiple conditional statements according to an exemplary embodiment is provided.
[0010] [Figure 4A] A diagram illustrating the generation of a modified loop for a loop having multiple conditional statements according to an exemplary embodiment is provided. [Figure 4B] A diagram illustrating the generation of a modified loop for a loop having multiple conditional statements according to an exemplary embodiment is provided. [Figure 4C] A diagram illustrating the generation of a modified loop for a loop having multiple conditional statements according to an exemplary embodiment is provided.
[0011] [Figure 5] A flowchart illustrating the process for generating a modified loop for a loop having multiple conditional statements according to an exemplary embodiment is shown.
[0012] [Figure 6] A flowchart illustrating the process for generating a sequence by splitting the values in each slice according to an exemplary embodiment is shown.
[0013] [Figure 7] A flowchart illustrating the process for adjusting the sequence according to an exemplary embodiment is shown.
[0014] [Figure 8] A flowchart illustrating the process for adjusting the sequence according to an exemplary embodiment is shown.
[0015] [Figure 9] A flowchart illustrating the process for determining the derivation variables according to an exemplary embodiment is shown.
[0016] [Figure 10] A flowchart is illustrated to show a process for generating a plurality of new conditional statements according to an exemplary embodiment.
[0017] [Figure 11] A flowchart is illustrated to show a process for generating a modified loop for a loop having a plurality of conditional statements according to an exemplary embodiment.
[0018] [Figure 12] A flowchart is illustrated to show a process for generating a new conditional statement for a modified loop according to an exemplary embodiment.
[0019] [Figure 13] A flowchart is illustrated to show a process for replacing a loop with a lowest-cost modified loop according to an exemplary embodiment.
[0020] [Figure 14] A flowchart is illustrated to show a process for performing a cost analysis according to an exemplary embodiment.
[0021] [Figure 15] A block diagram of a data processing system according to an exemplary embodiment.
BEST MODE FOR CARRYING OUT THE INVENTION
[0022] The computer implementation method generates a modified loop for a loop having multiple conditional statements. A processor set generates a condition tree based on the multiple conditional statements in the loop. The processor set generates a multidimensional table based on the values of the multiple conditional statements obtained from the condition tree. The values are determined by evaluating each conditional statement in the multiple conditional statements. The processor set determines the inductive variables of the modified loop. The processor set slices the multidimensional table to generate multiple slices. Each slice in the multiple slices represents at least a portion of the multidimensional table. The processor set generates multiple sequences by splitting the values in each slice. The values and strides in the multiple sequences are determined for the proper execution of the modified loop. The processor set generates multiple new conditional statements based on the determined inductive variables and at least the values and strides in the multiple sequences. The processor set generates the modified loop based on the multiple new conditional statements. As a result, the exemplary embodiment provides the technical benefit of modifying the loop to reduce code size and control overhead.
[0023] In an exemplary embodiment, each slice from the plurality of slices includes a set of values obtained by varying the determined inductive variable while fixing other existing inductive variables in the loop having the plurality of conditional statements. As a result, the exemplary embodiment provides the technical effect of identifying a linear pattern for values in a plurality of sequences for each slice.
[0024] In an exemplary embodiment, as part of generating the plurality of sequences by splitting the values in each slice, the processor set generates a sequence with a fixed stride by splitting the values in each slice. Each sequence in the sequence with a fixed stride corresponds to a plurality of values of the result index in each slice. As a result, the exemplary embodiment provides the technical effect of having sequences with a similar structure for efficiently generating a more compact modified loop.
[0025] In an exemplary embodiment, the processor set further determines, based on a condition tree, whether the induced variable is the innermost iterator of a loop having multiple conditional statements. In response to determining, based on the condition tree, that the determined induced variable is not the innermost iterator of the loop having multiple conditional statements, the processor set adjusts the sequences having a non-zero stride in the sequences having a fixed stride to generate the multiple sequences. The stride value of each sequence in the multiple sequences is zero. As a result, the exemplary embodiment provides the technical effect of eliminating the pre-defined problem in the modified loop in order to ensure proper execution of the modified loop.
[0026] In an exemplary embodiment, the processor set further generates the plurality of sequences by splitting sequences having non-zero stride within sequences having fixed stride. The number of sequences per resulting index is the same across different slices. As a result, the exemplary embodiment provides a technical effect of aligning values in the plurality of slices to ensure proper execution of the modified loop generated based on the plurality of sequences.
[0027] In an exemplary embodiment, as part of determining the inductive variables for the modified loop, the processor set generates the inductive variables to mimic the traverse of the multidimensional table in a one-dimensional manner. As a result, the exemplary embodiment provides the technical effect of providing an alternative slicing method that treats the entire multidimensional table as a single slice.
[0028] In an exemplary embodiment, as part of generating the multiple new conditional statements based on determined inductive variables and values and strides in at least the multiple sequences, the processor set generates multiple lists per slice in the multiple slices based on non-common values and strides in the multiple sequences and the determined inductive variable values corresponding to the last term of the sequence in each slice. The processor set generates multiple new inductive variables for the modified loop. The starting values and strides of the multiple new inductive variables are determined based on values from the multiple lists. The processor set generates the multiple new conditional statements using the multiple new inductive variables, existing variables from the loop, values from the multiple lists, and common values in the multiple sequences. As a result, the exemplary embodiment provides the technical effect of generating new conditional statements that can be used for the modified loop in order to reduce code size and control overhead.
[0029] The computer system includes a processor set, a set of one or more computer-readable storage media, and program instructions stored in the set of one or more storage media to cause the processor set to perform the following operations: The processor set generates a condition tree based on multiple conditional statements in a loop. The values are determined by evaluating each conditional statement in the above multiple conditional statements. The processor set generates a multidimensional table based on the values of the multiple conditional statements obtained from the condition tree. The processor set determines the inductive variables of the modified loop. The processor set slices the multidimensional table to generate multiple slices. Each slice in the multiple slices represents at least a portion of the multidimensional table. The processor set generates multiple sequences by splitting the values in each slice. The values and strides in the multiple sequences are determined for the proper execution of the modified loop. The processor set generates multiple new conditional statements based on the determined inductive variables and the values and strides in at least the above multiple sequences. The processor set generates the modified loop based on the above multiple new conditional statements. As a result, the exemplary embodiments provide the technical benefits of modifying loops to reduce code size and control overhead.
[0030] In an exemplary embodiment, each slice from a plurality of slices includes a set of values obtained by varying a determined inductive variable while fixing other existing inductive variables in a loop having multiple conditional statements. As a result, the exemplary embodiment provides the technical effect of identifying a linear pattern for values in a plurality of sequences for each slice.
[0031] In an exemplary embodiment, as part of generating the multiple sequences by dividing the values in each slice, the processor set further executes program instructions to generate sequences with a fixed stride by dividing the values in each slice. The sequences in the fixed-stride sequences correspond to multiple values of the result index in each slice. As a result, the exemplary embodiment provides the technical effect of having sequences with a similar structure for efficiently generating more compact modified loops.
[0032] In an exemplary embodiment, the processor set further executes program instructions to determine, based on the condition tree, whether the determined induced variable is the innermost iterator of a loop having multiple conditional statements. In response to determining, based on the condition tree, that the induced variable is not the innermost iterator of a loop having multiple conditional statements, the processor set further executes program instructions to coordinate sequences having non-zero strides in sequences having fixed strides to generate the above multiple sequences. The stride value of each sequence in the multiple sequences is zero. As a result, the exemplary embodiment provides the technical effect of eliminating the pre-defined problem in the modified loop in order to ensure proper execution of the modified loop.
[0033] In an exemplary embodiment, the processor set further executes program instructions to generate the plurality of sequences by dividing sequences having non-zero stride into sequences having fixed stride. The plurality of sequences per resulting index are identical across different slices. As a result, the exemplary embodiment provides a technical effect of aligning values in the plurality of slices to ensure proper execution of the modified loop generated based on the plurality of sequences.
[0034] In an exemplary embodiment, as part of determining the induced variables for the modified loop, the processor set further executes program instructions to generate induced variables in order to mimic a traverse of a multidimensional table in a one-dimensional manner. As a result, the exemplary embodiment provides the technical effect of offering an alternative slicing method that treats the entire multidimensional table as a single slice.
[0035] In an exemplary embodiment, as part of generating the plurality of new conditional statements based on the determined inducer variables and the values and strides in at least the plurality of sequences, the processor set further executes program instructions to generate a plurality of per-slice lists in the plurality of slices based on the non-common values and strides in the plurality of sequences and the value of the determined inducer variable corresponding to the last term of the sequence in each slice. The processor set further executes program instructions to generate a plurality of new inducer variables for the modified loop. The starting values and strides of the plurality of new inducer variables are determined based on the values from the plurality of lists. The processor set further executes program instructions to generate the plurality of new conditional statements using the plurality of new inducer variables, existing variables from the loop, the values from the plurality of lists, and the common values in the plurality of sequences. As a result, the exemplary embodiment provides the technical effect of generating new conditional statements that can be used for the modified loop in order to reduce code size and control overhead.
[0036] In an exemplary embodiment, a computer program product is provided for generating a modified loop for a loop having multiple conditional statements. The computer program product includes one or more sets of computer-readable storage media and program instructions stored in one or more sets of storage media to perform the following computer operations: The program instructions are executable by a computer system to generate a condition tree based on the multiple conditional statements in the loop. The values are determined by evaluating each of the multiple conditional statements. The program instructions are executable by a computer system to cause the computer system to generate a multidimensional table based on the values of the multiple conditional statements obtained from the condition tree. The program instructions are executable by a computer system to cause the computer system to slice the multidimensional table to generate multiple slices. Each slice in the multiple slices represents at least a portion of the multidimensional table. The program instructions are executable by a computer system to cause the computer system to generate multiple sequences by dividing the values in each slice. The values and strides in the multiple sequences are determined for the proper execution of the modified loop. The program instructions are executable by the computer system to cause the computer system to generate a plurality of new conditional statements based on the determined induction variables and the values and strides in at least the plurality of sequences. The program instructions are executable by the computer system to cause the computer system to generate a modified loop based on the plurality of new conditional statements. As a result, the exemplary embodiment provides the technical benefit of modifying the loop to reduce code size and control overhead.
[0037] In an exemplary embodiment, each slice from a plurality of slices includes a set of values obtained by varying a determined inductive variable while fixing other existing inductive variables in a loop having multiple conditional statements. As a result, the exemplary embodiment provides the technical effect of identifying a linear pattern for values in a plurality of sequences for each slice.
[0038] In an exemplary embodiment, as part of generating the plurality of sequences by dividing the values in each slice, the program instruction is further executable by the computer system to cause the computer system to generate a sequence having a fixed stride by dividing the values in each slice. Each sequence in the sequence having a fixed stride corresponds to a plurality of values of the result index in each slice. As a result, the exemplary embodiment provides the technical effect of having a sequence having a similar structure for efficiently generating a more compact modified loop.
[0039] In an exemplary embodiment, the program instruction is further executable by the computer system to cause the computer system to determine, based on a condition tree, whether the determined induced variable is the innermost iterator of a loop having multiple conditional statements. The program instruction is further executable by the computer system to cause the computer system to adjust sequences having a non-zero stride in sequences having a fixed stride in response to the determination, based on the condition tree, that the induced variable is not the innermost iterator of a loop having multiple conditional statements, in order to generate the above sequences. The stride value of each sequence in the multiple sequences is zero. As a result, the exemplary embodiment provides the technical effect of eliminating the pre-definition problem in the modified loop in order to ensure proper execution of the modified loop.
[0040] In an exemplary embodiment, the program instructions are further executable by the computer system to cause the computer system to generate the plurality of sequences by dividing sequences having non-zero strides into sequences having fixed strides. The plurality of sequences for each resulting index are identical across different slices. As a result, the exemplary embodiment provides a technical effect of aligning the values in the plurality of slices to ensure proper execution of the modified loop generated based on the plurality of sequences.
[0041] In an exemplary embodiment, as part of generating the multiple new conditional statements based on determined inductive variables and values and strides in at least the multiple sequences, the program instruction is further executable by the computer system to cause the computer system to generate multiple slice-by-slice lists in the multiple slices based on non-common values and strides in the multiple sequences and the determined inductive variable values corresponding to the last term of the sequence in each slice. The program instruction is further executable by the computer system to cause the computer system to generate multiple new inductive variables for the modified loop. The starting values and strides of the multiple new inductive variables are determined based on values from the multiple lists. The program instruction is further executable by the computer system to cause the computer system to generate the multiple new conditional statements using the multiple new inductive variables, existing variables from the loop, values from the multiple lists, and common values in the multiple sequences. As a result, the exemplary embodiment provides the technical effect of generating new conditional statements that can be used for the modified loop in order to reduce code size and control overhead.
[0042] The computer implementation method generates a modified loop for loops having multiple conditional statements. The processor set generates a tree based on the multiple conditional statements in the loop. The processor set generates a multidimensional table based on the values from the multiple conditional statements. The processor set slices the multidimensional table to generate multiple slices using the multiple slicing methods. Each slice in the multiple slices represents at least a portion of the multidimensional table. For each slicing method, the processor set generates multiple sequences by splitting the values in each slice. For each slicing method, the processor set generates multiple new conditional statements based on the determined inductive variables and at least the values and strides in the multiple sequences. For each slicing method, the processor set generates a modified loop based on the multiple new conditional statements. As a result, the exemplary embodiment provides the technical benefit of modifying loops using different methods to reduce code size and control overhead.
[0043] In an exemplary embodiment, as part of the step by which the processor set generates the plurality of new conditional statements for each slicing method, based on values and strides in at least the plurality of sequences, the processor set further generates a plurality of lists for each slicing method, based on non-common values in the plurality of sequences. The processor set further generates a plurality of new induce variables for the modified loop for each slicing method. The starting values and strides of the plurality of new induce variables are determined for each slicing method based on values from the plurality of lists. The processor set further generates the plurality of new conditional statements for each slicing method, using the plurality of new induce variables for the modified loop for each slicing method, existing variables from the loop, values from the plurality of lists, and common values in the plurality of sequences for each slicing method. As a result, the exemplary embodiment provides the technical benefit of modifying the loop using different methods to reduce code size and control overhead.
[0044] In an exemplary embodiment, the processor set further generates a condition tree of the modified loop for each slicing method. The processor set further performs a cost analysis of the modified loop for each slicing method based on the condition tree of the modified loop for each slicing method and the plurality of new induce variables for the modified loop for each slicing method. The processor set further replaces the loop with the plurality of conditional statements using the modified loop for the slicing method at the lowest cost. As a result, the exemplary embodiment provides the technical effect of modifying the loop to a method at the lowest cost to reduce code size and control overhead.
[0045] In an exemplary embodiment, as part of the step of performing the cost analysis of the modified loops for each slicing method, based on the condition tree of the modified loops for each slicing method and the plurality of new variables for the modified loops for each slicing method, the processor set further identifies the set of modified loops with the fewest leaves in the condition tree. The processor set further determines whether the set of modified loops comprises one or more loops for each slicing method. The processor set further identifies the set of modified loops as the modified loop for the slicing method at the lowest cost. As a result, the exemplary embodiment provides the technical effect of selecting the modified loops generated by the slicing method at the lowest cost.
[0046] In an exemplary embodiment, the processor set further determines, in response to the determination that the set of modified loops includes one or more slicing methods, to identify, at the lowest cost, the subset of modified loops from the set of modified loops that has the fewest new induce variables for the slicing method as the modified loop of the slicing method. As a result, the exemplary embodiment provides the technical effect of selecting the modified loop generated by the slicing method at the lowest cost in the context of the binding.
[0047] Various aspects of this disclosure are described by explanatory text, flowcharts, block diagrams of computer systems, and / or block diagrams of mechanical logic included in embodiments of computer program products (CPPs). With respect to any flowchart, depending on the technology involved, operations may be performed in a different order than those shown in a given flowchart. For example, again depending on the technology involved, two operations shown in consecutive blocks of a flowchart may be performed in reverse order, as a single integrated step, simultaneously, or with at least partial time overlap.
[0048] Embodiments of a computer program product ("CPP Embodiment" or "CPP") are terms used in this disclosure to describe any set of one or more storage media ("mediums") collectively comprising a set of one or more storage devices that collectively contain machine-readable code corresponding to instructions and / or data for performing computer operations specified in a given CPP claim. "Storage device" is any tangible device capable of holding and storing instructions for use by a computer processor. Without limitation, computer-readable storage media may be electronic storage media, magnetic storage media, optical storage media, electromagnetic storage media, semiconductor storage media, mechanical storage media, or any preferred combination thereof. Some known types of storage devices, including these media, include diskettes, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), static random access memory (SRAM), compact disk read-only memory (CD-ROM), digital purpose disks (DVDs), memory sticks, floppy disks, mechanical encoding devices (such as punch cards or pits / lands formed on the main surface of a disk), or any suitable combination of those described above. When the term "computer-readable storage medium" is used in this disclosure, it shall not be construed as storage in the form of a transient signal itself, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through waveguides, optical pulses passing through optical fiber cables, electrical signals transmitted through wires, and / or other transmission media. As those skilled in the art will understand, data is typically moved at several intermittent points in the normal operation of a storage device, such as during access, defragmentation, or garbage collection; however, data is not transient while it is stored, so the foregoing does not make a storage device transient.
[0049] Referring here to the figures, and in particular to Figure 1, a block diagram of a computing environment is illustrated according to an exemplary embodiment. The computing environment 100 includes an example of an environment for executing at least a portion of the computer code involved in performing the method of the invention, such as a program instruction manager 190. In addition to the program instruction manager 190, the computing environment 100 includes, for example, a computer 101, a wide area network (WAN) 102, an end user device (EUD) 103, a remote server 104, a public cloud 105, and a private cloud 106. In this embodiment, the computer 101 includes a processor set 110 (including processing circuits 120 and cache 121), a communication fabric 111, volatile memory 112, persistent storage 113 (including an operating system 122 and a program instruction manager 190 as shown above), a peripheral device set 114 (including a user interface (UI) device set 123, storage 124, and an Internet of Things (IoT) sensor set 125), and a network module 115. The remote server 104 includes a remote database 130. The public cloud 105 includes a gateway 140, a cloud orchestration module 141, a host physical machine set 142, a virtual machine set 143, and a container set 144.
[0050] Computer 101 may take the form of a desktop computer, a currently known or future-developed laptop computer, tablet computer, smartphone, smartwatch or other wearable computer, mainframe computer, quantum computer or any other form of computer or mobile device capable of running programs, accessing networks or querying databases such as remote database 130. As is well understood in the field of computer technology, and depending on the technology, the execution of the computer implementation method may be distributed among multiple computers and / or across multiple locations. On the other hand, in this presentation concerning the computing environment 100, in order to keep the presentation as concise as possible, the detailed discussion focuses on a single computer, specifically computer 101. Although computer 101 is not shown in the cloud in Figure 1, it may be located in the cloud. On the other hand, computer 101 is not required to be located in the cloud, except to any extent that can be definitively shown.
[0051] The processor set 110 includes one or more computer processors of any type currently known or to be developed in the future. The processing circuitry 120 may be distributed across multiple packages, for example, multiple coordinated integrated circuit chips. The processing circuitry 120 may implement multiple processor threads and / or multiple processor cores. The cache 121 is memory located within the processor chip package and is typically used for data or code that should be available for high-speed access by threads or cores running on the processor set 110. The cache memory is typically organized into multiple levels depending on its relative proximity to the processing circuitry. Alternatively, some or all of the cache for the processor set may be located "off-chip". In some computing environments, the processor set 110 may operate using qubits and be designed to perform quantum computing.
[0052] Computer-readable program instructions are typically loaded onto computer 101, causing the processor set 110 of computer 101 to execute a series of operational steps, thereby enabling the computer implementation method. As a result, the instructions thus executed instantiate the method specified in the flowcharts and / or descriptions of the computer implementation method contained herein (collectively referred to as the "Method of the Invention"). These computer-readable program instructions are stored in various types of computer-readable storage media, such as cache 121 and other storage media discussed below. The program instructions and associated data are accessed by the processor set 110 to control and direct the execution of the Method of the Invention. In computing environment 100, at least some of the instructions for executing the Method of the Invention may be stored in a program instruction manager 190 in persistent storage 113.
[0053] The communication fabric 111 is a signal conduction path that enables various components of the computer 101 to communicate with each other. Typically, this fabric is made up of switches and conductive paths, such as buses, bridges, and physical input / output ports. Other types of signal communication paths, such as optical fiber communication paths and / or wireless communication paths, may be used.
[0054] The volatile memory 112 is any type of volatile memory that is currently known or may be developed in the future. Examples include dynamic random-access memory (RAM) or static RAM. Typically, volatile memory 112 is characterized by random access, but this is not required unless explicitly stated. In computer 101, the volatile memory 112 is located in a single package and is internal to computer 101, but alternatively or additionally, the volatile memory 112 may be distributed across multiple packages and / or located externally to computer 101.
[0055] The persistent storage 113 is any form of non-volatile storage for a computer, currently known or to be developed in the future. The non-volatility of this storage means that the stored data is maintained whether or not power is directly supplied to the computer 101 and / or the persistent storage 113. The persistent storage 113 may be read-only memory (ROM), but typically at least a portion of the persistent storage allows for writing, deleting, and rewriting of data. Some well-known forms of persistent storage include magnetic disks and solid-state storage devices. The operating system 122 may take several forms, such as various known proprietary operating systems or open-source portable operating system interface (CSI) type operating systems employing a kernel. The code contained in the program instruction manager 190 typically includes at least a portion of computer code involved in executing the method of the invention.
[0056] The peripheral device set 114 includes a set of peripheral devices for the computer 101. Data communication connections between the computer 101's peripheral devices and other components may be implemented in various ways, such as Bluetooth® connections, near-field communication (NFC) connections, connections made by cables (such as Universal Serial Bus (USB) type cables), insert-type connections (e.g., Secure Digital (SD) cards), connections made through local area communication networks, and even connections made through wide area networks such as the Internet. In various embodiments, the UI device set 123 may include components such as a display screen, speakers, microphones, wearable devices (such as goggles and smartwatches), keyboards, mice, printers, touchpads, game controllers, and haptic devices. Storage 124 is external storage such as an external hard drive, or insertable storage such as an SD card. Storage 124 may be persistent and / or volatile. In some embodiments, storage 124 may take the form of a quantum computing memory device for storing data in the form of qubits. In embodiments where computer 101 is required to have a large amount of storage (for example, computer 101 locally stores and manages a large database), this storage can then be provided by peripheral storage devices designed to store very large amounts of data, such as a storage area network (SAN) shared by multiple geographically distributed computers. The IoT sensor set 125 consists of sensors that can be used in Internet of Things applications. For example, one sensor may be a thermometer and another may be a motion detector.
[0057] The network module 115 is a collection of computer software, hardware, and firmware that enables computer 101 to communicate with other computers via the WAN 102. The network module 115 may include hardware such as a modem or Wi-Fi® signal transceiver, software for packetizing and / or depacketizing data for communication network transmission, and / or web browser software for communicating data over the Internet. In some embodiments, the network control function and network forwarding function of the network module 115 are performed on the same physical hardware device. In other embodiments (e.g., embodiments utilizing Software-Defined Networking (SDN)), the control function and forwarding function of the network module 115 are performed on physically separate devices so that the control function manages multiple different network hardware devices. Computer-readable program instructions for performing the method of the present invention can typically be downloaded to computer 101 from an external computer or external storage device via a network adapter card or network interface included in the network module 115.
[0058] WAN102 is any wide area network (e.g., the Internet) that can transmit computer data over non-local distances using any currently known or future-developed technology for transmitting computer data. In some embodiments, WAN102 may be replaced and / or complemented by a local area network (LAN), such as a Wi-Fi® network, designed to transmit data between devices located in a local area. WANs and / or LANs typically include computer hardware such as copper transmission cables, optical transmission fibers, wireless transmissions, routers, firewalls, switches, gateway computers, and edge servers.
[0059] An end-user device (EUD) 103 is any computer system used and controlled by an end-user (e.g., a customer of the company operating computer 101), and can take any of the forms considered above in relation to computer 101. EUD 103 typically receives useful and valuable data from the operation of computer 101. For example, in a hypothetical case where computer 101 is designed to provide recommendations to an end-user, these recommendations would typically be communicated from computer 101's network module 115 to EUD 103 via WAN 102. In this way, EUD 103 can display or otherwise present the recommendations to the end-user. In some embodiments, EUD 103 may be a client device such as a thin client, heavy client, mainframe computer, or desktop computer.
[0060] The remote server 104 is any computer system that provides at least some data and / or functionality to computer 101. The remote server 104 may be controlled and used by the same entity that operates computer 101. The remote server 104 represents a machine that collects and stores useful and valuable data for use by other computers, such as computer 101. For example, in a hypothetical case where computer 101 is designed and programmed to provide recommendations based on historical data, this historical data may be provided to computer 101 from the remote database 130 of the remote server 104.
[0061] The public cloud 105 is any computer system available for use by multiple entities, providing on-demand availability of computer system resources and / or other computing capabilities, particularly data storage (cloud storage) and computing capabilities, without requiring direct and active management by the user. Cloud computing typically leverages resource sharing to achieve coherence and economies of scale. Direct and active management of the computing resources of the public cloud 105 is performed by the computer hardware and / or software of the cloud orchestration module 141. The computing resources provided by the public cloud 105 are typically implemented by virtual computing environments running on various computers that make up the host physical machine set 142, which is the universe of physical computers available in and / or to the public cloud 105. The virtual computing environment (VCE) typically takes the form of virtual machines from the virtual machine set 143 and / or containers from the container set 144. These VCEs may be stored as images and are understood to be transferable either as images or after VCE instantiation, among and between various physical machine hosts. The cloud orchestration module 141 manages the transfer and storage of images, deploys new VCE instantiations, and manages active instantiations of VCE deployments. The gateway 140 is a collection of computer software, hardware, and firmware that enables the public cloud 105 to communicate over the WAN 102.
[0062] Here, some further explanation of virtualized computing environments (VCEs) is provided. A VCE can be stored as an "image." A new active instance of a VCE can be instantiated from an image. Two well-known types of VCEs are virtual machines and containers. A container is a VCE that uses operating system-level virtualization. This refers to an operating system feature in which the kernel allows for the existence of multiple isolated user-space instances called containers. These isolated user-space instances typically behave like actual computers in terms of the programs running within them. Computer programs running on a normal operating system can utilize all of that computer's resources, including connected devices, files and folders, network shares, CPU power, and quantifiable hardware capabilities. However, programs running inside a container can only use the contents of the container and the devices allocated to the container; this feature is known as containerization.
[0063] The private cloud 106 is similar to the public cloud 105, except that its computing resources are available only for use by a single enterprise. While the private cloud 106 is shown as being in communication with the WAN 102, in other embodiments, the private cloud may be completely isolated from the internet and accessible only through a local / private network. A hybrid cloud is a combination of multiple clouds of different types (e.g., private, community, or public cloud types), often implemented by different vendors. Each of the multiple clouds remains a distinct and discrete entity, but the larger hybrid cloud architecture is bound together by standardized or proprietary technologies that enable orchestration, management, and / or data application portability between the multiple component clouds. In this embodiment, both the public cloud 105 and the private cloud 106 are part of a larger hybrid cloud.
[0064] Cloud Computing Services and / or Microservices: The public cloud 105 and private cloud 106 are programmed and configured to provide cloud computing services and / or microservices (not shown separately in Figure 1). Unless otherwise indicated, the term “microservices” should be interpreted as including larger “services,” regardless of scale. Cloud services are typically infrastructure, platforms, or software hosted by a third-party provider and made available to users over the internet. Cloud services facilitate the flow of user data from front-end clients (e.g., user-side servers, tablets, desktops, laptops) to the provider’s systems over the internet and vice versa. In some embodiments, cloud services may be configured and orchestrated according to an “as a service” technology paradigm, where one is presented to internal or external customers in the form of a cloud computing service. The as a service offering typically provides endpoints that various customers interface with. These endpoints are typically based on a set of APIs. One category of as-a-service offerings is Platform as a Service (PaaS), where a service provider provisions, instantiates, runs, and manages modular bundles of code that customers can use to instantiate a computing platform and one or more applications without the complexity of building and maintaining the infrastructure typically associated with them. Another category is Software as a Service (SaaS), where software is centrally hosted and allocated on a subscription basis. SaaS is also known as on-demand software, web-based software, or web-hosted software.The four technical subfields involved in cloud services are deployment, integration, on-demand, and virtual private networks.
[0065] Exemplary embodiments recognize and consider one or more different considerations as described herein. For example, exemplary embodiments recognize and consider that conditional structures are used to represent the dynamic start address of a tensor for a transfer operation and the loop count of an inner loop. Exemplary embodiments recognize and consider that unoptimized conditional structures can be translated into comparison and jump instructions, which may result in an increase in execution period and program size.
[0066] The exemplary embodiment also recognizes and considers that current loop optimization techniques, such as loop splitting and full loop unrolling, may increase program size and therefore cannot always be applied due to instruction buffer (IBUFF) constraints. In this exemplary example, the instruction buffer constraint refers to the size limit on instructions queued in the buffer. In other words, applying transformations such as loop splitting and full loop unrolling may result in multiple program instructions exceeding the size limit for the instruction buffer.
[0067] In addition, the exemplary embodiments also recognize and consider that optimizing loops by reducing the size of program instructions may provide more opportunities for other loop optimization techniques such as loop splitting and full loop unrolling.
[0068] Thus, exemplary embodiments of the present invention provide a computer implementation method, computer system, and computer program product for generating a modified loop for a loop having multiple conditional statements in order to improve computer performance. A processor set generates a condition tree based on the multiple conditional statements in the loop. A processor set generates a multidimensional table based on the values from the multiple conditional statements. A processor set determines the inductive variables of the modified loop. A processor set slices the multidimensional table to generate multiple slices. A processor set generates multiple sequences by dividing the values in each slice. A processor set generates multiple new conditional statements based on the determined inductive variables and the values and strides in at least the multiple sequences. A processor set generates a modified loop based on the multiple new conditional statements.
[0069] Referring here to Figure 2, an example block diagram of a program instruction management environment is illustrated according to an exemplary embodiment. In this exemplary example, the program instruction management environment 200 includes components that may be implemented in hardware, such as the hardware shown in the computing environment 100 in Figure 1.
[0070] In this exemplary example, the program instruction management system 202 in the program instruction management environment 200 generates a modified loop 212 for loop 222 in the computer system 204 in order to improve the computer performance of the computer system 204. In this exemplary example, the program instruction management system 202 includes the computer system 204, which includes a program instruction manager 220. The program instruction manager 220 is located in the computer system 204. The program instruction manager 220 may be implemented using the program instruction manager 190 in Figure 1.
[0071] The program instruction manager 220 may be implemented in software, hardware, firmware, or a combination thereof. When software is used, the operations performed by the program instruction manager 220 may be implemented in program instructions configured to be executed in hardware such as a processor unit. When firmware is used, the operations performed by the program instruction manager 220 may be implemented in program instructions and data, which are stored in persistent memory for execution in the processor unit. When hardware is employed, the hardware may include circuitry that operates to perform the operations of the program instruction manager 220.
[0072] In exemplary examples, the hardware can take the form of at least one of a circuit system, an integrated circuit, an application-specific integrated circuit (ASIC), a programmable logic device, or any other suitable type of hardware configured to perform multiple operations. In the case of a programmable logic device, the device may be configured to perform multiple operations. The device may be reconfigured later or may be permanently configured to perform multiple operations. Programmable logic devices include, for example, programmable logic arrays, programmable array logic, field-programmable logic arrays, field-programmable gate arrays, and other suitable hardware devices. Additionally, these operations may be implemented in organic components integrated with inorganic components, or may consist entirely of organic components without human intervention. For example, these operations may be implemented as circuits within organic semiconductors.
[0073] As used herein, "multiple" means one or more items when used in relation to an item. For example, "multiple actions" means one or more actions.
[0074] Furthermore, the phrase "at least one of" when used with a list of items means that one or more different combinations of items from the list may be used, and that only one of each item in the list may be required. In other words, "at least one" means that any combination of items and the number of items in the list may be used, but not all items in the list are required. An item can be a specific object, thing, or category.
[0075] For example, without limitation, “at least one of item A, item B, or item C” could include item A, item A and item B, or item B. This example could also include item A, item B, and item C, or item B and item C. Of course, any combination of these items is possible. In some exemplary examples, “at least one” could, for example, without limitation, two of item A, one of item B, ten of item C, four of item B and seven of item C, or any other preferred combination.
[0076] As used herein, “medium access control (MAC) address” refers to a unique identifier assigned to a device’s network interface controller for internal network communication. In this illustrative example, “medium access control (MAC) address” may also be referred to as “media access control (MAC) address.”
[0077] Computer system 204 is a physical hardware system and includes one or more data processing systems. If there are more than one data processing systems in computer system 204, those data processing systems communicate with each other using a communication medium. The communication medium may be a network. The data processing systems may be selected from at least one of a computer, a server computer, a tablet computer, or several other suitable data processing systems.
[0078] As shown in the figure, the computer system 204 includes a set of processors 216 capable of executing program instructions 214 that implement the process in the exemplary example. In other words, the program instructions 214 are computer-readable program instructions.
[0079] As used herein, a processor unit within a processor set 216 is a hardware device and consists of hardware circuits, such as those on integrated circuits, that respond to and process instructions and program code that operate the computer. A processor unit may be implemented using the processor set 110 in Figure 1. If the processor set 216 executes program instructions 214 for a process, the processor set 216 may be one or more processor units in the same computer or in different computers. In other words, a process may be distributed among processor sets 216 on the same or different computers in the computer system 204.
[0080] Furthermore, the processor set 216 may consist of the same or different types of processor units. For example, the processor set 216 may be selected from at least one of a single-core processor, a dual-core processor, a multi-processor core, a central processing unit (CPU), a graphics processing unit (GPU), a digital signal processor (DSP), or several other types of processor units.
[0081] As shown in the figure, the computer system 204 includes a loop 222. Loop 222 is part of a program instruction, which is a control structure that allows a sequence of program instructions to be executed repeatedly. In this exemplary example, loop 222 may be part of program instruction 214 or part of a different program instruction in the computer system 204.
[0082] In this exemplary example, loop 222 contains multiple conditional statements 248. These multiple conditional statements 248 are decision-making statements within the body of loop 222. The multiple conditional statements 248 allow the execution of different blocks of program instructions depending on a specific condition. For example, the multiple conditional statements could be "if" statements, "else" and "else if" statements, a "switch statement," or any appropriate conditional statement.
[0083] In this exemplary example, multiple conditional statements 248 in loop 222 may be used by the program instruction manager 220 to generate a condition tree. For example, condition tree 250 in condition tree 228 may be generated based on the value 264 of conditional statement 248 in loop 222. In this exemplary example, each value in value 264 is determined by evaluating the conditional statement in conditional statement 248. In this exemplary example, condition tree 228 is a representation of a decision-making structure that controls the flow of execution inside loop 222 based on multiple conditional statements 248. In this exemplary example, each conditional node in condition tree 228 contains a condition node representing a conditional statement test inside loop 222, and the loop node represents the body of the loop, which defines the actions to be performed. In addition, condition tree 228 may also contain condition nodes representing the final result of the conditional statements and branches representing the flow of execution based on the results of the leaves. In this exemplary example, value 264 is represented by a leaf in condition tree 250.
[0084] The program instruction manager 220 may generate a multidimensional table 236 based on the condition tree 250 and the values 264. In this exemplary example, the multidimensional table 236 is generated by populating the values brought about by the conditional statements through iteration from the condition tree 250. Each dimension in the multidimensional table 236 represents an iterator in the loop 222. In this exemplary example, the iterator is an object in the loop 222 that traverses through the loop's iterations, one at a time.
[0085] In this exemplary example, the program instruction manager 220 slices the multidimensional table 236 to generate a plurality of slices 234. Each slice in the plurality of slices 234 represents a portion of the multidimensional table 236 and contains a set of values from that portion of the multidimensional table 236. For example, the plurality of slices 234 includes a slice 256 that represents a portion of the multidimensional table 236. In this example, slice 256 includes a result index 266 that indicates the coordinates of the values contained in slice 256.
[0086] In this exemplary example, the program instruction manager 220 may use multiple slicing methods from the slicing method 226 to generate the multiple slices 234. For example, the program instruction manager 220 may slice the multidimensional table 236 row by row, treating each row in the multidimensional table 236 as a slice in the multiple slices 234. In an alternative example, the program instruction manager 220 may slice the multidimensional table 236 column by column, treating each column in the multidimensional table 236 as a slice in the multiple slices 234. In yet another example, the program instruction manager 220 may treat the entire multidimensional table 236 as a slice in the multiple slices 234.
[0087] In this exemplary example, the program instruction manager 220 may determine the induced variable 224 of the modified loop 212 based on the slicing method 226. For example, if the multidimensional table 236 is sliced row by row, the program instruction manager 220 may select an iterator represented row by row in the multidimensional table 236 as the induced variable 224. Alternatively, if the multidimensional table 236 is sliced column by column, the program instruction manager 220 may select an iterator represented column by column in the multidimensional table 236 as the induced variable 224. In yet another example, if the entire multidimensional table 236 is treated as a single slice, the program instruction manager 220 may generate the induced variable 224 to mimic traversing the multidimensional table 236 in a one-dimensional manner. In this exemplary example, the induced variable 224 is an iterator that iterates through the execution of the modified loop 212.
[0088] The program instruction manager 220 generates multiple sequences 232 by dividing the values for each result index and slice in the multiple slices 234. For example, the sequences in the multiple sequences 232 may be generated for the result index 266 of slice 256. In this exemplary example, the multiple sequences 232 include a value 252 and a stride 254. The value 252 is a value obtained from the multiple slices 234, and the stride, such as the stride 254, is the step size or interval between values in each sequence. For example, the sequence [1,2,3,4] has a stride of 1, the sequence [5,7,9,11] has a stride of 2, and the sequence [1,1,1,1] has a stride of 0. In this exemplary example, the stride 254 may include zero stride and non-zero stride for the multiple sequences 232. In other words, each sequence in the multiple sequences has multiple values from the value 252 and a fixed stride from the stride 254.
[0089] In this exemplary example, the starting value for each sequence in the sequence 232 is determined by using the sequence's first value minus slice, before multiplying each sequence by the sequence's stride value. In addition, the program instruction manager 220 may also determine an interval marker for each sequence in the sequence 232. In this exemplary example, the interval marker for each sequence is determined by the value of the induction variable 224 corresponding to the last element in each sequence.
[0090] In this illustrative example, the program instruction manager 220 may adjust sequence 232 so that the interval markers of the sequence match across the result indices for each slicing method. For example, the values of result indices 0 and 1 in sequence 232 could be 4, 7, 10|12, 13 and 1, 3|6, 9, 12, respectively, and the induction variable 224 could be executed from 0 to 4, where "|" is used for visually distinct sequences within each slice. In this example, the interval markers do not match because the interval marker of 2 in sequence [4,7,10] is not equal to the interval marker of 1 in sequence [1,3] at result index 0, and the interval markers do not match because the interval marker of 1 in sequence [12,13] is not equal to the interval marker of 2 in sequence [6,9,12] at result index 1.
[0091] In this illustrative example, the sequences described above may be adjusted to 4, 7|10|12, 13 and 1, 3|6|9, 12, respectively, so that the interval markers match across the sequences in the result index, where "|" is used for visually distinct sequences within each slice.
[0092] In an alternative example, the program instruction manager 220 may also adjust sequence 232 so that the number of sequences (count) in each slice matches across slices for each result index. In yet another example, the program instruction manager 220 may determine whether the induction variable 224 is the innermost iterator of loop 222. If the induction variable 224 is not the innermost iterator of loop 222, the program instruction manager 220 may adjust sequence 232 by splitting all sequences with non-zero strides into multiple one-length sequences with zero strides. In such a way, the use-before-definition problem in the modified loop 212 can be eliminated.
[0093] In this exemplary example, the program instruction manager 220 may generate a list 230 of the multiple slices 234 based on the sequence 232. Each list in list 230 contains numerical information from each sequence in the multiple sequences 232. For example, each list in list 230 may contain non-common starting values for each sequence in the multiple slices 234 from value 252, and non-common strides for each sequence in the multiple slices 234 from stride 254. In addition, each list in list 230 may also contain non-common interval markers for the sequences in the multiple sequences 232. In this exemplary example, these are the non-common starting value 270, the non-common stride 272, and the non-common interval marker 268 for each sequence, respectively.
[0094] In this exemplary example, the program instruction manager 220 may generate a number of new induce variables 238 using the listing 230. These number of new induce variables 238 are iterators that may be used in the modified loop 212. In this exemplary example, sets of corresponding sequences across slices are compared, and a new induce variable is generated for each set of corresponding sequences that have at least one sequence with a non-zero stride.
[0095] In this exemplary example, the multiple new inducers 238 include a starting value 258 determined based on a common sequence starting value from value 252 and a non-common starting value from non-common starting value 270, and a stride 260 determined based on a common sequence stride from stride 254 and a non-common stride from non-common stride 272.
[0096] In this exemplary example, the program instruction manager 220 may generate a number of new conditional statements 246 using the number of new induction variables 238, existing variables and iterators from the loop 222, the list 230, the common stride in the stride 254, and the common value in the value 252 of the number of sequences 232.
[0097] In this exemplary example, the first new conditional statement in the above-mentioned multiple new conditional statements 246 is generated for each induced variable 224 for each slicing method. In this example, the first new conditional statement is generated based on the list 230, a common starting value from value 252, and a common stride from stride 254. In addition, the second new conditional statement in the above-mentioned multiple new conditional statements 246 is generated for other induced variables for the slicing method that slices the multidimensional table 236 row by row and column by column. In this exemplary example, the other induced variables may include existing induced variables from loop 222 and new induced variables 238. The second new conditional statement is generated based on list 230. In this exemplary example, the second new conditional statement may use the same variables for the list of different slices in list 230.
[0098] As a result, the program instruction manager 220 may generate a modified loop 212 for loop 222 using a new conditional statement 246. In this exemplary example, the modified loop 212 may contain loops for different slicing methods in slicing method 226. The program instruction manager 220 may determine the cost 218 of the modified loop 212 to determine which slicing method can produce the loop at the lowest cost. In this exemplary example, the cost 218 may be determined through cost analysis. Cost analysis can be performed in several ways; for example, cost analysis may be performed by generating a conditional tree for each slicing method loop in the modified loop 212. In this exemplary example, the conditional trees generated for each slicing method loop in the modified loop 212 may be part of the conditional tree 228.
[0099] The program instruction manager 220 may identify a set of modified loops 244 as the lowest cost loop. In this exemplary example, the set of modified loops 244 includes the loop for the slicing method with the fewest leaves, based on the condition tree generated for each slicing method loop in the modified loop 212. It should be understood that the set of modified loops 244 may include loops for one or more slicing methods in the case of linking. In this exemplary example, the program instruction manager 220 may further identify a loop from the set of modified loops 244 that has the fewest new induce variables from the new induce variable 238. In this exemplary example, the program instruction manager 220 may further select a loop for a slicing method that maintains perfect loop nesting as the lowest cost loop in another case of linking.
[0100] In this exemplary example, the program instruction manager 220 may, based on cost 218, replace loop 222 with a modified set of loops 244, which are loops for the slicing method, at the lowest cost.
[0101] In this exemplary example, user 206 may interact with computer system 204 through user input to computer system 204. For example, computer system 204 may track, monitor, and review the process that generates the modified loop 212 relative to loop 222.
[0102] In this exemplary example, user input 208 may be generated by user 206 using human-machine interface (HMI) 210. As illustrated, the human-machine interface 210 includes a display system 240 and an input system 242. The display system 240 is a physical hardware system including one or more display devices on which a graphical user interface 262 may be displayed. The display devices may include at least one of several other suitable devices capable of outputting information for visual presentation of information, such as a light-emitting diode (LED) display, an organic light-emitting diode (OLED) display, a computer monitor, a projector, a flat-panel display, a heads-up display (HUD), a head-mounted display (HMD), smart glasses, augmented reality glasses, or several other suitable devices.
[0103] In this example, user 206 is a person who can interact with the graphical user interface 262 through user input 208 generated by the input system 242. The input system 242 is a physical hardware system and may be selected from at least one of several other suitable types of input devices, such as a mouse, keyboard, touchpad, trackball, touchscreen, stylus, motion-sensing input device, gesture detection device, data glove, cyber glove, haptic feedback device, or several other suitable types of input devices. For example, user 206 may look at the modified loop 212 and perform a cost analysis of the modified loop 212 to determine whether it is appropriate to replace loop 222 with the loop in the modified loop 212.
[0104] In one exemplary example, there is one or more solutions to overcome the problem by optimizing loops in program instructions. As a result, one or more technical solutions may provide the ability to improve the efficiency and performance of the computer system 204. For example, a compiler may utilize the aforementioned loop optimization techniques during the compilation process to improve the performance of the computer system 204.
[0105] In an exemplary example, computer system 204 may be configured to perform at least one of the steps, operations, or actions described in a different exemplary example using software, hardware, firmware, or a combination thereof. As a result, computer system 204 operates as a dedicated computer system in which the program instruction manager 220 in computer system 204 enables loop optimization to the compiler. In particular, the program instruction manager 220 transforms computer system 204 into a dedicated computer system compared to a currently available general computer system that does not have a program instruction manager 220.
[0106] In this exemplary example, the use of the program instruction manager 220 in computer system 204 integrates the process into a practical application for optimizing loops. In other words, the program instruction manager 220 in computer system 204 targets a practical application of the process integrated into the program instruction manager 220 in computer system 204 that optimizes loops to reduce the size of program instructions. In this exemplary example, the program instruction manager 220 can efficiently help computer system 204 improve computer performance and resource allocation.
[0107] Referring here to Figures 3A and 3B, an example of generating a modified loop for a loop with multiple conditional statements is shown according to an exemplary embodiment. In this exemplary example, the process shown in Figures 3A and 3B may be implemented in hardware, software, or both. When implemented in software, the process may take the form of program instructions executed by one or more processor units located in one or more hardware devices within one or more computer systems. For example, the process may be implemented in a program instruction manager 220 within computer system 204 in Figure 2.
[0108] In Figure 3A, program instruction 300 includes a loop with multiple conditional statements. In this exemplary example, a condition tree 302 may be generated based on program instruction 300. As shown, the condition tree 302 shows the conditional statements of program instruction 300 and the final result as program instruction 300 is iterated over.
[0109] The multidimensional table 304 is generated based on the condition tree 302. In this exemplary example, the values in the multidimensional table 304 are based on the values from the condition tree 302. In other words, the values in the multidimensional table 304 are determined by evaluating the conditional statement in the program instruction 300.
[0110] In this exemplary example, each dimension in the multidimensional table 304 represents an iterator in the program instruction 300. For example, the columns in the multidimensional table 304 represent different values of the iterator "j" in the program instruction 300, and the rows in the multidimensional table 304 represent different values of the iterator "i" in the program instruction 300.
[0111] As illustrated, the multidimensional table 304 can be sliced using different slicing methods. In this exemplary example, slice 306 is produced by treating the entire multidimensional table 304 as a single slice, slice 308 contains two slices produced by slicing the multidimensional table 304 row by row, and slice 310 contains two slices produced by slicing the multidimensional table 304 column by column.
[0112] As illustrated, the induced variables are determined for each slicing method. For example, iterator "j" is selected as the induced variable for a slicing method that slices the multidimensional table 304 row by row, and iterator "i" is selected as the induced variable for a slicing method that slices the multidimensional table 304 column by column. In addition, if the entire multidimensional table 304 is treated as a single slice, induced variables may be generated to mimic traversing the multidimensional table 304 in a one-dimensional manner.
[0113] In this illustrative example, the generation of modified loops using different slicing methods is performed separately and without interference from one another. In other words, the modified loops generated through each slicing method are unique and different from those generated through other slicing methods.
[0114] Sequence 312 includes sequences generated from each slicing method. In this exemplary example, each sequence in sequence 312 includes a set of values from the multidimensional table 304, and start values, stride, and interval markers corresponding to the values of the derived variables of the final element in each sequence. In this exemplary example, sequence 314 includes two sequences generated from slice 306, sequence 316 includes two sequences generated from slice 308, and sequence 318 includes two sequences generated from slice 310.
[0115] Sequence 312 may be further modified to ensure proper execution of the modified loop generated based on sequence 312. In this exemplary example, sequence 318 needs to be modified by splitting the sequence into zero-stride sequences to eliminate the user-before-definition issue in the modified loop generated based on sequence 318.
[0116] As shown in Figure 3B, sequence 320 represents the sequence of the adjusted sequence 318. In this exemplary example, the two sequences in sequence 318 are divided into four sequences with zero stride.
[0117] In this exemplary example, program instruction 322 is generated for a slicing method that treats the entire multidimensional table 304 as a single slice. In this exemplary example, several new induce variables are generated for program instruction 322. For example, induce variables "synth_iv" and "seq" are generated for a new conditional statement, with "synth_iv" determined as the induce variable that mimics traversing the multidimensional table in a one-dimensional manner. In this exemplary example, the starting value and stride of the induce variable "synth_iv" are 0 and 1, respectively, and the starting value and stride of the induce variable "seq" are obtained directly from the sequence in sequence 314. In this exemplary example, a new conditional statement is generated for each sequence in sequence 314, based on the new induce variables, starting values, strides, and interval markers from each sequence in sequence 314.
[0118] In a similar manner, program instruction 324 is generated for a slicing method that slices the multidimensional table 304 row by row. In program instruction 324, iterator "j" is chosen as an induction variable because iterator "i" is constant for each slice in sequence 316. In this exemplary example, multiple lists containing non-common starting values across different sequences in sequence 316, non-common strides for sequences from sequence 316, and non-common interval markers for sequences from sequence 316 are generated. For example, list "enc" may contain the value (10, 0) when "i" is equal to 0, which is obtained from the starting value and stride of the sequence for the slice i==0 in sequence 316. In another example, list "enc" may contain the value (12, 3) when "i" is not equal to 0, which is obtained from the starting value and stride of the sequence for the slice i==1 in sequence 316.
[0119] In this exemplary example, several new induce variables are generated for program instruction 324. For example, the induce variable "seq" is generated for a new conditional statement. In this exemplary example, the start value and stride for the induce variable "seq" are determined based on the generated list. The new conditional statement is generated using the sequence-by-sequence condition in the slices in sequence 316, based on the determined list, the common value from each sequence in sequence 316, the common stride, and the common interval marker. Since each slice in sequence 316 has exactly one sequence, the new conditional statement can be completely discarded, and its value is provided by the condition that was directly discarded for program instruction 324. In this exemplary example, the new conditional statement is generated to mimic the iteration of program instruction 300.
[0120] Furthermore, program instruction 326 is generated for a slicing method that slices the multidimensional table 304 column by column. In program instruction 326, iterator "i" is chosen as an induction variable because iterator "j" is constant for each slice in sequence 320. In a similar manner, multiple lists containing non-common starting values across different sequences in sequence 320, non-common strides for sequences from sequence 320, and non-common interval markers for sequences from sequence 320 are generated. For example, list "enc" may contain the value "12" when "j" is equal to 0, which is taken from the starting value of the sequence for the slice j==0 in sequence 320. In another example, list "enc" may contain the value "15" when "j" is not equal to 0, which is taken from the starting value of the sequence for the slice j==1 in sequence 320.
[0121] In a similar manner, a new conditional statement is generated using the sequence-specific conditions in the slices of sequence 320, based on the determined list, common values from each sequence in sequence 320, a common stride, and a common interval marker. As illustrated, each slice in sequence 320 has two sequences. In this exemplary example, the new conditional statement is generated to mimic the iteration of program instruction 300.
[0122] In Figure 3B, cost analysis can be performed on program instructions 322, 324, and 326. In this exemplary example, condition trees may be generated for each of program instructions 322, 324, and 326, and the number of leaves in each condition tree can be compared. In this exemplary example, the program instruction with the fewest leaves can be identified as the lowest-cost program instruction. However, program instructions 322 (table as slices) and 324 (each row as a slice) are linked by two leaves, as shown in Table 328. In this exemplary example, the number of new induce variables in the program instructions can be compared to resolve this issue. In this example, program instruction 324 is identified as the lowest-cost program instruction because, as shown in Table 328, program instruction 324 has only one new induce variable generated for the j-loop. As a result, program instruction 326 can be used to replace program instruction 300 in order to improve the performance of the computer system.
[0123] In all slicing modes, the number of leaves in the new conditional statements generated for the induced variables is the above multiple sequences for each slice per result index. In all slicing modes except those where the entire table is treated as a slice, a second new conditional statement is generated for the remaining induced variables that result in a list. In this example, the number of leaves for the second new conditional statement is the above multiple slices, or equivalently, the product of all dimensions of the table excluding the induced variables. In this exemplary example, a one-leaf conditional can be simplified by removing all conditions together. In other words, the total number of leaves in the modified loop for a slicing method is equal to the number of slices in the slicing method plus the number of sequences for each slice per result index of the slicing method.
[0124] The examples of generating program instructions 322, 324, and 326 in Figure 3 are not intended to imply any physical or architectural limitations on how the exemplary embodiment may be implemented. Other components may be used in addition to or instead of those shown. Some components may be unnecessary. Also, the blocks are presented to show several functional components. One or more of these blocks may be combined, divided, or combined and divided into different blocks when implemented in the exemplary embodiment. For example, the replacement of a program instruction should not occur if a cost analysis shows that program instruction 300 is the lowest cost program instruction.
[0125] Referring here to Figures 4A, 4B, and 4C, an example of generating a modified loop for a loop having multiple conditional statements is shown according to an exemplary embodiment. In this exemplary example, the process shown in Figures 4A, 4B, and 4C may be implemented in hardware, software, or both. When implemented in software, the process may take the form of program instructions executed by one or more processor units located in one or more hardware devices within one or more computer systems. For example, the process may be implemented in a program instruction manager 220 within computer system 204 in Figure 2.
[0126] In Figure 4A, program instruction 400 includes a loop with multiple conditional statements. In this exemplary example, a condition tree 402 may be generated based on program instruction 400. As shown, the condition tree 402 shows the conditional statements of program instruction 400 and the final result as program instruction 400 is iterated over. In this exemplary example, the condition tree 402 includes eight leaves.
[0127] The multidimensional table 404 is generated based on the condition tree 402. In this exemplary example, the values in the multidimensional table 404 are based on the values from the condition tree 402. In other words, the values in the multidimensional table 404 are determined by evaluating the conditional statement in the program instruction 400.
[0128] As illustrated, each dimension in the multidimensional table 404 represents an iterator in the program instruction 400. For example, the columns in the multidimensional table 404 represent different values of the iterator "j" in the program instruction 400, and the rows in the multidimensional table 404 represent different values of the iterator "i" in the program instruction 400. In this illustrative example, each entry in the multidimensional table 404 contains two values, which correspond to result indices 0 and 1. For example, entry (1, 5) contains the value "1" for result index 0 and the value "5" for result index 1. In another example, entry (0, 11) contains the value "0" for result index 0 and the value "11" for result index 1.
[0129] As illustrated, the multidimensional table 404 can be sliced using different slicing methods to produce slice 406. In this exemplary example, slice 408 is produced by treating the entire multidimensional table 404 as a single slice, slice 410 contains two slices produced by slicing the multidimensional table 404 row by row, and slice 412 contains four slices produced by slicing the multidimensional table 404 column by column.
[0130] As illustrated, the induced variables are determined for each slicing method. For example, iterator "j" is selected as the induced variable for a slicing method that slices the multidimensional table 404 row by row, and iterator "i" is selected as the induced variable for a slicing method that slices the multidimensional table 404 column by column. In addition, if the entire multidimensional table 404 is treated as a single slice, induced variables may be generated to mimic traversing the multidimensional table 404 in a one-dimensional manner.
[0131] Similarly, the generation of modified loops using the different slicing methods shown in Figure 4 is performed separately and without interference from one another. In other words, the modified loops generated through each slicing method are unique and different from those generated through other slicing methods.
[0132] As illustrated in Figure 4B, sequence 414 contains sequences generated from each slicing method. In this exemplary example, each sequence in sequence 414 contains a set of values based on values from the multidimensional table 404, and a start value, stride, and interval marker corresponding to the value of the derived variable of the last element in each sequence. In this exemplary example, the sequence notation for a sequence in sequence 414 is (sequence start value - sequence * stride, stride, number of previous elements in the slice before the interval marker).
[0133] In this exemplary example, sequence 416 includes seven sequences generated based on slice 408, sequence 418 includes seven sequences generated based on slice 410, and sequence 420 includes eight sequences generated based on slice 412.
[0134] In this exemplary example, the adjusted sequence 422 is generated by adjusting sequence 414, ensuring proper execution of the modified loop generated based on sequence 414. In this exemplary example, sequence 416 is adjusted as shown in sequence 424, so that the interval markers in each sequence match across the resulting index. In a similar manner, sequence 418 is adjusted as shown in sequence 426, so that the interval markers in each sequence match across the resulting index.
[0135] In addition, sequence 420 is modified because the induction variable "i" for the slicing method of slice 412 is not the innermost iterator of program instruction 400. In this illustrative example, sequence 428 is generated by splitting the sequence in sequence 420 into zero-stride sequences of length 1. As illustrated, the modification performed on sequence 420 eliminates the pre-defined problem in the modified loop generated based on sequence 420.
[0136] In this exemplary example, program instruction 430 is generated for a slicing method that treats the entire multidimensional table 404 as a single slice. In this exemplary example, several new induce variables are generated for program instruction 430. For example, the induce variables "synth_iv" and "seq" are generated for a new conditional statement, with "synth_iv" determined as the induce variable that mimics traversing the multidimensional table in a one-dimensional manner. In this exemplary example, the starting value and stride of the induce variable "synth_iv" are 0 and 1, respectively, and the starting value and stride of the induce variable "seq" are taken directly from the sequence in sequence 424. In this exemplary example, the new conditional statement is generated based on the new induce variables, starting values, strides, and interval markers from each sequence in sequence 424. In this exemplary example, the new conditional statement in program instruction 430 is generated to mimic iterating over program instruction 400.
[0137] In a similar manner, program instruction 432 is generated for a slicing method that slices the multidimensional table 404 row by row. In program instruction 432, iterator "j" is chosen as the induction variable because iterator "i" is constant for each slice in sequence 426. In this exemplary example, multiple lists are generated to contain non-common values between different sequences of the same result index across slices, non-common strides between different sequences of the same result index across slices, and non-common interval markers between different sequences of the same result index across slices.
[0138] For example, the list "enc" may contain the values (1, 0, 5, 21, 2, 5, 2) when "i" is equal to 0, which are obtained from the non-common values, non-common strides, and non-common interval markers of the slice in sequence 426 where i==0. In another example, the list "enc" may contain the values (4, 2, 4, 22, 0, 11, 0) when "i" is equal to 1, which are obtained from the non-common values, non-common strides, and non-common interval markers of the slice in sequence 426 where i==1. In this illustrative example, only one non-common interval marker is included in the list for each sequence regardless of the resulting index, because the interval markers match across the resulting indices.
[0139] In this exemplary example, several new induce variables are generated for program instruction 432. For example, induce variables "seq0_idx0", "seq0_idx1", and "seq1_idx1" are generated for a new conditional statement. In this exemplary example, the starting value and stride for induce variable "seq0_idx0" are determined based on the generated list. In this exemplary example, several new conditional statements are generated based on new induce variables, existing variables from program instruction 400, values from the list generated for program instruction 432, and common values in sequence 426. In this exemplary example, the new conditional statements in program instruction 432 are generated to mimic the repetition of program instruction 400.
[0140] Furthermore, program instruction 434 is generated for a slicing method that slices the multidimensional table 404 column by column. In program instruction 434, iterator "i" is selected as an inducement variable because iterator "j" is constant for each slice in sequence 428. In a similar manner, multiple lists are generated to contain non-common values between different sequences of the same result index across slices, non-common strides between different sequences of the same result index across slices, and non-common interval markers between different sequences of the same result index across slices.
[0141] For example, the list "enc" may contain the values (1, 5, 4, 4) when "j" is equal to 20, which are obtained from the values, strides, and interval markers of the sequence for the slice j==20 in sequence 428. In another example, the list "enc" may contain the values (1, 7, 6, 6) when "j" is equal to 21, which are obtained from the non-common values, non-common strides, and non-common interval markers of the sequence for the slice j==21 in sequence 428. In yet another example, the list "enc" may contain the values (2, 9, 8, 8) when "j" is equal to 22, which are obtained from the non-common values, non-common strides, and non-common interval markers of the sequence for the slice j==22 in sequence 428. In yet another example, the list "enc" may contain the values (2, 11, 0, 11) if "j" is equal to 23, which are obtained from the non-common values, non-common strides, and non-common interval markers of the sequence slices j==23 in sequence 428.
[0142] In this exemplary example, since all sequences have zero stride, no new induction variables are generated for program instruction 434. In this exemplary example, several new conditional statements are generated based on existing variables from program instruction 400, values from a list generated for program instruction 434, and common values from sequence 428. In this exemplary example, the new conditional statement in program instruction 432 is generated to mimic the repetition of program instruction 400.
[0143] In Figure 4C, a cost analysis may be performed on program instructions 430, 432, and 434. In this exemplary example, a condition tree may be generated for each of program instructions 430, 432, and 434, and the number of leaves in each condition tree may be compared. In this exemplary example, the program instruction with the fewest leaves may be identified as the lowest-cost program instruction. However, program instructions 430 (table as slices) and 432 (each row as a slice) are linked by four leaves, as shown in Table 436. In this exemplary example, the number of new induce variables in the program instructions may be compared to resolve this issue. In this example, program instruction 432 is identified as the lowest-cost program instruction because, as shown in Table 436, program instruction 432 has only three new induce variables generated for the j-loop. As a result, program instruction 432 may be used to replace program instruction 400 in order to improve the performance of the computer system.
[0144] Referring here to Figure 5, a flowchart illustrating the process for generating a modified loop for a loop having multiple conditional statements is shown according to an exemplary embodiment. The process in Figure 5 can be implemented in hardware, software, or both. When implemented in software, the process may take the form of program instructions executed by one or more processor units located in one or more hardware devices within one or more computer systems. For example, the process may be implemented in the program instruction manager 220 within the computer system 204 in Figure 2.
[0145] The process is initiated by a step (step 500) that generates a condition tree based on multiple conditional statements in a loop. In step 500, values are determined by evaluating each of the multiple conditional statements. The process generates a multidimensional table based on the values for the multiple conditional statements obtained from the condition tree (step 502). The process determines the inductive variables for the modified loop (step 504). The process slices the multidimensional table to generate multiple slices (step 506). In step 506, each slice in the multiple slices represents at least a portion of the multidimensional table.
[0146] The process generates multiple sequences by splitting the values in each slice (step 508). In this step, the values and strides in the multiple sequences are determined for the proper execution of the modified loop. The process generates multiple new conditional statements based on the determined inducers and at least the values and strides in the multiple sequences (step 510). The process generates the modified loop based on the multiple new conditional statements (step 512). The process then terminates.
[0147] Referring here to Figure 6, a flowchart illustrating the process for generating a sequence by splitting the values in each slice is shown according to an exemplary embodiment. The process in this flowchart is an example of an implementation for step 508 in Figure 5.
[0148] The process is initiated by a step (step 600) that generates a sequence with a fixed stride by dividing the values in each slice. As illustrated, the stride is the step or interval between values in the sequence. In this step, each sequence in the sequence with a fixed stride corresponds to multiple values of the result index in each slice. The process then terminates.
[0149] Referring here to Figure 7, a flowchart illustrating the process for adjusting the sequence is shown according to an exemplary embodiment. The process in this figure is an example of additional steps that may be performed using the steps in Figure 6.
[0150] The process begins with a step (step 700) in which, based on the condition tree, it is determined whether the determined inducer variable is the innermost iterator of the loop having the multiple conditional statements. In response to the determination, based on the condition tree, that the determined inducer variable is not the innermost iterator of the loop having the multiple conditional statements, the process adjusts the sequences having non-zero strides in the sequences having fixed strides to generate the multiple sequences (step 702). In this step, the stride value of each sequence in the multiple sequences is zero. The process then terminates.
[0151] Referring here to Figure 8, a flowchart illustrating the process for adjusting the sequence is shown according to an exemplary embodiment. The process in this figure is an example of additional steps that may be performed using the steps in Figure 7.
[0152] The process is initiated by a procedure (step 800) that generates the above-mentioned multiple sequences by splitting sequences with non-zero stride into sequences with fixed stride. In this step, the above-mentioned multiple sequences for each result index are the same across different slices. The process then terminates.
[0153] Referring here to Figure 9, a flowchart illustrating the process for determining the inducement variables is shown according to an exemplary embodiment. The process in this flowchart is an example of an implementation for step 504 in Figure 5.
[0154] The process begins with a step (step 900) to generate induced variables to simulate the traversal of a multidimensional table in a one-dimensional manner. The process then terminates.
[0155] Referring here to Figure 10, a flowchart illustrating the process for generating the above-mentioned new conditional statements is shown according to an exemplary embodiment. The process in this figure is an example of additional steps that may be performed using the steps in Figure 5.
[0156] The process begins with a step (step 1000) that generates multiple lists for each slice in the multiple slices, based on the non-common values and strides in the multiple sequences and the determined values of the inductive variables corresponding to the last term of the sequence in each slice. The process generates multiple new inductive variables for the modified loop (step 1002). In step 1002, the starting values and strides of the multiple new inductive variables are determined based on the values from the multiple lists. The process generates multiple new conditional statements using the multiple new inductive variables, the existing variables from the loop, the values from the multiple lists, and the common values in the multiple sequences (step 1004). The process then terminates.
[0157] Referring here to Figure 11, a flowchart illustrating the process for generating a modified loop for a loop having multiple conditional statements is shown according to an exemplary embodiment. The process in Figure 11 can be implemented in hardware, software, or both. When implemented in software, the process may take the form of program instructions executed by one or more processor units located in one or more hardware devices within one or more computer systems. For example, the process may be implemented in a program instruction manager 220 within computer system 204 in Figure 2.
[0158] The process begins with a step (step 1100) that generates a condition tree based on multiple conditional statements in a loop. The process generates a multidimensional table based on the values from the multiple conditional statements (step 1102). The process slices the multidimensional table to generate multiple slices using multiple slicing methods (step 1104). In step 1104, each slice in the multiple slices represents at least a portion of the multidimensional table.
[0159] The process generates multiple sequences by splitting the values in each slice for each slicing method (step 1106). In this step, the values and strides in the above multiple sequences are determined for the proper execution of the modified loop. For each slicing method, the process generates multiple new conditional statements based on the determined inducer variables and at least the values and strides in the above multiple sequences (step 1108). For each slicing method, the process generates a modified loop based on the above multiple new conditional statements (step 1110). The process then terminates.
[0160] Referring here to Figure 12, a flowchart illustrating the process for generating a new conditional statement for the modified loop is shown according to an exemplary embodiment. The process in this flowchart is an example of an implementation for step 1108 in Figure 11.
[0161] The process begins with a step (step 1200) that generates multiple lists for each slicing method based on non-common values in the multiple sequences for each slicing method. The process generates multiple new induce variables for the modified loop for each slicing method (step 1202). In this step, the starting values and strides of the multiple new induce variables are determined for each slicing method based on the values from the multiple lists. The process generates multiple new conditional statements for each slicing method using the multiple new induce variables for the modified loop for each slicing method, the variables from the loop, and the common values in the multiple sequences for each slicing method (step 1204). The process then terminates.
[0162] Referring here to Figure 13, a flowchart illustrating the process for replacing the loop with a minimum-cost modified loop is shown according to an exemplary embodiment. The process in this figure is an example of additional steps that may be performed using the steps in Figure 12.
[0163] The process begins with a step that generates a condition tree of the modified loop for each slicing method (step 1300). The process further performs a cost analysis of the modified loop for each slicing method based on the condition tree of the modified loop for each slicing method and the above multiple induce variables for the modified loop for each slicing method (step 1302). The process replaces the loop with multiple conditional statements using the modified loop for the slicing method at the lowest cost (step 1304). The process then terminates.
[0164] Referring here to Figure 14, a flowchart illustrating the process for performing a cost analysis is shown according to an exemplary embodiment. The process in this flowchart is an example of an implementation for step 1302 in Figure 13.
[0165] The process begins with a step to identify the set of modified loops with the fewest leaves in the condition tree (step 1400). The process determines whether the set of modified loops contains loops for one more slicing method (step 1402). In response to determining that the set of modified loops does not contain loops for one more slicing method, the process identifies the set of modified loops as the modified loop for the lowest cost slicing method (step 1404). The process then terminates.
[0166] Referring again to step 1402, the process, in response to determining that the set of modified loops contains loops for one more slicing method, identifies, at the lowest cost, the subset of modified loops from the set of modified loops that has the fewest new inducement variables for the slicing method as the modified loop for the slicing method (step 1406). The process then terminates.
[0167] Referring here to Figure 15, a block diagram of a data processing system according to an exemplary embodiment is shown. The data processing system 1500 may be used to implement the computer and computing devices in the computing environment 100 in Figure 1. The data processing system 1500 may also be used to implement the computer system 204 in Figure 2. In this exemplary example, the data processing system 1500 includes a processor unit 1504, memory 1506, persistent storage 1508, a communication unit 1510, an input / output (I / O) unit 1512, and a communication framework 1502 that provides communication between the display 1514. In this example, the communication framework 1502 takes the form of a bus system.
[0168] The processor unit 1504 functions to execute instructions for software that can be loaded into memory 1506. The processor unit 1504 includes one or more processors. For example, the processor unit 1504 may be selected from at least one of a multicore processor, a central processing unit (CPU), a graphics processing unit (GPU), a physical processing unit (PPU), a digital signal processor (DSP), a network processor, or some other suitable type of processor. Furthermore, the processor unit 1504 may be implemented using one or more heterogeneous processor systems in which the main processor and secondary processors reside on a single chip. As another example, the processor unit 1504 may be a symmetrical multiprocessor system containing multiple processors of the same type on a single chip.
[0169] Memory 1506 and persistent storage 1508 are examples of storage devices 1516. A storage device is any number of hardware capable of temporarily, permanently, or both temporarily and permanently storing information such as, for example, data, program instructions in a functional form, or at least one of other suitable information. In these exemplary examples, storage devices 1516 may also be referred to as computer-readable storage devices. Memory 1506 in these examples may be, for example, random-access memory or any other suitable volatile or non-volatile storage device. Persistent storage 1508 may take various forms depending on the specific implementation.
[0170] For example, persistent storage 1508 may include one or more components or devices. For example, persistent storage 1508 may be a hard drive, a solid-state drive (SSD), flash memory, a rewritable optical disk, a rewritable magnetic tape, or any combination thereof. The medium used by persistent storage 1508 may be removable. For example, a removable hard drive may be used for persistent storage 1508.
[0171] In these exemplary examples, the communication unit 1510 provides communication with other data processing systems or devices. In these exemplary examples, the communication unit 1510 is a network interface card.
[0172] The input / output unit 1512 enables the input and output of data to and from other devices that may be connected to the data processing system 1500. For example, the input / output unit 1512 may provide a connection for user input through at least one of a keyboard, mouse, or some other suitable input device. Furthermore, the input / output unit 1512 may send output to a printer. The display 1514 provides a mechanism for displaying information to the user.
[0173] Instructions for at least one of an operating system, an application, or a program may reside in a storage device 1516 that communicates with the processor unit 1504 through a communication framework 1502. Processes of different embodiments may be executed by the processor unit 1504 using computer implementation instructions that may reside in memory, such as memory 1506.
[0174] These instructions are referred to as program instructions, computer-readable program instructions, or computer-readable program instructions, which can be read and executed by the processor in the processor unit 1504. In different embodiments, the program instructions may be implemented on different physical or computer-readable storage media, such as memory 1506 or persistent storage 1508.
[0175] The program instruction 1518 is functionally located on a selectively removable computer-readable medium 1520, which can be loaded or transferred to a data processing system 1500 for execution by a processor unit 1504. The program instruction 1518 and the computer-readable medium 1520 form a computer program product 1522 in these exemplary examples. In the exemplary examples, the computer-readable medium 1520 is a computer-readable storage medium 1524.
[0176] The computer-readable storage medium 1524 is not a medium for propagating or transmitting the program instructions 1518, but rather a physical or tangible storage device used to store the program instructions 1518. As used herein, the computer-readable storage medium 1524 is not construed as a transient signal itself, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through waveguides or other transmission media (e.g., light pulses passing through optical fiber cables), or electrical signals transmitted through wires.
[0177] Alternatively, program instruction 1518 may be transmitted to data processing system 1500 using a computer-readable signal medium. The computer-readable signal medium is a signal, and could be, for example, a propagating data signal containing program instruction 1518. For example, the computer-readable signal medium could be at least one of an electromagnetic signal, an optical signal, or any other suitable type of signal. These signals may be transmitted via a connection, such as a wireless connection, fiber optic cable, coaxial cable, wire, or any other suitable type of connection.
[0178] Furthermore, as used herein, “computer-readable medium 1520” may be singular or plural. For example, program instructions 1518 may reside in computer-readable medium 1520 in the form of a single storage device or system. In another example, program instructions 1518 may reside in computer-readable medium 1520 distributed across multiple data processing systems. In other words, some instructions within program instructions 1518 may reside within one data processing system, while other instructions within program instructions 1518 may reside within one data processing system. For example, some of program instructions 1518 may reside in computer-readable medium 1520 on a server computer, while other parts of program instructions 1518 may reside in computer-readable medium 1520 on a set of client computers.
[0179] The different components shown for the data processing system 1500 are not intended to impose any architectural limitations on how different embodiments may be implemented. In some exemplary examples, one or more components may be incorporated into or otherwise formed as part of another component. For example, memory 1506, or a portion thereof, may be incorporated into processor unit 1504 in some exemplary examples. Different exemplary embodiments may be implemented in a data processing system that includes components in addition to, or instead of, those shown for the data processing system 1500. Other components shown in Figure 15 may be modified from those shown in the exemplary examples. Different embodiments may be implemented using any hardware device or system capable of executing program instructions 1518.
[0180] Thus, exemplary embodiments of this disclosure provide computer implementation methods, computer systems, and computer program products for managing containers. The descriptions of the various embodiments of this disclosure are presented for illustrative purposes only and are not intended to be exhaustive or limit to the disclosed embodiments. Many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the embodiments described. The terminology used herein has been selected to best describe the principles of the embodiments, their practical applications or technical improvements to the art found in the market, or to enable other persons skilled in the art to understand the embodiments disclosed herein.
[0181] The descriptions of different exemplary embodiments are presented for illustrative and explanatory purposes and are not intended to be exhaustive or to limit the embodiments of the disclosed form. Different examples describe components that perform an action or operation. In exemplary embodiments, components may be configured to perform the described action or operation. For example, a component may have a configuration or design for a structure that provides the component with the ability to perform the action or operation described in the exemplary example as being performed by the component. Furthermore, to the extent that the terms “includes,” “including,” “has,” and “contains” and their variations are used herein, such terms are intended to be comprehensive in the same manner as the term “comprises” as an open transitional term, without excluding any additional or other elements.
[0182] The descriptions of various embodiments of the present invention are presented for illustrative purposes only and are not intended to be exhaustive or limitful to the disclosed embodiments. Not all embodiments include all of the features described in the examples. Furthermore, different exemplary embodiments may offer different features compared to other exemplary embodiments. Many modifications and variations will become apparent to those skilled in the art without departing from the scope and spirit of the described embodiments. The terminology used herein has been selected to best describe the principles of the embodiments, their practical applications, or technical improvements to the art found in the market, or to enable those skilled in the art to understand the embodiments disclosed herein.
Claims
1. A computer implementation method for generating a modified loop for a loop having multiple conditional statements, the computer implementation method being: The processor set generates a condition tree based on the multiple conditional statements in the loop, where the value is determined by evaluating each conditional statement in the multiple conditional statements; The processor set generates a multidimensional table based on the values of the multiple conditional statements obtained from the condition tree; The step of determining the induction variables of the modified loop using the aforementioned processor set; The process involves the set of processors slicing the multidimensional table to generate multiple slices, where each slice represents at least a portion of the multidimensional table; The processor set generates multiple sequences by dividing the values in each slice, where the values and strides in the multiple sequences are determined for the proper execution of the modified loop; The processor set generates a plurality of new conditional statements based on the determined inducer variables and the values and strides in at least the plurality of sequences; and The processor set generates the modified loop based on the multiple new conditional statements. A computer implementation method comprising the above.
2. The computer implementation method according to claim 1, wherein each slice from the plurality of slices includes a set of values obtained by varying the determined inducer while fixing other existing inducer variables in the loop having the plurality of conditional statements.
3. The step of generating multiple sequences by dividing the values in each slice using the aforementioned processor set is as follows: The processor set generates a sequence with a fixed stride by dividing the values in each slice, wherein each sequence in the sequence with a fixed stride corresponds to multiple values of the result index in each slice. A computer implementation method according to claim 1, comprising:
4. The processor set determines, based on the condition tree, whether the determined induction variable is the innermost iterator of the loop having the multiple conditional statements; and In response to the determination, based on the condition tree, that the determined induced variable is not the innermost iterator of the loop having the plurality of conditional statements, the processor set performs the step of arranging sequences having a non-zero stride in sequences having a fixed stride in order to generate the plurality of sequences, where the stride value of each sequence in the plurality of sequences is zero. The computer implementation method according to claim 3, further comprising:
5. The processor set generates the plurality of sequences by splitting sequences having non-zero stride within sequences having fixed stride, wherein the number of sequences per result index is the same across different slices. The computer implementation method according to claim 3, further comprising:
6. The step of determining the induction variables of the modified loop by the aforementioned processor set is: The processor set generates the derived variables in order to simulate the traversal of the multidimensional table in a one-dimensional manner. A computer implementation method according to any one of claims 1 to 5, comprising:
7. The step of generating the plurality of new conditional statements based on the determined inducer variables and the values and strides in at least the plurality of sequences by the processor set is as follows: A step of generating multiple lists for each slice in the multiple slices based on the non-common values and strides in the multiple sequences and the determined values of the induction variables corresponding to the last term of the sequence in each slice, using the processor set; The processor set generates a plurality of new induce variables for the modified loop, where the starting value and stride of the plurality of new induce variables are determined based on the values from the plurality of lists; and The processor set generates the multiple new conditional statements using the multiple new inducer variables, existing variables from the loop, values from the multiple lists, and common values in the multiple sequences. A computer implementation method according to any one of claims 1 to 5, comprising:
8. A computer system for generating modified loops for loops with multiple conditional statements, wherein: Processor set; A set of one or more computer-readable storage media; and A procedure for generating a condition tree based on the plurality of conditional statements in the loop, wherein the value is determined by evaluating each conditional statement in the plurality of conditional statements; A procedure for generating a multidimensional table based on the values of the multiple conditional statements obtained from the conditional tree; Procedure for determining the inductive variables of the modified loop; A procedure for slicing the multidimensional table to generate multiple slices, wherein each slice in the multiple slices represents at least a portion of the multidimensional table; A procedure for generating multiple sequences by dividing the values in each slice, wherein the values and strides in the multiple sequences are determined for the proper execution of the modified loop; A procedure for generating a plurality of new conditional statements based on the determined inductive variables and the values and strides in at least the plurality of sequences; and Procedure for generating the modified loop based on the aforementioned multiple new conditional statements Program instructions stored in one or more storage media of the set to cause the processor set to perform an operation having the above A computer system equipped with the following features.
9. The computer system according to claim 8, wherein each slice from the plurality of slices includes a set of values obtained by varying the determined inducer while fixing other existing inducer variables in the loop having the plurality of conditional statements.
10. The procedure for generating multiple sequences by splitting the values in each slice is as follows: A procedure for generating a sequence with a fixed stride by dividing the values in each slice, wherein each sequence in the sequence with a fixed stride corresponds to multiple values of the result index in each slice. The computer system according to claim 8, having the following features.
11. The aforementioned operation is not specified: A procedure for determining, based on the condition tree, whether the determined induced variable is the innermost iterator of the loop having the multiple conditional statements; and A procedure to arrange sequences having a non-zero stride in sequences having a fixed stride in order to generate the plurality of sequences in response to the determination, based on the condition tree, that the determined induced variable is not the innermost iterator of the loop having the plurality of conditional statements, wherein the stride value of each sequence in the plurality of sequences is zero. The computer system according to claim 10, comprising:
12. The aforementioned operation is not specified: A procedure for generating a plurality of sequences by splitting a sequence having a non-zero stride from a sequence having a fixed stride, wherein the number of sequences per result index is the same across different slices. The computer system according to claim 10, comprising:
13. The procedure for determining the inductive variables of the modified loop is as follows: A procedure for generating the derived variables in order to mimic the traversal of the multidimensional table in a one-dimensional manner. The computer system according to claim 10, having the following features.
14. The procedure for generating the plurality of new conditional statements based on the determined inducer variables and the values and strides in at least the plurality of sequences is as follows: A procedure for generating multiple lists for each slice in the multiple slices, based on the non-common values and strides in the multiple sequences, and the determined values of the derived variables corresponding to the last term of the sequence in each slice; A procedure for generating a plurality of new induce variables for the modified loop, wherein the starting value and stride of the plurality of new induce variables are determined based on the values from the plurality of lists; and A procedure for generating the multiple new conditional statements using the multiple new inducer variables, existing variables from the loop, values from the multiple lists, and common values in the multiple sequences. A computer system according to any one of claims 8 to 13, having the following features.
15. A computer program for generating a modified loop for a loop having multiple conditional statements, wherein: A set of processors provides a procedure for generating a condition tree based on the multiple conditional statements in the loop, where the value is determined by evaluating each conditional statement in the multiple conditional statements; A procedure for generating a multidimensional table based on the values of the multiple conditional statements obtained from the condition tree using the aforementioned processor set; A procedure for determining the induction variables of the modified loop using the aforementioned processor set; A procedure for slicing the multidimensional table using the processor set to generate multiple slices, wherein each slice in the multiple slices represents at least a portion of the multidimensional table; The processor set provides a procedure for generating multiple sequences by dividing the values in each slice, wherein the values and strides in the multiple sequences are determined for the proper execution of the modified loop; A procedure for generating a plurality of new conditional statements based on the determined inducer variable and the values and stride in at least the plurality of sequences, using the processor set; and The processor set provides a procedure for generating the modified loop based on the multiple new conditional statements. A program instruction that performs an action having A computer program that includes the following features.
16. The computer program according to claim 15, wherein each slice from the plurality of slices includes a set of values obtained by varying the determined inducer while fixing other existing inducer variables in the loop having the plurality of conditional statements.
17. The procedure for generating multiple sequences by splitting the values in each slice is as follows: The processor set provides a procedure for generating a sequence with a fixed stride by dividing the values in each slice, wherein each sequence in the sequence with a fixed stride corresponds to multiple values of the result index in each slice. A computer program according to claim 15, having the following:
18. The aforementioned operation is not specified: A procedure by which the processor set determines, based on the condition tree, whether the determined induction variable is the innermost iterator of the loop having the plurality of conditional statements; and In response to the determination, based on the condition tree, that the determined induced variable is not the innermost iterator of the loop having the plurality of conditional statements, the set of processors performs a procedure to arrange a sequence having a non-zero stride in the sequence having a fixed stride in order to generate the plurality of sequences, wherein the stride value of each sequence in the plurality of sequences is zero. The computer program according to claim 17, comprising:
19. The aforementioned operation is not specified: A procedure for generating the plurality of sequences by dividing sequences having non-zero stride within sequences having a fixed stride using the aforementioned processor set, wherein the number of sequences per result index is the same across different slices. The computer program according to claim 17, comprising:
20. The procedure for generating the plurality of new conditional statements based on the determined inducer variables and the values and strides in at least the plurality of sequences, according to the processor set, is as follows: A procedure for generating multiple lists for each slice in the multiple slices, based on the non-common values and strides in the multiple sequences and the determined values of the induction variables corresponding to the last term of the sequence in each slice, using the processor set; The processor set provides a procedure for generating a plurality of new induce variables for the modified loop, wherein the starting value and stride of the plurality of new induce variables are determined based on the values from the plurality of lists; and The processor set provides a procedure for generating the multiple new conditional statements using the multiple new inducer variables, existing variables from the loop, values from the multiple lists, and common values in the multiple sequences. A computer program according to any one of claims 15 to 19, comprising:
21. A computer implementation method for generating a modified loop for a loop having multiple conditional statements, the computer implementation method being: The processor set generates a condition tree based on the multiple conditional statements in the loop, where the value is determined by evaluating each conditional statement in the multiple conditional statements; The processor set generates a multidimensional table based on the values of the multiple conditional statements obtained from the condition tree; The processor set slices the multidimensional table to generate multiple slices using multiple slicing methods, where each slice in the multiple slices represents at least a portion of the multidimensional table; The processor set generates multiple sequences by dividing the values in each slice according to the slicing method, where the values and strides in the multiple sequences are determined for the proper execution of the modified loop; The processor set generates a plurality of new conditional statements for each slicing method, based on the values and strides in at least the plurality of sequences; and The processor set generates the modified loop based on the plurality of new conditional statements for each slicing method. A computer implementation method comprising the above.
22. For each slicing method, the step of generating the plurality of new conditional statements by the processor set, based on the values and strides in at least the plurality of sequences, is: The processor set generates, for each slicing method, multiple lists based on non-common values in the multiple sequences; The processor set generates a plurality of new induce variables for the modified loop of each slicing method, wherein the starting value and stride of the plurality of new induce variables are determined for each slicing method based on the values from the plurality of lists; and The processor set generates the multiple new conditional statements for each slicing method, using the multiple new induction variables of the modified loop for each slicing method, existing variables from the loop, values from the multiple lists, and common values in the multiple sequences for each slicing method. A computer implementation method according to claim 21, comprising:
23. The processor set generates the modified loop condition tree for each slicing method; The processor set performs a cost analysis of the modified loop for each slicing method based on the condition tree of the modified loop for each slicing method and the plurality of new induction variables of the modified loop for each slicing method; and The processor set performs the step of replacing the loop with the multiple conditional statements using a modified loop for slicing at the lowest cost. The computer implementation method according to claim 22, further comprising:
24. The step of performing the cost analysis of the modified loop for each slicing method by the processor set, based on the condition tree of the modified loop for each slicing method and the multiple new variables of the modified loop for each slicing method, is: The processor set then identifies the set of modified loops in the condition tree that has the fewest leaves; The processor set determines whether the set of modified loops comprises one or more slicing method loops; and In response to determining that the set of modified loops does not comprise one or more loops of the slicing method, the set of processors identifies, at the lowest cost, the set of modified loops as the modified loops of the slicing method. A computer implementation method according to claim 23, comprising:
25. In response to determining that the set of modified loops comprises one or more loops of the slicing method, the set of processors, at the lowest cost, identifies from the set of modified loops the subset of modified loops with the fewest number of new inducers of the slicing method as the modified loop of the slicing method. The computer implementation method according to claim 24, further comprising: