Patent Document ID: 9875100
Application ID: 15456812
Patent Status: 1

Claim One:
1. An apparatus for processing an instruction for accessing an N-dimensional tensor, the apparatus comprising: multiple tensor index elements, wherein each tensor index element includes hardware storage circuitry configured to store an index value for a respective nested loop that is used to traverse a respective dimension of the N-dimensional tensor and wherein the index value for each nested loop is adjusted after each iteration of the nested loop; multiple dimension multiplier elements, wherein each of the dimension multiplier elements has a corresponding tensor index element and includes hardware storage circuitry configured to store a multiplier value for the corresponding tensor index element, wherein each multiplier value is a constant value for the corresponding tensor index element and remains constant for each iteration of the nested loop for the corresponding tensor index element; and one or more hardware processors configured to execute one or more instructions of an instruction set executable by the one or more hardware processors, wherein execution of the one or more instructions causes the one or more hardware processors to perform operations comprising: obtaining an instruction to access a particular element of a N-dimensional tensor, wherein the N-dimensional tensor has multiple elements arranged across each of the N dimensions, and wherein N is an integer that is equal to or greater than one; obtaining a current index value stored by each of one or more tensor index elements of the multiple tensor index elements; determining, using the current index value stored by each of the one or more tensor index elements of the multiple tensor index elements and the multiplier value stored by one or more dimension multiplier elements of the multiple dimension multiplier elements that correspond to the one or more tensor index elements, a memory address at which the particular element is stored in memory, the determining including: determining, for each dimension of the N-dimensional tensor, a product of (i) the current index value for the nested loop that is used to traverse the dimension and (ii) the multiplier value for the corresponding tensor index element that stores the current index value for the nested loop that is used to traverse the dimension; and determining the memory address of the particular element based on a sum of the product for each dimension of the N-dimensional tensor; and outputting data indicating the determined memory address to a processing unit that is configured to access the particular element of the N-dimensional tensor using the determined memory address.