@@ -82,33 +82,40 @@ public OwnedIterator make_one_shot_iterator()
8282 public IDatasetV2 flat_map ( Func < Tensor , IDatasetV2 > map_func )
8383 => new FlatMapDataset ( this , map_func ) ;
8484
85- public IDatasetV2 model ( AutotuneAlgorithm algorithm , long cpu_budget )
86- => new ModelDataset ( this , algorithm , cpu_budget ) ;
85+ public IDatasetV2 model ( AutotuneAlgorithm algorithm , long cpu_budget , long ram_budget )
86+ => new ModelDataset ( this , algorithm , cpu_budget , ram_budget ) ;
8787
8888 public IDatasetV2 with_options ( DatasetOptions options )
8989 => new OptionsDataset ( this , options ) ;
9090
9191 public IDatasetV2 apply_options ( )
9292 {
93+ IDatasetV2 dataset = this ;
9394 // (1) Apply threading options
95+
96+ // (2) Apply autotune options
97+ var autotune = true ;
98+ long cpu_budget = 0 ;
99+ long ram_budget = 0 ;
100+ if ( autotune )
101+ dataset = dataset . model ( AutotuneAlgorithm . HILL_CLIMB , cpu_budget , ram_budget ) ;
102+
103+ // (3) Apply graph rewrite options
94104 var graph_rewrites = new [ ]
95105 {
96- "map_and_batch_fusion" ,
97106 "noop_elimination" ,
107+ "map_and_batch_fusion" ,
98108 "shuffle_and_repeat_fusion"
99109 } ;
110+ var graph_rewrite_configs = new string [ ]
111+ {
112+ "autotune_buffer_sizes:autotune:true" ,
113+ "disable_prefetch_legacy_autotune:autotune:true" ,
114+ "enable_gradient_descent:autotune:true" ,
115+ "map_parallelization:autotune:true"
116+ } ;
100117
101- var graph_rewrite_configs = new string [ 0 ] ;
102-
103- // (2) Apply graph rewrite options
104- var dataset = optimize ( graph_rewrites , graph_rewrite_configs ) ;
105-
106- // (3) Apply autotune options
107- var autotune = true ;
108- long cpu_budget = 0 ;
109-
110- if ( autotune )
111- dataset = dataset . model ( AutotuneAlgorithm . HILL_CLIMB , cpu_budget ) ;
118+ dataset = new OptimizeDataset ( dataset , new string [ 0 ] , new string [ 0 ] , graph_rewrites , graph_rewrite_configs ) ;
112119
113120 // (4) Apply stats aggregator options
114121
0 commit comments