From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id A1A4913835B for ; Thu, 10 Jun 2021 00:51:43 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id B6256E0929; Thu, 10 Jun 2021 00:51:42 +0000 (UTC) Received: from smtp.gentoo.org (dev.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 83095E0920 for ; Thu, 10 Jun 2021 00:51:42 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id CF942335D9A for ; Thu, 10 Jun 2021 00:51:40 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 287A879B for ; Thu, 10 Jun 2021 00:51:39 +0000 (UTC) From: "Sam James" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" Message-ID: <1623284356.7da3d02dd4d346906f0bdf7cd0df04f542706bb8.sam@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: media-libs/osl/, media-libs/osl/files/ X-VCS-Repository: repo/gentoo X-VCS-Files: media-libs/osl/Manifest media-libs/osl/files/osl-1.12.0.2-llvm-11.patch media-libs/osl/files/osl-1.12.0.2-llvm-12.patch media-libs/osl/osl-1.12.0.2.ebuild X-VCS-Directories: media-libs/osl/files/ media-libs/osl/ X-VCS-Committer: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: 7da3d02dd4d346906f0bdf7cd0df04f542706bb8 X-VCS-Branch: master Date: Thu, 10 Jun 2021 00:51:39 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 7d71d80d-15c3-4a19-bbfb-7565b7e4d75e X-Archives-Hash: aeab581e27fae1fc4f37ef2b06aaa19d commit: 7da3d02dd4d346906f0bdf7cd0df04f542706bb8 Author: Sebastian Parborg gmail com> AuthorDate: Tue Apr 27 23:42:58 2021 +0000 Commit: Sam James gentoo org> CommitDate: Thu Jun 10 00:19:16 2021 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7da3d02d media-libs/osl: bump to 1.12.0.2 Signed-off-by: Sebastian Parborg gmail.com> Signed-off-by: Sam James gentoo.org> media-libs/osl/Manifest | 1 + media-libs/osl/files/osl-1.12.0.2-llvm-11.patch | 29 +++ media-libs/osl/files/osl-1.12.0.2-llvm-12.patch | 240 ++++++++++++++++++++++++ media-libs/osl/osl-1.12.0.2.ebuild | 88 +++++++++ 4 files changed, 358 insertions(+) diff --git a/media-libs/osl/Manifest b/media-libs/osl/Manifest index db1eb09c70c..d880f7d1d0f 100644 --- a/media-libs/osl/Manifest +++ b/media-libs/osl/Manifest @@ -1,2 +1,3 @@ DIST osl-1.10.13.tar.gz 13551733 BLAKE2B 63b687ec46bd5334a7d0c00cfa5bf5243003e16adf2637fba648a75f98c10103c7c4b5fa1d091ab43b0929f85523b0fa79589eca56686490ee61c48069593767 SHA512 bc39fcf80878160807e35c52654a2993a7d33b3ab2fbf567ec50d0b23636a19064830afab5734f1e39276c77e843bbfe1d6b10a64fd4ebe69b17c8faa5378201 DIST osl-1.11.9.0.tar.gz 14137334 BLAKE2B db68cb77d6af56e711b897371a4fe9386bf1a62625f9fa04012e9ec22346933fe3b0112301a8ad17ac6dd9c01c2a8e00c6d6e557d947870fd39bb3dec1443fd8 SHA512 f93bce0b29ff2da022372d81f2709c7db68e011c07c346b679c4b5ce05425f7eda8904779d7ea460817639e6be78a8c77272d71a3ffa8b068cfaab7572eb2e65 +DIST osl-1.12.0.2.tar.gz 16205315 BLAKE2B 543d120e981f093c121b4abb4c36d7d8c127555c8986df931a3040136e3ae3d84d602d73395604cd492f8d192e408f585cd6579fe6283c974778f0b99092985d SHA512 cdcd1fb348f6f2f1f889ed1895bac545e10b73e700959bc09b1df2a40cd86e69ba43a1dfaf26dedaec9c23aa17b74428d4bccc9cf7f4d27ae2fc5152adb6c010 diff --git a/media-libs/osl/files/osl-1.12.0.2-llvm-11.patch b/media-libs/osl/files/osl-1.12.0.2-llvm-11.patch new file mode 100644 index 00000000000..a47bcd4e47d --- /dev/null +++ b/media-libs/osl/files/osl-1.12.0.2-llvm-11.patch @@ -0,0 +1,29 @@ +From 84c26c0baab8f071270d0fef23175c24d738c73c Mon Sep 17 00:00:00 2001 +From: Brecht Van Lommel +Date: Mon, 19 Apr 2021 13:49:22 +0200 +Subject: [PATCH] Fix crash generating closure functions calls with LLVM 11 + +Generating code for prepare_closure and gen_closure was crashing. +The code now matches the implementation of the removed LLVM function. + +Signed-off-by: Brecht Van Lommel +--- + src/liboslexec/llvm_util.cpp | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/src/liboslexec/llvm_util.cpp b/src/liboslexec/llvm_util.cpp +index 445f64000..3d468de27 100644 +--- a/src/liboslexec/llvm_util.cpp ++++ b/src/liboslexec/llvm_util.cpp +@@ -3430,8 +3430,9 @@ LLVM_Util::call_function (llvm::Value *func, cspan args) + #endif + //llvm_gen_debug_printf (std::string("start ") + std::string(name)); + #if OSL_LLVM_VERSION >= 110 +- OSL_DASSERT(llvm::isa(func)); +- llvm::Value *r = builder().CreateCall(llvm::cast(func), llvm::ArrayRef(args.data(), args.size())); ++ llvm::Value* r = builder().CreateCall( ++ llvm::cast(func->getType()->getPointerElementType()), func, ++ llvm::ArrayRef(args.data(), args.size())); + #else + llvm::Value *r = builder().CreateCall (func, llvm::ArrayRef(args.data(), args.size())); + #endif diff --git a/media-libs/osl/files/osl-1.12.0.2-llvm-12.patch b/media-libs/osl/files/osl-1.12.0.2-llvm-12.patch new file mode 100644 index 00000000000..dcf9ac863f7 --- /dev/null +++ b/media-libs/osl/files/osl-1.12.0.2-llvm-12.patch @@ -0,0 +1,240 @@ +commit f76ea6220a5f0d59f5f43d3d6d526f1fd09b90f7 +Author: Euan Haahr +Date: Fri Feb 5 22:51:14 2021 +0000 + + Various fixes for LLVM 12 compatibility (1351) + + Removed use of options.PrintMachineCode since this has been removed as + of llvm 12. Converted uses of DebugLoc::get to DILocation::get since + it has been deprecated and removed as of llvm 12. + + PrintMachine code will only be used if llvm is lower than version 12. + TODO: Needs to be re-added in the new way for LLVM12. (LG just doesn't + have time to figure this out right now.) + + Pass adjustment as various things have been deprecated or changed + names. (LG) + + Signed-off-by: Euan Haahr + Signed-off-by: Larry Gritz + +diff --git a/src/liboslexec/llvm_passes.h b/src/liboslexec/llvm_passes.h +index 4ec3489c..7c14fc76 100644 +--- a/src/liboslexec/llvm_passes.h ++++ b/src/liboslexec/llvm_passes.h +@@ -73,9 +73,14 @@ public: + // 16 bit and 32 bit native mask representation to be passed as a + // livein. + m_native_mask_type = llvm::FixedVectorType::get(llvm_type_int32, WidthT); ++# if OSL_LLVM_VERSION >= 112 ++ m_wide_zero_initializer = llvm::ConstantDataVector::getSplat(WidthT, ++ llvm::ConstantInt::get(M.getContext(), llvm::APInt(32,0))); ++# else + m_wide_zero_initializer = llvm::ConstantVector::getSplat( + llvm::ElementCount(WidthT, false), + llvm::ConstantInt::get (M.getContext(), llvm::APInt(32,0))); ++# endif + #else + m_llvm_mask_type = llvm::VectorType::get(llvm_type_bool, WidthT); + m_native_mask_type = llvm::VectorType::get(llvm_type_int32, WidthT); +@@ -341,9 +346,8 @@ public: + // of the mask promotion will always be correct here. Should 16 bit + // support be needed, this pass could be extended. + m_native_mask_type = llvm::FixedVectorType::get(llvm_type_int32, WidthT); +- m_wide_zero_initializer = llvm::ConstantVector::getSplat( +- llvm::ElementCount(WidthT, false), +- llvm::ConstantInt::get (M.getContext(), llvm::APInt(32,0))); ++ m_wide_zero_initializer = llvm::ConstantDataVector::getSplat(WidthT, ++ llvm::ConstantInt::get(M.getContext(), llvm::APInt(32,0))); + #else + m_llvm_mask_type = llvm::VectorType::get(llvm_type_bool, WidthT); + m_native_mask_type = llvm::VectorType::get(llvm_type_int32, WidthT); +diff --git a/src/liboslexec/llvm_util.cpp b/src/liboslexec/llvm_util.cpp +index fed8c5ec..b2a02f61 100644 +--- a/src/liboslexec/llvm_util.cpp ++++ b/src/liboslexec/llvm_util.cpp +@@ -20,6 +20,7 @@ + #include "llvm_passes.h" + + #include ++#include + #include + #include + #include +@@ -59,6 +60,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -74,10 +76,9 @@ + #include + #include + +- +-#include +-#include +-#include ++#if OSL_LLVM_VERSION >= 120 ++#include ++#endif + + // additional includes for PTX generation + #include +@@ -129,6 +130,11 @@ static bool setup_done = false; + static std::unique_ptr >> jitmm_hold; + static int jit_mem_hold_users = 0; + ++ ++#if OSL_LLVM_VERSION >= 120 ++llvm::raw_os_ostream raw_cout(std::cout); ++#endif ++ + }; // end anon namespace + + +@@ -701,7 +707,8 @@ LLVM_Util::debug_pop_function() + // that has been finalized, point it back to the compilation unit + OSL_ASSERT(m_builder); + OSL_ASSERT(m_builder->getCurrentDebugLocation().get() != nullptr); +- m_builder->SetCurrentDebugLocation(llvm::DebugLoc::get(static_cast(1), ++ m_builder->SetCurrentDebugLocation(llvm::DILocation::get(getCurrentDebugScope()->getContext(), ++ static_cast(1), + static_cast(0), /* column? we don't know it, may be worth tracking through osl->oso*/ + getCurrentDebugScope())); + +@@ -776,7 +783,8 @@ LLVM_Util::debug_set_location(ustring sourcefile, int sourceline) + } + if (newDebugLocation) { + llvm::DebugLoc debug_location = +- llvm::DebugLoc::get(static_cast(sourceline), ++ llvm::DILocation::get(sp->getContext(), ++ static_cast(sourceline), + static_cast(0), /* column? we don't know it, may be worth tracking through osl->oso*/ + sp, + inlineSite); +@@ -958,7 +966,8 @@ LLVM_Util::new_builder (llvm::BasicBlock *block) + m_builder = new IRBuilder (block); + if (this->debug_is_enabled()) { + OSL_ASSERT(getCurrentDebugScope()); +- m_builder->SetCurrentDebugLocation(llvm::DebugLoc::get(static_cast(1), ++ m_builder->SetCurrentDebugLocation(llvm::DILocation::get(getCurrentDebugScope()->getContext(), ++ static_cast(1), + static_cast(0), /* column? we don't know it, may be worth tracking through osl->oso*/ + getCurrentDebugScope())); + } +@@ -1386,7 +1395,13 @@ LLVM_Util::make_jit_execengine (std::string *err, + options.RelaxELFRelocations = false; + //options.DebuggerTuning = llvm::DebuggerKind::GDB; + ++ // TODO: Find equivalent function for PrintMachineCode post LLVM 12 ++#if OSL_LLVM_VERSION < 120 ++ // This option disappeared from the TargetOptions struct in LLVM 12. ++ // It is instead accomplished with a MachineFunctionPrinterPass. + options.PrintMachineCode = dumpasm(); ++#endif ++ + engine_builder.setTargetOptions(options); + + detect_cpu_features(requestedISA, !jit_fma()); +@@ -1715,14 +1730,14 @@ LLVM_Util::setup_optimization_passes (int optlevel, bool target_host) + + mpm.add(llvm::createReassociatePass()); + mpm.add(llvm::createConstantPropagationPass()); +- mpm.add(llvm::createDeadInstEliminationPass()); ++ mpm.add(llvm::createDeadCodeEliminationPass()); + mpm.add(llvm::createCFGSimplificationPass()); + + mpm.add(llvm::createPromoteMemoryToRegisterPass()); + mpm.add(llvm::createAggressiveDCEPass()); + + mpm.add(llvm::createInstructionCombiningPass()); +- mpm.add(llvm::createDeadInstEliminationPass()); ++ mpm.add(llvm::createDeadCodeEliminationPass()); + + mpm.add(llvm::createJumpThreadingPass()); + mpm.add(llvm::createSROAPass()); +@@ -1746,8 +1761,10 @@ LLVM_Util::setup_optimization_passes (int optlevel, bool target_host) + + // Eliminate and remove as much as possible up front + mpm.add(llvm::createReassociatePass()); ++#if OSL_LLVM_VERSION < 120 + mpm.add(llvm::createConstantPropagationPass()); +- mpm.add(llvm::createDeadInstEliminationPass()); ++#endif ++ mpm.add(llvm::createDeadCodeEliminationPass()); + mpm.add(llvm::createCFGSimplificationPass()); + + mpm.add(llvm::createPromoteMemoryToRegisterPass()); +@@ -1784,7 +1801,7 @@ LLVM_Util::setup_optimization_passes (int optlevel, bool target_host) + mpm.add(llvm::createInstructionCombiningPass()); + + mpm.add(llvm::createPromoteMemoryToRegisterPass()); +- mpm.add(llvm::createDeadInstEliminationPass()); ++ mpm.add(llvm::createDeadCodeEliminationPass()); + + mpm.add(llvm::createGlobalDCEPass()); + mpm.add(llvm::createConstantMergePass()); +@@ -1803,8 +1820,10 @@ LLVM_Util::setup_optimization_passes (int optlevel, bool target_host) + mpm.add(llvm::createLowerExpectIntrinsicPass()); + + mpm.add(llvm::createReassociatePass()); ++#if OSL_LLVM_VERSION < 120 + mpm.add(llvm::createConstantPropagationPass()); +- mpm.add(llvm::createDeadInstEliminationPass()); ++#endif ++ mpm.add(llvm::createDeadCodeEliminationPass()); + mpm.add(llvm::createCFGSimplificationPass()); + + mpm.add(llvm::createPromoteMemoryToRegisterPass()); +@@ -1814,7 +1833,7 @@ LLVM_Util::setup_optimization_passes (int optlevel, bool target_host) + // optimizations, should attempt to reduce the number of times it is + // executed, if at all + mpm.add(llvm::createInstructionCombiningPass()); +- mpm.add(llvm::createDeadInstEliminationPass()); ++ mpm.add(llvm::createDeadCodeEliminationPass()); + + mpm.add(llvm::createSROAPass()); + mpm.add(llvm::createInstructionCombiningPass()); +@@ -1822,7 +1841,16 @@ LLVM_Util::setup_optimization_passes (int optlevel, bool target_host) + mpm.add(llvm::createPromoteMemoryToRegisterPass()); + mpm.add(llvm::createGlobalOptimizerPass()); + mpm.add(llvm::createReassociatePass()); ++#if OSL_LLVM_VERSION < 120 + mpm.add(llvm::createIPConstantPropagationPass()); ++#else ++ // createIPConstantPropagationPass disappeared with LLVM 12. ++ // Comments in their PR indicate that IPSCCP is better, but I don't ++ // know if that means such a pass should be *right here*. I leave it ++ // to others who use opt==13 to continue to curate this particular ++ // list of passes. ++ mpm.add(llvm::createIPSCCPPass()); ++#endif + + mpm.add(llvm::createDeadArgEliminationPass()); + mpm.add(llvm::createInstructionCombiningPass()); +@@ -1831,8 +1859,10 @@ LLVM_Util::setup_optimization_passes (int optlevel, bool target_host) + mpm.add(llvm::createPostOrderFunctionAttrsLegacyPass()); + mpm.add(llvm::createReversePostOrderFunctionAttrsPass()); + mpm.add(llvm::createFunctionInliningPass()); ++#if OSL_LLVM_VERSION < 120 + mpm.add(llvm::createConstantPropagationPass()); +- mpm.add(llvm::createDeadInstEliminationPass()); ++#endif ++ mpm.add(llvm::createDeadCodeEliminationPass()); + mpm.add(llvm::createCFGSimplificationPass()); + + mpm.add(llvm::createArgumentPromotionPass()); +@@ -1845,8 +1875,9 @@ LLVM_Util::setup_optimization_passes (int optlevel, bool target_host) + mpm.add(llvm::createTailCallEliminationPass()); + + mpm.add(llvm::createFunctionInliningPass()); ++#if OSL_LLVM_VERSION < 120 + mpm.add(llvm::createConstantPropagationPass()); +- ++#endif + + mpm.add(llvm::createIPSCCPPass()); + mpm.add(llvm::createDeadArgEliminationPass()); diff --git a/media-libs/osl/osl-1.12.0.2.ebuild b/media-libs/osl/osl-1.12.0.2.ebuild new file mode 100644 index 00000000000..a312fa3bc86 --- /dev/null +++ b/media-libs/osl/osl-1.12.0.2.ebuild @@ -0,0 +1,88 @@ +# Copyright 1999-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 +inherit cmake llvm toolchain-funcs + +# check this on updates +LLVM_MAX_SLOT=12 + +DESCRIPTION="Advanced shading language for production GI renderers" +HOMEPAGE="http://opensource.imageworks.com/?p=osl" +SRC_URI="https://github.com/imageworks/OpenShadingLanguage/archive/Release-${PV}-dev.tar.gz -> ${P}.tar.gz" + +LICENSE="BSD" +SLOT="0" +KEYWORDS="~amd64 ~x86" + +X86_CPU_FEATURES=( + sse2:sse2 sse3:sse3 ssse3:ssse3 sse4_1:sse4.1 sse4_2:sse4.2 + avx:avx avx2:avx2 avx512f:avx512f f16c:f16c +) +CPU_FEATURES=( ${X86_CPU_FEATURES[@]/#/cpu_flags_x86_} ) + +IUSE="doc partio qt5 test ${CPU_FEATURES[@]%:*}" + +RDEPEND=" + dev-libs/boost:= + dev-libs/pugixml + media-libs/openexr:= + media-libs/openimageio:= + <=sys-devel/clang-13:= + sys-libs/zlib:= + dev-python/pybind11 + partio? ( media-libs/partio ) + qt5? ( + dev-qt/qtcore:5 + dev-qt/qtgui:5 + dev-qt/qtwidgets:5 + ) +" + +DEPEND="${RDEPEND}" +BDEPEND=" + sys-devel/bison + sys-devel/flex + virtual/pkgconfig +" + +PATCHES=( + ${FILESDIR}/${P}-llvm-11.patch + ${FILESDIR}/${P}-llvm-12.patch +) + +# Restricting tests as Make file handles them differently +RESTRICT="test" + +S="${WORKDIR}/OpenShadingLanguage-Release-${PV}-dev" + +llvm_check_deps() { + has_version -r "sys-devel/clang:${LLVM_SLOT}" +} + +src_configure() { + local cpufeature + local mysimd=() + for cpufeature in "${CPU_FEATURES[@]}"; do + use "${cpufeature%:*}" && mysimd+=("${cpufeature#*:}") + done + + # If no CPU SIMDs were used, completely disable them + [[ -z ${mysimd} ]] && mysimd=("0") + + local gcc=$(tc-getCC) + # LLVM needs CPP11. Do not disable. + local mycmakeargs=( + -DCMAKE_CXX_STANDARD=14 + -DCMAKE_INSTALL_DOCDIR="share/doc/${PF}" + -DINSTALL_DOCS=$(usex doc) + -DLLVM_STATIC=OFF + -DOSL_BUILD_TESTS=$(usex test) + -DSTOP_ON_WARNING=OFF + -DUSE_PARTIO=$(usex partio) + -DUSE_QT=$(usex qt5) + -DUSE_SIMD="$(IFS=","; echo "${mysimd[*]}")" + ) + + cmake_src_configure +}