Skip to content

Commit

Permalink
Renamed r2hc/hc2r codelets to r2c
Browse files Browse the repository at this point in the history
After the recent changes, r2hc/hc2r codelets became rdft2
problems, so I renamed them accordingly to r2cf/r2cb.
Codelet parameters are now a real array and a complex array, instead
of an input array and an output array, and forward and backward
codelets have the same type, which removes some clutter from the rdft
code.
  • Loading branch information
matteo-frigo committed Dec 18, 2006
1 parent 91b8d21 commit 8e69f06
Show file tree
Hide file tree
Showing 25 changed files with 265 additions and 486 deletions.
4 changes: 2 additions & 2 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ libfftw3@PREC_SUFFIX@_la_LIBADD = \
dft/codelets/standard/libdft_standard.la \
rdft/librdft.la \
rdft/codelets/librdft_codelets.la \
rdft/codelets/r2hc/librdft_codelets_r2hc.la \
rdft/codelets/hc2r/librdft_codelets_hc2r.la \
rdft/codelets/r2cf/librdft_codelets_r2cf.la \
rdft/codelets/r2cb/librdft_codelets_r2cb.la \
rdft/codelets/r2r/librdft_codelets_r2r.la \
reodft/libreodft.la \
api/libapi.la \
Expand Down
4 changes: 2 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -452,8 +452,8 @@ AC_CONFIG_FILES([
rdft/Makefile
rdft/codelets/Makefile
rdft/codelets/r2hc/Makefile
rdft/codelets/hc2r/Makefile
rdft/codelets/r2cf/Makefile
rdft/codelets/r2cb/Makefile
rdft/codelets/r2r/Makefile
reodft/Makefile
Expand Down
2 changes: 1 addition & 1 deletion doc/fftw3.texi
Original file line number Diff line number Diff line change
Expand Up @@ -4805,7 +4805,7 @@ that you want to share.
To create the FFTW library, you will then need to compile all of the
@samp{.c} files in the @code{kernel}, @code{dft}, @code{dft/codelets},
@code{dft/codelets/standard}, @code{rdft}, @code{rdft/codelets},
@code{rdft/codelets/r2hc}, @code{rdft/codelets/hc2r},
@code{rdft/codelets/r2cf}, @code{rdft/codelets/r2cb},
@code{rdft/codelets/r2r}, @code{reodft}, and @code{api} directories.
If you are compiling with SIMD support (e.g. you defined
@code{HAVE_SSE2} in @code{config.h}), then you also need to compile
Expand Down
18 changes: 9 additions & 9 deletions genfft/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

EXTRA_DIST = .depend algsimp.ml annotate.ml assoctable.ml c.ml \
complex.ml conv.ml dag.ml expr.ml fft.ml gen_conv.ml gen_hc2c.ml \
gen_hc2hc.ml gen_hc2r.ml gen_mdct.ml gen_notw.ml gen_notw_c.ml \
gen_r2hc.ml gen_r2r.ml gen_twiddle.ml gen_twiddle_c.ml gen_twidsq.ml \
gen_hc2hc.ml gen_r2cb.ml gen_mdct.ml gen_notw.ml gen_notw_c.ml \
gen_r2cf.ml gen_r2r.ml gen_twiddle.ml gen_twiddle_c.ml gen_twidsq.ml \
gen_twidsq_c.ml genutil.ml littlesimp.ml magic.ml monads.ml number.ml \
oracle.ml schedule.ml simd.ml simdmagic.ml to_alist.ml trig.ml \
twiddle.ml unique.ml util.ml variable.ml algsimp.mli annotate.mli \
Expand All @@ -12,7 +12,7 @@ littlesimp.mli number.mli oracle.mli schedule.mli simd.mli \
to_alist.mli trig.mli twiddle.mli unique.mli util.mli variable.mli

noinst_SCRIPTS=gen_notw gen_notw_c gen_twiddle gen_twiddle_c \
gen_twidsq gen_twidsq_c gen_r2r gen_conv gen_r2hc gen_hc2r gen_hc2c \
gen_twidsq gen_twidsq_c gen_r2r gen_conv gen_r2cf gen_r2cb gen_hc2c \
gen_hc2hc gen_mdct

libgenfft_objects = unique.cmo magic.cmo util.cmo number.cmo \
Expand Down Expand Up @@ -64,17 +64,17 @@ gen_twidsq_c: libgenfft.cmxa $(gen_twidsq_c_OBJECTS:.cmo=.cmx)
maintainer-clean-local::
rm -f gen_twidsq_c

gen_r2hc_OBJECTS = gen_r2hc.cmo
gen_r2hc: libgenfft.cmxa $(gen_r2hc_OBJECTS:.cmo=.cmx)
gen_r2cf_OBJECTS = gen_r2cf.cmo
gen_r2cf: libgenfft.cmxa $(gen_r2cf_OBJECTS:.cmo=.cmx)
$(OCAMLOPTLINK)
maintainer-clean-local::
rm -f gen_r2hc
rm -f gen_r2cf

gen_hc2r_OBJECTS = gen_hc2r.cmo
gen_hc2r: libgenfft.cmxa $(gen_hc2r_OBJECTS:.cmo=.cmx)
gen_r2cb_OBJECTS = gen_r2cb.cmo
gen_r2cb: libgenfft.cmxa $(gen_r2cb_OBJECTS:.cmo=.cmx)
$(OCAMLOPTLINK)
maintainer-clean-local::
rm -f gen_hc2r
rm -f gen_r2cb

gen_hc2hc_OBJECTS = gen_hc2hc.cmo
gen_hc2hc: libgenfft.cmxa $(gen_hc2hc_OBJECTS:.cmo=.cmx)
Expand Down
109 changes: 51 additions & 58 deletions genfft/gen_hc2r.ml → genfft/gen_r2cb.ml
Original file line number Diff line number Diff line change
Expand Up @@ -26,32 +26,32 @@ open C

let usage = "Usage: " ^ Sys.argv.(0) ^ " -n <number>"

let uristride = ref Stride_variable
let uiistride = ref Stride_variable
let uostride = ref Stride_variable
let uivstride = ref Stride_variable
let uovstride = ref Stride_variable
let urs = ref Stride_variable
let ucsr = ref Stride_variable
let ucsi = ref Stride_variable
let uivs = ref Stride_variable
let uovs = ref Stride_variable
let dftIII_flag = ref false

let speclist = [
"-with-ristride",
Arg.String(fun x -> uristride := arg_to_stride x),
" specialize for given real input stride";
"-with-rs",
Arg.String(fun x -> urs := arg_to_stride x),
" specialize for given real-array stride";

"-with-iistride",
Arg.String(fun x -> uiistride := arg_to_stride x),
" specialize for given imaginary input stride";
"-with-csr",
Arg.String(fun x -> ucsr := arg_to_stride x),
" specialize for given complex-array real stride";

"-with-ostride",
Arg.String(fun x -> uostride := arg_to_stride x),
" specialize for given output stride";
"-with-csi",
Arg.String(fun x -> ucsi := arg_to_stride x),
" specialize for given complex-array imaginary stride";

"-with-ivstride",
Arg.String(fun x -> uivstride := arg_to_stride x),
"-with-ivs",
Arg.String(fun x -> uivs := arg_to_stride x),
" specialize for given input vector stride";

"-with-ovstride",
Arg.String(fun x -> uovstride := arg_to_stride x),
"-with-ovs",
Arg.String(fun x -> uovs := arg_to_stride x),
" specialize for given output vector stride";

"-dft-III",
Expand All @@ -73,46 +73,39 @@ let hcdftIII sign n input =
in Fft.dft sign (2 * n) input'

let generate n =
let riarray = "Ir"
and iiarray = "Ii"
and oarraye = "O0"
and oarrayo = "O1"
and ristride = "ris"
and iistride = "iis"
and ostride = "os"
and i = "i"
and v = "v"
and (transform, kind) =
if !dftIII_flag then(hcdftIII, "hc2rIII") else (Trig.hdft, "hc2r")
let ar0 = "R0" and ar1 = "R1" and acr = "Cr" and aci = "Ci"
and rs = "rs" and csr = "csr" and csi = "csi"
and i = "i" and v = "v"
and transform = if !dftIII_flag then hcdftIII else Trig.hdft
in

let sign = !Genutil.sign
and name = !Magic.codelet_name in

let vristride = either_stride (!uristride) (C.SVar ristride)
and viistride = either_stride (!uiistride) (C.SVar iistride)
and vostride = either_stride (!uostride) (C.SVar ostride)
let vrs = either_stride (!urs) (C.SVar rs)
and vcsr = either_stride (!ucsr) (C.SVar csr)
and vcsi = either_stride (!ucsi) (C.SVar csi)
in

let _ = Simd.ovs := stride_to_string "ovs" !uovstride in
let _ = Simd.ivs := stride_to_string "ivs" !uivstride in
let _ = Simd.ovs := stride_to_string "ovs" !uovs in
let _ = Simd.ivs := stride_to_string "ivs" !uivs in

let locations = unique_array_c n in
let input =
locative_array_c n
(C.array_subscript riarray vristride)
(C.array_subscript iiarray viistride)
(C.array_subscript acr vcsr)
(C.array_subscript aci vcsi)
locations in
let output = transform sign n (load_array_hc n input) in
let oloce =
locative_array_c n
(C.array_subscript oarraye vostride)
(C.array_subscript "BUG" vostride)
(C.array_subscript ar0 vrs)
(C.array_subscript "BUG" vrs)
locations
and oloco =
locative_array_c n
(C.array_subscript oarrayo vostride)
(C.array_subscript "BUG" vostride)
(C.array_subscript ar1 vrs)
(C.array_subscript "BUG" vrs)
locations in
let oloc i = if i mod 2 == 0 then oloce (i/2) else oloco ((i-1)/2) in
let odag = store_array_r n oloc output in
Expand All @@ -124,44 +117,44 @@ let generate n =
Binop (" > ", CVar i, Integer 0),
list_to_comma
[Expr_assign (CVar i, CPlus [CVar i; CUminus (Integer 1)]);
Expr_assign (CVar riarray, CPlus [CVar riarray; CVar !Simd.ivs]);
Expr_assign (CVar iiarray, CPlus [CVar iiarray; CVar !Simd.ivs]);
Expr_assign (CVar oarraye, CPlus [CVar oarraye; CVar !Simd.ovs]);
Expr_assign (CVar oarrayo, CPlus [CVar oarrayo; CVar !Simd.ovs]);
make_volatile_stride (CVar ristride);
make_volatile_stride (CVar iistride);
make_volatile_stride (CVar ostride)
Expr_assign (CVar ar0, CPlus [CVar ar0; CVar !Simd.ovs]);
Expr_assign (CVar ar1, CPlus [CVar ar1; CVar !Simd.ovs]);
Expr_assign (CVar acr, CPlus [CVar acr; CVar !Simd.ivs]);
Expr_assign (CVar aci, CPlus [CVar aci; CVar !Simd.ivs]);
make_volatile_stride (CVar rs);
make_volatile_stride (CVar csr);
make_volatile_stride (CVar csi)
],
Asch annot)
])
in

let tree =
Fcn ((if !Magic.standalone then "void" else "static void"), name,
([Decl (C.constrealtypep, riarray);
Decl (C.constrealtypep, iiarray);
Decl (C.realtypep, oarraye);
Decl (C.realtypep, oarrayo);
Decl (C.stridetype, ristride);
Decl (C.stridetype, iistride);
Decl (C.stridetype, ostride);
([Decl (C.realtypep, ar0);
Decl (C.realtypep, ar1);
Decl (C.realtypep, acr);
Decl (C.realtypep, aci);
Decl (C.stridetype, rs);
Decl (C.stridetype, csr);
Decl (C.stridetype, csi);
Decl ("INT", v);
Decl ("INT", "ivs");
Decl ("INT", "ovs")]),
add_constants body)

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

and init =
(declare_register_fcn name) ^
"{" ^
" X(k" ^ kind ^ "_register)(p, " ^ name ^ ", &desc);\n" ^
" X(kr2c_register)(p, " ^ name ^ ", &desc);\n" ^
"}\n"

in
Expand Down
Loading

0 comments on commit 8e69f06

Please sign in to comment.