Application programming interface to accelerate matrix operations
Apparatuses, systems, and techniques to determine a matrix multiplication algorithm for a matrix multiplication operation. In at least one embodiment, a matrix multiplication operation is analyzed to determine an appropriate matrix multiplication algorithm to perform the matrix multiplication algorithm.
1 . A non-transitory machine-readable medium having stored thereon a Get Heuristic application programming interface (API), which if performed by one or more processors, causes the one or more processors to at least:
determine possible algorithms for a matrix multiplication operation, wherein the Get Heuristic API includes parameters comprising:
an operation description parameter including a pointer to a matrix multiplication operation description;
input matrices;
a search preferences parameter including a pointer to a data object comprising search preferences;
an algorithm count parameter to specify a desired number of algorithms;
a results array parameter to specify an array to store algorithm identifiers in order of increasing estimated compute time; and
an operation status parameter to indicate if the Get Heuristic API is successful.
2 . The non-transitory machine-readable medium of claim 1 , wherein the pointer to the matrix multiplication operation description is a pointer to a matrix multiply operation descriptor.
3 . The non-transitory machine-readable medium of claim 1 , wherein the data object comprising search preferences indicates a search algorithm to utilize to search for the possible algorithms.
4 . The non-transitory machine-readable medium of claim 1 , wherein the data object comprising search preferences indicates a preferred resource utilization.
5 . The non-transitory machine-readable medium of claim 1 , wherein the algorithm count parameter includes an integer value of the desired number.
6 . The non-transitory machine-readable medium of claim 1 , wherein the machine-readable medium further stores thereon a matrix multiply API to perform an algorithm indicated by the Get Heuristic API.
7 . The non-transitory machine-readable medium of claim 1 , wherein the machine-readable medium further stores thereon a matrix multiply API to compute a matrix multiplication of matrices, wherein the matrix multiply API includes parameters comprising:
an operation description parameter comprising a pointer to a matrix multiply operation descriptor;
an input scalars parameter comprising pointers to data objects comprising values of input scalars;
an input matrices parameter comprising pointers to values of the input matrices;
a matrix layout descriptor parameter comprising pointers to matrix layout descriptors;
an output location parameter comprising a pointer to a location in which a result of the matrix multiplication is to be stored;
an algorithm parameter including a pointer to a data object that comprises a particular algorithm to be utilized in the matrix multiplication operation; and
an operation status parameter to indicate a status of the matrix multiply API.
8 . The non-transitory machine-readable medium of claim 1 , wherein:
the pointer to the matrix multiplication operation description is a pointer to a matrix multiply operation descriptor;
the data object comprising search preferences indicates a search algorithm to utilize to search for the possible algorithms;
the data object comprising search preferences indicates a preferred resource utilization;
the algorithm count parameter includes an integer value of the desired number;
the machine-readable medium further stores thereon a matrix multiply API to perform an algorithm indicated by the Get Heuristic API, wherein the matrix multiply API includes parameters comprising:
an operation description parameter comprising a pointer to a matrix multiply operation descriptor;
an input scalars parameter comprising pointers to data objects comprising values of input scalars;
an input matrices parameter comprising pointers to values of the input matrices;
a matrix layout descriptor parameter comprising pointers to matrix layout descriptors;
an output location parameter comprising a pointer to a location in which a result of the matrix multiplication is to be stored;
an algorithm parameter including a pointer to a data object that comprises a particular algorithm to be utilized in the matrix multiplication operation; and
an operation status parameter to indicate a status of the matrix multiply API.
9 . A computer-implemented method, comprising:
in response to a Get Heuristic application programming interface (API) call, causing one or more processors to at least:
determine possible algorithms for a matrix multiplication operation, wherein the Get Heuristic API call includes parameters comprising:
an operation description parameter including a pointer to a matrix multiplication operation description;
input matrices;
a search preferences parameter including a pointer to a data object comprising search preferences;
an algorithm count parameter to specify a desired number of algorithms;
a results array parameter to specify an array to store algorithm identifiers in order of increasing estimated compute time; and
an operation status parameter to indicate if the Get Heuristic API call is successful.
10 . The computer-implemented method of claim 9 , wherein the pointer to the matrix multiplication operation description is a pointer to a matrix multiply operation descriptor.
11 . The computer-implemented method of claim 9 , wherein the data object comprising search preferences indicates a search algorithm to utilize to search for the possible algorithms.
12 . The computer-implemented method of claim 9 , wherein the data object comprising search preferences indicates a preferred resource utilization.
13 . The computer-implemented method of claim 9 , wherein the algorithm count parameter includes an integer value of the desired number.
14 . The computer-implemented method of claim 9 , further comprising, in response to a matrix multiply API call, causing a matrix multiply operation to perform one or more of the determined possible algorithms.
15 . The computer-implemented method of claim 9 , further comprising, in response to a matrix multiply API call, causing a matrix multiply operation to be performed, wherein the matrix multiply API call comprises parameters including:
an operation description parameter comprising a pointer to a matrix multiply operation descriptor;
an input scalars parameter comprising pointers to data objects comprising values of input scalars;
an input matrices parameter comprising pointers to values of the input matrices;
a matrix layout descriptor parameter comprising pointers to matrix layout descriptors;
an output location parameter comprising a pointer to a location in which a result of the matrix multiplication is to be stored;
an algorithm parameter including a pointer to a data object that comprises a particular algorithm to be utilized in the matrix multiplication operation; and
an operation status parameter to indicate a status of the matrix multiply API call.
16 . The computer-implemented method of claim 9 , wherein:
the pointer to the matrix multiplication operation description is a pointer to a matrix multiply operation descriptor;
the data object comprising search preferences indicates a search algorithm to utilize to search for the possible algorithms;
the data object comprising search preferences indicates a preferred resource utilization;
the algorithm count parameter includes an integer value of the desired number;
the computer-implemented method further comprises performing an algorithm indicated by the Get Heuristic API call, wherein a matrix multiply API call includes parameters comprising:
an operation description parameter comprising a pointer to a matrix multiply operation descriptor;
an input scalars parameter comprising pointers to data objects comprising values of input scalars;
an input matrices parameter comprising pointers to values of the input matrices;
a matrix layout descriptor parameter comprising pointers to matrix layout descriptors;
an output location parameter comprising a pointer to a location in which a result of the matrix multiplication is to be stored;
an algorithm parameter including a pointer to a data object that comprises a particular algorithm to be utilized in the matrix multiplication operation; and
an operation status parameter to indicate a status of the matrix multiply API call.
17 . A processor, comprising:
one or more circuits to, in response to a Get Heuristic application programming interface (API) call, at least:
determine possible algorithms for a matrix multiplication operation, wherein the Get Heuristic API call includes parameters comprising:
an operation description parameter including a pointer to a matrix multiplication operation description;
input matrices;
a search preferences parameter including a pointer to a data object comprising search preferences;
an algorithm count parameter to specify a desired number of algorithms;
a results array parameter to specify an array to store algorithm identifiers in order of increasing estimated compute time; and
an operation status parameter to indicate if the Get Heuristic API call is successful.
18 . The processor of claim 17 , wherein the pointer to the matrix multiplication operation description is a pointer to a matrix multiply operation descriptor.
19 . The processor of claim 17 , wherein the data object comprising search preferences indicates a search algorithm to utilize to search for the possible algorithms.
20 . The processor of claim 17 , wherein the data object comprising search preferences indicates a preferred resource utilization.
21 . The processor of claim 17 , wherein the algorithm count parameter includes an integer value of the desired number.
22 . The processor of claim 17 , wherein a machine-readable medium further stores thereon a matrix multiply API to perform an algorithm indicated by the Get Heuristic API call.
23 . The processor of claim 17 , wherein a machine-readable medium further stores thereon a matrix multiply API to compute a matrix multiplication of matrices, wherein the matrix multiply API includes parameters comprising:
an operation description parameter comprising a pointer to a matrix multiply operation descriptor;
an input scalars parameter comprising pointers to data objects comprising values of input scalars;
an input matrices parameter comprising pointers to values of the input matrices;
a matrix layout descriptor parameter comprising pointers to matrix layout descriptors;
an output location parameter comprising a pointer to a location in which a result of the matrix multiplication is to be stored;
an algorithm parameter including a pointer to a data object that comprises a particular algorithm to be utilized in the matrix multiplication operation; and
an operation status parameter to indicate a status of the matrix multiply API.
24 . The processor of claim 17 , wherein:
the pointer to the matrix multiplication operation description is a pointer to a matrix multiply operation descriptor;
the data object comprising search preferences indicates a search algorithm to utilize to search for the possible algorithms;
the data object comprising search preferences indicates a preferred resource utilization;
the algorithm count parameter includes an integer value of the desired number;
a machine-readable medium further stores thereon a matrix multiply API to perform an algorithm indicated by the Get Heuristic API call, wherein the matrix multiply API includes parameters comprising:
an operation description parameter comprising a pointer to a matrix multiply operation descriptor;
an input scalars parameter comprising pointers to data objects comprising values of input scalars;
an input matrices parameter comprising pointers to values of the input matrices;
a matrix layout descriptor parameter comprising pointers to matrix layout descriptors;
an output location parameter comprising a pointer to a location in which a result of the matrix multiplication is to be stored;
an algorithm parameter including a pointer to a data object that comprises a particular algorithm to be utilized in the matrix multiplication operation; and
an operation status parameter to indicate a status of the matrix multiply API.