Skip to content

Commit

Permalink
Implemented buffered direct-r2c, direct-hc2c.
Browse files Browse the repository at this point in the history
Also, removed some old cruft:

* okp() functions were never used and a pain to maintain---now they
  are gone.

* ``m'' in hc2hc and hc2c codelets is now the number of iterations,
  not the ``logical'' m.
  • Loading branch information
matteo-frigo committed Dec 20, 2006
1 parent de904f1 commit f84c7e6
Show file tree
Hide file tree
Showing 18 changed files with 416 additions and 335 deletions.
8 changes: 3 additions & 5 deletions genfft/gen_hc2c.ml
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,10 @@ let generate n =
in
let body = Block (
[Decl ("INT", i)],
[For (Expr_assign (vi, (CPlus [vm; CUminus (Integer 2)])),
[For (Expr_assign (vi, vm),
Binop (" > ", vi, Integer 0),
list_to_comma
[Expr_assign (vi, CPlus [vi; CUminus (byvl (Integer 2))]);
[Expr_assign (vi, CPlus [vi; CUminus (byvl (Integer 1))]);
Expr_assign (varp, CPlus [varp; byvl vms]);
Expr_assign (vaip, CPlus [vaip; byvl vms]);
Expr_assign (varm, CPlus [varm; CUminus (byvl vms)]);
Expand Down Expand Up @@ -166,10 +166,8 @@ let generate n =
(twinstr_to_string "VL" (twdesc n))
and desc =
Printf.sprintf
"static const hc2c_desc desc = {%d, \"%s\", twinstr, &GENUS, %s, %s, %s, %s};\n\n"
"static const hc2c_desc desc = {%d, \"%s\", twinstr, &GENUS, %s};\n\n"
n name (flops_of tree)
(stride_to_solverparm !urs) "0"
(stride_to_solverparm !ums)
and register = "X(khc2c_register)"

in
Expand Down
18 changes: 9 additions & 9 deletions genfft/gen_hc2hc.ml
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@ let genone sign n transform load store vrs =
let input =
locative_array_c n
(C.array_subscript rioarray vrs)
(C.array_subscript iioarray (SNeg vrs))
(C.array_subscript iioarray vrs)
locations in
let output = transform sign n (load n input) in
let ioloc =
locative_array_c n
(C.array_subscript rioarray vrs)
(C.array_subscript iioarray (SNeg vrs))
(C.array_subscript iioarray vrs)
locations in
let odag = store n ioloc output in
let annot = standard_optimizer odag
Expand Down Expand Up @@ -102,11 +102,13 @@ let generate n =
match !ditdif with
| DIT ->
genone sign n
(fun sign n input -> sym2 n (Fft.dft sign n (byw (sym1 n input))))
(fun sign n input ->
((sym1 n) @@ (sym2 n)) (Fft.dft sign n (byw input)))
load_array_c store_array_c vrs
| DIF ->
genone sign n
(fun sign n input -> sym1 n (byw (Fft.dft sign n (sym2i n input))))
(fun sign n input ->
byw (Fft.dft sign n (((sym2i n) @@ (sym1 n)) input)))
load_array_c store_array_c vrs
in

Expand All @@ -117,10 +119,10 @@ let generate n =
in
let body = Block (
[Decl ("INT", i)],
[For (Expr_assign (vi, (CPlus [vm; CUminus (Integer 2)])),
[For (Expr_assign (vi, vm),
Binop (" > ", vi, Integer 0),
list_to_comma
[Expr_assign (vi, CPlus [vi; CUminus (byvl (Integer 2))]);
[Expr_assign (vi, CPlus [vi; CUminus (byvl (Integer 1))]);
Expr_assign (vrioarray, CPlus [vrioarray; byvl vms]);
Expr_assign (viioarray,
CPlus [viioarray; CUminus (byvl vms)]);
Expand Down Expand Up @@ -148,10 +150,8 @@ let generate n =
(twinstr_to_string "VL" (twdesc n))
and desc =
Printf.sprintf
"static const hc2hc_desc desc = {%d, \"%s\", twinstr, &GENUS, %s, %s, %s, %s};\n\n"
"static const hc2hc_desc desc = {%d, \"%s\", twinstr, &GENUS, %s};\n\n"
n name (flops_of tree)
(stride_to_solverparm !urs) "0"
(stride_to_solverparm !ums)
and register = "X(khc2hc_register)"

in
Expand Down
5 changes: 1 addition & 4 deletions genfft/gen_r2cb.ml
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,8 @@ let generate n =

in let desc =
Printf.sprintf
"static const kr2c_desc desc = { %d, \"%s\", %s, &GENUS, %s, %s, %s, %s, %s };\n\n"
"static const kr2c_desc desc = { %d, \"%s\", %s, &GENUS };\n\n"
n name (flops_of tree)
(stride_to_solverparm !ucsr) (stride_to_solverparm !ucsi)
(stride_to_solverparm !urs)
"0" "0"

and init =
(declare_register_fcn name) ^
Expand Down
5 changes: 1 addition & 4 deletions genfft/gen_r2cf.ml
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,8 @@ let generate n =

in let desc =
Printf.sprintf
"static const kr2c_desc desc = { %d, \"%s\", %s, &GENUS, %s, %s, %s, %s, %s };\n\n"
"static const kr2c_desc desc = { %d, \"%s\", %s, &GENUS };\n\n"
n name (flops_of tree)
(stride_to_solverparm !urs)
(stride_to_solverparm !ucsr) (stride_to_solverparm !ucsi)
"0" "0"

and init =
(declare_register_fcn name) ^
Expand Down
6 changes: 1 addition & 5 deletions genfft/gen_r2r.ml
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ let generate n mode =

in let desc =
Printf.sprintf
"static const kr2r_desc desc = { %d, \"%s\", %s, &GENUS, %s, %s, %s, %s, %s };\n\n"
"static const kr2r_desc desc = { %d, \"%s\", %s, &GENUS, %s };\n\n"
n name (flops_of tree)
(match mode with
| RDFT -> "RDFT00"
Expand All @@ -227,10 +227,6 @@ let generate n mode =
| RODFT01 -> "RODFT01"
| RODFT11 -> "RODFT11"
| _ -> failwith "must specify a transform kind")
(stride_to_solverparm !uistride)
(stride_to_solverparm !uostride)
(choose_simd "0" (stride_to_solverparm !uivstride))
(choose_simd "0" (stride_to_solverparm !uovstride))

and init =
(declare_register_fcn name) ^
Expand Down
34 changes: 4 additions & 30 deletions rdft/codelet-rdft.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,21 +67,15 @@ typedef enum {
typedef struct kr2c_desc_s kr2c_desc;

typedef struct {
int (*okp)(
const kr2c_desc *desc,
const R *R0, const R *R1, const R *Cr, const R *Ci,
INT rs, INT csr, INT csi, INT vl, INT ivs, INT ovs);
rdft_kind kind;
INT vl;
} kr2c_genus;

struct kr2c_desc_s {
INT sz; /* size of transform computed */
INT n; /* size of transform computed */
const char *nam;
opcnt ops;
const kr2c_genus *genus;
INT rs, csr, csi;
INT ivs, ovs;
};

typedef void (*kr2c) (R *R0, R *R1, R *Cr, R *Ci,
Expand All @@ -93,11 +87,8 @@ void X(kr2c_register)(planner *p, kr2c codelet, const kr2c_desc *desc);
typedef struct hc2hc_desc_s hc2hc_desc;

typedef struct {
int (*okp)(
const struct hc2hc_desc_s *desc,
const R *rio, const R *iio, INT rs, INT vs, INT m, INT ms);
rdft_kind kind;
int vl;
INT vl;
} hc2hc_genus;

struct hc2hc_desc_s {
Expand All @@ -106,9 +97,6 @@ struct hc2hc_desc_s {
const tw_instr *tw;
const hc2hc_genus *genus;
opcnt ops;
INT rs;
INT vs;
INT ms;
};

typedef const R *(*khc2hc) (R *rioarray, R *iioarray, const R *W,
Expand All @@ -119,12 +107,8 @@ void X(khc2hc_register)(planner *p, khc2hc codelet, const hc2hc_desc *desc);
typedef struct hc2c_desc_s hc2c_desc;

typedef struct {
int (*okp)(
const struct hc2c_desc_s *desc,
const R *Rp, const R *Ip, const R *Rm, const R *Im,
INT rs, INT vs, INT m, INT ms);
rdft_kind kind;
int vl;
INT vl;
} hc2c_genus;

struct hc2c_desc_s {
Expand All @@ -133,9 +117,6 @@ struct hc2c_desc_s {
const tw_instr *tw;
const hc2c_genus *genus;
opcnt ops;
INT rs;
INT vs;
INT ms;
};

typedef const R *(*khc2c) (R *Rp, R *Ip, R *Rm, R *Im, const R *W,
Expand All @@ -150,22 +131,15 @@ extern const solvtab X(solvtab_rdft_r2cb);
typedef struct kr2r_desc_s kr2r_desc;

typedef struct {
int (*okp)(
const kr2r_desc *desc,
const R *I, const R *O,
INT is, INT os, INT vl, INT ivs, INT ovs);
INT vl;
} kr2r_genus;

struct kr2r_desc_s {
INT sz; /* size of transform computed */
INT n; /* size of transform computed */
const char *nam;
opcnt ops;
const kr2r_genus *genus;
rdft_kind kind;
INT is, os;
INT ivs;
INT ovs;
};

typedef void (*kr2r) (const R *I, R *O, stride is, stride os,
Expand Down
16 changes: 2 additions & 14 deletions rdft/codelets/hc2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,9 @@
#include "codelet-rdft.h"
#include "hc2cf.h"

static int okp(const hc2c_desc *d,
const R *Rp, const R *Ip, const R *Rm, const R *Im,
INT rs, INT vs, INT m, INT ms)
{
UNUSED(Rp); UNUSED(Ip); UNUSED(Rm); UNUSED(Im); UNUSED(m);
return (1
&& (!d->rs || (d->rs == rs))
&& (!d->vs || (d->vs == vs))
&& (!d->ms || (d->ms == ms))
);
}

const hc2c_genus GENUS = { okp, R2HC, 1 };
const hc2c_genus GENUS = { R2HC, 1 };

#undef GENUS
#include "hc2cb.h"

const hc2c_genus GENUS = { okp, HC2R, 1 };
const hc2c_genus GENUS = { HC2R, 1 };
16 changes: 2 additions & 14 deletions rdft/codelets/hfb.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,9 @@
#include "codelet-rdft.h"
#include "hf.h"

static int okp(const hc2hc_desc *d,
const R *rio, const R *iio,
INT rs, INT vs, INT m, INT ms)
{
UNUSED(rio); UNUSED(iio); UNUSED(m);
return (1
&& (!d->rs || (d->rs == rs))
&& (!d->vs || (d->vs == vs))
&& (!d->ms || (d->ms == ms))
);
}

const hc2hc_genus GENUS = { okp, R2HC, 1 };
const hc2hc_genus GENUS = { R2HC, 1 };

#undef GENUS
#include "hb.h"

const hc2hc_genus GENUS = { okp, HC2R, 1 };
const hc2hc_genus GENUS = { HC2R, 1 };
22 changes: 4 additions & 18 deletions rdft/codelets/r2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,32 +20,18 @@

#include "codelet-rdft.h"

static int okp(const kr2c_desc *d,
const R *R0, const R *R1, const R *Cr, const R *Ci,
INT rs, INT csr, INT csi, INT vl, INT ivs, INT ovs)
{
UNUSED(R0); UNUSED(R1); UNUSED(Cr); UNUSED(Ci); UNUSED(vl);
return (1
&& (!d->rs || (d->rs == rs))
&& (!d->csr || (d->csr == csr))
&& (!d->csi || (d->csi == csi))
&& (!d->ivs || (d->ivs == ivs))
&& (!d->ovs || (d->ovs == ovs))
);
}

#include "r2cf.h"
const kr2c_genus GENUS = { okp, R2HC, 1 };
const kr2c_genus GENUS = { R2HC, 1 };
#undef GENUS

#include "r2cfII.h"
const kr2c_genus GENUS = { okp, R2HCII, 1 };
const kr2c_genus GENUS = { R2HCII, 1 };
#undef GENUS

#include "r2cb.h"
const kr2c_genus GENUS = { okp, HC2R, 1 };
const kr2c_genus GENUS = { HC2R, 1 };
#undef GENUS

#include "r2cbIII.h"
const kr2c_genus GENUS = { okp, HC2RIII, 1 };
const kr2c_genus GENUS = { HC2RIII, 1 };
#undef GENUS
16 changes: 1 addition & 15 deletions rdft/codelets/r2r.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,4 @@
#include "codelet-rdft.h"
#include "r2r.h"

static int okp(const kr2r_desc *d,
const R *I,
const R *O,
INT is, INT os, INT vl, INT ivs, INT ovs)
{
UNUSED(I); UNUSED(O); UNUSED(vl);
return (1
&& (!d->is || (d->is == is))
&& (!d->os || (d->os == os))
&& (!d->ivs || (d->ivs == ivs))
&& (!d->ovs || (d->ovs == ovs))
);
}

const kr2r_genus GENUS = { okp, 1 };
const kr2r_genus GENUS = { 1 };
Loading

0 comments on commit f84c7e6

Please sign in to comment.