diff --git a/sycl-fusion/jit-compiler/lib/fusion/FusionHelper.cpp b/sycl-fusion/jit-compiler/lib/fusion/FusionHelper.cpp index d3a54b19979d6..07d710a864892 100644 --- a/sycl-fusion/jit-compiler/lib/fusion/FusionHelper.cpp +++ b/sycl-fusion/jit-compiler/lib/fusion/FusionHelper.cpp @@ -64,6 +64,7 @@ Expected> helper::FusionHelper::addFusedKernel( // correct name and signature only during the fusion pass. auto *F = Function::Create(FT, GlobalValue::LinkageTypes::ExternalLinkage, "fused_kernel", *NewMod); + F->IsNewDbgInfoFormat = UseNewDbgInfoFormat; // Attach metadata to the function stub. // The metadata specifies the name of the fused kernel (as the diff --git a/sycl-fusion/passes/cleanup/Cleanup.cpp b/sycl-fusion/passes/cleanup/Cleanup.cpp index e69a2f24abc2f..239255092cfe2 100644 --- a/sycl-fusion/passes/cleanup/Cleanup.cpp +++ b/sycl-fusion/passes/cleanup/Cleanup.cpp @@ -51,6 +51,7 @@ static Function *createMaskedFunction(const BitVector &Mask, Function *F, FunctionType *NFTy = createMaskedFunctionType(Mask, F->getFunctionType()); Function *NF = Function::Create(NFTy, F->getLinkage(), F->getAddressSpace(), F->getName(), F->getParent()); + NF->IsNewDbgInfoFormat = UseNewDbgInfoFormat; copyAttributesFrom(Mask, NF, F); NF->setComdat(F->getComdat()); NF->takeName(F); diff --git a/sycl-fusion/passes/internalization/Internalization.cpp b/sycl-fusion/passes/internalization/Internalization.cpp index 8a36106c0d48f..eb93baa7389ac 100644 --- a/sycl-fusion/passes/internalization/Internalization.cpp +++ b/sycl-fusion/passes/internalization/Internalization.cpp @@ -564,8 +564,11 @@ getPromotedFunctionDeclaration(Function *F, ArrayRef PromInfos, // declaration. FunctionType *NewTy = ChangeTypes ? getPromotedFunctionType(Ty, PromInfos, AS) : Ty; - return Function::Create(NewTy, F->getLinkage(), F->getAddressSpace(), - F->getName(), F->getParent()); + Function *NewF = + Function::Create(NewTy, F->getLinkage(), F->getAddressSpace(), + F->getName(), F->getParent()); + NewF->IsNewDbgInfoFormat = UseNewDbgInfoFormat; + return NewF; } /// diff --git a/sycl-fusion/passes/kernel-fusion/Builtins.cpp b/sycl-fusion/passes/kernel-fusion/Builtins.cpp index af85ab5897fc6..8fdcb49769c95 100644 --- a/sycl-fusion/passes/kernel-fusion/Builtins.cpp +++ b/sycl-fusion/passes/kernel-fusion/Builtins.cpp @@ -125,6 +125,7 @@ getOrCreateGetGlobalLinearIDFunction(const TargetFusionInfo &TargetInfo, auto *Ty = FunctionType::get(Builder.getIntNTy(N), /*isVarArg*/ false); F = Function::Create(Ty, Function::LinkageTypes::InternalLinkage, Name, M); TargetInfo.setMetadataForGeneratedFunction(F); + F->IsNewDbgInfoFormat = UseNewDbgInfoFormat; auto *EntryBlock = BasicBlock::Create(Context, "entry", F); Builder.SetInsertPoint(EntryBlock); diff --git a/sycl-fusion/passes/kernel-fusion/SYCLKernelFusion.cpp b/sycl-fusion/passes/kernel-fusion/SYCLKernelFusion.cpp index c5b4d04d2cfcd..1057680ddf5ad 100644 --- a/sycl-fusion/passes/kernel-fusion/SYCLKernelFusion.cpp +++ b/sycl-fusion/passes/kernel-fusion/SYCLKernelFusion.cpp @@ -473,6 +473,7 @@ Error SYCLKernelFusion::fuseKernel( Function *FusedFunction = Function::createWithDefaultAttr( FT, GlobalValue::LinkageTypes::ExternalLinkage, M.getDataLayout().getProgramAddressSpace(), KernelName->getString(), &M); + FusedFunction->IsNewDbgInfoFormat = UseNewDbgInfoFormat; { auto DefaultAttr = FusedFunction->getAttributes(); // Add uniform function attributes, i.e., attributes with identical value on diff --git a/sycl-fusion/passes/target/TargetFusionInfo.cpp b/sycl-fusion/passes/target/TargetFusionInfo.cpp index b7b3495338782..dd0c8acddf031 100644 --- a/sycl-fusion/passes/target/TargetFusionInfo.cpp +++ b/sycl-fusion/passes/target/TargetFusionInfo.cpp @@ -18,11 +18,14 @@ #include "llvm/IR/Instructions.h" #include "llvm/IR/IntrinsicsAMDGPU.h" #include "llvm/IR/IntrinsicsNVPTX.h" +#include "llvm/Support/CommandLine.h" #include "llvm/Support/raw_ostream.h" #include "llvm/TargetParser/Triple.h" using namespace jit_compiler; +extern llvm::cl::opt UseNewDbgInfoFormat; + template static ForwardIt mapArrayLookup(ForwardIt Begin, ForwardIt End, const KeyTy &Key) { @@ -227,6 +230,7 @@ class SPIRVTargetFusionInfo : public TargetFusionInfoImpl { F->setAttributes( AttributeList::get(LLVMMod->getContext(), FnAttrs, {}, {})); F->setCallingConv(CallingConv::SPIR_FUNC); + F->IsNewDbgInfoFormat = UseNewDbgInfoFormat; } // See @@ -393,6 +397,7 @@ class SPIRVTargetFusionInfo : public TargetFusionInfoImpl { Attribute::get(Ctx, Attribute::AttrKind::NoUnwind)}), {}, {})); F->setCallingConv(CallingConv::SPIR_FUNC); + F->IsNewDbgInfoFormat = UseNewDbgInfoFormat; } auto *Call = Builder.CreateCall(F, {Builder.getInt32(Idx)}); @@ -415,6 +420,7 @@ class SPIRVTargetFusionInfo : public TargetFusionInfoImpl { /*isVarArg*/ false); auto *F = Function::Create(Ty, Function::InternalLinkage, Name, *M); setMetadataForGeneratedFunction(F); + F->IsNewDbgInfoFormat = UseNewDbgInfoFormat; auto *EntryBlock = BasicBlock::Create(Ctx, "entry", F); Builder.SetInsertPoint(EntryBlock); @@ -559,6 +565,7 @@ class NVPTXAMDGCNTargetFusionInfoBase : public TargetFusionInfoImpl { /*isVarArg*/ false); F = Function::Create(Ty, Function::InternalLinkage, GetGlobalIDName, M); setMetadataForGeneratedFunction(F); + F->IsNewDbgInfoFormat = UseNewDbgInfoFormat; auto *EntryBlock = BasicBlock::Create(Builder.getContext(), "entry", F); Builder.SetInsertPoint(EntryBlock); @@ -618,6 +625,7 @@ class NVPTXAMDGCNTargetFusionInfoBase : public TargetFusionInfoImpl { /*isVarArg*/ false); auto *F = Function::Create(FTy, Function::InternalLinkage, Name, *M); setMetadataForGeneratedFunction(F); + F->IsNewDbgInfoFormat = UseNewDbgInfoFormat; auto *EntryBlock = BasicBlock::Create(Ctx, "entry", F); Builder.SetInsertPoint(EntryBlock); @@ -635,6 +643,7 @@ class NVPTXAMDGCNTargetFusionInfoBase : public TargetFusionInfoImpl { auto *FTy = FunctionType::get(Builder.getInt32Ty(), /*isVarArg*/ false); auto *F = Function::Create(FTy, Function::InternalLinkage, Name, *M); setMetadataForGeneratedFunction(F); + F->IsNewDbgInfoFormat = UseNewDbgInfoFormat; auto *EntryBlock = BasicBlock::Create(Ctx, "entry", F); Builder.SetInsertPoint(EntryBlock);