// (c) 2008 Steven Gratton // Guided in part by samples from the AMD CAL SDK // and currently links with their Timer code #include #include #include #include #include #include "cal.h" #include "calcl.h" #include "bothstripedmmm.h" #include "Timer.h" #define PERFCOUNT #ifdef PERFCOUNT #include "cal_ext.h" #include "cal_ext_counter.h" #endif std::string ILcheck= "il_ps_2_0\n" "ret_dyn\n" "end\n"; std::string ILcheck2= "il_ps_2_0\n" "dcl_input_position_interp(linear_noperspective) vWinCoord0.xy\n" "dcl_resource_id(0)_type(2d,unnorm)_fmtx(float)_fmty(float)_fmtz(float)_fmtw(float)\n" "dcl_resource_id(1)_type(2d,unnorm)_fmtx(float)_fmty(float)_fmtz(float)_fmtw(float)\n" "dcl_cb cb0[1] ; k4max, pitch of mat2 as floats \n" "sample_resource(0)_sampler(0) r0, vWinCoord0.xy\n" "sample_resource(1)_sampler(0) r1, vWinCoord0.xy\n" "imad r2.x___,vWinCoord0.y,cb0[0].y,vWinCoord0.x \n" "mov g[0],vWinCoord0.xy11\n" "ret_dyn\n" "end\n"; static CPerfCounter timer; using namespace std; #ifdef PERFCOUNT static PFNCALCTXCREATECOUNTER calCtxCreateCounterExt; static PFNCALCTXDESTROYCOUNTER calCtxDestroyCounterExt; static PFNCALCTXBEGINCOUNTER calCtxBeginCounterExt; static PFNCALCTXENDCOUNTER calCtxEndCounterExt; static PFNCALCTXGETCOUNTER calCtxGetCounterExt; #endif void cpumatmult(int m,int k,int n,float* a,float* b,float* c) { printf("*on the cpu...*\n"); int i,j,p; float sum; volatile clock_t internalcpu; internalcpu=clock(); for (i=0;i