diff --git a/sycl-jit/common/include/Kernel.h b/sycl-jit/common/include/Kernel.h index 17e96b8bc2be8..25885c775a96d 100644 --- a/sycl-jit/common/include/Kernel.h +++ b/sycl-jit/common/include/Kernel.h @@ -380,7 +380,7 @@ struct FrozenPropertyValue { FrozenPropertyValue(std::string_view Name, uint32_t Value) : Name{Name}, IsUIntValue{true}, UIntValue{Value}, Bytes{0} {} FrozenPropertyValue(std::string_view Name, const uint8_t *Ptr, size_t Size) - : Name{Name}, IsUIntValue{false}, Bytes{Size} { + : Name{Name}, IsUIntValue{false}, UIntValue{0}, Bytes{Size} { std::memcpy(Bytes.begin(), Ptr, Size); } }; diff --git a/sycl-jit/jit-compiler/lib/translation/KernelTranslation.cpp b/sycl-jit/jit-compiler/lib/translation/KernelTranslation.cpp index f00fe2f8761b1..c0d9d3ae6ba89 100644 --- a/sycl-jit/jit-compiler/lib/translation/KernelTranslation.cpp +++ b/sycl-jit/jit-compiler/lib/translation/KernelTranslation.cpp @@ -133,8 +133,13 @@ KernelTranslator::loadKernels(llvm::LLVMContext &LLVMCtx, // read last. This could cause problems if different modules contain // definitions with the same name, but different body/content. // Check that this is not problematic. - Linker::linkModules(*Result, std::move(NewMod), - Linker::Flags::OverrideFromSrc); + const bool HasErrors = Linker::linkModules( + *Result, std::move(NewMod), Linker::Flags::OverrideFromSrc); + if (HasErrors) { + return createStringError(inconvertibleErrorCode(), + "Failed to link modules"); + } + if (AddressBits != BinInfo.AddressBits) { return createStringError( inconvertibleErrorCode(), @@ -300,9 +305,9 @@ KernelTranslator::translateToPTX(SYCLKernelInfo &KernelInfo, llvm::Module &Mod, } // FIXME: Check whether we can provide more accurate target information here - auto *TargetMachine = Target->createTargetMachine( + std::unique_ptr TargetMachine(Target->createTargetMachine( TargetTriple, CPU, Features, {}, llvm::Reloc::PIC_, std::nullopt, - llvm::CodeGenOptLevel::Default); + llvm::CodeGenOptLevel::Default)); llvm::legacy::PassManager PM; @@ -380,9 +385,9 @@ KernelTranslator::translateToAMDGCN(SYCLKernelInfo &KernelInfo, } // FIXME: Check whether we can provide more accurate target information here - auto *TargetMachine = Target->createTargetMachine( + std::unique_ptr TargetMachine(Target->createTargetMachine( TargetTriple, CPU, Features, {}, llvm::Reloc::PIC_, std::nullopt, - llvm::CodeGenOptLevel::Default); + llvm::CodeGenOptLevel::Default)); std::string AMDObj; { diff --git a/sycl-jit/passes/target/TargetFusionInfo.cpp b/sycl-jit/passes/target/TargetFusionInfo.cpp index db1f6327fe25b..0f4262707aaf7 100644 --- a/sycl-jit/passes/target/TargetFusionInfo.cpp +++ b/sycl-jit/passes/target/TargetFusionInfo.cpp @@ -458,6 +458,7 @@ class NVPTXAMDGCNTargetFusionInfoBase : public TargetFusionInfoImpl { SmallPtrSet DeletedFuncs{Funcs.begin(), Funcs.end()}; SmallVector ValidKernels; auto *OldAnnotations = LLVMMod->getNamedMetadata(MDName); + assert(OldAnnotations && "Failed to retrieve old annotations"); for (auto *Op : OldAnnotations->operands()) { if (auto *TOp = dyn_cast(Op)) { if (auto *COp = dyn_cast_if_present(