Skip to content

[Aggressive Fusion] missing LLVMTranslationDialectInterface registration for dialect for op: builtin.unrealized_conversion_cast #12287

Closed

Description

@pzread

With patch #11980

iree-compile --output-format=vm-bytecode \
  --iree-hal-target-backends=cuda \                                                                                                      
  --iree-input-type=mhlo \                                                                                                               
  --iree-hal-cuda-llvm-target-arch=sm_80 \                                                                                               
  iree_ecf5c970-ee97-49f0-a4ed-df1f34e9d493_MiniLML12H384Uncased.mlir

Input MLIR: https://storage.googleapis.com/iree-jerry-test/debug-11980/iree_ecf5c970-ee97-49f0-a4ed-df1f34e9d493_MiniLML12H384Uncased.mlir

Error:

<unknown>:0: error: cannot be converted to LLVM IR: missing `LLVMTranslationDialectInterface` registration for dialect for op: builtin.unrealized_conversion_cast                
<unknown>:0: note: see current operation: %45 = "builtin.unrealized_conversion_cast"(%44) : (!llvm.struct<(ptr<f32>, ptr<f32>, i64, array<2 x i64>, array<2 x i64>)>) -> memref<1
28x384xf32>                                                                                                                                                                      
<unknown>:0: error: loc(fused["BatchMatMulV2:", "bert/encoder/layer_._0/attention/self/MatMul@__inference_predict_6353"]): failed to translate the MLIR LLVM dialect to the nativ
e llvm::Module                                                                                                                                                                   
<unknown>:0: note: loc(fused["BatchMatMulV2:", "bert/encoder/layer_._0/attention/self/MatMul@__inference_predict_6353"]): see current operation:                                 
"hal.executable.variant"() ({                                                                                                                                                    
  "hal.executable.export"() ({                                                                                                                                                   
  ^bb0(%arg0: !hal.device, %arg1: index, %arg2: index):                                                                                                                          
    %0 = "arith.constant"() {value = 4 : index} : () -> index                                                                                                                    
    %1 = "arith.constant"() {value = 12 : index} : () -> index                                                                                                                   
    %2 = "arith.constant"() {value = 1 : index} : () -> index                                                                                                                    
    "hal.return"(%0, %1, %2) : (index, index, index) -> ()                                                                                                                       
  }) {layout = #hal.pipeline.layout<push_constants = 0, sets = [<0, bindings = [<0, storage_buffer, ReadOnly>, <1, storage_buffer>, <2, storage_buffer>]>]>, ordinal = 0 : index,
 sym_name = "predict_dispatch_6_generic_384x128", translation_info = #iree_codegen.translation_info<LLVMGPUTransposeSharedMem>, workgroup_local_memory = 4224 : index, workgroup_
size = [8 : index, 32 : index, 1 : index]} : () -> ()                                                                                                                            
  "builtin.module"() ({                                                                                                                                                          
    "llvm.mlir.global"() ({                                                                                                                                                      
    }) {addr_space = 3 : i32, alignment = 16 : i64, global_type = !llvm.array<0 x i8>, linkage = #llvm.linkage<external>, sym_name = "__dynamic_shared_memory__"} : () -> ()     
    "llvm.mlir.global"() ({                                                                                                                                                      
    }) {addr_space = 3 : i32, alignment = 4 : i64, global_type = !llvm.array<32 x array<33 x f32>>, linkage = #llvm.linkage<private>, sym_name = "__shared_memory__"} : () -> () 
    "llvm.func"() ({                                                                                                                                                             
    ^bb0(%arg0: !llvm.ptr<f32>, %arg1: !llvm.ptr<f32>, %arg2: !llvm.ptr<f32>):                                                                                                   
      %0 = "llvm.mlir.constant"() {value = 3 : i64} : () -> i64                                                                                                                  
      %1 = "llvm.mlir.constant"() {value = 2 : i64} : () -> i64                                                                                                                  
      %2 = "llvm.mlir.constant"() {value = 1 : i64} : () -> i64                                                                                                                  
      %3 = "llvm.mlir.constant"() {value = 0 : i32} : () -> i32                                                                                                                  
      %4 = "llvm.mlir.constant"() {value = 63 : index} : () -> i64                                                                                                               
      %5 = "llvm.mlir.constant"() {value = 384 : index} : () -> i64                                                                                                              
      %6 = "llvm.mlir.constant"() {value = 128 : index} : () -> i64                                                                                                              
      %7 = "llvm.mlir.constant"() {value = 0 : i64} : () -> i64                                                                                                                  
      %8 = "llvm.mlir.constant"() {value = dense<0.000000e+00> : vector<4xf32>} : () -> vector<4xf32>                                                                            
      %9 = "llvm.mlir.constant"() {value = 32 : index} : () -> i64                                                                                                               
      %10 = "llvm.mlir.constant"() {value = 8 : index} : () -> i64                                                                                                               
      %11 = "llvm.mlir.constant"() {value = -1 : index} : () -> i64                                                                                                              
      %12 = "llvm.mlir.constant"() {value = 4 : index} : () -> i64                                                                                                               
      %13 = "llvm.mlir.constant"() {value = -32 : index} : () -> i64                                                                                                             
      %14 = "llvm.mlir.constant"() {value = dense<0.000000e+00> : vector<1x4xf32>} : () -> !llvm.array<1 x vector<4xf32>>                                                        
      %15 = "llvm.mlir.constant"() {value = dense<0.000000e+00> : vector<4x1xf32>} : () -> !llvm.array<4 x vector<1xf32>>                                                        
      %16 = "llvm.mlir.constant"() {value = 0 : index} : () -> i64                                                                                                               
      %17 = "llvm.mlir.constant"() {value = 1 : index} : () -> i64                                                                                                               
      %18 = "llvm.mlir.constant"() {value = 2 : index} : () -> i64                                                                                                               
      %19 = "llvm.mlir.constant"() {value = 3 : index} : () -> i64                                                                                                               
      %20 = "llvm.mlir.constant"() {value = 33 : index} : () -> i64                                                                                                              
      %21 = "llvm.mlir.addressof"() {global_name = @__dynamic_shared_memory__} : () -> !llvm.ptr<array<0 x i8>, 3>

Activity

  1. MaheshRavishankar commented on Feb 21, 2023

    @MaheshRavishankar
    Collaborator

    @ThomasRaoux could you help fix this on the CUDA side. This is blocking #11980 . The other blocking issues, I think we have a handle on.

  2. ThomasRaoux commented on Feb 21, 2023

    @ThomasRaoux
    Contributor

    @ThomasRaoux could you help fix this on the CUDA side. This is blocking #11980 . The other blocking issues, I think we have a handle on.

    what's the timeline your are looking at? I doubt I'll get to it right away. However it shouldn't extremely hard to debug if someone else wants to take a stab at it.

  3. pzread commented on Feb 21, 2023

    @pzread
    ContributorAuthor

    I can take a look first to find the root cause (it seems like bufferization failed to handle some case and left a unrealized_conversion_cast)

  4. self-assigned this
    on Feb 21, 2023
  5. ThomasRaoux commented on Feb 21, 2023

    @ThomasRaoux
    Contributor

    I can take a look first to find the root cause (it seems like bufferization failed to handle some case and left a unrealized_conversion_cast)

    Thanks, feel free to ping if you need any help

  6. moved this from Not Started to Inbox in (Deprecated) IREEon Apr 5, 2023
  7. allieculp commented on Apr 13, 2023

    @allieculp

    @pzread setting to 'in progress' by you - please update as needed.

  8. moved this from Inbox to In Progress in (Deprecated) IREEon Apr 13, 2023
  9. moved this from In Progress to Not Started in (Deprecated) IREEon Apr 13, 2023
  10. moved this from Not Started to Backlog in (Deprecated) IREEon Jun 5, 2023
  11. pzread commented on Jul 14, 2023

    @pzread
    ContributorAuthor

    The compilation is now passed with multi-use fusion:

    iree-compile \
      --iree-hal-target-backends=cuda \
      --iree-input-type=stablehlo \
      --iree-hal-cuda-llvm-target-arch=sm_80 \
      --iree-flow-fuse-multi-use \
      ./model_MiniLML12H384Uncased.timestamp_1683504734.mlirbc
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions