Changeset 8976

Show
Ignore:
Timestamp:
07/22/08 11:29:13
Author:
eb
Message:

This changeset adds the framework for altivec, and implements
gr_fir_fff_altivec using it. This gives a speedup of between 1.8 and
3.0 depending on the type of machine it's running on. There's
probably another factor of 1.25 - 1.50 that can be obtained by
recoding dotprod_fff_altivec.c directly in assembler. The compiler is
generating about 20% more instructions in the inner loop than is
necessary. Also, it may be possible to improve dispatch by hand-
scheduling the assembly.

Merged eb/vmx 8953:8975 into features/mp-sched.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • gnuradio/branches/features/mp-sched/config/gr_set_md_cpu.m4

    r6044 r8976  
    11dnl 
    2 dnl Copyright 2003 Free Software Foundation, Inc. 
     2dnl Copyright 2003,2008 Free Software Foundation, Inc. 
    33dnl  
    44dnl This file is part of GNU Radio 
     
    2929  AC_MSG_CHECKING([for machine dependent speedups]) 
    3030  case "$cf_with_md_cpu" in 
    31    x86 | i[[3-7]]86)    MD_CPU=x86      MD_SUBCPU=x86  ;; 
    32    x86_64)              MD_CPU=x86      MD_SUBCPU=x86_64       ;; 
    33 #  sparc)       MD_CPU=sparc    ;; 
    34    *)           MD_CPU=generic  ;; 
     31   x86 | i[[3-7]]86)    MD_CPU=x86      MD_SUBCPU=x86 ;; 
     32   x86_64)              MD_CPU=x86      MD_SUBCPU=x86_64 ;; 
     33   powerpc*)            MD_CPU=powerpc ;; 
     34   *)                  MD_CPU=generic ;; 
    3535  esac 
    3636  AC_MSG_RESULT($MD_CPU) 
     
    4040  AM_CONDITIONAL(MD_CPU_x86,     test "$MD_CPU" = "x86") 
    4141  AM_CONDITIONAL(MD_SUBCPU_x86_64,  test "$MD_SUBCPU" = "x86_64") 
     42  AM_CONDITIONAL(MD_CPU_powerpc, test "$MD_CPU" = "powerpc") 
    4243  AM_CONDITIONAL(MD_CPU_generic, test "$MD_CPU" = "generic") 
    4344]) 
  • gnuradio/branches/features/mp-sched/gnuradio-core/src/lib/filter/Makefile.am

    r8057 r8976  
    118118        sysconfig_x86.cc                \ 
    119119        gr_fir_sysconfig_x86.cc         \ 
    120         gr_cpu.cc                     \ 
     120        gr_cpu_x86.cc                 \ 
    121121        gr_fir_ccc_simd.cc              \ 
    122122        gr_fir_ccc_x86.cc               \ 
     
    167167        qa_ccomplex_dotprod_x86.cc       
    168168 
     169powerpc_CODE = \ 
     170        sysconfig_powerpc.cc \ 
     171        gr_fir_sysconfig_powerpc.cc \ 
     172        gr_cpu_powerpc.cc \ 
     173        gr_fir_fff_altivec.cc \ 
     174        gr_altivec.c \ 
     175        dotprod_fff_altivec.c 
     176 
     177powerpc_qa_CODE = \ 
     178        qa_dotprod_powerpc.cc 
     179 
     180 
    169181# 
    170182# include each <foo>_CODE entry here... 
     
    176188        $(x86_SUBCODE)                  \ 
    177189        $(x86_64_SUBCODE)               \ 
    178         $(x86_qa_CODE) 
     190        $(x86_qa_CODE)                  \ 
     191        $(powerpc_CODE)                 \ 
     192        $(powerpc_qa_CODE) 
    179193 
    180194 
     
    235249endif 
    236250 
     251if MD_CPU_powerpc 
     252libfilter_la_SOURCES = $(libfilter_la_common_SOURCES) $(powerpc_CODE) 
     253libfilter_qa_la_SOURCES = $(libfilter_qa_la_common_SOURCES) $(powerpc_qa_CODE) 
     254endif 
     255 
    237256 
    238257grinclude_HEADERS =                     \ 
     
    246265        float_dotprod_x86.h             \ 
    247266        gr_adaptive_fir_ccf.h           \ 
     267        gr_altivec.h                    \ 
    248268        gr_cma_equalizer_cc.h           \ 
    249269        gr_cpu.h                        \ 
     
    273293noinst_HEADERS =                        \ 
    274294        assembly.h                      \ 
     295        dotprod_fff_altivec.h           \ 
    275296        gr_fir_scc_simd.h               \ 
    276297        gr_fir_scc_x86.h                \ 
     
    281302        gr_fir_ccc_simd.h               \ 
    282303        gr_fir_ccc_x86.h                \ 
     304        gr_fir_fff_altivec.h            \ 
    283305        gr_fir_fff_simd.h               \ 
    284306        gr_fir_fff_x86.h                \ 
  • gnuradio/branches/features/mp-sched/gnuradio-core/src/lib/filter/gr_cpu.h

    r6044 r8976  
    11/* -*- c++ -*- */ 
    22/* 
    3  * Copyright 2002 Free Software Foundation, Inc. 
     3 * Copyright 2002,2008 Free Software Foundation, Inc. 
    44 *  
    55 * This file is part of GNU Radio 
     
    3030  static bool has_3dnow (); 
    3131  static bool has_3dnowext (); 
     32  static bool has_altivec (); 
    3233}; 
    3334 
  • gnuradio/branches/features/mp-sched/gnuradio-core/src/lib/filter/qa_filter.cc

    r6575 r8976  
    4343 
    4444  s->addTest (qa_dotprod_suite ()); 
    45   s->addTest (qa_gri_mmse_fir_interpolator::suite ()); 
    46   s->addTest (qa_gri_mmse_fir_interpolator_cc::suite ()); 
    4745  s->addTest (qa_gr_fir_fff::suite ()); 
    4846  s->addTest (qa_gr_fir_ccc::suite ()); 
     
    5048  s->addTest (qa_gr_fir_scc::suite ()); 
    5149  s->addTest (qa_gr_fir_ccf::suite ()); 
     50  s->addTest (qa_gri_mmse_fir_interpolator::suite ()); 
     51  s->addTest (qa_gri_mmse_fir_interpolator_cc::suite ()); 
    5252 
    5353  return s; 
  • gnuradio/branches/features/mp-sched/gnuradio-core/src/lib/filter/qa_gr_fir_fff.cc

    r8292 r8976  
    144144test_random_io (fir_maker_t maker)   
    145145{ 
    146   const int     MAX_TAPS        = 9
     146  const int     MAX_TAPS        = 32
    147147  const int     OUTPUT_LEN      = 17; 
    148148  const int     INPUT_LEN       = MAX_TAPS + OUTPUT_LEN; 
     
    188188      for (int o = 0; o < ol; o++){ 
    189189        CPPUNIT_ASSERT_DOUBLES_EQUAL (expected_output[o], actual_output[o], 
    190                             fabs (expected_output[o]) * 1e-4); 
     190                                     fabs (expected_output[o]) * 9e-3); 
    191191      } 
    192192 
  • gnuradio/branches/features/mp-sched/gnuradio-core/src/lib/general/gr_math.h

    r8244 r8976  
    175175} 
    176176 
     177/*! 
     178 * \param x any value 
     179 * \param pow2 must be a power of 2 
     180 * \returns \p x rounded down to a multiple of \p pow2. 
     181 */ 
     182static inline size_t 
     183gr_p2_round_down(size_t x, size_t pow2) 
     184{ 
     185  return x & -pow2; 
     186} 
     187 
     188/*! 
     189 * \param x any value 
     190 * \param pow2 must be a power of 2 
     191 * \returns \p x rounded up to a multiple of \p pow2. 
     192 */ 
     193static inline size_t 
     194gr_p2_round_up(size_t x, size_t pow2) 
     195{ 
     196  return gr_p2_round_down(x + pow2 - 1, pow2); 
     197} 
     198 
     199/*! 
     200 * \param x any value 
     201 * \param pow2 must be a power of 2 
     202 * \returns \p x modulo \p pow2. 
     203 */ 
     204static inline size_t 
     205gr_p2_modulo(size_t x, size_t pow2) 
     206{ 
     207  return x & (pow2 - 1); 
     208} 
     209 
     210/*! 
     211 * \param x any value 
     212 * \param pow2 must be a power of 2 
     213 * \returns \p pow2 - (\p x modulo \p pow2). 
     214 */ 
     215static inline size_t 
     216gr_p2_modulo_neg(size_t x, size_t pow2) 
     217{ 
     218  return pow2 - gr_p2_modulo(x, pow2); 
     219} 
     220 
    177221#endif /* _GR_MATH_H_ */