Skip to content

Instantly share code, notes, and snippets.

@lovettchris
Created December 19, 2020 01:43
Show Gist options
  • Save lovettchris/c5b9cedc909b38afbd4f6c828fdc76a8 to your computer and use it in GitHub Desktop.
Save lovettchris/c5b9cedc909b38afbd4f6c828fdc76a8 to your computer and use it in GitHub Desktop.
; ModuleID = 'ELL'
source_filename = "ELL"
target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-windows-msvc"
%TensorShape = type { i32, i32, i32 }
@ELL_context = internal unnamed_addr global i8* null, align 32
@c_0 = internal unnamed_addr constant [10 x float] [float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00], align 32
@g_0 = internal unnamed_addr global [10 x float] zeroinitializer, align 32
@0 = private unnamed_addr constant [1 x i8] zeroinitializer, align 1
@1 = private unnamed_addr constant [5 x i8] c"1000\00", align 1
@2 = private unnamed_addr constant [9 x i8] c"ancestor\00", align 1
@3 = private unnamed_addr constant [5 x i8] c"1001\00", align 1
@4 = private unnamed_addr constant [5 x i8] c"1002\00", align 1
@5 = private unnamed_addr constant [5 x i8] c"1003\00", align 1
; Function Attrs: nounwind
define dso_local void @ELL_Predict(i8* noalias %context, float* noalias nocapture readonly %input, float* noalias nocapture %output) local_unnamed_addr #0 !ell.header.declareFn !2 !ell.fn.predict !2 {
entry:
store i8* %context, i8** @ELL_context, align 32
br label %vector.body
vector.body: ; preds = %vector.body, %entry
%index = phi i64 [ 0, %entry ], [ %index.next, %vector.body ]
%0 = getelementptr [10 x float], [10 x float]* @c_0, i64 0, i64 %index
%1 = bitcast float* %0 to <8 x float>*
%wide.load = load <8 x float>, <8 x float>* %1, align 32, !noalias !3
%2 = getelementptr float, float* %input, i64 %index
%3 = bitcast float* %2 to <8 x float>*
%wide.load5 = load <8 x float>, <8 x float>* %3, align 4, !alias.scope !3
%4 = call <8 x float> @llvm.minimum.v8f32(<8 x float> %wide.load, <8 x float> %wide.load5)
%5 = getelementptr [10 x float], [10 x float]* @g_0, i64 0, i64 %index
%6 = bitcast float* %5 to <8 x float>*
store <8 x float> %4, <8 x float>* %6, align 32, !noalias !3
%index.next = add i64 %index, 8
%7 = icmp eq i64 %index, 0
br i1 %7, label %loop.body.i, label %vector.body, !llvm.loop !6
loop.body.i: ; preds = %vector.body, %loop.body.i
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %loop.body.i ], [ 8, %vector.body ]
%8 = getelementptr [10 x float], [10 x float]* @c_0, i64 0, i64 %indvars.iv.i
%9 = load float, float* %8, align 4, !noalias !3
%10 = getelementptr float, float* %input, i64 %indvars.iv.i
%11 = load float, float* %10, align 4, !alias.scope !3
%12 = tail call float @llvm.minimum.f32(float %9, float %11) #5
%13 = getelementptr [10 x float], [10 x float]* @g_0, i64 0, i64 %indvars.iv.i
store float %12, float* %13, align 4, !noalias !3
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%exitcond.i = icmp eq i64 %indvars.iv.next.i, 10
br i1 %exitcond.i, label %vector.body6, label %loop.body.i, !llvm.loop !10
vector.body6: ; preds = %loop.body.i, %vector.body6
%index10 = phi i64 [ %index.next11, %vector.body6 ], [ 0, %loop.body.i ]
%14 = getelementptr [10 x float], [10 x float]* @g_0, i64 0, i64 %index10
%15 = bitcast float* %14 to <8 x float>*
%wide.load17 = load <8 x float>, <8 x float>* %15, align 32, !noalias !12
%16 = call <8 x float> @llvm.log.v8f32(<8 x float> %wide.load17)
%17 = getelementptr float, float* %output, i64 %index10
%18 = bitcast float* %17 to <8 x float>*
store <8 x float> %16, <8 x float>* %18, align 1, !alias.scope !12
%index.next11 = add i64 %index10, 8
%19 = icmp eq i64 %index10, 0
br i1 %19, label %loop.body.i4, label %vector.body6, !llvm.loop !15
loop.body.i4: ; preds = %vector.body6, %loop.body.i4
%indvars.iv.i1 = phi i64 [ %indvars.iv.next.i2, %loop.body.i4 ], [ 8, %vector.body6 ]
%20 = getelementptr [10 x float], [10 x float]* @g_0, i64 0, i64 %indvars.iv.i1
%.0.copyload8.i = load float, float* %20, align 4, !noalias !12
%21 = tail call float @llvm.log.f32(float %.0.copyload8.i) #5
%22 = getelementptr float, float* %output, i64 %indvars.iv.i1
store float %21, float* %22, align 1, !alias.scope !12
%indvars.iv.next.i2 = add nuw nsw i64 %indvars.iv.i1, 1
%exitcond.i3 = icmp eq i64 %indvars.iv.next.i2, 10
br i1 %exitcond.i3, label %UnaryOperationNodeCodeNode_1027__0.exit, label %loop.body.i4, !llvm.loop !16
UnaryOperationNodeCodeNode_1027__0.exit: ; preds = %loop.body.i4
ret void
}
; Function Attrs: nounwind readnone speculatable
declare float @llvm.minimum.f32(float, float) #1
; Function Attrs: nounwind readnone speculatable
declare float @llvm.log.f32(float) #1
; Function Attrs: norecurse nounwind readnone
define dso_local void @ELL_Reset() local_unnamed_addr #2 !ell.header.declareFn !2 {
entry:
ret void
}
; Function Attrs: norecurse nounwind readnone
define dso_local i32 @ELL_GetInputSize(i32 %index) local_unnamed_addr #2 !ell.header.declareFn !2 {
entry:
%0 = icmp eq i32 %index, 0
%merge = select i1 %0, i32 10, i32 0
ret i32 %merge
}
; Function Attrs: norecurse nounwind readnone
define dso_local i32 @ELL_GetOutputSize(i32 %index) local_unnamed_addr #2 !ell.header.declareFn !2 {
entry:
%0 = icmp eq i32 %index, 0
%merge = select i1 %0, i32 10, i32 0
ret i32 %merge
}
; Function Attrs: norecurse nounwind readnone
define dso_local i32 @ELL_GetNumNodes() local_unnamed_addr #2 !ell.header.declareFn !2 {
entry:
ret i32 4
}
; Function Attrs: norecurse nounwind writeonly
define dso_local void @ELL_GetInputShape(i32 %index, %TensorShape* nocapture %shape) local_unnamed_addr #3 !ell.header.declareFn !2 {
entry:
%rows = getelementptr inbounds %TensorShape, %TensorShape* %shape, i64 0, i32 0
%columns = getelementptr inbounds %TensorShape, %TensorShape* %shape, i64 0, i32 1
%channels = getelementptr inbounds %TensorShape, %TensorShape* %shape, i64 0, i32 2
%0 = icmp eq i32 %index, 0
br i1 %0, label %ThenBlock0, label %ElseBlock0
ThenBlock0: ; preds = %entry
store i32 1, i32* %rows, align 4
store i32 1, i32* %columns, align 4
store i32 10, i32* %channels, align 4
ret void
ElseBlock0: ; preds = %entry
store i32 0, i32* %rows, align 4
store i32 0, i32* %columns, align 4
store i32 0, i32* %channels, align 4
ret void
}
; Function Attrs: norecurse nounwind writeonly
define dso_local void @ELL_GetOutputShape(i32 %index, %TensorShape* nocapture %shape) local_unnamed_addr #3 !ell.header.declareFn !2 {
entry:
%rows = getelementptr inbounds %TensorShape, %TensorShape* %shape, i64 0, i32 0
%columns = getelementptr inbounds %TensorShape, %TensorShape* %shape, i64 0, i32 1
%channels = getelementptr inbounds %TensorShape, %TensorShape* %shape, i64 0, i32 2
%0 = icmp eq i32 %index, 0
br i1 %0, label %ThenBlock0, label %ElseBlock0
ThenBlock0: ; preds = %entry
store i32 1, i32* %rows, align 4
store i32 1, i32* %columns, align 4
store i32 10, i32* %channels, align 4
ret void
ElseBlock0: ; preds = %entry
store i32 0, i32* %rows, align 4
store i32 0, i32* %columns, align 4
store i32 0, i32* %channels, align 4
ret void
}
; Function Attrs: norecurse nounwind readonly
define dso_local i8* @ELL_GetMetadata(i8* nocapture readonly %key) local_unnamed_addr #4 !ell.header.declareFn !2 {
entry:
br label %loop.body.i
loop.body.i: ; preds = %if.after.i, %entry
%index_0.02.i = phi i32 [ 0, %entry ], [ %11, %if.after.i ]
%0 = icmp eq i32 %index_0.02.i, 8
%1 = sext i32 %index_0.02.i to i64
%2 = getelementptr i8, i8* %key, i64 %1
%3 = load i8, i8* %2, align 1
%4 = icmp eq i8 %3, 0
%5 = and i1 %0, %4
br i1 %5, label %NoMatchBlock, label %if.after.i
if.after.i: ; preds = %loop.body.i
%6 = getelementptr [9 x i8], [9 x i8]* @2, i64 0, i64 %1
%7 = load i8, i8* %6, align 1
%8 = icmp ne i8 %3, %7
%9 = or i1 %0, %4
%10 = or i1 %9, %8
%11 = add nuw i32 %index_0.02.i, 1
br i1 %10, label %loop.body.i24, label %loop.body.i
NoMatchBlock: ; preds = %loop.body.i, %loop.body.i24, %loop.body.i19, %if.after.i15, %loop.body.i14
%merge = phi i8* [ getelementptr inbounds ([5 x i8], [5 x i8]* @5, i64 0, i64 0), %loop.body.i14 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @0, i64 0, i64 0), %if.after.i15 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @4, i64 0, i64 0), %loop.body.i19 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @3, i64 0, i64 0), %loop.body.i24 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @1, i64 0, i64 0), %loop.body.i ]
ret i8* %merge
loop.body.i24: ; preds = %if.after.i, %if.after.i25
%index_0.02.i23 = phi i32 [ %23, %if.after.i25 ], [ 0, %if.after.i ]
%12 = icmp eq i32 %index_0.02.i23, 8
%13 = sext i32 %index_0.02.i23 to i64
%14 = getelementptr i8, i8* %key, i64 %13
%15 = load i8, i8* %14, align 1
%16 = icmp eq i8 %15, 0
%17 = and i1 %12, %16
br i1 %17, label %NoMatchBlock, label %if.after.i25
if.after.i25: ; preds = %loop.body.i24
%18 = getelementptr [9 x i8], [9 x i8]* @2, i64 0, i64 %13
%19 = load i8, i8* %18, align 1
%20 = icmp ne i8 %15, %19
%21 = or i1 %12, %16
%22 = or i1 %21, %20
%23 = add nuw i32 %index_0.02.i23, 1
br i1 %22, label %loop.body.i19, label %loop.body.i24
loop.body.i19: ; preds = %if.after.i25, %if.after.i20
%index_0.02.i18 = phi i32 [ %35, %if.after.i20 ], [ 0, %if.after.i25 ]
%24 = icmp eq i32 %index_0.02.i18, 8
%25 = sext i32 %index_0.02.i18 to i64
%26 = getelementptr i8, i8* %key, i64 %25
%27 = load i8, i8* %26, align 1
%28 = icmp eq i8 %27, 0
%29 = and i1 %24, %28
br i1 %29, label %NoMatchBlock, label %if.after.i20
if.after.i20: ; preds = %loop.body.i19
%30 = getelementptr [9 x i8], [9 x i8]* @2, i64 0, i64 %25
%31 = load i8, i8* %30, align 1
%32 = icmp ne i8 %27, %31
%33 = or i1 %24, %28
%34 = or i1 %33, %32
%35 = add nuw i32 %index_0.02.i18, 1
br i1 %34, label %loop.body.i14, label %loop.body.i19
loop.body.i14: ; preds = %if.after.i20, %if.after.i15
%index_0.02.i13 = phi i32 [ %47, %if.after.i15 ], [ 0, %if.after.i20 ]
%36 = icmp eq i32 %index_0.02.i13, 8
%37 = sext i32 %index_0.02.i13 to i64
%38 = getelementptr i8, i8* %key, i64 %37
%39 = load i8, i8* %38, align 1
%40 = icmp eq i8 %39, 0
%41 = and i1 %36, %40
br i1 %41, label %NoMatchBlock, label %if.after.i15
if.after.i15: ; preds = %loop.body.i14
%42 = getelementptr [9 x i8], [9 x i8]* @2, i64 0, i64 %37
%43 = load i8, i8* %42, align 1
%44 = icmp ne i8 %39, %43
%45 = or i1 %36, %40
%46 = or i1 %45, %44
%47 = add nuw i32 %index_0.02.i13, 1
br i1 %46, label %NoMatchBlock, label %loop.body.i14
}
; Function Attrs: nounwind
define dso_local void @ELL_Predict_dispatch(i8* %context, i8** nocapture readonly %inputs, i8** nocapture readonly %outputs) local_unnamed_addr #0 {
entry:
%0 = bitcast i8** %inputs to float**
%1 = load float*, float** %0, align 8
%2 = bitcast i8** %outputs to float**
%3 = load float*, float** %2, align 8
store i8* %context, i8** @ELL_context, align 32, !noalias !17
br label %vector.body
vector.body: ; preds = %vector.body, %entry
%index = phi i64 [ 0, %entry ], [ %index.next, %vector.body ]
%4 = getelementptr [10 x float], [10 x float]* @c_0, i64 0, i64 %index
%5 = bitcast float* %4 to <8 x float>*
%wide.load = load <8 x float>, <8 x float>* %5, align 32, !noalias !22
%6 = getelementptr float, float* %1, i64 %index
%7 = bitcast float* %6 to <8 x float>*
%wide.load1 = load <8 x float>, <8 x float>* %7, align 4, !alias.scope !25, !noalias !26
%8 = call <8 x float> @llvm.minimum.v8f32(<8 x float> %wide.load, <8 x float> %wide.load1)
%9 = getelementptr [10 x float], [10 x float]* @g_0, i64 0, i64 %index
%10 = bitcast float* %9 to <8 x float>*
store <8 x float> %8, <8 x float>* %10, align 32, !noalias !22
%index.next = add i64 %index, 8
%11 = icmp eq i64 %index, 0
br i1 %11, label %loop.body.i.i, label %vector.body, !llvm.loop !27
loop.body.i.i: ; preds = %vector.body, %loop.body.i.i
%indvars.iv.i.i = phi i64 [ %indvars.iv.next.i.i, %loop.body.i.i ], [ 8, %vector.body ]
%12 = getelementptr [10 x float], [10 x float]* @c_0, i64 0, i64 %indvars.iv.i.i
%13 = load float, float* %12, align 4, !noalias !22
%14 = getelementptr float, float* %1, i64 %indvars.iv.i.i
%15 = load float, float* %14, align 4, !alias.scope !25, !noalias !26
%16 = tail call float @llvm.minimum.f32(float %13, float %15) #5
%17 = getelementptr [10 x float], [10 x float]* @g_0, i64 0, i64 %indvars.iv.i.i
store float %16, float* %17, align 4, !noalias !22
%indvars.iv.next.i.i = add nuw nsw i64 %indvars.iv.i.i, 1
%exitcond.i.i = icmp eq i64 %indvars.iv.next.i.i, 10
br i1 %exitcond.i.i, label %vector.body2, label %loop.body.i.i, !llvm.loop !28
vector.body2: ; preds = %loop.body.i.i, %vector.body2
%index6 = phi i64 [ %index.next7, %vector.body2 ], [ 0, %loop.body.i.i ]
%18 = getelementptr [10 x float], [10 x float]* @g_0, i64 0, i64 %index6
%19 = bitcast float* %18 to <8 x float>*
%wide.load13 = load <8 x float>, <8 x float>* %19, align 32, !noalias !29
%20 = call <8 x float> @llvm.log.v8f32(<8 x float> %wide.load13)
%21 = getelementptr float, float* %3, i64 %index6
%22 = bitcast float* %21 to <8 x float>*
store <8 x float> %20, <8 x float>* %22, align 1, !alias.scope !32, !noalias !33
%index.next7 = add i64 %index6, 8
%23 = icmp eq i64 %index6, 0
br i1 %23, label %loop.body.i4.i, label %vector.body2, !llvm.loop !34
loop.body.i4.i: ; preds = %vector.body2, %loop.body.i4.i
%indvars.iv.i1.i = phi i64 [ %indvars.iv.next.i2.i, %loop.body.i4.i ], [ 8, %vector.body2 ]
%24 = getelementptr [10 x float], [10 x float]* @g_0, i64 0, i64 %indvars.iv.i1.i
%.0.copyload8.i.i = load float, float* %24, align 4, !noalias !29
%25 = tail call float @llvm.log.f32(float %.0.copyload8.i.i) #5
%26 = getelementptr float, float* %3, i64 %indvars.iv.i1.i
store float %25, float* %26, align 1, !alias.scope !32, !noalias !33
%indvars.iv.next.i2.i = add nuw nsw i64 %indvars.iv.i1.i, 1
%exitcond.i3.i = icmp eq i64 %indvars.iv.next.i2.i, 10
br i1 %exitcond.i3.i, label %ELL_Predict.exit, label %loop.body.i4.i, !llvm.loop !35
ELL_Predict.exit: ; preds = %loop.body.i4.i
ret void
}
; Function Attrs: nounwind readnone speculatable
declare <8 x float> @llvm.minimum.v8f32(<8 x float>, <8 x float>) #1
; Function Attrs: nounwind readnone speculatable
declare <8 x float> @llvm.log.v8f32(<8 x float>) #1
attributes #0 = { nounwind "target-cpu"="znver1" "target-features"="+sse2,+cx16,+sahf,+sha,+prfchw,+bmi2,+fsgsbase,+xsavec,+popcnt,+aes,+xsaves,+clwb,+clzero,+mmx,+rdpid,+rdseed,+sse4a,+clflushopt,+xsave,+64bit,+avx,+fma,+bmi,+rdrnd,+sse4.1,+sse4.2,+avx2,+sse,+lzcnt,+pclmul,+f16c,+ssse3,+cmov,+movbe,+xsaveopt,+adx,+sse3" }
attributes #1 = { nounwind readnone speculatable "target-cpu"="znver1" "target-features"="+sse2,+cx16,+sahf,+sha,+prfchw,+bmi2,+fsgsbase,+xsavec,+popcnt,+aes,+xsaves,+clwb,+clzero,+mmx,+rdpid,+rdseed,+sse4a,+clflushopt,+xsave,+64bit,+avx,+fma,+bmi,+rdrnd,+sse4.1,+sse4.2,+avx2,+sse,+lzcnt,+pclmul,+f16c,+ssse3,+cmov,+movbe,+xsaveopt,+adx,+sse3" }
attributes #2 = { norecurse nounwind readnone "target-cpu"="znver1" "target-features"="+sse2,+cx16,+sahf,+sha,+prfchw,+bmi2,+fsgsbase,+xsavec,+popcnt,+aes,+xsaves,+clwb,+clzero,+mmx,+rdpid,+rdseed,+sse4a,+clflushopt,+xsave,+64bit,+avx,+fma,+bmi,+rdrnd,+sse4.1,+sse4.2,+avx2,+sse,+lzcnt,+pclmul,+f16c,+ssse3,+cmov,+movbe,+xsaveopt,+adx,+sse3" }
attributes #3 = { norecurse nounwind writeonly "target-cpu"="znver1" "target-features"="+sse2,+cx16,+sahf,+sha,+prfchw,+bmi2,+fsgsbase,+xsavec,+popcnt,+aes,+xsaves,+clwb,+clzero,+mmx,+rdpid,+rdseed,+sse4a,+clflushopt,+xsave,+64bit,+avx,+fma,+bmi,+rdrnd,+sse4.1,+sse4.2,+avx2,+sse,+lzcnt,+pclmul,+f16c,+ssse3,+cmov,+movbe,+xsaveopt,+adx,+sse3" }
attributes #4 = { norecurse nounwind readonly "target-cpu"="znver1" "target-features"="+sse2,+cx16,+sahf,+sha,+prfchw,+bmi2,+fsgsbase,+xsavec,+popcnt,+aes,+xsaves,+clwb,+clzero,+mmx,+rdpid,+rdseed,+sse4a,+clflushopt,+xsave,+64bit,+avx,+fma,+bmi,+rdrnd,+sse4.1,+sse4.2,+avx2,+sse,+lzcnt,+pclmul,+f16c,+ssse3,+cmov,+movbe,+xsaveopt,+adx,+sse3" }
attributes #5 = { nounwind }
!ell.type.fields.TensorShape = !{!0}
!ell.header.declareType = !{!1}
!0 = !{!"rows", !"columns", !"channels"}
!1 = !{!"TensorShape"}
!2 = !{!""}
!3 = !{!4}
!4 = distinct !{!4, !5, !"_Node__BinaryOperationNode_float__in_10_10_out_10_Node_1026: %input1"}
!5 = distinct !{!5, !"_Node__BinaryOperationNode_float__in_10_10_out_10_Node_1026"}
!6 = distinct !{!6, !7, !8, !9}
!7 = !{!"llvm.loop.vectorize.enable", i1 true}
!8 = !{!"llvm.loop.disable_nonforced"}
!9 = !{!"llvm.loop.isvectorized", i32 1}
!10 = distinct !{!10, !7, !8, !11, !9}
!11 = !{!"llvm.loop.unroll.runtime.disable"}
!12 = !{!13}
!13 = distinct !{!13, !14, !"UnaryOperationNodeCodeNode_1027__0: %arg1"}
!14 = distinct !{!14, !"UnaryOperationNodeCodeNode_1027__0"}
!15 = distinct !{!15, !7, !8, !9}
!16 = distinct !{!16, !7, !8, !11, !9}
!17 = !{!18, !20, !21}
!18 = distinct !{!18, !19, !"ELL_Predict: %context"}
!19 = distinct !{!19, !"ELL_Predict"}
!20 = distinct !{!20, !19, !"ELL_Predict: %input"}
!21 = distinct !{!21, !19, !"ELL_Predict: %output"}
!22 = !{!23, !20, !21}
!23 = distinct !{!23, !24, !"_Node__BinaryOperationNode_float__in_10_10_out_10_Node_1026: %input1"}
!24 = distinct !{!24, !"_Node__BinaryOperationNode_float__in_10_10_out_10_Node_1026"}
!25 = !{!23, !20}
!26 = !{!18, !21}
!27 = distinct !{!27, !7, !8, !9}
!28 = distinct !{!28, !7, !8, !11, !9}
!29 = !{!30, !20, !21}
!30 = distinct !{!30, !31, !"UnaryOperationNodeCodeNode_1027__0: %arg1"}
!31 = distinct !{!31, !"UnaryOperationNodeCodeNode_1027__0"}
!32 = !{!30, !21}
!33 = !{!18, !20}
!34 = distinct !{!34, !7, !8, !9}
!35 = distinct !{!35, !7, !8, !11, !9}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment