Repository navigation
Closed
Labels
codegenShared code generation infrastructure and dialectscodegen/spirvSPIR-V code generation compiler backend
Description
iree-codegen-convert-to-spirv-pass fails on this input even though Float16 capability is set.
module attributes {spv.target_env = #spv.target_env<#spv.vce<v1.3, [Float16, Shader, CooperativeMatrixNV], [SPV_KHR_storage_buffer_storage_class, SPV_NV_cooperative_matrix]>, {max_compute_workgroup_invo\
cations = 512 : i32, max_compute_workgroup_size = dense<[128, 128, 64]> : vector<3xi32>}>} {
func @matmul_static_shape() attributes {spv.entry_point_abi = {local_size = dense<[32, 16, 1]> : vector<3xi32>}, vkspv.num_workgroups_fn = @matmul_static_shape__num_workgroups__} {
%c64 = constant 64 : index
%c0 = constant 0 : index
%c1 = constant 1 : index
%c16 = constant 16 : index
%c32 = constant 32 : index
%0 = iree.placeholder for "interface buffer" {binding = @legacy_io::@arg0, operand_result_num = 0 : i64} : memref<128x64xf16>
%1 = iree.placeholder for "interface buffer" {binding = @legacy_io::@arg1, operand_result_num = 1 : i64} : memref<64x256xf16>
%2 = iree.placeholder for "interface buffer" {binding = @legacy_io::@ret0, operand_result_num = 2 : i64} : memref<128x256xf16>
%3 = "gpu.block_id"() {dimension = "x"} : () -> index
%4 = "gpu.block_id"() {dimension = "y"} : () -> index
%5 = muli %4, %c16 : index
%6 = muli %3, %c32 : index
%7 = "gpu.thread_id"() {dimension = "x"} : () -> index
%8 = "gpu.thread_id"() {dimension = "y"} : () -> index
%9 = cmpi "slt", %8, %c16 : index
%10 = cmpi "slt", %7, %c32 : index
%11 = and %9, %10 : i1
scf.if %11 {
scf.for %arg0 = %c0 to %c64 step %c1 {
%12 = addi %5, %8 : index
%13 = load %0[%12, %arg0] : memref<128x64xf16>
%14 = addi %6, %7 : index
%15 = load %1[%arg0, %14] : memref<64x256xf16>
%16 = load %2[%12, %14] : memref<128x256xf16>
%17 = mulf %13, %15 : f16
%18 = addf %16, %17 : f16
store %18, %2[%12, %14] : memref<128x256xf16>
}
}
return
}
hal.interface @legacy_io attributes {sym_visibility = "private"} {
hal.interface.binding @arg0, set=0, binding=0, type="StorageBuffer", access="Read"
hal.interface.binding @arg1, set=0, binding=1, type="StorageBuffer", access="Read"
hal.interface.binding @ret0, set=0, binding=2, type="StorageBuffer", access="Write|Discard"
}
}
Metadata
Metadata
Assignees
Labels
codegenShared code generation infrastructure and dialectscodegen/spirvSPIR-V code generation compiler backend
Activity
MaheshRavishankar commentedon Oct 19, 2020
Assigning this to @antiagainst for now. This is the error
For whatever reason the
spv.FAddends up withf16andf32operandsantiagainst commentedon Oct 20, 2020
The input IR lacks the
StorageBuffer16BitAccess, which allows using 16bit floats inStorageBufferstorage class. (TheFloat16capability only allows using 16-bit arithmetics.I assume you are going from NVIDIA target triple. Seems some extensions are not properly registered in the target triple. I'll update it.
antiagainst commentedon Oct 20, 2020
#3546 is landed. @MaheshRavishankar please try it out and close the issue if it's the proper fix.
MaheshRavishankar commentedon Oct 21, 2020
Fixed now. Thanks!