[Mlir-commits] [clang] [llvm] [mlir] [OpenMP] Migrate GPU Reductions CodeGen from Clang to OMPIRBuilder (PR #80343)

Joseph Huber llvmlistbot at llvm.org
Tue Jul 2 11:23:00 PDT 2024


jhuber6 wrote:

This patch causes the `offloading/bug51781.c` test to fail when compiled with reductions + debug information.
```console
> clang ../offload/test/offloading/bug51781.c -fopenmp -O1 --offload-arch=sm_89 -DADD_REDUCTION --offload-device-only -gline-tables-only
!dbg attachment points at wrong subprogram for function
!19 = distinct !DISubprogram(name: "__omp_offloading_10302_af88b66_main_l44", scope: !11, file: !11, line: 44, type: !20, scopeLine: 44, flags: DIFlagArtificial | DIFlagPrototyped, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition | DISPFlagOptimized, unit: !10)
ptr @__omp_offloading_10302_af88b66_main_l44
  %16 = load i32, ptr %14, align 4, !dbg !50, !tbaa !35
!50 = !DILocation(line: 44, column: 58, scope: !32)
!32 = distinct !DISubprogram(name: "__omp_offloading_10302_af88b66_main_l44_omp_outlined", scope: !11, file: !11, line: 44, type: !20, scopeLine: 44, flags: DIFlagArtificial | DIFlagPrototyped, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition | DISPFlagOptimized, unit: !10)
!32 = distinct !DISubprogram(name: "__omp_offloading_10302_af88b66_main_l44_omp_outlined", scope: !11, file: !11, line: 44, type: !20, scopeLine: 44, flags: DIFlagArtificial | DIFlagPrototyped, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition | DISPFlagOptimized, unit: !10)
!dbg attachment points at wrong subprogram for function
!19 = distinct !DISubprogram(name: "__omp_offloading_10302_af88b66_main_l44", scope: !11, file: !11, line: 44, type: !20, scopeLine: 44, flags: DIFlagArtificial | DIFlagPrototyped, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition | DISPFlagOptimized, unit: !10)
ptr @__omp_offloading_10302_af88b66_main_l44
  %14 = load i32, ptr %12, align 4, !dbg !50, !tbaa !35
!50 = !DILocation(line: 44, column: 58, scope: !32)
!32 = distinct !DISubprogram(name: "__omp_offloading_10302_af88b66_main_l44_omp_outlined", scope: !11, file: !11, line: 44, type: !20, scopeLine: 44, flags: DIFlagArtificial | DIFlagPrototyped, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition | DISPFlagOptimized, unit: !10)
!32 = distinct !DISubprogram(name: "__omp_offloading_10302_af88b66_main_l44_omp_outlined", scope: !11, file: !11, line: 44, type: !20, scopeLine: 44, flags: DIFlagArtificial | DIFlagPrototyped, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition | DISPFlagOptimized, unit: !10)
```

This test directly uses a reduction, and if I revert this patch it no longer breaks. I'm fairly confident that somewhere in this code we did not copy debug information correctly. Any clue where that might be?

https://github.com/llvm/llvm-project/pull/80343


More information about the Mlir-commits mailing list