cancel
Showing results for 
Search instead for 
Did you mean: 

PC Processors

ep-98d
Adept II

Different LLVM IR content for the same code on different Zen generation

I am getting different LLVM IR file content from two different CPUs which are AMD Ryzen 7 PRO 4750U and AMD EPYC 7513, and this is causing failure to build my application. Note that the same compilation process has been imposed on the very same code. The only difference is the CPU. Also, note that I am using OpenMPI, netcdf-fortran, BLAS and LAPACK which are all built with AOCC 4.0.0.

On 4750U I get the following content

```

; ModuleID = '/tmp/rad-e4bed5.ll'
source_filename = "/tmp/rad-e4bed5.ll"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct_rad_2_ = type <{ [216 x i8] }>
%struct_rad_0_ = type <{ [3062962528 x i8] }>

@_rad_2_ = common local_unnamed_addr global %struct_rad_2_ zeroinitializer, align 64
@_rad_0_ = common local_unnamed_addr global %struct_rad_0_ zeroinitializer, align 64

; Function Attrs: mustprogress nofree noinline norecurse nosync nounwind readnone willreturn
define float @_rad_() local_unnamed_addr #0 {
.L.entry:
ret float undef
}

attributes #0 = { mustprogress nofree noinline norecurse nosync nounwind readnone willreturn "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" }

!llvm.module.flags = !{!0, !1}

```

 

while on the EPYC 7513 I get the following

```

; ModuleID = '/tmp/rad-52dcd1.ll'
source_filename = "/tmp/rad-52dcd1.ll"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct_rad_2_ = type <{ [216 x i8] }>
%struct_rad_0_ = type <{ [42546976 x i8] }>
%struct_rad_8_ = type <{ [6783044 x i8] }>

@_rad_2_ = common local_unnamed_addr global %struct_rad_2_ zeroinitializer, align 64
@_rad_0_ = common local_unnamed_addr global %struct_rad_0_ zeroinitializer, align 64

@_rad_8_ = local_unnamed_addr global %struct_rad_8_ <{ [6783044 x i8] c"\00\00 ...... \00\00"

; Function Attrs: mustprogress nofree noinline norecurse nosync nounwind readnone willreturn
define float @_rad_() local_unnamed_addr #0 {
.L.entry:
ret float undef
}

attributes #0 = { mustprogress nofree noinline norecurse nosync nounwind readnone willreturn "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse, +sse2,+x87" }

!llvm.module.flags = !{!0, !1}

```

 

Noteable difference is the `%struct_rad_8_ = type <{ [6783044 x i8] }>` part. 4750U does not produce this, while EPYC 7513 does. I think this is causing my application to fail on its build process on 4750U. On EPYC 7513 my application builds fine. Relevant error message for this is like the following

```

ld.lld: error: undefined symbol: _rad_8_
>>> referenced by buildings_rad_walls.f90:26 (/home/rangke/archive/gsam1.4/SRC/BUILDINGS/buildings_rad_walls.f90:26)
>>> buildings_rad_walls.o:(buildings_rad_walls_)
>>> referenced by buildings_rad_walls.f90:0 (/home/rangke/archive/gsam1.4/SRC/BUILDINGS/buildings_rad_walls.f90:0)
>>> buildings_rad_walls.o:(buildings_rad_walls_)
>>> referenced by buildings_rad_walls.f90:0 (/home/rangke/archive/gsam1.4/SRC/BUILDINGS/buildings_rad_walls.f90:0)
>>> buildings_rad_walls.o:(buildings_rad_walls_)
>>> referenced 69 more times
>>> did you mean: _rad_0_
>>> defined in: rad.o
clang-14: error: linker command failed with exit code 1 (use -v to see invocation)

```

Each file compiles without any issues, but the above error message appears on the linking stage. I have used different linker (ld) and it is giving me similar error.

In my code, I don't have any variable named `_rad_8_`, and only after looking in to the LLVM IR files I found this. Is there a way to fix the problem of 4750U not generating the `_rad_8_`?

0 Likes
0 Replies