Skip to content

Commit

Permalink
export db links for user errors (#110555)
Browse files Browse the repository at this point in the history
Summary:
Ideally all `_dynamo.exc.UserError`s should have "case names", i.e., link to examples in `exportdb`.

This PR adds case names to several instances of `_dynamo.exc.UserError`. In particular, looking at coverage based on `UserErrorType`:
* `DYNAMIC_CONTROL_FLOW`, `ANTI_PATTERN`, and `STANDARD_LIBRARY` are fully covered.
* `CONSTRAINT_VIOLATION` and `DYNAMIC_DIM` have no coverage. We don't seem to have any dedicated examples of specifying dynamic shapes in `exportdb` (although they are used in some other examples without explanation, to avoid some specialization that would make such examples moot).
* `INVALID_INPUT` is only partly covered. Frankly this is tedious to cover via examples.

X-link: pytorch/pytorch#110555
Approved by: https://github.com/angelayi, https://github.com/ydwu4

Reviewed By: PaliC

Differential Revision: D49928518

Pulled By: avikchaudhuri

fbshipit-source-id: c42737c818923573e1de92d9451c3d9b116ff4e8
  • Loading branch information
avikchaudhuri authored and facebook-github-bot committed Oct 6, 2023
1 parent 0b5d5bb commit 0f37477
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions userbenchmark/dynamo/dynamobench/_dynamo/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1391,15 +1391,15 @@ def visit(n: torch.fx.Node):
cause, torch.fx.experimental.symbolic_shapes.GuardOnDataDependentSymNode
):
raise UserError(
UserErrorType.CONSTRAIN_VIOLATION,
UserErrorType.CONSTRAINT_VIOLATION,
"Tried to use data-dependent value in the subsequent computation. "
"This can happen when we encounter unbounded dynamic value that is unknown during tracing time."
"You will need to explicitly give hint to the compiler. Please take a look at "
"constrain_as_value OR constrain_as_size APIs",
case_name="constrain_as_size_example",
)
elif isinstance(cause, torch.utils._sympy.value_ranges.ValueRangeError):
raise UserError(UserErrorType.CONSTRAIN_VIOLATION, e.args[0]) from e
raise UserError(UserErrorType.CONSTRAINT_VIOLATION, e.args[0]) from e
raise TorchRuntimeError(str(e)).with_traceback(e.__traceback__) from None


Expand Down

0 comments on commit 0f37477

Please sign in to comment.