-
Notifications
You must be signed in to change notification settings - Fork 364
feat: support tiling optimization as of TRT 10.8 #3444
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -329,6 +329,32 @@ def _populate_trt_builder_config( | |
if self.compilation_settings.enable_weight_streaming: | ||
builder_config.set_flag(trt.BuilderFlag.WEIGHT_STREAMING) | ||
|
||
if version.parse(trt.__version__) >= version.parse("10.8"): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can just drop 10.7 instead having this piecemeal support There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like we do it for some settings but not others, so we need to decide if we want versioned builder config or not There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. my default stance is no but if its not too much work (outside of 2.7 scope) then we might want to in which case this can stay |
||
if self.compilation_settings.tiling_optimization_level == 0: | ||
builder_config.tiling_optimization_level = ( | ||
trt.TilingOptimizationLevel.NONE | ||
) | ||
elif self.compilation_settings.tiling_optimization_level == 1: | ||
builder_config.tiling_optimization_level = ( | ||
trt.TilingOptimizationLevel.FAST | ||
) | ||
elif self.compilation_settings.tiling_optimization_level == 2: | ||
builder_config.tiling_optimization_level = ( | ||
trt.TilingOptimizationLevel.MODERATE | ||
) | ||
elif self.compilation_settings.tiling_optimization_level == 3: | ||
builder_config.tiling_optimization_level = ( | ||
trt.TilingOptimizationLevel.FULL | ||
) | ||
else: | ||
raise ValueError( | ||
f"Invalid tiling optimization level: {self.compilation_settings.tiling_optimization_level}. A valid value should be in [0, 1, 2, 3]." | ||
) | ||
zewenli98 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
builder_config.l2_limit_for_tiling = ( | ||
self.compilation_settings.l2_limit_for_tiling | ||
) | ||
Comment on lines
+347
to
+349
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if you want to be really safe (when we remove version guarding), you can check if self.compilation_settings.get("l2_limit_for_tiling", -1) != -1 or something. |
||
|
||
return builder_config | ||
|
||
def _create_timing_cache( | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's your opinion on exposing this as string ? https://docs.nvidia.com/deeplearning/tensorrt/api/python_api/infer/Core/BuilderConfig.html#tensorrt.TilingOptimizationLevel instead of integers ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah using the names is a good idea