@@ -32,7 +32,7 @@ struct Max {
32
32
Func minOp (" min" , Min());
33
33
Func maxOp (" max" , Max());
34
34
35
- IndexExpr genMinMaxExpr (Tensor<float >& game, std::vector<IndexVar>& indexVars, int index) {
35
+ IndexExpr genMinMaxExpr (Tensor<double >& game, std::vector<IndexVar>& indexVars, int index) {
36
36
Func op = (index % 2 == 0 ) ? maxOp : minOp;
37
37
if (index == (game.getOrder () - 1 )) {
38
38
std::vector<IndexVar> slice;
@@ -45,10 +45,18 @@ IndexExpr genMinMaxExpr(Tensor<float>& game, std::vector<IndexVar>& indexVars, i
45
45
}
46
46
47
47
static void bench_minimax (benchmark::State& state) {
48
- int order = state.range (0 ) + 2 ;
48
+ auto order_str = getEnvVar (" MINMAX_ORDER" );
49
+ if (order_str == " " ) {
50
+ state.error_occurred ();
51
+ return ;
52
+ }
53
+ int order = std::stoi (order_str) + 2 ;
54
+
55
+ state.counters [" order" ] = order - 2 ;
56
+
49
57
std::vector<ModeFormatPack> modes (order, Sparse);
50
58
Format f (modes);
51
- taco::Tensor<int64_t > tensor = castToType< int64_t >( " A " , loadMinMaxTensor (" A" , order, f) );
59
+ taco::Tensor<double > game = loadMinMaxTensor (" A" , order, f);
52
60
53
61
// This benchmark needs this hack activated to generate correct code.
54
62
if (util::getFromEnv (" TACO_CONCRETIZE_HACK" , " 0" ) == " 0" ) {
@@ -71,18 +79,17 @@ static void bench_minimax(benchmark::State& state) {
71
79
IndexVar (" t" ),
72
80
};
73
81
74
- std::vector<int > dims = {20 , 20 , 43 , 43 , 43 , 43 , 43 , 43 , 43 };
82
+ std::vector<int > dims = {20 , 20 , 43 , 43 , 43 , 43 , 43 };
75
83
dims.resize (order);
76
84
// TODO (rohany, owhsu): We need to actually generate the input game state.
77
- Tensor<float > game (" game" , dims, Sparse);
78
85
for (auto _ : state) {
79
86
state.PauseTiming ();
80
87
Tensor<float > result (" C" );
81
88
result = genMinMaxExpr (game, ivars, 0 );
82
89
result.compile ();
83
- std::cout << result.getSource () << std::endl;
90
+ // std::cout << result.getSource() << std::endl;
84
91
state.ResumeTiming ();
85
92
result.compute ();
86
93
}
87
94
}
88
- TACO_BENCH (bench_minimax)->Arg( 1 )->Arg( 3 )->Arg( 5 )->Arg( 7 ) ;
95
+ TACO_BENCH (bench_minimax);
0 commit comments