Skip to content

Instantly share code, notes, and snippets.

@AmosLewis
Created February 2, 2025 19:19
Show Gist options
  • Save AmosLewis/d0f1dca5d3b39d804ebc406eb6851e4d to your computer and use it in GitHub Desktop.
Save AmosLewis/d0f1dca5d3b39d804ebc406eb6851e4d to your computer and use it in GitHub Desktop.
func.func @function(%arg2: !torch.vtensor<[1,?],si64>, %669:!torch.vtensor<[1,?],si64>, %667: !torch.vtensor<[?,32,8,128],f16>, %674:!torch.vtensor<[?,32,8,128],f8E4M3FNUZ>) -> !torch.vtensor<[?,32,8,128],f16> {
%false = torch.constant.bool false
%int1 = torch.constant.int 1
%670 = torch.aten.size.int %arg2, %int1 : !torch.vtensor<[1,?],si64>, !torch.int -> !torch.int
%675 = torch.prim.ListConstruct %670 : (!torch.int) -> !torch.list<int>
%676 = torch.aten.view %669, %675 : !torch.vtensor<[1,?],si64>, !torch.list<int> -> !torch.vtensor<[?],si64>
%677 = torch.prim.ListConstruct %676 : (!torch.vtensor<[?],si64>) -> !torch.list<optional<vtensor>>
%678 = torch.aten.index_put %667, %677, %674, %false : !torch.vtensor<[?,32,8,128],f16>, !torch.list<optional<vtensor>>, !torch.vtensor<[?,32,8,128],f8E4M3FNUZ>, !torch.bool -> !torch.vtensor<[?,32,8,128],f16>
return %678 : !torch.vtensor<[?,32,8,128],f16>
}
@AmosLewis
Copy link
Author

//===-------------------------------------------===//
Legalizing operation : 'torch.aten.index_put.hacked_twin'(0x5b3522baeef0) {
  %26 = "torch.aten.index_put.hacked_twin"(%arg2, %25, %arg3, %2) : (!torch.vtensor<[?,32,8,128],f16>, !torch.list<vtensor>, !torch.vtensor<[?,32,8,128],f8E4M3FNUZ>, !torch.bool) -> !torch.vtensor<[?,32,8,128],f16>

  * Fold {
  } -> FAILURE : unable to fold

  * Pattern : 'torch.aten.index_put.hacked_twin -> ()' {
Trying to match "(anonymous namespace)::ConvertAtenIndexPutHackedTwinOp"
    ** Failure : Input element type should be same as the values element type.
"(anonymous namespace)::ConvertAtenIndexPutHackedTwinOp" result 0
  } -> FAILURE : pattern failed to match
} -> FAILURE : no matched legalization pattern
//===-------------------------------------------===//
ImplicitTypeIDRegistry::lookupOrInsert(mlir::AttributeTrait::IsLocation<Empty>)
indexput.torch.mlir:8:10: error: failed to legalize operation 'torch.aten.index_put.hacked_twin' that was explicitly marked illegal
  %678 = torch.aten.index_put %667, %677, %674, %false : !torch.vtensor<[?,32,8,128],f16>, !torch.list<optional<vtensor>>, !torch.vtensor<[?,32,8,128],f8E4M3FNUZ>, !torch.bool -> !torch.vtensor<[?,32,8,128],f16>
         ^
indexput.torch.mlir:8:10: note: see current operation: %26 = "torch.aten.index_put.hacked_twin"(%arg2, %25, %arg3, %2) : (!torch.vtensor<[?,32,8,128],f16>, !torch.list<vtensor>, !torch.vtensor<[?,32,8,128],f8E4M3FNUZ>, !torch.bool) -> !torch.vtensor<[?,32,8,128],f16>

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