Skip to content

Getting TVM working with VE #24

@saudet

Description

@saudet

I would like to use TVM to compile models like BERT for VE, but I'm encountering errors from LLVM like these:

LLVM ERROR: Cannot select: 0x10f7dfc8: v16f32 = fadd 0xd33cfa8, 0x99008b8
  0xd33cfa8: v16f32,ch = load<(load 64 from %ir.uglygep1718, !tbaa !247)> 0x2a31c68, 0x99002a0, undef:i64
    0x99002a0: i64 = add 0x10f7e308, 0x9901008
      0x10f7e308: i64,ch = CopyFromReg 0x2a31c68, Register:i64 %12
        0x9900b90: i64 = Register %12
      0x9901008: i64,ch = CopyFromReg 0x2a31c68, Register:i64 %17
        0xd33d280: i64 = Register %17
    0x9900ac0: i64 = undef
  0x99008b8: v16f32 = fadd 0x99001d0, 0x10f7e988
    0x99001d0: v16f32,ch = load<(load 64 from %ir.uglygep56, !tbaa !250)> 0x2a31c68, 0x10f7dc88, undef:i64
      0x10f7dc88: i64 = add 0x9900578, 0x9901008
        0x9900578: i64,ch = CopyFromReg 0x2a31c68, Register:i64 %16
          0x14856630: i64 = Register %16
        0x9901008: i64,ch = CopyFromReg 0x2a31c68, Register:i64 %17
          0xd33d280: i64 = Register %17
      0x9900ac0: i64 = undef
    0x10f7e988: v16f32,ch = load<(load 64 from %ir.uglygep2, !tbaa !253)> 0x2a31c68, 0x10f7dc20, undef:i64
      0x10f7dc20: i64 = add 0x9900648, 0x9901008
        0x9900648: i64,ch = CopyFromReg 0x2a31c68, Register:i64 %15
          0x9900e68: i64 = Register %15
        0x9901008: i64,ch = CopyFromReg 0x2a31c68, Register:i64 %17
          0xd33d280: i64 = Register %17
      0x9900ac0: i64 = undef
In function: __tvm_parallel_lambda
Aborted

What does that mean? Where should I start to debug this?

I build https://github.com/sx-aurora-dev/llvm-project this way on CentOS 7:

cmake ../llvm
make

And https://github.com/apache/incubator-tvm this way:

cmake -DUSE_LLVM=/path/to/llvm-project/build/bin/llvm-config ..

For the default BERT model described here on this blog post:

Using this script:

with tvm.transform.PassContext(opt_level=3, required_pass=["FastMath"]):
    compiled_lib = relay.build(mod, "llvm -mtriple=ve-linux", params=params)
compiled_lib.export_library("libbertve.so")

Everything works fine with the x86 target of LLVM, on the same machine with the same binaries, so it's something specific to the VE target. Any help would be greatly appreciated! Thanks in advance

Metadata

Metadata

Assignees

No one assigned

    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