@@ -68,8 +68,8 @@ class IThreading {
68
68
virtual std::pair<float , float > get_PEtime () const { return {0 .0f , 0 .0f }; };
69
69
70
70
protected:
71
- int mThreadNum ;
72
- const bool isSupportPE;
71
+ int mThreadNum = 0 ;
72
+ const bool isSupportPE = false ;
73
73
};
74
74
75
75
#if BTLA_OPENMP
@@ -107,7 +107,14 @@ class OMPThreading : public IThreading {
107
107
class StdThreading : public IThreading {
108
108
public:
109
109
using Timer_T = utils::timer<utils::microseconds>;
110
- explicit StdThreading () : IThreading(true ) { cr = nullptr ; }
110
+ explicit StdThreading () : IThreading(true ) {
111
+ cr = nullptr ;
112
+ memset (func_, 0 , sizeof (func_));
113
+ memset (flag, 0 , sizeof (flag));
114
+ stop = true ;
115
+ time_per_p = -1 .f ;
116
+ time_per_e = -1 .f ;
117
+ }
111
118
112
119
void parallel_for (const thread_func& func) override {
113
120
time_per_p = 0 ;
@@ -117,7 +124,7 @@ class StdThreading : public IThreading {
117
124
running.store (mThreadNum - 1 );
118
125
for (int i = 0 ; i < 10 ; i++) flag[i].store (mThreadNum );
119
126
if (cr->mHybrid ) {
120
- int time_p = 0 , time_e = 0 ;
127
+ int64_t time_p = 0 , time_e = 0 ;
121
128
122
129
for (size_t i = 0 ; i < mThreadNum - 1 ; i++) func_[i] = &func;
123
130
thread_time[0 ] = 0 ;
@@ -135,8 +142,8 @@ class StdThreading : public IThreading {
135
142
time_e += thread_time[i];
136
143
else
137
144
time_p += thread_time[i];
138
- time_per_p = (time_p) / (1.0 * (mThreadNum - cr->E_core_num ));
139
- time_per_e = (time_e) / (1.0 * cr->E_core_num );
145
+ time_per_p = (time_p) / (1 .0f * (mThreadNum - cr->E_core_num ));
146
+ time_per_e = (time_e) / (1 .0f * cr->E_core_num );
140
147
// printf("%d %d %f %f\n", time_p, time_e, time_per_p, time_per_e);
141
148
} else {
142
149
for (size_t i = 0 ; i < mThreadNum - 1 ; i++) {
@@ -810,7 +817,7 @@ class SchedulerDispatcher<Scheduler2D> {
810
817
} // namespace gemm
811
818
812
819
template <class Parallel_T , class Launch_T >
813
- void GemmRun (Launch_T& launcher, const typename Launch_T::Param& args, parallel::IThreading* th) {
820
+ void GemmRun (const typename Launch_T::Param& args, parallel::IThreading* th) {
814
821
gemm::SchedulerDispatcher<Parallel_T> para (th, args.problem );
815
822
static bool flag = false ;
816
823
if (flag) {
@@ -822,16 +829,16 @@ void GemmRun(Launch_T& launcher, const typename Launch_T::Param& args, parallel:
822
829
typename Parallel_T::ThreadProblem thdp{tidx};
823
830
para.getIndex (thdp);
824
831
if (thdp.valid ) {
825
- launcher. run (args, thdp);
832
+ Launch_T:: run (args, thdp);
826
833
}
827
834
});
828
835
}
829
836
830
837
template <class Parallel_T , class Launch_T >
831
- void GemmRunWithA (Launch_T& launcher, const typename Launch_T::Param& args, parallel::IThreading* th) {
838
+ void GemmRunWithA (const typename Launch_T::Param& args, parallel::IThreading* th) {
832
839
gemm::SchedulerDispatcher<Parallel_T> para (th, args.problem );
833
840
using AParall = typename Launch_T::PrologueA::Parallel;
834
- AParall apara = launcher. mProA . createParallel (th->num_threads (), args.problem );
841
+ AParall apara = Launch_T::PrologueA:: createParallel (th->num_threads (), args.problem );
835
842
static bool flag = false ;
836
843
if (flag) {
837
844
printf (" %s\n " , __FUNCTION__);
@@ -842,13 +849,13 @@ void GemmRunWithA(Launch_T& launcher, const typename Launch_T::Param& args, para
842
849
typename AParall::ThreadProblem thdpA{tidx};
843
850
apara.getIndex (thdpA);
844
851
if (thdpA.valid ) {
845
- launcher. mProA . run (args.paramA , thdpA);
852
+ Launch_T::PrologueA:: run (args.paramA , thdpA);
846
853
}
847
854
th->sync (tidx);
848
855
typename Parallel_T::ThreadProblem thdp{tidx};
849
856
para.getIndex (thdp);
850
857
if (thdp.valid ) {
851
- launcher. run (args, thdp);
858
+ Launch_T:: run (args, thdp);
852
859
}
853
860
});
854
861
}
0 commit comments