Patent ID: 8359586

Claim:
A method for generating optimized code, the method comprising: receiving input code having a plurality of functional elements retrieving a first selection of block sizes for two or more of the functional elements that indicates a size of blocks of data elements for processing; generating a first intermediate representation (IR) of the input code based on the first selection of block sizes, wherein the first IR includes a plurality of nodes, a plurality of buffers each having a size for storing respective blocks, and one or more loops structures, nodes of the first intermediate representation that map to the functional elements being assigned the first selection of block sizes; determining a first memory access bandwidth characteristic for each buffer of the first IR based on the size of the respective buffer, and the one or more loop structures; generating a second IR of the input code based on a second selection of block sizes for the two or more functional elements, wherein the second IR includes a plurality of nodes, a plurality of buffers each having a size for storing respective blocks, and one or more loops structures; determining a second memory access bandwidth characteristic for each buffer of the second IR based on the size of the respective buffer, and the one or more loop structures; selecting one of the first or the second IRs based on the first and second memory access bandwidth characteristics; generating output code from the selected first or second IR; and storing the output code in a memory.