Commit Graph

638 Commits

Author SHA1 Message Date
Simeon Ehrig
e47bb75f9f Allows to configure CUDA sm level for Cling CUDA tests
- the CUDA sm level can be set via CLING_TEST_CUDA_SM_LEVEL
environment variable (e.g. "35"), before running the tests
2021-02-18 09:29:04 +01:00
Pratyush Das
e978660f35 Remove dependence on svn
LLVM repository has migrated from svn to git
2021-02-16 22:29:03 +01:00
Simeon Ehrig
b2bfd6e19f Extend the cling-test to deal with CUDA SDKs that are not in the default location
- To enable the CUDA test, lit detects the `libcudart.so` in
`LD_LIBRARY_PATH`. Now lit also set the CUDA SDK root of
`libcudart.so` as cling parameter (`--cuda-path`) in the tests.
- Pass through the environment variable `CUDA_VISIBLE_DEVICES`.
2021-02-10 15:18:14 +01:00
Jonas Hahnfeld
c7558a2c0d Reset function sections before JITting
This makes all functions end up in the same text section, which is
important for TCling on macOS to catch exceptions from constructors:
Stack unwinding requires information about program addresses to find
out which objects to destroy and what code should be called to handle
the exception. These addresses are relocated against a single __text
section when loading the produced MachO binary, which breaks if the
call sites of global constructors end up in a separate init section.

Fixes ROOT-10703 and ROOT-10962
2021-02-10 15:18:14 +01:00
Jonas Hahnfeld
173de1db30 Enable test for exceptions 2021-02-10 15:18:14 +01:00
Javier Lopez-Gomez
c054ac2840 added missing include in cling/test/CodeUnloading/DeclShadowing.C 2020-12-16 18:29:03 +01:00
Javier Lopez-Gomez
904796d2bb New interface to export Cling run-time configuration bits.
This commit allows the user to enable/disable specific interpreter capabilities
without requiring to `#include` the heavier weight `Interpreter.h` (that also
has dependencies on llvm).

The only feature covered at the moment is definition shadowing.

Closes cling issue #360.
2020-12-14 10:29:04 +01:00
Axel Naumann
dfb84fe995 Support GCC10 type name:
(std::pair<std::__strip_reference_wrapper<const char *>::__type, std::__strip_reference_wrapper<int>::__type>) { "s", 10 }
i.e. the array size is not part of the type.
2020-08-20 17:29:08 +02:00
Frederich Munch
06afb308e4 Report ValueExtractionSynthesizer errors with DiagnosticsEngine. 2020-08-20 09:44:06 +02:00
Axel Naumann
68ede76505 Remove fwddecl files; RUN: often fails. 2020-08-12 09:14:07 +02:00
Jonas Hahnfeld
f2b3a8408e IsClassOrFunction: Handle signedness modifiers
When using these modifiers, a type can consist of multiple tokens
as for example "unsigned int". However the keyword "int" can also
be omitted, making "unsigned" itself also a valid type.

Note that this only handles the most basic case for the modifiers.
The size modifiers "short", "long", and "long long" would need
similar treatment. Moreover the standard permits any order for the
type specifiers, ie "unsigned long long int" and "long int unsigned
long" are both valid (and actually the same type).
2020-07-01 22:44:08 +02:00
Axel Naumann
41dbc3be44 Add test for ROOT-10689. 2020-04-16 18:29:08 +02:00
Philippe Canal
7a5894d1b8 meta/cling: consistent casing for AutoLoading 2020-02-15 17:14:14 +01:00
Pratyush Das
bc70947c9a Fix broken vanilla-cling tests.
Change condition of adding vanilla-cling, change directory locations for
downloaded binary release.
2019-12-23 06:44:28 +01:00
Simeon Ehrig
ad8d5e1137 Changes for Pull Request #284
- add Author to CUDA test cases
- optimize DeviceKernelInliner
- improve some comments
- remove deprecated opt level variables
- change interface of IncrementalCUDADeviceCompiler::process() IncrementalCUDADeviceCompiler::declare()
2019-11-07 19:29:15 +01:00
Simeon Ehrig
f63b935c68 Refactor public interface of cling::IncrementalCUDADeviceCompiler
- it is more similar to the interface of cling::Interpreter
- replace function compileDeviceCode() with process()
- add declare() and parse() functions
- the functions have only the argument input, because the rest of the missing arguments (e.g. Transaction) requires modifications at the transaction system
- it also fixes a bug in the I/O system of the xeus-cling kernel
2019-11-07 19:29:15 +01:00
Simeon Ehrig
64fe3f7d6d Setting a new include path at runtime in the PTX compiler now works 2019-11-07 19:29:15 +01:00
Simeon Ehrig
0d9d8be5b9 Support for the define argument (-D) in the CUDA mode 2019-11-07 19:29:15 +01:00
Simeon Ehrig
2489cf13b1 Replaced incremental PTX compiler with a internal implementation
Replaced the old version of the PTX compiler which used external tools and llvm::ExecuteAndWait with an internal implementation. The new incremental PTX compiler uses a modified version of the cling::Interpreter instance. The instance can process the PTX built-ins and generates LLVM IR. The LLVM IR is be compiled to PTX via an additional NVPTX backend implemented in the IncrementalCUDADeviceCompiler.

The new implementation has many advantages:
- it's much faster than the old version
- less error-prone because the ASTPrinter and some unnecessary cling transformations are avoided
- reduction of problems in searching for external tools (can be very complicated on HPC systems)

The IncrementalCUDADeviceCompiler is moved from the cling::IncrementalParser to the cling::Interpreter, because the second interpreter needs the input without wrappers or transformations.
2019-11-07 19:29:15 +01:00
Simeon Ehrig
6c46b65754 Extend cling::Intpereter to incremental compile PTX code for CUDA devices
- change CUDA to CUDAHost and add CUDADevice to the InvocationOptions
- in the PTX mode, some ASTTransformer will not be used, which are useful for the x86 mode
2019-11-07 19:29:15 +01:00
Philippe Canal
4a92ac82a9 Don't use make_unique to be runnable in C++11 2019-10-05 14:59:03 +02:00
Philippe Canal
8339e5498e print the value of the pointer when value printing smart pointers.
This fixes ROOT-10333.

Since the printValue set of functions always takes a pointer and dereferences it without any checks,
the previous implementation was attempting to valuePrint the pointee (rather than the pointer value)
but this lead to a segmentation fault whenever the smart pointer was set to nullptr.

Now, the valuePrinting for the smart pointers behaves the same as for regular pointer.
2019-10-05 13:59:26 +02:00
Javier Lopez-Gomez
699583cdf0 DefinitionShadower: minor fix to test/CodeUnloading/DeclShadowing.C 2019-10-04 10:29:22 +02:00
Javier Lopez-Gomez
fc63a9f205 DefinitionShadower: added test/CodeUnloading/DeclShadowing.C 2019-09-27 14:59:06 +02:00
Axel Naumann
ba4cc7641e Add test for ROOT-10221. 2019-07-16 00:14:07 +02:00
Axel Naumann
be780f4812 Fix initialization of array, fixes test. 2019-07-15 21:14:05 +02:00
Axel Naumann
4fef27091e Add storage to test types, to trigger dtor call. 2019-07-15 17:29:08 +02:00
Vassil Vassilev
daeaa6d9fb Fix failing test. 2019-03-17 08:15:02 +01:00
Vassil Vassilev
0b9abc1e14 Force flush cout after execution
The user might use utilities which print on cout and expects the output
to be shown immediately.

This patch automatically flushes std::cout after each execution of a wrapper.
2019-03-16 14:29:29 +01:00
Axel Naumann
76fac41c28 test lookup of template function specialization (ROOT-9789). 2019-01-10 13:29:15 +01:00
Vassil Vassilev
5789f5b2eb Build clingDemoPlugin when testing. 2018-11-21 17:15:14 +01:00
Yuka Takahashi
80fa13b41e Fix print.C
Remove semicolon to print out
2018-10-12 14:30:16 +02:00
Yuka Takahashi
d77a3252dc Fix print.C
ToString takes typename and an object pointer
2018-10-12 08:44:07 +02:00
Yuka Takahashi
53476daf4b Fix printing test in Cling
Testsuit was actually looking at '"' for match, comparing literal 21
should be enough.
2018-10-10 14:59:07 +02:00
Vassil Vassilev
38eb2b89ba Allow plugins to handle custom pragmas.
This will help clad implement pattern such as:
#pragma clad on
// code which needs derivation
#pragma clad off
2018-10-08 21:44:55 +02:00
Yuka Takahashi
9c7abadde0 Implement toString interface to gInterpreter
This is the final version of "printValue" discussion.

We agreed that printValue interface should be altered to ToString
interface, which can be invoked `gInterpreter->ToString(XYZ)`. (ToString is in TCling and toString is in Interpreter :D)

This patch contains:

- Implementation of toString in Interpreter.cpp
- Re-Implementation of ClingPrintValue to use ToString because I changed to use Evaluate some time ago.
- Removing of RVec version of printValue which wasn't used at all
- Fix test/vecops_rvec.cxx, printValue is never supposed to be called by a normal user.
2018-10-04 17:13:34 +02:00
Danilo Piparo
a9160b6374 Fix tag lookup test 2018-09-24 09:58:50 +02:00
Danilo Piparo
f2b6205182 Remove fatal typo in tag lookup tests 2018-09-24 09:13:47 +02:00
Danilo Piparo
333bf59b14 Fix Tag test: the test failed because of a typo
the tag called "E" was looked for but its name tested against the
string "N"
2018-09-22 09:59:07 +02:00
Danilo Piparo
4d3fa7427b Add test for the Tag lookup helpers. 2018-09-22 09:14:48 +02:00
Vassil Vassilev
272905eced Implement clang plugin support.
Clang allows third party shared libraries to provide user-defined
extensions. For example, a custom libTemplateInstantiation.so can
visualize all template instantiation chains in clang. To enable it
one needs to pass a set of options such as -fplugin.

Cling should be able to inherently work with clang plugins. However,
cling still does not make full use of the clang driver where the plugin
setup is handled.

This patch enables plugins in cling and extends them in some aspects.
In particular, cling allows loading of plugins from shared libraries
but also if they are linked to the same library where cling is. This is
very useful in cases where cling runs itself in a shared library (eg
libCling). Users of libCling (such as ROOT) prefer to keep all llvm and
clang related symbols local to avoid symbol clashes if there is another
version of clang and llvm linked against a package. This can be done by
dlopen-ing libCling with RTLD_LOCAL visibility mode. Then the only way
for clang plugins to work in this scenario is to be linked to libCling.

Patch by Aleksandr Efremov and me.
2018-07-28 13:17:44 +02:00
Axel Naumann
5e0ff39cd8 Test printValue on unutterable types. 2018-06-27 08:45:21 +02:00
Simeon Ehrig
9a4418b3c0 Improvements for Pull Request #240
- little changes at comments and code style
- try to use const in IncrementalCUDADeviceCompiler, where is possible
- move CUDA device code compiler instance to IncrementalParser
- change the members of CuArgs to const and adjust the setCuArgs method
- use std::vector<string> instead llvm::Smallvector<const char *> to build argv for executeAndWait
- improve the error messages of generatePCH(), generatePTX() and generateFatbinary()
- replace m_Counter with a copy in IncrementalCUDADeviceCompiler to avoid involuntary changes
2018-06-25 08:29:07 +02:00
Simeon Ehrig
68cffbb853 Improve CUDA device code testcases. 2018-06-25 08:29:07 +02:00
Simeon Ehrig
50bc19f6b5 Add some complex cuda template kernel test cases. 2018-06-25 08:29:07 +02:00
Simeon Ehrig
2011246c17 Overwork CUDA device tests.
- add cudaDeviceSynchronize() at every kernel launch
- remove small address bug at cudaMemcpy, if host array is used
- in parallel test cases, replace fixes thread number with variable
- overworked shared memory kernel
2018-06-25 08:29:07 +02:00
Simeon Ehrig
e7b0e22ae8 Add test cases for CUDA features.
- CUDA __constant__ memory
- CUDA global __device__ memory
- CUDA __host__ prefix
- CUDA kernel launch with arguments
- CUDA templated kernels
- CUDA shared memory with dynamic runtime
- CUDA Streams
- test if CUDA device is available
2018-06-25 08:29:07 +02:00
Axel Naumann
673a1d63a4 cling PR 233 (#2038)
Add llvm module pass to generate unique cuda module ctor/dtor names.

This llvm module pass address the follow problem. Every llvm module has a cuda ctor and dtor (if a cuda fatbinary exist), with at least a function call to register the fatbinary. The ctor/dtor can also include function calls to register global functions and variables at runtime, depending on user's code. The lazy compilation detects functions by the name. If the name (symbol) already exists it uses the existing translation. Otherwise it translates the function on first use (but it never translates twice). Without the module pass, Cling will always use the translation of the first module.

The testcase use the reflection of the gCling interpreter object. It takes two random modules and compare the symbols of the cuda module ctor and dtor.

Also add function, which change the symbol of the cuda module ctor and dtor to preprocessor compliant symbols.
2018-05-18 11:14:07 +02:00
Axel Naumann
855d7224ae cling can now print lamda-dependent types! 2018-04-30 16:29:42 +02:00
Axel Naumann
e39e1baf94 Do not rely on value printer to side-#include <string>. 2018-04-30 16:29:42 +02:00