[Openmp-dev] CodeGen for target offloading

Johannes Doerfert via Openmp-dev openmp-dev at lists.llvm.org
Tue Aug 11 06:25:26 PDT 2020


Almost all of that is still generated in

   clang/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp

~ Johannes


On 8/11/20 6:26 AM, Abid Malik via Openmp-dev wrote:
> Hello,
>
> For some OpenMP target offloading code, I see the following at the top:
> -----
>
> ; __CLANG_OFFLOAD_BUNDLE____START__ openmp-nvptx64-nvidia-cuda
> ; ModuleID = 'if.cpp'
> source_filename = "if.cpp"
> target datalayout = "e-i64:64-i128:128-v16:16-v32:32-n16:32:64"
> target triple = "nvptx64-nvidia-cuda"
>
> %struct.ident_t = type { i32, i32, i32, i32, i8* }
> %class.omptarget_nvptx_Queue = type { [32 x
> %class.omptarget_nvptx_ThreadPrivateContext], [32 x
> %class.omptarget_nvptx_ThreadPrivateContext*], i32, [32 x i32], i32, [8 x
> i8] }
> %class.omptarget_nvptx_ThreadPrivateContext = type {
> %class.omptarget_nvptx_TeamDescr, [1024 x
> %class.omptarget_nvptx_TaskDescr], [1024 x
> %class.omptarget_nvptx_TaskDescr*], %union.anon, [1024 x i32], [1024 x
> i64], [1024 x i64], [1024 x i64], [1024 x i64], i64, [8 x i8] }
> %class.omptarget_nvptx_TeamDescr = type { %class.omptarget_nvptx_TaskDescr,
> %class.omptarget_nvptx_WorkDescr, i64, [8 x i8], [32 x
> %struct.__kmpc_data_sharing_worker_slot_static], [1 x
> %struct.__kmpc_data_sharing_master_slot_static] }
> %class.omptarget_nvptx_TaskDescr = type {
> %"struct.omptarget_nvptx_TaskDescr::SavedLoopDescr_items",
> %"struct.omptarget_nvptx_TaskDescr::TaskDescr_items",
> %class.omptarget_nvptx_TaskDescr* }
> %"struct.omptarget_nvptx_TaskDescr::SavedLoopDescr_items" = type { i64,
> i64, i64, i64, i32 }
> %"struct.omptarget_nvptx_TaskDescr::TaskDescr_items" = type { i8, i8, i16,
> i64 }
> %class.omptarget_nvptx_WorkDescr = type { %class.omptarget_nvptx_TaskDescr }
> %struct.__kmpc_data_sharing_worker_slot_static = type {
> %struct.__kmpc_data_sharing_slot*, %struct.__kmpc_data_sharing_slot*, i8*,
> i8*, [8192 x i8] }
> %struct.__kmpc_data_sharing_slot = type {
> %struct.__kmpc_data_sharing_slot*, %struct.__kmpc_data_sharing_slot*, i8*,
> i8*, [0 x i8] }
> %struct.__kmpc_data_sharing_master_slot_static = type {
> %struct.__kmpc_data_sharing_slot*, %struct.__kmpc_data_sharing_slot*, i8*,
> i8*, [256 x i8] }
> %union.anon = type { [1024 x i16] }
> %struct.DataSharingStateTy = type { [32 x
> %struct.__kmpc_data_sharing_slot*], [32 x i8*], [32 x i8*], [32 x i32] }
> %printf_args.5 = type { i32 }
>
> @"_openmp_kernel_static_glob_rd$ptr" = internal addrspace(3) global i8* null
> @.str = private unnamed_addr constant [23 x i8]
> c";unknown;unknown;0;0;;\00", align 1
> @0 = private unnamed_addr constant %struct.ident_t { i32 0, i32 2050, i32
> 3, i32 0, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i32 0,
> i32 0) }, align 8
> @1 = private unnamed_addr constant %struct.ident_t { i32 0, i32 514, i32 3,
> i32 0, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i32 0, i32
> 0) }, align 8
> @.str2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
> @2 = private unnamed_addr constant %struct.ident_t { i32 0, i32 2, i32 3,
> i32 0, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i32 0, i32
> 0) }, align 8
> @__omp_offloading_2c_19fe4918__Z4FUNCi_l7_exec_mode = weak constant i8 0
> @llvm.compiler.used = appending global [1 x i8*] [i8*
> @__omp_offloading_2c_19fe4918__Z4FUNCi_l7_exec_mode], section
> "llvm.metadata"
> @parallelLevel = external dso_local local_unnamed_addr addrspace(3) global
> [32 x i8], align 1
> @threadsInTeam = external dso_local local_unnamed_addr addrspace(3) global
> i16, align 2
> @execution_param = external dso_local local_unnamed_addr addrspace(3)
> global i32, align 4
> @usedSlotIdx = external dso_local local_unnamed_addr addrspace(3) global
> i32, align 4
> @omptarget_nvptx_device_State = external dso_local addrspace(1) global [84
> x %class.omptarget_nvptx_Queue], align 16
> @omptarget_nvptx_threadPrivateContext = external dso_local
> local_unnamed_addr addrspace(3) global
> %class.omptarget_nvptx_ThreadPrivateContext*, align 8
> @DataSharingState = external dso_local addrspace(3) global
> %struct.DataSharingStateTy, align 8
>
> ---
>
>
> Which part of the codegen is producing/responsible for this code?
>
>
>
> _______________________________________________
> Openmp-dev mailing list
> Openmp-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/openmp-dev


More information about the Openmp-dev mailing list