Skip to content

Commit

Permalink
Allow bounds_check_mode to be set by environment variable (#3187)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #3187

X-link: facebookresearch/FBGEMM#282

This very simple diff allows TBE's bounds_check_mode to be overwritten by the environment variable `FBGEMM_TBE_BOUNDS_CHECK_MODE`. When set to `3`, this will disable bounds checking.

Reviewed By: renganxu, qchip

Differential Revision: D63549883

fbshipit-source-id: 4b5f3180e0e04acece9a4c36ba620da748f31107
  • Loading branch information
jwfromm authored and facebook-github-bot committed Sep 27, 2024
1 parent d056aa3 commit 5582d23
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,10 @@ def __init__( # noqa C901
self.uuid = str(uuid.uuid4())
self.logging_table_name: str = self.get_table_name_for_logging(table_names)
self.pooling_mode = pooling_mode
self.bounds_check_mode_int: int = bounds_check_mode.value
# If environment variable is set, it overwrites the default bounds check mode.
self.bounds_check_mode_int: int = int(
os.environ.get("FBGEMM_TBE_BOUNDS_CHECK_MODE", bounds_check_mode.value)
)
self.weights_precision = weights_precision
self.output_dtype: int = output_dtype.as_int()
assert (
Expand Down

0 comments on commit 5582d23

Please sign in to comment.