Skip to content

Instantly share code, notes, and snippets.

@hanhanW
Created April 1, 2021 15:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hanhanW/8a4494f337629299959b6e7d59a882f5 to your computer and use it in GitHub Desktop.
Save hanhanW/8a4494f337629299959b6e7d59a882f5 to your computer and use it in GitHub Desktop.
Load new dialect in Context
Load new dialect in Context spv
Load new dialect in Context memref
Load new dialect in Context std
Load new dialect in Context tensor
//===-------------------------------------------===//
Legalizing operation : 'module'(0x45c97fdd6ac0) {
* Fold {
} -> FAILURE : unable to fold
} -> FAILURE : no matched legalization pattern
//===-------------------------------------------===//
//===-------------------------------------------===//
Legalizing operation : 'func'(0x45c97fcdb240) {
* Fold {
} -> FAILURE : unable to fold
* Pattern : 'func -> ()' {
i8 illegal: requires at least one capability in [StorageBuffer8BitAccess] but none allowed in target environment
i8 converted to 32-bit for SPIR-V
** Insert : 'spv.func'(0x45c97fcdb380)
** Erase : 'func'(0x45c97fcdb240)
//===-------------------------------------------===//
Legalizing operation : 'spv.func'(0x45c97fcdb380) {
} -> SUCCESS : operation marked legal by the target
//===-------------------------------------------===//
} -> SUCCESS : pattern applied successfully
} -> SUCCESS
//===-------------------------------------------===//
//===-------------------------------------------===//
Legalizing operation : 'memref.load'(0x45c97fc98e70) {
%0 = "memref.load"(<<UNKNOWN SSA VALUE>>) : (memref<i1>) -> i1
* Fold {
} -> FAILURE : unable to fold
* Pattern : 'memref.load -> ()' {
} -> FAILURE : pattern failed to match
* Pattern : 'memref.load -> ()' {
** Insert : 'spv.Constant'(0x45c97fd28ed0)
** Insert : 'spv.AccessChain'(0x45c97f844f30)
** Insert : 'spv.Constant'(0x45c97fd28f60)
** Insert : 'spv.SDiv'(0x45c97fdbe810)
** Insert : 'spv.AccessChain'(0x45c97f845030)
** Insert : 'spv.Load'(0x45c97fc99170)
** Insert : 'spv.Constant'(0x45c97fcddaa0)
** Insert : 'spv.Constant'(0x45c97fcddb30)
** Insert : 'spv.UMod'(0x45c97fdbe8f0)
** Insert : 'spv.IMul'(0x45c97fdbe9d0)
** Insert : 'spv.ShiftRightArithmetic'(0x45c97fdbeab0)
** Insert : 'spv.Constant'(0x45c97fcdd980)
** Insert : 'spv.BitwiseAnd'(0x45c97fdbeb90)
** Insert : 'spv.Constant'(0x45c97fcdda10)
** Insert : 'spv.ShiftLeftLogical'(0x45c97fdbec70)
** Insert : 'spv.ShiftRightArithmetic'(0x45c97fdbed50)
** Replace : 'memref.load'(0x45c97fc98e70)
** Erase : 'spv.AccessChain'(0x45c97f844f30)
//===-------------------------------------------===//
Legalizing operation : 'spv.Constant'(0x45c97fd28ed0) {
%0 = "spv.Constant"() {value = 0 : i32} : () -> i32
} -> SUCCESS : operation marked legal by the target
//===-------------------------------------------===//
//===-------------------------------------------===//
Legalizing operation : 'spv.AccessChain'(0x45c97f844f30) {
%1 = "spv.AccessChain"(%arg0, %0, %0) : (!spv.ptr<!spv.struct<(!spv.array<1 x i32, stride=4> [0])>, StorageBuffer>, i32, i32) -> !spv.ptr<i32, StorageBuffer>
} -> SUCCESS : operation marked legal by the target
//===-------------------------------------------===//
//===-------------------------------------------===//
Legalizing operation : 'spv.Constant'(0x45c97fd28f60) {
%2 = "spv.Constant"() {value = 4 : i32} : () -> i32
} -> SUCCESS : operation marked legal by the target
//===-------------------------------------------===//
//===-------------------------------------------===//
Legalizing operation : 'spv.SDiv'(0x45c97fdbe810) {
%3 = "spv.SDiv"(%0, %2) : (i32, i32) -> i32
} -> SUCCESS : operation marked legal by the target
//===-------------------------------------------===//
//===-------------------------------------------===//
Legalizing operation : 'spv.AccessChain'(0x45c97f845030) {
%4 = "spv.AccessChain"(%arg0, %0, %3) : (!spv.ptr<!spv.struct<(!spv.array<1 x i32, stride=4> [0])>, StorageBuffer>, i32, i32) -> !spv.ptr<i32, StorageBuffer>
} -> SUCCESS : operation marked legal by the target
//===-------------------------------------------===//
//===-------------------------------------------===//
Legalizing operation : 'spv.Load'(0x45c97fc99170) {
%5 = "spv.Load"(%4) : (!spv.ptr<i32, StorageBuffer>) -> i32
} -> SUCCESS : operation marked legal by the target
//===-------------------------------------------===//
//===-------------------------------------------===//
Legalizing operation : 'spv.Constant'(0x45c97fcddaa0) {
%6 = "spv.Constant"() {value = 4 : i32} : () -> i32
} -> SUCCESS : operation marked legal by the target
//===-------------------------------------------===//
//===-------------------------------------------===//
Legalizing operation : 'spv.Constant'(0x45c97fcddb30) {
%7 = "spv.Constant"() {value = 8 : i32} : () -> i32
} -> SUCCESS : operation marked legal by the target
//===-------------------------------------------===//
//===-------------------------------------------===//
Legalizing operation : 'spv.UMod'(0x45c97fdbe8f0) {
%8 = "spv.UMod"(%0, %6) : (i32, i32) -> i32
} -> SUCCESS : operation marked legal by the target
//===-------------------------------------------===//
//===-------------------------------------------===//
Legalizing operation : 'spv.IMul'(0x45c97fdbe9d0) {
%9 = "spv.IMul"(%8, %7) : (i32, i32) -> i32
} -> SUCCESS : operation marked legal by the target
//===-------------------------------------------===//
//===-------------------------------------------===//
Legalizing operation : 'spv.ShiftRightArithmetic'(0x45c97fdbeab0) {
%10 = "spv.ShiftRightArithmetic"(%5, %9) : (i32, i32) -> i32
} -> SUCCESS : operation marked legal by the target
//===-------------------------------------------===//
//===-------------------------------------------===//
Legalizing operation : 'spv.Constant'(0x45c97fcdd980) {
%11 = "spv.Constant"() {value = 255 : i32} : () -> i32
} -> SUCCESS : operation marked legal by the target
//===-------------------------------------------===//
//===-------------------------------------------===//
Legalizing operation : 'spv.BitwiseAnd'(0x45c97fdbeb90) {
%12 = "spv.BitwiseAnd"(%10, %11) : (i32, i32) -> i32
} -> SUCCESS : operation marked legal by the target
//===-------------------------------------------===//
//===-------------------------------------------===//
Legalizing operation : 'spv.Constant'(0x45c97fcdda10) {
%13 = "spv.Constant"() {value = 24 : i32} : () -> i32
} -> SUCCESS : operation marked legal by the target
//===-------------------------------------------===//
//===-------------------------------------------===//
Legalizing operation : 'spv.ShiftLeftLogical'(0x45c97fdbec70) {
%14 = "spv.ShiftLeftLogical"(%12, %13) : (i32, i32) -> i32
} -> SUCCESS : operation marked legal by the target
//===-------------------------------------------===//
//===-------------------------------------------===//
Legalizing operation : 'spv.ShiftRightArithmetic'(0x45c97fdbed50) {
%15 = "spv.ShiftRightArithmetic"(%14, %13) : (i32, i32) -> i32
} -> SUCCESS : operation marked legal by the target
//===-------------------------------------------===//
} -> SUCCESS : pattern applied successfully
} -> SUCCESS
//===-------------------------------------------===//
//===-------------------------------------------===//
Legalizing operation : 'std.return'(0x45c97f82c180) {
"std.return"(%16) : (i1) -> ()
* Fold {
} -> FAILURE : unable to fold
* Pattern : 'std.return -> ()' {
%16 = memref.load <<UNKNOWN SSA VALUE>>[] : memref<i1>
** Insert : 'spv.ReturnValue'(0x45c97f82c020)
** Replace : 'std.return'(0x45c97f82c180)
//===-------------------------------------------===//
Legalizing operation : 'spv.ReturnValue'(0x45c97f82c020) {
"spv.ReturnValue"(%16) : (i1) -> ()
} -> SUCCESS : operation marked legal by the target
//===-------------------------------------------===//
} -> SUCCESS : pattern applied successfully
} -> SUCCESS
//===-------------------------------------------===//
a.mlir:8:8: error: failed to materialize conversion for result #0 of operation 'memref.load' that remained live after conversion
%0 = memref.load %arg0[] : memref<i1>
^
a.mlir:8:8: note: see current operation: %16 = "memref.load"(<<UNKNOWN SSA VALUE>>) : (memref<i1>) -> i1
a.mlir:9:3: note: see existing live user here: spv.ReturnValue %16 : i1
return %0 : i1
^
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment