IF YOU WOULD LIKE TO GET AN ACCOUNT, please write an
email to Administrator. User accounts are meant only to access repo
and report issues and/or generate pull requests.
This is a purpose-specific Git hosting for
BaseALT
projects. Thank you for your understanding!
Только зарегистрированные пользователи имеют доступ к сервису!
Для получения аккаунта, обратитесь к администратору.
This feature, originally added in commit 22b1606f, was reverted to
make the LLVM upgrade to version 13 easier. This commit adds back
all functionality as it was just before the LLVM upgrade.
This commit builds on previous work for getting GDB support for JITted
and interpreted code working in cling. It adds a JIT event listener as
well to create perf map files to allow profiling of interpreted/JITted
code with cling.
The functionality provided is disabled by default. The interface to
enable it has been chosen to be via environment variables to allow both
interpreted code in the prompt as well as linked code to be able to
optionally enable debugging/profiling. Using ld.so as example, where
LD_DEBUG and LD_PROFILE exist, we chose CLING_DEBUG and CLING_PROFILE
to enable these features. For the moment, setting these variables to
anything enables the feature. Later on, if support for oprofile is
added, for example, it may be better to enable specific JIT event
listeners depending on the value of the variables, for example with
CLING_PROFILE=perf or CLING_PROFILE=oprofile, respectively.
The CMAKE_OSX_SYSROOT exports the exact version of the sdk which we build
against. However, this means that binary releases become sensitive to minor sdk
upgrades (eg. MacOSX11.1.sdk -> MacOSX11.2.sdk). Our infrastructure is
relatively resilient to such changes.
This patch introduces a workaround to address this issue -- it uses the fact
that the current sdk's parent directory has a symlink MacOSX.sdk which points
to the current sdk.
This should resolveroot-project/root#7021.
Ninja buffers compiler output, and compilers then think they should
not use colored output (because no terminal). Force it on them.
The same was already implemented for clang, a few lines above.
And let cling survive: it's parsing compiler output, and the ANSI
color escapes confuse the regexes.
This patch consolidates the symbol resolution facilities throughout TCling into
a new singleton class Dyld part of the cling's DynamicLibraryManager.
The new dyld is responsible for:
* Symlink resolution -- it implements a memory efficient representation of
the full path to shared objects allowing search at constant time O(1). This
also fixes issues when resolving symbols from OSX where the system libraries
contain multiple levels of symlinks.
* Bloom filter optimization -- it uses a stohastic data structure which gives
a definitive answer if a symbol is not in the set. The implementation checks
the .gnu.hash section in ELF which is the GNU implementation of a bloom
filter and uses it. If the symbol is not in the bloom filter, the
implementation builds its own and uses it. The measured performance of the
bloom filter is 30% speed up for 2mb more memory. The custom bloom filter on
top of the .gnu.hash filter gives 1-2% better performance.
The advantage for the custom bloom filter is that it works on all
implementations which do not support .gnu.hash (windows and osx). It is also
customizable if we want to further reduce the false positive rates
(currently at p=2%).
* Hash table optimization -- we build a hash table which contains all symbols
for a given library. This allows us to avoid the fallback symbol iteration
if multiple symbols from the same library are requested. The hash table
optimization targets to optimize the case where the bloom filter tells us
the symbol is *maybe* in the library.
Patch by Alexander Penev and me!
Compiling Interpreter.cpp allows RunFunction and friends to be actually seen during stack unwind after an
exception has been thrown, directly or indirectly, by interpreter code. This allows for the RAII objects to be
properly tear down.
In particular, without this patch, EnterUserCodeRAII was not tear down and thus the callbacks were not executed.
Consequently the "Restore the ROOT global Mutex" callback was not executed leaving the Mutex in an invalid state.
In case of ART application, in most cases, they customize the ROOT error handler to throw an exception. This
resulted (without this fix) in crash when import a GDML file with an error in it.
In practice what we have is:
call to TGeo Import
which calls the interpreter for some of its functionality
which calls gdml code
which reports an error
which leads the error handler to thrown an exception.
... some of the stack are properly unwound ... some are not (because they were not compiled with exception support on) ....
... so the ROOT Mutex goes into an incorrect state ...
... unwinding continues
... unwinding reached a frame that Unlock the mutex
Mutex notices it is an incorrect state.
so it reports the Error
the Error handler throw an exception .......
and because this exception is being thrown during the unwind, it is fatal.
This ASTTransformer adds an inline attribute to any CUDA __device__ kernel
that does not have the attribute. Inlining solves a problem caused by
incremental compilation of PTX code. In a normal compiler, all definitions
of __global__ and __device__ kernels are in the same translation unit. In
the incremental compiler, each kernel has its own translation unit. In case
a __global__ kernel uses a __device__ function, this design caused an error.
Instead of generating the PTX code of the __device__ kernel in the same file
as the __global__ kernel, there is only an external declaration of the
__device__ function. However, normal PTX code does not support an external
declaration of functions.
The transformer only works if the target device is nvptx.
We use the target clingInterpreter in a few places as a
general dependency rule making sure the cling infrastructure is
already built.
In some cases, such as clad, the highly parallel builds trigger
build of clad before clangSema, clangBasic and clangAST are built.
This patch ensures the right dependencies are in order.
The class IncrementalCUDADeviceCompiler use external tools to generate PTX and cuda fatbin files. It runs the tools clang and fatbinary via llvm::sys::ExecuteAndWait. The class also handle to include new code in existing code. The steps of the compiler pipeline are:
- clang: CUDA C++ + previous PCH -> PCH
- clang: PCH -> PTX
- fatbinary: PTX -> fatbin
There is no selection of code. Every input of the cling will pass to the IncrementalCUDADeviceCompiler.
To do so one needs to pass -Dbuiltin_llvm=Off -Dbuiltin_clang=Off and the
PATH should contain the path to llvm-config.
Note this is not enabling ROOT to work with vanilla clang!
This patch allows ROOT to be built against a prebuilt clang and llvm from
https://root.cern.ch/git/{llvm.git,clang.git}. It allows to reduce ROOT's
build times (in cases when cmake decides to rebuild the in-tree llvm for
no good reason). It moves the common denominator of different ROOT builds
in one place to save space. It also allows easy switch between LLVM in
debug and release mode.
To build the external clang and llvm exactly in the same way as the
in-tree builds use:
CMAKE_FLAGS="\
-DLLVM_ENABLE_WARNINGS=OFF \
-DLLVM_INCLUDE_TESTS=OFF \
-DCLANG_INCLUDE_TESTS=OFF \
-DLLVM_INCLUDE_EXAMPLES=OFF \
-DCLANG_BUILD_TOOLS=OFF \
-DCLANG_TOOL_ARCMT_TEST_BUILD=OFF \
-DCLANG_TOOL_CLANG_CHECK_BUILD=OFF \
-DCLANG_TOOL_CLANG_FORMAT_BUILD=OFF \
-DCLANG_TOOL_CLANG_FORMAT_VS_BUILD=OFF \
-DCLANG_TOOL_CLANG_FUZZER_BUILD=OFF \
-DCLANG_TOOL_CLANG_IMPORT_TEST_BUILD=OFF \
-DCLANG_TOOL_CLANG_OFFLOAD_BUNDLER_BUILD=OFF \
-DCLANG_TOOL_CLANG_RENAME_BUILD=OFF \
-DCLANG_TOOL_C_ARCMT_TEST_BUILD=OFF \
-DCLANG_TOOL_C_INDEX_TEST_BUILD=OFF \
-DCLANG_TOOL_DIAGTOOL_BUILD=OFF \
-DCLANG_TOOL_LIBCLANG_BUILD=OFF \
-DCLANG_TOOL_SCAN_BUILD_BUILD=OFF \
-DCLANG_TOOL_SCAN_VIEW_BUILD=OFF \
-DLLVM_BUILD_TOOLS=OFF \
-DLLVM_TOOL_LLVM_AR_BUILD=OFF \
-DCLANG_TOOL_CLANG_OFFLOAD_BUNDLER_BUILD=OFF \
-DLLVM_FORCE_USE_OLD_TOOLCHAIN=ON \
-DCLANG_ENABLE_STATIC_ANALYZER=OFF \
-DCLANG_ENABLE_ARCMT=OFF \
-DCLANG_ENABLE_FORMAT=OFF \
-DLLVM_TARGETS_TO_BUILD=host \
-DLLVM_ABI_BREAKING_CHECKS=FORCE_OFF \
-DLLVM_ENABLE_ABI_BREAKING_CHECKS=OFF \
-DCMAKE_INSTALL_PREFIX=.. \
-DCMAKE_BUILD_TYPE=Debug"
cmake "$CMAKE_FLAGS" ../../../sources/root-llvm/
To use C++ modules during runtime we need to generate a modulemap
and install it alongside the ROOT headers. However, right now
we need to turn on cxxmodules to generate a modulemap, which would
force experiments to fulfill all the depndencies that cxxmodules
brings with it (that is, a modern clang that can build ROOT with C++
modules).
This patch untangles the modulemap generation from the cxxmodules
option, so that we always generate a modulemap even when cxxmodules
is turned off. We now also install the modulemap alongside
the ROOT headers.
No functional change for normal ROOT expected here, as the modulemap
will just be ignored without having runtime C++ modules enabled.
In some ccache setups we have the compiler soft link to ccache.
Eg. /usr/local/bin/g++ -> /usr/local/bin/ccache. If we resolve the link too
early we will take the wrong branch assuming the compiler was set as
CMAKE_CXX_COMPILER="ccache g++" and try to get the second token of the command.
This was broken in b8b4bec (ROOT: 965fb30) when support for ccache and distcc was added,
and affected cling being compiled with clang.
Signed-off-by: Vassil Vassilev <vvasilev@cern.ch>
Instead call it at the end of cling::createCI (that should probably change too).
clang::ApplyHeaderSearchOptions is a very heavy-weight function that does a lot
of work to determine and add system headers. More importantly it can also wind
up invalidating clangs internal cache making inclusion of files later impossible.
By using the lighter HeaderSearchOptions::AddSearchPath we not only avoid redoing
a lot of work that has been done, but can adjust the method in clang to avoid
cache invalidation so that calling Interpreter::AddIncludePath will actually
make the files in that path accessible to clang.
Signed-off-by: Vassil Vassilev <vvasilev@cern.ch>
This allows a user to prepend to CLING_INCLUDE_PATHS any additional include paths
they want to add on startup.
Refactor common path splitting code into Utils/Paths
Signed-off-by: Vassil Vassilev <vvasilev@cern.ch>
Generate C++ include paths at compile time, fallback to absolute path of compiler cling was built with, and finally relative/PATH invocation.
Previously if cling was built with wrapper to a compiler like ccache, then there was a
good chance the wrapper would be invoked to find C++ headers, meaning it would fail unless the user also had said wrapper.
This commit also:
Changes LLVM_CXX macro to CLING_CXX_PATH.
Fixes cling-compiledata.h not being updated after changes to
cling-compiledata.h.in have occurred.
Signed-off-by: Vassil Vassilev <vvasilev@cern.ch>