Repository: pytorch
Issue: Incorrect hint calculated for expression involving unbacked SymInt
Labels: triaged,oncall: pt2,module: dynamic shapes

### 🐛 Describe the bug

Internal xref: https://fb.workplace.com/groups/6829516587176185/permalink/7507212116073292/

As a performance optimization, we maintain a hint on SymNode and use it preferentially in evaluate_expr rather than recomputing a hint from scratch from the expression every time we need it. In some cases, we do end up computing a hint like quantity (e.g., via maybe_evaluate_static); when we do this, we assert that the computed value is equal to hint, and assert fail if it is not.

In https://fb.workplace.com/groups/6829516587176185/posts/7501336323327538/ we observe that we nondeterministically fail with

```
    File "/data/users/ezyang/fbsource/buck-out/v2/gen/fbcode/17f95ac06b22dbae/aps_models/ads/icvr/__icvr_launcher_live__/icvr_launcher_live#link-tree/torch/_meta_registrations.py", line 3698, in meta_alias
      return self.view(self.shape) 
    File "/data/users/ezyang/fbsource/buck-out/v2/gen/fbcode/17f95ac06b22dbae/aps_models/ads/icvr/__icvr_launcher_live__/icvr_launcher_live#link-tree/torch/_refs/__init__.py", line 4587, in view
      return _reshape_view_helper(a, *shape, allow_copy=False)
    File "/data/users/ezyang/fbsource/buck-out/v2/gen/fbcode/17f95ac06b22dbae/aps_models/ads/icvr/__icvr_launcher_live__/icvr_launcher_live#link-tree/torch/_refs/__init__.py", line 3675, in _reshape_view_helper
      if a.is_contiguous():
    File "/data/users/ezyang/fbsource/buck-out/v2/gen/fbcode/17f95ac06b22dbae/aps_models/ads/icvr/__icvr_launcher_live__/icvr_launcher_live#link-tree/torch/fx/experimental/sym_node.py", line 460, in guard_size_oblivious
      r = self.shape_env.evaluate_expr(
    File "/data/users/ezyang/fbsource/buck-out/v2/gen/fbcode/17f95ac06b22dbae/aps_models/ads/icvr/__icvr_launcher_live__/icvr_launcher_live#link-tree/torch/fx/experimental/recording.py", line 245, in wrapper
      return fn(*args, **kwargs)
    File "/data/users/ezyang/fbsource/buck-out/v2/gen/fbcode/17f95ac06b22dbae/aps_models/ads/icvr/__icvr_launcher_live__/icvr_launcher_live#link-tree/torch/fx/experimental/symbolic_shapes.py", line 5136, in evaluate_expr
      return self._evaluate_expr(orig_expr, hint, fx_node, expect_rational, size_oblivious, forcing_spec=forcing_spec)
    File "/data/users/ezyang/fbsource/buck-out/v2/gen/fbcode/17f95ac06b22dbae/aps_models/ads/icvr/__icvr_launcher_live__/icvr_launcher_live#link-tree/torch/fx/experimental/symbolic_shapes.py", line 5218, in _evaluate_expr
      assert static_expr == hint, f"{static_expr} != {hint}"
  torch._dynamo.exc.BackendCompilerFailed: backend='inductor' raised: 
  AssertionError: True != False
```

I haven't been able to identify why this is nondeterministically failing (TORCH_LOGS=+dynamic,sym_node do not diverge, until the failure point). However, inspection of logs during failure suggest a conceptually mistake in the code that we can fix even without a repro.

In some situations, an expression with unbacked SymInts can have a hint associated with it. In this particular case, we have:

```
evaluate_expr(Ne(u15, 1), hint=False, expect_rational=True, size_oblivious=True, forcing_spec=False
```

For some reason, we think that u15 != 1 should be False. Logs seem insufficient to diagnose further.

### Versions

main

cc @anijain2305 @chauhang @penguinwu