Code Monkey home page Code Monkey logo

Comments (4)

wsmoses avatar wsmoses commented on August 20, 2024

Is this all the output from post optimization (I'm not seeing the !33 being complained about). In any case I'll try reproducing

from enzyme.jl.

vchuravy avatar vchuravy commented on August 20, 2024

Got the IR:

(rr) call M.dump()
; ModuleID = 'g'
source_filename = "g"
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128-ni:10:11:12:13"
target triple = "x86_64-pc-linux-gnu"

%jl_value_t = type opaque

; Function Attrs: sspstrong
define double @julia_g_16998(double) #0 !dbg !5 {
top:
  call void @llvm.dbg.value(metadata double %0, metadata !12, metadata !DIExpression()), !dbg !13
  %1 = call { double } @diffejulia_f_1(double %0, double 1.000000e+00), !dbg !14
  %2 = extractvalue { double } %1, 0, !dbg !14
  ret double %2, !dbg !13
}

define nonnull %jl_value_t addrspace(10)* @jfptr_g_16999(%jl_value_t addrspace(10)*, %jl_value_t addrspace(10)**, i32) #1 {
top:
  %thread_ptr = call i8* asm "movq %fs:0, $0", "=r"()
  %ptls_i8 = getelementptr i8, i8* %thread_ptr, i64 -15712
  %ptls = bitcast i8* %ptls_i8 to %jl_value_t***
  %3 = bitcast %jl_value_t addrspace(10)** %1 to double addrspace(10)**
  %4 = load double addrspace(10)*, double addrspace(10)** %3, align 8, !nonnull !4, !dereferenceable !23, !align !23
  %5 = addrspacecast double addrspace(10)* %4 to double addrspace(11)*
  %6 = load double, double addrspace(11)* %5, align 8
  %7 = call double @julia_g_16998(double %6)
  %8 = bitcast %jl_value_t*** %ptls to i8*
  %9 = call noalias nonnull %jl_value_t addrspace(10)* @jl_gc_pool_alloc(i8* %8, i32 1400, i32 16) #2
  %10 = bitcast %jl_value_t addrspace(10)* %9 to %jl_value_t addrspace(10)* addrspace(10)*
  %11 = getelementptr %jl_value_t addrspace(10)*, %jl_value_t addrspace(10)* addrspace(10)* %10, i64 -1
  store %jl_value_t addrspace(10)* addrspacecast (%jl_value_t* inttoptr (i64 139811181807920 to %jl_value_t*) to %jl_value_t addrspace(10)*), %jl_value_t addrspace(10)* addrspace(10)* %11, !tbaa !24
  %12 = bitcast %jl_value_t addrspace(10)* %9 to double addrspace(10)*
  store double %7, double addrspace(10)* %12, align 8, !tbaa !28
  ret %jl_value_t addrspace(10)* %9
}

; Function Attrs: allocsize(1)
declare noalias nonnull %jl_value_t addrspace(10)* @julia.gc_alloc_obj(i8*, i64, %jl_value_t addrspace(10)*) #2

; Function Attrs: nounwind readnone speculatable
declare void @llvm.dbg.declare(metadata, metadata, metadata) #3

; Function Attrs: alwaysinline
define double @jl_llvmcall0(double) #4 {
entry:
  %1 = call { double } @diffejulia_f_1(double %0, double 1.000000e+00)
  %2 = extractvalue { double } %1, 0
  ret double %2
}

; Function Attrs: sspstrong
define { double } @diffejulia_f_1(double, double %differeturn) #0 !dbg !31 {
top:
  %1 = insertvalue { double } undef, double %differeturn, 0
  ret { double } %1
}

; Function Attrs: nounwind readnone speculatable
declare void @llvm.dbg.value(metadata, metadata, metadata) #3

; Function Attrs: argmemonly nounwind
declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture) #5

; Function Attrs: argmemonly nounwind
declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture) #5

; Function Attrs: inaccessiblemem_or_argmemonly
declare void @jl_gc_queue_root(%jl_value_t addrspace(10)*) #6

; Function Attrs: allocsize(1)
declare noalias nonnull %jl_value_t addrspace(10)* @jl_gc_pool_alloc(i8*, i32, i32) #2

; Function Attrs: allocsize(1)
declare noalias nonnull %jl_value_t addrspace(10)* @jl_gc_big_alloc(i8*, i64) #2

; Function Attrs: allocsize(1)
declare noalias nonnull %jl_value_t addrspace(10)* @julia.gc_alloc_bytes(i8*, i64) #2

; Function Attrs: nounwind
declare void @llvm.stackprotector(i8*, i8**) #7

attributes #0 = { sspstrong }
attributes #1 = { "thunk" }
attributes #2 = { allocsize(1) }
attributes #3 = { nounwind readnone speculatable }
attributes #4 = { alwaysinline }
attributes #5 = { argmemonly nounwind }
attributes #6 = { inaccessiblemem_or_argmemonly }
attributes #7 = { nounwind }

!llvm.module.flags = !{!0, !1}
!llvm.dbg.cu = !{!2}

!0 = !{i32 2, !"Dwarf Version", i32 4}
!1 = !{i32 1, !"Debug Info Version", i32 3}
!2 = distinct !DICompileUnit(language: DW_LANG_Julia, file: !3, producer: "julia", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !4)
!3 = !DIFile(filename: "/home/vchuravy/src/Enzyme.jl/script.jl", directory: ".")
!4 = !{}
!5 = distinct !DISubprogram(name: "g", linkageName: "julia_g_16998", scope: null, file: !3, line: 3, type: !6, isLocal: false, isDefinition: true, scopeLine: 3, isOptimized: true, unit: !2, variables: !9)
!6 = !DISubroutineType(types: !7)
!7 = !{!8, !8}
!8 = !DIBasicType(name: "Float64", size: 64, encoding: DW_ATE_unsigned)
!9 = !{!10, !12}
!10 = !DILocalVariable(name: "#self#", arg: 1, scope: !5, file: !3, line: 3, type: !11)
!11 = !DICompositeType(tag: DW_TAG_structure_type, name: "#g", align: 8, elements: !4, runtimeLang: DW_LANG_Julia, identifier: "49612")
!12 = !DILocalVariable(name: "x", arg: 2, scope: !5, file: !3, line: 3, type: !8)
!13 = !DILocation(line: 3, scope: !5)
!14 = !DILocation(line: 52, scope: !15, inlinedAt: !18)
!15 = distinct !DISubprogram(name: "macro expansion;", linkageName: "macro expansion", scope: !16, file: !16, type: !17, isLocal: false, isDefinition: true, isOptimized: true, unit: !2, variables: !4)
!16 = !DIFile(filename: "/home/vchuravy/src/LLVM/src/interop/base.jl", directory: ".")
!17 = !DISubroutineType(types: !4)
!18 = !DILocation(line: 98, scope: !19, inlinedAt: !21)
!19 = distinct !DISubprogram(name: "macro expansion;", linkageName: "macro expansion", scope: !20, file: !20, type: !17, isLocal: false, isDefinition: true, isOptimized: true, unit: !2, variables: !4)
!20 = !DIFile(filename: "/home/vchuravy/src/Enzyme.jl/src/Enzyme.jl", directory: ".")
!21 = !DILocation(line: 98, scope: !22, inlinedAt: !13)
!22 = distinct !DISubprogram(name: "autodiff;", linkageName: "autodiff", scope: !20, file: !20, type: !17, isLocal: false, isDefinition: true, isOptimized: true, unit: !2, variables: !4)
!23 = !{i64 8}
!24 = !{!25, !25, i64 0}
!25 = !{!"jtbaa_tag", !26, i64 0}
!26 = !{!"jtbaa_data", !27, i64 0}
!27 = !{!"jtbaa"}
!28 = !{!29, !29, i64 0}
!29 = !{!"jtbaa_immut", !30, i64 0}
!30 = !{!"jtbaa_value", !26, i64 0}
!31 = distinct !DISubprogram(name: "f", linkageName: "julia_f_16929", scope: null, file: !3, line: 2, type: !6, isLocal: false, isDefinition: true, scopeLine: 2, isOptimized: true, unit: !32, variables: !33)
!32 = distinct !DICompileUnit(language: DW_LANG_Julia, file: !3, producer: "julia", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !4)
!33 = !{!34, !36}
!34 = !DILocalVariable(name: "#self#", arg: 1, scope: !31, file: !3, line: 2, type: !35)
!35 = !DICompositeType(tag: DW_TAG_structure_type, name: "#f", align: 8, elements: !4, runtimeLang: DW_LANG_Julia, identifier: "49611")
!36 = !DILocalVariable(name: "x", arg: 2, scope: !31, file: !3, line: 2, type: !8)
(rr) n
DICompileUnit not listed in llvm.dbg.cu
!32 = distinct !DICompileUnit(language: DW_LANG_Julia, file: !3, producer: "julia", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !4)

from enzyme.jl.

vchuravy avatar vchuravy commented on August 20, 2024

I am hypothesising that the reingestion doesn't like having two DICompileUnits one for f and the other for g. We should probably just strip it.

from enzyme.jl.

wsmoses avatar wsmoses commented on August 20, 2024

It may be worthwhile looking at this again since now debug info is better handled.

from enzyme.jl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.