@@ -143,11 +143,6 @@ partitioning::GraphAndMapping BuildHybridGraph(
143
143
auto convert_info = cfg.convert_info ;
144
144
auto partitioning_info = cfg.partitioning_info ;
145
145
146
- // Any nonzero block size is valid if full compilation to TRT is desired
147
- if (expect_full_compilation) {
148
- partitioning_info.min_block_size = 1 ;
149
- }
150
-
151
146
auto partitioning_ctx = partitioning::PartitioningCtx (block, partitioning_info);
152
147
partitioning_ctx.input_types_map = first_use_types;
153
148
@@ -197,9 +192,10 @@ partitioning::GraphAndMapping BuildHybridGraph(
197
192
if (expect_full_compilation) {
198
193
for (auto torch_node : seg_block.block ()->nodes ()) {
199
194
if (partitioning::CollectionNodeKinds.find (torch_node->kind ()) == partitioning::CollectionNodeKinds.end ()) {
200
- LOG_ERROR (
195
+ TORCHTRT_THROW_ERROR (
201
196
" Full compilation specified but node " << torch_node->kind ().toQualString ()
202
- << " was executed in Torch." );
197
+ << " was executed in Torch."
198
+ << " Try recompiling with require_full_compilation=False." );
203
199
}
204
200
}
205
201
}
@@ -209,10 +205,11 @@ partitioning::GraphAndMapping BuildHybridGraph(
209
205
// If full compilation is expected, cannot have more than 2 Torch segments
210
206
// (one for preprocessing inputs, one for post-processing outputs) and 1 TRT segment
211
207
if (expect_full_compilation && !(num_torch_segments <= 2 && num_trt_segments == 1 )) {
212
- LOG_ERROR (
208
+ TORCHTRT_THROW_ERROR (
213
209
" Full compilation specified but number of torch segments was "
214
210
<< num_torch_segments << " and number of trt segments was " << num_trt_segments
215
- << " . Was expecting at most 2 Torch segments and 1 TRT segment." );
211
+ << " . Was expecting at most 2 Torch segments and 1 TRT segment."
212
+ << " Try recompiling with require_full_compilation=False." );
216
213
}
217
214
}
218
215
@@ -384,6 +381,14 @@ torch::jit::Module CompileGraph(const torch::jit::Module& mod, CompileSpec cfg)
384
381
// If the model is fully-compilable and the user has specified full compilation, run partitioning
385
382
// to generate collection-processing code in Torch
386
383
auto expect_full_compilation = (nearly_full_compilation && !cfg.partitioning_info .enabled );
384
+
385
+ // Any nonzero block size is valid if full compilation to TRT is desired
386
+ // Override the default min_block_size to ensure all TRT-supported operations are
387
+ // executed in TRT, regardless of the size of the graph
388
+ if (expect_full_compilation) {
389
+ cfg.partitioning_info .min_block_size = 1 ;
390
+ }
391
+
387
392
auto graph_and_mapping =
388
393
BuildHybridGraph (new_mod, g->block (), cfg, static_params, first_use_types, expect_full_compilation);
389
394
new_g = graph_and_mapping.first ;
0 commit comments