EnzymeAD / rust

A rust fork to work towards Enzyme integration
https://www.rust-lang.org
Other
72 stars 8 forks source link

Cannot deduce adding type of: %19 = call { i64, i1 } @llvm.umul.with.overflow.i64 #128

Closed ZuseZ4 closed 3 months ago

ZuseZ4 commented 5 months ago

out_dbg.ll.txt

wsmoses commented 5 months ago

From the log this looks like insufficient rust type info:

ptr): Enzyme: oldFunc: ; Function Attrs: mustprogress nonlazybind sanitize_hwaddress willreturn uwtable
define internal void @"preprocess__ZN82_$LT$faer..mat..matalloc..RawMatUnit$LT$T$GT$$u20$as$u20$core..ops..drop..Drop$GT$4drop17hfbd1f4c29bf544eaE"(ptr align 8 %0) unnamed_addr EnzymeAD/Enzyme#109 !dbg !2212192 {
  %2 = alloca i128, align 8
  %3 = alloca i128, align 8
  %4 = alloca i128, align 8
  %5 = alloca i128, align 8
  %6 = alloca i128, align 8
  %7 = alloca i128, align 8
  %8 = alloca i128, align 8
  %9 = alloca i128, align 8
  %10 = alloca i128, align 8
  %11 = alloca i128, align 8
  %12 = alloca i128, align 8
  %13 = alloca i128, align 8
  call void @llvm.dbg.value(metadata ptr %0, metadata !2212194, metadata !DIExpression()), !dbg !2212197
  %14 = getelementptr inbounds { ptr, i64, i64 }, ptr %0, i32 0, i32 1, !dbg !2212198
  %15 = load i64, ptr %14, align 8, !dbg !2212198, !noundef !21
  %16 = getelementptr inbounds { ptr, i64, i64 }, ptr %0, i32 0, i32 2, !dbg !2212199
  %17 = load i64, ptr %16, align 8, !dbg !2212199, !noundef !21
  call void @llvm.dbg.value(metadata i64 %15, metadata !102755, metadata !DIExpression()), !dbg !2212200
  call void @llvm.dbg.value(metadata i64 %17, metadata !102758, metadata !DIExpression()), !dbg !2212200
  %18 = mul i64 %15, %17, !dbg !2212202
  %19 = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 %18, i64 8) EnzymeAD/Enzyme#113, !dbg !2212198
  %20 = extractvalue { i64, i1 } %19, 0, !dbg !2212198
  %21 = extractvalue { i64, i1 } %19, 1, !dbg !2212198
  %22 = call i1 @llvm.expect.i1(i1 %21, i1 false) EnzymeAD/Enzyme#113, !dbg !2212198
  br i1 %22, label %25, label %23, !dbg !2212198

23:                                               ; preds = %1
  call void @llvm.dbg.value(metadata i64 %20, metadata !2212195, metadata !DIExpression()), !dbg !2212203
  %24 = icmp eq i64 %20, 0, !dbg !2212204
  br i1 %24, label %26, label %27, !dbg !2212204

25:                                               ; preds = %1
  call void @_ZN4core9panicking5panic17h9007d4b5b02124fcE(ptr align 1 @str.0.306, i64 33, ptr align 8 @409) EnzymeAD/Enzyme#114, !dbg !2212198
  unreachable, !dbg !2212198

26:                                               ; preds = %59, %23
  ret void, !dbg !2212205

27:                                               ; preds = %23
  %28 = load ptr, ptr %0, align 8, !dbg !2212206, !nonnull !21, !noundef !21
  call void @llvm.dbg.value(metadata ptr %28, metadata !102767, metadata !DIExpression()), !dbg !2212207
  %29 = call i128 @_ZN4core3any6TypeId2of17h48bdd485a7db96baE() EnzymeAD/Enzyme#113, !dbg !2212209
  store i128 %29, ptr %11, align 8, !dbg !2212209
  %30 = call i128 @_ZN4core3any6TypeId2of17h25d02c4d72df0105E() EnzymeAD/Enzyme#113, !dbg !2212213
  store i128 %30, ptr %10, align 8, !dbg !2212213
  %31 = call zeroext i1 @"_ZN58_$LT$core..any..TypeId$u20$as$u20$core..cmp..PartialEq$GT$2eq17h98fe83a623728eccE"(ptr align 8 %11, ptr align 8 %10) EnzymeAD/Enzyme#113, !dbg !2212209
  br i1 %31, label %53, label %32, !dbg !2212214

32:                                               ; preds = %27
  %33 = call i128 @_ZN4core3any6TypeId2of17h25d02c4d72df0105E() EnzymeAD/Enzyme#113, !dbg !2212215
  store i128 %33, ptr %13, align 8, !dbg !2212215
  %34 = call i128 @_ZN4core3any6TypeId2of17h25d02c4d72df0105E() EnzymeAD/Enzyme#113, !dbg !2212217
  store i128 %34, ptr %12, align 8, !dbg !2212217
  %35 = call zeroext i1 @"_ZN58_$LT$core..any..TypeId$u20$as$u20$core..cmp..PartialEq$GT$2eq17h98fe83a623728eccE"(ptr align 8 %13, ptr align 8 %12) EnzymeAD/Enzyme#113, !dbg !2212215
  br i1 %35, label %53, label %36, !dbg !2212218

36:                                               ; preds = %32
  %37 = call i128 @_ZN4core3any6TypeId2of17h22fbff1c526b5b95E() EnzymeAD/Enzyme#113, !dbg !2212219
  store i128 %37, ptr %9, align 8, !dbg !2212219
  %38 = call i128 @_ZN4core3any6TypeId2of17h25d02c4d72df0105E() EnzymeAD/Enzyme#113, !dbg !2212221
  store i128 %38, ptr %8, align 8, !dbg !2212221
  %39 = call zeroext i1 @"_ZN58_$LT$core..any..TypeId$u20$as$u20$core..cmp..PartialEq$GT$2eq17h98fe83a623728eccE"(ptr align 8 %9, ptr align 8 %8) EnzymeAD/Enzyme#113, !dbg !2212219
  br i1 %39, label %53, label %40, !dbg !2212222

40:                                               ; preds = %36
  %41 = call i128 @_ZN4core3any6TypeId2of17h9da248a2f0bc0651E() EnzymeAD/Enzyme#113, !dbg !2212223
  store i128 %41, ptr %3, align 8, !dbg !2212223
  %42 = call i128 @_ZN4core3any6TypeId2of17h25d02c4d72df0105E() EnzymeAD/Enzyme#113, !dbg !2212225
  store i128 %42, ptr %2, align 8, !dbg !2212225
  %43 = call zeroext i1 @"_ZN58_$LT$core..any..TypeId$u20$as$u20$core..cmp..PartialEq$GT$2eq17h98fe83a623728eccE"(ptr align 8 %3, ptr align 8 %2) EnzymeAD/Enzyme#113, !dbg !2212223
  br i1 %43, label %53, label %44, !dbg !2212226

44:                                               ; preds = %40
  %45 = call i128 @_ZN4core3any6TypeId2of17h9c478ee0fd0945b8E() EnzymeAD/Enzyme#113, !dbg !2212227
  store i128 %45, ptr %7, align 8, !dbg !2212227
  %46 = call i128 @_ZN4core3any6TypeId2of17h25d02c4d72df0105E() EnzymeAD/Enzyme#113, !dbg !2212229
  store i128 %46, ptr %6, align 8, !dbg !2212229
  %47 = call zeroext i1 @"_ZN58_$LT$core..any..TypeId$u20$as$u20$core..cmp..PartialEq$GT$2eq17h98fe83a623728eccE"(ptr align 8 %7, ptr align 8 %6) EnzymeAD/Enzyme#113, !dbg !2212227
  br i1 %47, label %53, label %48, !dbg !2212230

48:                                               ; preds = %44
  %49 = call i128 @_ZN4core3any6TypeId2of17h197bbd510bfd5bdaE() EnzymeAD/Enzyme#113, !dbg !2212231
  store i128 %49, ptr %5, align 8, !dbg !2212231
  %50 = call i128 @_ZN4core3any6TypeId2of17h25d02c4d72df0105E() EnzymeAD/Enzyme#113, !dbg !2212233
  store i128 %50, ptr %4, align 8, !dbg !2212233
  %51 = call zeroext i1 @"_ZN58_$LT$core..any..TypeId$u20$as$u20$core..cmp..PartialEq$GT$2eq17h98fe83a623728eccE"(ptr align 8 %5, ptr align 8 %4) EnzymeAD/Enzyme#113, !dbg !2212231
  %52 = zext i1 %51 to i8, !dbg !2212234
  br label %53, !dbg !2212234

53:                                               ; preds = %27, %32, %36, %40, %44, %48
  %54 = phi i8 [ %52, %48 ], [ 1, %44 ], [ 1, %40 ], [ 1, %36 ], [ 1, %32 ], [ 1, %27 ], !dbg !2212235
  %55 = trunc i8 %54 to i1, !dbg !2212236
  br i1 %55, label %56, label %59, !dbg !2212237

56:                                               ; preds = %53
  %57 = call i64 @_ZN4core3cmp3Ord3max17hdab661539ee42c38E(i64 8, i64 128) EnzymeAD/Enzyme#113, !dbg !2212238
  %58 = call i64 @_ZN4core3cmp3Ord3max17hdab661539ee42c38E(i64 8, i64 %57) EnzymeAD/Enzyme#113, !dbg !2212239
  br label %59, !dbg !2212239

59:                                               ; preds = %53, %56
  %60 = phi i64 [ %58, %56 ], [ 8, %53 ], !dbg !2212240
  %61 = call { i64, i64 } @_ZN4core5alloc6layout6Layout25from_size_align_unchecked17h1b3494a6a8c0d676E(i64 %20, i64 %60) EnzymeAD/Enzyme#113, !dbg !2212241
  %62 = extractvalue { i64, i64 } %61, 0, !dbg !2212241
  %63 = extractvalue { i64, i64 } %61, 1, !dbg !2212241
  call void @_ZN5alloc5alloc7dealloc17h2da20f441640f416E(ptr %28, i64 %62, i64 %63) EnzymeAD/Enzyme#113, !dbg !2212242
  br label %26, !dbg !2212242
}

Cannot deduce adding type of:   %19 = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 %18, i64 8) EnzymeAD/Enzyme#113, !dbg !8547
 + idxs {i32 0,}
<analysis>
  %16 = getelementptr inbounds { ptr, i64, i64 }, ptr %0, i32 0, i32 2, !dbg !8548: {[-1]:Pointer, [-1,0]:Integer, [-1,1]:Integer, [-1,2]:Integer, [-1,3]:Integer, [-1,4]:Integer, [-1,5]:Integer, [-1,6]:Integer, [-1,7]:Integer}, intvals: {}
  %2 = alloca i128, align 8: {[-1]:Pointer}, intvals: {}
  %14 = getelementptr inbounds { ptr, i64, i64 }, ptr %0, i32 0, i32 1, !dbg !8547: {[-1]:Pointer}, intvals: {}
  call void @_ZN5alloc5alloc7dealloc17h2da20f441640f416E(ptr %28, i64 %62, i64 %63) EnzymeAD/Enzyme#113, !dbg !8648: {}, intvals: {}
  %3 = alloca i128, align 8: {[-1]:Pointer}, intvals: {}
  %4 = alloca i128, align 8: {[-1]:Pointer, [-1,-1]:Integer}, intvals: {}
ptr %0: {[-1]:Pointer, [-1,16]:Integer, [-1,17]:Integer, [-1,18]:Integer, [-1,19]:Integer, [-1,20]:Integer, [-1,21]:Integer, [-1,22]:Integer, [-1,23]:Integer}, intvals: {}
  %5 = alloca i128, align 8: {[-1]:Pointer, [-1,-1]:Integer}, intvals: {}
  %6 = alloca i128, align 8: {[-1]:Pointer}, intvals: {}
  %7 = alloca i128, align 8: {[-1]:Pointer}, intvals: {}
  %8 = alloca i128, align 8: {[-1]:Pointer, [-1,-1]:Integer}, intvals: {}
  %9 = alloca i128, align 8: {[-1]:Pointer, [-1,-1]:Integer}, intvals: {}
  %10 = alloca i128, align 8: {[-1]:Pointer, [-1,-1]:Integer}, intvals: {}
ZuseZ4 commented 3 months ago

support for ops with overflow was added