Skip to content

Instantly share code, notes, and snippets.

@AmosLewis
Last active March 2, 2023 16:53
Show Gist options
  • Save AmosLewis/20895fa06e8b61ce83e9a2b9c2ee8ca6 to your computer and use it in GitHub Desktop.
Save AmosLewis/20895fa06e8b61ce83e9a2b9c2ee8ca6 to your computer and use it in GitHub Desktop.
module attributes {torch.debug_module_name = "_lambda"} {
func.func private @__torch__.torch.fx.graph_module._lambda.forward(%arg0: !torch.nn.Module<"__torch__.torch.fx.graph_module._lambda">, %arg1: !torch.tensor {torch.type_bound = !torch.vtensor<[1,15],si64>}, %arg2: !torch.tensor {torch.type_bound = !torch.vtensor<[1,4],si64>}) -> !torch.tensor {
%none_1 = torch.constant.none
%int-1 = torch.constant.int -1
%false = torch.constant.bool false
%cpu = torch.constant.device "cpu"
%int1 = torch.constant.int 1
%int4 = torch.constant.int 4
%int0 = torch.constant.int 0
%int-100 = torch.constant.int -100
%int9223372036854775807 = torch.constant.int 9223372036854775807
%133 = torch.prim.ListConstruct %int1, %int4 : (!torch.int, !torch.int) -> !torch.list<int>
%134 = torch.aten.new_zeros %arg2, %133, %int4, %int0, %cpu, %false : !torch.tensor, !torch.list<int>, !torch.int, !torch.int, !torch.Device, !torch.bool -> !torch.tensor
%135 = torch.aten.slice.Tensor %arg2, %int1, %int0, %int-1, %int1 : !torch.tensor, !torch.int, !torch.int, !torch.int, !torch.int -> !torch.tensor
%136 = torch.aten.clone %135, %none_1 : !torch.tensor, !torch.none -> !torch.tensor
%137 = torch.aten.slice.Tensor %134, %int1, %int1, %int9223372036854775807, %int1 : !torch.tensor, !torch.int, !torch.int, !torch.int, !torch.int -> !torch.tensor
%138 = torch.aten.copy_ %137, %136, %false : !torch.tensor, !torch.tensor, !torch.bool -> !torch.tensor
%141 = torch.aten.select.int %134, %int1, %int0 : !torch.tensor, !torch.int, !torch.int -> !torch.tensor
return %141 : !torch.tensor
}
torch.class_type @__torch__.torch.fx.graph_module._lambda {
torch.method "forward", @__torch__.torch.fx.graph_module._lambda.forward
}
%132 = torch.nn_module {
} : !torch.nn.Module<"__torch__.torch.fx.graph_module._lambda">
}
@AmosLewis
Copy link
Author

%5 = torch.copy.to_tensor %4 : !torch.tensor

//===-------------------------------------------===//
Processing operation : 'torch.copy.to_tensor'(0x55ea4a642550) {
  %13 = "torch.copy.to_tensor"(%12) : (!torch.vtensor) -> !torch.tensor


  * Pattern (anonymous namespace)::AbstractlyInterpretCopyToNonValueTensorOpUsersWithinABlock : 'torch.copy.to_tensor -> ()' {
Trying to match "(anonymous namespace)::AbstractlyInterpretCopyToNonValueTensorOpUsersWithinABlock"
mlir-asm-printer: Verifying operation: func.func
%5 = torch.copy.to_tensor %4 : !torch.tensor
 - Bf OverwriteTensorContentsOp: 
mlir-asm-printer: Verifying operation: func.func
torch.overwrite.tensor.contents %11 overwrites %9 : !torch.vtensor, !torch.tensor
 - Af OverwriteTensorContentsOp: 
    ** Failure : operand of op is not a valid tensor alias
"(anonymous namespace)::AbstractlyInterpretCopyToNonValueTensorOpUsersWithinABlock" result 0
  } -> failure : pattern failed to match

  * Pattern (anonymous namespace)::RewriteViewLikeSubgraph : 'torch.copy.to_tensor -> ()' {
Trying to match "(anonymous namespace)::RewriteViewLikeSubgraph"
    ** Failure : can only handle these transitive user ops
"(anonymous namespace)::RewriteViewLikeSubgraph" result 0
  } -> failure : pattern failed to match
} -> failure : pattern failed to match
//===-------------------------------------------===//

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment