Skip to content

Commit 09af3b6

Browse files
Clarify min_val semantics for torch.symbolic_int op (#3959)
Addresses #3938 .
1 parent 4f9f82d commit 09af3b6

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

include/torch-mlir/Dialect/Torch/IR/TorchOps.td

+9
Original file line numberDiff line numberDiff line change
@@ -1361,6 +1361,15 @@ def Torch_SymbolicIntOp : Torch_Op<"symbolic_int", [Pure]> {
13611361
%0 = torch.symbolic_int "s0" {min_val = 5, max_val = 10} : !torch.int
13621362
%1 = torch.symbolic_int "s1" {min_val = 2, max_val = 20} : !torch.int
13631363
```
1364+
1365+
In this case, we see that `s0` has the range [5, 10] and `s1` has the
1366+
range [2, 20]. When unspecified, the range constraints feeding in from
1367+
TorchDynamo default to [0, INT_MAX] (or [2, INT_MAX] in older PyTorch
1368+
releases). In either case, the interpretation (as specified by TorchDynamo)
1369+
is that the dynamic dimension is assumed to be not 0 or 1. This is not a
1370+
bug, and does not necessarily mean that the exported program will not work
1371+
for dimensions 0 or 1. For an in-depth discussion of this topic, see
1372+
[The 0/1 Specialization Problem](https://docs.google.com/document/d/16VPOa3d-Liikf48teAOmxLc92rgvJdfosIy-yoT38Io/edit?fbclid=IwAR3HNwmmexcitV0pbZm_x1a4ykdXZ9th_eJWK-3hBtVgKnrkmemz6Pm5jRQ#heading=h.ez923tomjvyk).
13641373
}];
13651374
let arguments = (ins
13661375
StrAttr:$symbol_name,

0 commit comments

Comments
 (0)