Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Facilities for composing SOAC functions. Mostly intended for use by the fusion module, but factored into a separate module for ease of testing, debugging and development. Of course, there is nothing preventing you from using the exported functions whereever you want.
Important: this module is "dumb" in the sense that it does not check the validity of its inputs, and does not have any functionality for massaging SOACs to be fusible. It is assumed that the given SOACs are immediately compatible.
The module will, however, remove duplicate inputs after fusion.
Synopsis
- fuseMaps :: Buildable rep => Names -> Lambda rep -> [Input] -> [(VName, Ident)] -> Lambda rep -> [Input] -> (Lambda rep, [Input])
- fuseRedomap :: Buildable rep => Names -> [VName] -> Lambda rep -> [SubExp] -> [SubExp] -> [Input] -> [(VName, Ident)] -> Lambda rep -> [SubExp] -> [SubExp] -> [Input] -> (Lambda rep, [Input])
Documentation
:: Buildable rep | |
=> Names | The producer var names that still need to be returned |
-> Lambda rep | Function of SOAC to be fused. |
-> [Input] | Input of SOAC to be fused. |
-> [(VName, Ident)] | Output of SOAC to be fused. The first identifier is the name of the actual output, where the second output is an identifier that can be used to bind a single element of that output. |
-> Lambda rep | Function to be fused with. |
-> [Input] | Input of SOAC to be fused with. |
-> (Lambda rep, [Input]) | The fused lambda and the inputs of the resulting SOAC. |
fuseMaps lam1 inp1 out1 lam2 inp2
fuses the function lam1
into
lam2
. Both functions must be mapping functions, although lam2
may have leading reduction parameters. inp1
and inp2
are the
array inputs to the SOACs containing lam1
and lam2
respectively. out1
are the identifiers to which the output of
the SOAC containing lam1
is bound. It is nonsensical to call
this function unless the intersection of out1
and inp2
is
non-empty.
If lam2
accepts more parameters than there are elements in
inp2
, it is assumed that the surplus (which are positioned at the
beginning of the parameter list) are reduction (accumulator)
parameters, that do not correspond to array elements, and they are
thus not modified.
The result is the fused function, and a list of the array inputs expected by the SOAC containing the fused function.