Skip to content

Instantly share code, notes, and snippets.

@stellaraccident
Created December 13, 2021 05:49
Show Gist options
  • Save stellaraccident/d48bbde799978f907706ac2fd69d15c4 to your computer and use it in GitHub Desktop.
Save stellaraccident/d48bbde799978f907706ac2fd69d15c4 to your computer and use it in GitHub Desktop.
Failing vm initializer
#device_target_vmvx = #hal.device.target<"vmvx", {executable_targets = [#hal.executable.target<"vmvx", "vmvx-bytecode-fb">]}>
module attributes {hal.device.targets = [#device_target_vmvx]} {
util.global private @hoisted_1 : !hal.buffer
util.global private @hoisted_1__offset : index
util.global private @hoisted_1__size : index
util.global private @hoisted_0 : !hal.buffer
util.global private @hoisted : !hal.buffer
util.global private @hoisted__storage_size : index
util.global private @hoisted__offset : index
util.global private @hoisted__size : index
hal.executable private @_initializer_0_dispatch_0 {
hal.interface public @io attributes {push_constants = 1 : index} {
hal.interface.binding public @s0b0, set=0, binding=0, type="StorageBuffer"
hal.interface.binding public @s0b1, set=0, binding=1, type="StorageBuffer"
}
hal.executable.binary public @vmvx_bytecode_fb attributes {data = dense<"0x080000004952454524F9FFFF1C0000004003000050030000540300003C0400004804000010000000060000006D6F64756C65000062F9FFFF0C00000018000000400000000A0000000202020300020202020200000A000000B4020000A00200008C02000070020000000000005802000044020000300200001C020000080200000100000004000000CEF9FFFF040000003E000000000000000300000003000000030000000A00000003000000110000000300000018000000040000001F0000000300000026000000050000002E0000000300000035000000030000003C0000000100000043000000040000004A000000040000005500000004000000600000000300000067000000030000006E0000000300000075000000030000007C0000000300000083000000030000008A0000000300000093000000030000009A00000003000000A100000003000000AA00000003000000B200000003000000B900000003000000C800000003000000CF00000003000000DA00000003000000E100000003000000F000000003000000F700000003000000FE0000000300000005010000030000000E010000030000001A010000030000002101000003000000300100000300000037010000030000004201000003000000490100000300000058010000030000005F0100000300000066010000030000006D0100000300000074010000030000007C0100000300000083010000030000008B0100000600000093010000070000009B01000008000000A101000009000000A701000003000000AE01000003000000B501000003000000BC01000003000000C301000003000000CA01000003000000D101000003000000D801000003000000DF01000003000000E601000003000000B2FBFFFF94000000430000000D000000C2FBFFFF840000003D0000000D000000D2FBFFFF74000000370000000D000000E2FBFFFF64000000300000000D000000F2FBFFFF54000000330000000C000000F8FBFFFF04000000030000000000000001000000020000001AFCFFFF2C00000027000000100000002AFCFFFF1C00000026000000120000003AFCFFFF0C000000410000000A0000002F0000002F686F6D652F7374656C6C612F736372617463682F6E756D6F70742F6576616C5F696E7075745F6D696E2E6D6C69720004000000EC000000D8000000BC00000094000000010000000C00000001000000E0000000AAFCFFFF5C00000004000000C0FCFFFF1C000000040000000F000000307272726969696969696969695F76000C000000020000000200000003000000010000000100000001000000010000000100000001000000010000000100000001000000190000005F696E697469616C697A65725F305F64697370617463685F300000003AFDFFFF040000001400000021766D2E6C6973743C21766D2E6275666665723E000000005EFDFFFF040000000A00000021766D2E627566666572000076FDFFFF04000000030000006933320086FDFFFF040000000300000066333200A0FDFFFF080200000100000000000000F001000017000300F001000008020009FFFFFFFF030009040000000400091000000005000901000000080009020000000900E1090000003F0A0009060000000B0009030000000C000B000000000080B301C002000D0016028002000200000001801602C0080002000000028024010009000100240700090007002400000500000024060005000600420D0002000E002303000D000F001E0E000F000D000D00250D0004000D002303000D000F001E0E000F000D000D0050B20000000000004201000B000E00510E00C80000000000E601000000002401000C000E0050DA000000010000000F00420F000C001000511000F00000000000D80100000000240F00030010002210000C001000420500100011001E1100050010001000501A0100000001000200110042110009001200511200300100000000CA01000000002411000C001200504201000001000200130042130010001400511400580100000000BC0100000000221200130014002214000E0014002214000F00140024140004001500E1B0008015001500240D0004001600E1B0018016001600E124150016001500E12215000A001500E12B15001500E13215001500B8028014001500221300080013005042010000000022110008001100501A0100000000220F0006000F0050DA00000000002201000700010050B200000000005400000000000000000048000000000000006626FA4366267A44CC9CBB446626FA4400581C45CC9C3B4599E15A4566267A4599B58C4500589C4566FAAB45CC9CBB45333FCB4599E1DA450084EA456626FA4566E4044600000000000000000A0008000000000004000600080004000A000C0004000000080008000C00040008000A001000040008000C000800080000000400180020000400080000000C00100000000000140018001C00"> : vector<1788xi8>, format = "vmvx-bytecode-fb"}
}
util.initializer {
%c18 = arith.constant 18 : index
%c0 = arith.constant 0 : index
%c1 = arith.constant 1 : index
%c3 = arith.constant 3 : index
%hoisted__storage_size = util.global.load @hoisted__storage_size : index
%hoisted__offset = util.global.load @hoisted__offset : index
%hoisted = util.global.load @hoisted : !hal.buffer
%device = hal.ex.shared_device : !hal.device
%allocator = hal.device.allocator<%device : !hal.device> : !hal.allocator
%buffer = hal.allocator.allocate<%allocator : !hal.allocator> type("DeviceVisible|DeviceLocal") usage("Constant|Transfer|Dispatch") : !hal.buffer{%c18}
%cmd = hal.command_buffer.create device(%device : !hal.device) mode("OneShot|AllowInlineExecution") categories("Transfer|Dispatch") : !hal.command_buffer
hal.command_buffer.begin<%cmd : !hal.command_buffer>
%ok, %value = hal.device.query<%device : !hal.device> key("hal.executable.format" :: "vmvx-bytecode-fb") : i1, i1 = false
cond_br %value, ^bb1, ^bb2
^bb1: // pred: ^bb0
%executable_layout = hal.executable_layout.lookup device(%device : !hal.device) push_constants(1) layouts([[#hal.descriptor_set_layout_binding<0, "StorageBuffer">, #hal.descriptor_set_layout_binding<1, "StorageBuffer">]]) : !hal.executable_layout
%0 = arith.index_cast %hoisted__offset : index to i32
hal.command_buffer.push_constants<%cmd : !hal.command_buffer> layout(%executable_layout : !hal.executable_layout) offset(0) values([%0]) : i32
hal.command_buffer.push_descriptor_set<%cmd : !hal.command_buffer> layout(%executable_layout : !hal.executable_layout)[%c0] bindings([
%c0 = (%hoisted : !hal.buffer)[%c0, %hoisted__storage_size],
%c1 = (%buffer : !hal.buffer)[%c0, %c18]
])
%exe = hal.executable.lookup device(%device : !hal.device) executable(@_initializer_0_dispatch_0) : !hal.executable
hal.command_buffer.dispatch<%cmd : !hal.command_buffer> target(%exe : !hal.executable)[0] workgroups([%c1, %c3, %c1])
hal.command_buffer.execution_barrier<%cmd : !hal.command_buffer> source("Dispatch|Transfer|CommandRetire") target("CommandIssue|Dispatch|Transfer") flags("None")
hal.command_buffer.end<%cmd : !hal.command_buffer>
hal.ex.submit_and_wait %device, %cmd
util.global.store %buffer, @hoisted_0 : !hal.buffer
util.initializer.return
^bb2: // pred: ^bb0
util.unreachable "device not supported in the compiled configuration"
}
func @get$hoisted_0() -> !hal.buffer_view attributes {iree.abi.stub} {
%c18 = arith.constant 18 : index
%c0 = arith.constant 0 : index
%c6 = arith.constant 6 : index
%c3 = arith.constant 3 : index
%c268435464_i32 = arith.constant 268435464 : i32
%c1_i32 = arith.constant 1 : i32
%hoisted_0 = util.global.load @hoisted_0 : !hal.buffer
%device = hal.ex.shared_device : !hal.device
%allocator = hal.device.allocator<%device : !hal.device> : !hal.allocator
%buffer = hal.allocator.allocate<%allocator : !hal.allocator> type("HostVisible|DeviceVisible|DeviceLocal") usage("Transfer|Mapping|Dispatch") : !hal.buffer{%c18}
%cmd = hal.command_buffer.create device(%device : !hal.device) mode("OneShot|AllowInlineExecution") categories(Transfer) : !hal.command_buffer
hal.command_buffer.begin<%cmd : !hal.command_buffer>
hal.command_buffer.copy_buffer<%cmd : !hal.command_buffer> source(%hoisted_0 : !hal.buffer)[%c0] target(%buffer : !hal.buffer)[%c0] length(%c18)
hal.command_buffer.execution_barrier<%cmd : !hal.command_buffer> source("Dispatch|Transfer|CommandRetire") target("CommandIssue|Dispatch|Transfer") flags("None")
hal.command_buffer.end<%cmd : !hal.command_buffer>
hal.ex.submit_and_wait %device, %cmd
%view = hal.buffer_view.create buffer(%buffer : !hal.buffer) shape([%c6, %c3]) type(%c268435464_i32) encoding(%c1_i32) : !hal.buffer_view
return %view : !hal.buffer_view
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment