@@ -143,11 +143,6 @@ partitioning::GraphAndMapping BuildHybridGraph(
143143 auto convert_info = cfg.convert_info ;
144144 auto partitioning_info = cfg.partitioning_info ;
145145
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-
151146 auto partitioning_ctx = partitioning::PartitioningCtx (block, partitioning_info);
152147 partitioning_ctx.input_types_map = first_use_types;
153148
@@ -197,9 +192,10 @@ partitioning::GraphAndMapping BuildHybridGraph(
197192 if (expect_full_compilation) {
198193 for (auto torch_node : seg_block.block ()->nodes ()) {
199194 if (partitioning::CollectionNodeKinds.find (torch_node->kind ()) == partitioning::CollectionNodeKinds.end ()) {
200- LOG_ERROR (
195+ TORCHTRT_THROW_ERROR (
201196 " 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." );
203199 }
204200 }
205201 }
@@ -209,10 +205,11 @@ partitioning::GraphAndMapping BuildHybridGraph(
209205 // If full compilation is expected, cannot have more than 2 Torch segments
210206 // (one for preprocessing inputs, one for post-processing outputs) and 1 TRT segment
211207 if (expect_full_compilation && !(num_torch_segments <= 2 && num_trt_segments == 1 )) {
212- LOG_ERROR (
208+ TORCHTRT_THROW_ERROR (
213209 " Full compilation specified but number of torch segments was "
214210 << 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." );
216213 }
217214 }
218215
@@ -384,6 +381,14 @@ torch::jit::Module CompileGraph(const torch::jit::Module& mod, CompileSpec cfg)
384381 // If the model is fully-compilable and the user has specified full compilation, run partitioning
385382 // to generate collection-processing code in Torch
386383 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+
387392 auto graph_and_mapping =
388393 BuildHybridGraph (new_mod, g->block (), cfg, static_params, first_use_types, expect_full_compilation);
389394 new_g = graph_and_mapping.first ;
0 commit comments