Skip to main content

emit_spatial_zip_map_test

Function emit_spatial_zip_map_test 

Source
pub fn emit_spatial_zip_map_test(
    n: usize,
    columns: &[MapColumn],
    declared: &[usize],
    term: &ZipTerm,
    out: &str,
    p: MapPar,
    pir_args: Option<&str>,
    class_name: &str,
) -> Result<String, String>
Expand description

Emit a Spatial REGRESSION-HARNESS zip map out[t] = f(c₀[t], c₁[t], …) with the structure of Spatial’s own BlackScholes app: per ts-element tile, a FIFO of every column loaded in the order the program declares its columns (declared, a permutation of the columns, which are in the order the term reads them), an ip-lane Foreach dequeuing one element of every column and enqueuing the term’s value, the output tile stored, op tiles at once — at our length, over the program’s own data, with the variant’s PIR arguments (pir_args, the suffix its pirArgs override appends). The term is printed as its DAG: a function the program calls twice is two copies, as Spatial stages it, and a subterm used twice is computed once. The app computes in Spatial’s 32-bit Int and Float; a term whose Int would wrap there or whose Real would leave the Float’s range is refused, as is a division by zero on any path (the host’s gold would trap), a tile that does not divide the length, or a map wider than its tile. The gold is the host’s own evaluation of the term: a Float result passes within 0.1% (and 0.001) of it, an Int one exactly.