Example #1
0
void gl_test_all_normal_transform_functions( char *description )
{
   int masked;
   int mtype;
   long benchmark_tab[0xf][0x4];
   static int first_time = 1;

   if ( first_time ) {
      first_time = 0;
      mesa_profile = getenv( "MESA_PROFILE" );
   }

#ifdef RUN_XFORM_BENCHMARK
   if ( mesa_profile ) {
      if ( need_counter ) {
	 need_counter = 0;
	 INIT_COUNTER();
	 printf( "counter overhead: %ld cycles\n\n", counter_overhead );
      }
      printf( "normal transform results after hooking in %s functions:\n",
	      description );
   }
#endif

   for ( masked = 0 ; masked <= 1 ; masked++ ) {
      int cma = masked ? CULL_MASK_ACTIVE : 0;
      char *cmastring = masked ? "CULL_MASK_ACTIVE" : "0";

#ifdef RUN_XFORM_BENCHMARK
      if ( mesa_profile ) {
         printf( "\n culling: %s \n", masked ? "CULL_MASK_ACTIVE" : "0" );
         printf( "\n-------------------------------------------------------\n" );
      }
#endif

      for ( mtype = 0 ; mtype < 8 ; mtype++ ) {
         normal_func func = gl_normal_tab[norm_types[mtype]][cma];
         long *cycles = &(benchmark_tab[mtype][cma]);

         if ( test_norm_function( func, mtype, masked, cycles ) == 0 ) {
            char buf[100];
            sprintf( buf, "gl_normal_tab[%s][%s] failed test (%s)",
                     cmastring, norm_strings[mtype], description );
            gl_problem( NULL, buf );
	 }

#ifdef RUN_XFORM_BENCHMARK
         if ( mesa_profile ) {
            printf( " %li\t", benchmark_tab[mtype][cma] );
            printf( " | [%s]\n", norm_strings[mtype] );
         }
      }
      if ( mesa_profile )
	 printf( "\n" );
#else
      }
#endif
   }
Example #2
0
void _math_test_all_cliptest_functions( char *description )
{
   int np, psize;
   long benchmark_tab[2][4];
   static int first_time = 1;

   if ( first_time ) {
      first_time = 0;
      mesa_profile = _mesa_getenv( "MESA_PROFILE" );
   }

#ifdef RUN_DEBUG_BENCHMARK
   if ( mesa_profile ) {
      if ( !counter_overhead ) {
	 INIT_COUNTER();
	 printf( "counter overhead: %ld cycles\n\n", counter_overhead );
      }
      printf( "cliptest results after hooking in %s functions:\n", description );
   }
#endif

#ifdef RUN_DEBUG_BENCHMARK
   if ( mesa_profile ) {
      printf( "\n\t" );
      for ( psize = 2 ; psize <= 4 ; psize++ ) {
	 printf( " p%d\t", psize );
      }
      printf( "\n--------------------------------------------------------\n\t" );
   }
#endif

   for ( np = 0 ; np < 2 ; np++ ) {
      for ( psize = 2 ; psize <= 4 ; psize++ ) {
	 clip_func func = clip_tab[np][psize];
	 long *cycles = &(benchmark_tab[np][psize-1]);

	 if ( test_cliptest_function( func, np, psize, cycles ) == 0 ) {
	    char buf[100];
	    sprintf( buf, "%s[%d] failed test (%s)",
		     cnames[np], psize, description );
	    _mesa_problem( NULL, "%s", buf );
	 }
#ifdef RUN_DEBUG_BENCHMARK
	 if ( mesa_profile )
	    printf( " %li\t", benchmark_tab[np][psize-1] );
#endif
      }
#ifdef RUN_DEBUG_BENCHMARK
      if ( mesa_profile )
	 printf( " | [%s]\n\t", cstrings[np] );
#endif
   }
#ifdef RUN_DEBUG_BENCHMARK
   if ( mesa_profile )
      printf( "\n" );
#endif
}
Example #3
0
void _math_test_all_transform_functions( char *description )
{
   int psize, mtype;
   unsigned long benchmark_tab[4][7];
   static int first_time = 1;

   if ( first_time ) {
      first_time = 0;
      mesa_profile = _mesa_getenv( "MESA_PROFILE" );
   }

#ifdef RUN_DEBUG_BENCHMARK
   if ( mesa_profile ) {
      if ( !counter_overhead ) {
	 INIT_COUNTER();
	 _mesa_printf("counter overhead: %lu cycles\n\n", counter_overhead );
      }
      _mesa_printf("transform results after hooking in %s functions:\n", description );
   }
#endif

#ifdef RUN_DEBUG_BENCHMARK
   if ( mesa_profile ) {
      _mesa_printf("\n" );
      for ( psize = 1 ; psize <= 4 ; psize++ ) {
	 _mesa_printf(" p%d\t", psize );
      }
      _mesa_printf("\n--------------------------------------------------------\n" );
   }
#endif

   for ( mtype = 0 ; mtype < 7 ; mtype++ ) {
      for ( psize = 1 ; psize <= 4 ; psize++ ) {
	 transform_func func = _mesa_transform_tab[psize][mtypes[mtype]];
	 unsigned long *cycles = &(benchmark_tab[psize-1][mtype]);

	 if ( test_transform_function( func, psize, mtype, cycles ) == 0 ) {
	    char buf[100];
	    _mesa_sprintf(buf, "_mesa_transform_tab[0][%d][%s] failed test (%s)",
		     psize, mstrings[mtype], description );
	    _mesa_problem( NULL, buf );
	 }
#ifdef RUN_DEBUG_BENCHMARK
	 if ( mesa_profile )
	    _mesa_printf(" %li\t", benchmark_tab[psize-1][mtype] );
#endif
      }
#ifdef RUN_DEBUG_BENCHMARK
      if ( mesa_profile )
	 _mesa_printf(" | [%s]\n", mstrings[mtype] );
#endif
   }
#ifdef RUN_DEBUG_BENCHMARK
   if ( mesa_profile )
      _mesa_printf( "\n" );
#endif
}
Example #4
0
int main() {
        DECLARE_COUNTER(counter);
        BEGINNING_OF_PROCESS;

        INIT_COUNTER(counter);

        while (!counterfinished) {
                step(counter);
                DEBUG_COUNTER(counter);
        }
        check(false);
        return 0;
}
Example #5
0
void _math_test_all_normal_transform_functions( char *description )
{
   int mtype;
   long benchmark_tab[0xf];
   static int first_time = 1;

   if ( first_time ) {
      first_time = 0;
      mesa_profile = _mesa_getenv( "MESA_PROFILE" );
   }

#ifdef RUN_DEBUG_BENCHMARK
   if ( mesa_profile ) {
      if ( !counter_overhead ) {
	 INIT_COUNTER();
	 printf( "counter overhead: %ld cycles\n\n", counter_overhead );
      }
      printf( "normal transform results after hooking in %s functions:\n",
	      description );
      printf( "\n-------------------------------------------------------\n" );
   }
#endif

   for ( mtype = 0 ; mtype < 8 ; mtype++ ) {
      normal_func func = _mesa_normal_tab[norm_types[mtype]];
      long *cycles = &benchmark_tab[mtype];

      if ( test_norm_function( func, mtype, cycles ) == 0 ) {
	 char buf[100];
	 sprintf( buf, "_mesa_normal_tab[0][%s] failed test (%s)",
		  norm_strings[mtype], description );
	 _mesa_problem( NULL, "%s", buf );
      }

#ifdef RUN_DEBUG_BENCHMARK
      if ( mesa_profile ) {
	 printf( " %li\t", benchmark_tab[mtype] );
	 printf( " | [%s]\n", norm_strings[mtype] );
      }
#endif
   }
#ifdef RUN_DEBUG_BENCHMARK
   if ( mesa_profile ) {
      printf( "\n" );
   }
#endif
}
Example #6
0
static void
iter_struct_store_struct(na_loop_t *const lp)
{
    size_t  i, s1, s2;
    char   *p1, *p2;
    size_t *idx1, *idx2;
    size_t  elmsz;
    char   *x, *y;

    INIT_COUNTER(lp, i);
    INIT_PTR_IDX(lp, 0, p1, s1, idx1);
    INIT_PTR_IDX(lp, 1, p2, s2, idx2);
    INIT_ELMSIZE(lp, 0, elmsz);
    if (idx2) {
        if (idx1) {
            for (; i--;) {
                x = (char*)(p1+*idx1); idx1++;
                y = (char*)(p2+*idx2); idx2++;
                memcpy(x,y,elmsz);
            }
        } else {
            for (; i--;) {
                x = (char*)p1;         p1+=s1;
                y = (char*)(p2+*idx2); idx2++;
                memcpy(x,y,elmsz);
            }
        }
    } else {
        if (idx1) {
            for (; i--;) {
                x = (char*)(p1+*idx1); idx1++;
                y = (char*)p2;         p2+=s2;
                memcpy(x,y,elmsz);
            }
        } else {
            for (; i--;) {
                x = (char*)p1;         p1+=s1;
                y = (char*)p2;         p2+=s2;
                memcpy(x,y,elmsz);
            }
        }
    }
}