Skip to content

Commit

Permalink
[AutoBump] Merge with 09af3b6 (Jan 14)
Browse files Browse the repository at this point in the history
  • Loading branch information
mgehre-amd committed Feb 13, 2025
2 parents c654228 + 09af3b6 commit 54b73be
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
12 changes: 10 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ option(TORCH_MLIR_ENABLE_STABLEHLO "Add stablehlo dialect" ON)
if(TORCH_MLIR_ENABLE_STABLEHLO)
add_definitions(-DTORCH_MLIR_ENABLE_STABLEHLO)
endif()
# It is possible that both stablehlo and torch_mlir projects are used in some compiler project.
# In this case, we don't want to use stablehlo that is downloaded by torch_mlir (in external/stablehlo)
# folder but instead want to use stablehlo that is part of top level compiler project.
# With TORCH_MLIR_USE_EXTERNAL_STABLEHLO enables, it is assumed that top level compiler project makes
# stablehlo targets AND includes available (for example with `add_subdirectory` and `include_directories`).
option(TORCH_MLIR_USE_EXTERNAL_STABLEHLO "Use stablehlo from top level project" OFF)

option(TORCH_MLIR_OUT_OF_TREE_BUILD "Specifies an out of tree build" OFF)

Expand Down Expand Up @@ -142,7 +148,8 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR}/include)

function(torch_mlir_target_includes target)
set(_dirs
$<BUILD_INTERFACE:${MLIR_INCLUDE_DIRS}>
$<BUILD_INTERFACE:${MLIR_INCLUDE_DIR}>
$<BUILD_INTERFACE:${MLIR_GENERATED_INCLUDE_DIR}>
$<BUILD_INTERFACE:${TORCH_MLIR_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${TORCH_MLIR_BINARY_DIR}/include>
)
Expand Down Expand Up @@ -232,7 +239,8 @@ endif()
# Getting this wrong results in building large parts of the stablehlo
# project that we don't actually depend on. Further some of those parts
# do not even compile on all platforms.
if (TORCH_MLIR_ENABLE_STABLEHLO)
# Only configure StableHLO if it isn't provided from a top-level project
if (TORCH_MLIR_ENABLE_STABLEHLO AND NOT TORCH_MLIR_USE_EXTERNAL_STABLEHLO)
set(STABLEHLO_BUILD_EMBEDDED ON)
set(STABLEHLO_ENABLE_BINDINGS_PYTHON ON)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/externals/stablehlo
Expand Down
9 changes: 9 additions & 0 deletions include/torch-mlir/Dialect/Torch/IR/TorchOps.td
Original file line number Diff line number Diff line change
Expand Up @@ -1361,6 +1361,15 @@ def Torch_SymbolicIntOp : Torch_Op<"symbolic_int", [Pure]> {
%0 = torch.symbolic_int "s0" {min_val = 5, max_val = 10} : !torch.int
%1 = torch.symbolic_int "s1" {min_val = 2, max_val = 20} : !torch.int
```

In this case, we see that `s0` has the range [5, 10] and `s1` has the
range [2, 20]. When unspecified, the range constraints feeding in from
TorchDynamo default to [0, INT_MAX] (or [2, INT_MAX] in older PyTorch
releases). In either case, the interpretation (as specified by TorchDynamo)
is that the dynamic dimension is assumed to be not 0 or 1. This is not a
bug, and does not necessarily mean that the exported program will not work
for dimensions 0 or 1. For an in-depth discussion of this topic, see
[The 0/1 Specialization Problem](https://docs.google.com/document/d/16VPOa3d-Liikf48teAOmxLc92rgvJdfosIy-yoT38Io/edit?fbclid=IwAR3HNwmmexcitV0pbZm_x1a4ykdXZ9th_eJWK-3hBtVgKnrkmemz6Pm5jRQ#heading=h.ez923tomjvyk).
}];
let arguments = (ins
StrAttr:$symbol_name,
Expand Down

0 comments on commit 54b73be

Please sign in to comment.