Commit Graph

455048 Commits

Author SHA1 Message Date
Artem Belevich
5f66348e59 Use nvptxcompile library.
Differential Revision: https://reviews.llvm.org/D145527
2023-03-17 14:08:53 -07:00
Dhruva Chakrabarti
1c9ec74e3f [Clang][OpenMP] Insert alloca for kernel args at function entry block instead of the launch point.
If an inlined kernel is called in a loop, the launch point alloca would
lead to increasing stack usage every time the kernel is invoked. This
could make the application run out of stack space and crash. This problem
is fixed by using the alloca insertion point while creating the alloca instruction.

Fixes https://github.com/llvm/llvm-project/issues/60602

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D145820
2023-03-17 16:36:12 -04:00
Emilia Dreamer
6acdf58919
[clang] Properly parse variable template requires clause in lambda
Since P0857, part of C++20, a *lambda-expression* can contain a
*requires-clause* after its *template-parameter-list*.

While support for this was added as part of
eccc734a69, one specific case isn't
handled properly, where the *requires-clause* consists of an
instantiation of a boolean variable template. This is due to a
diagnostic check which was written with the assumption that a
*requires-clause* can never be followed by a left parenthesis. This
assumption no longer holds for lambdas.

This diagnostic check would then attempt to perform a "recovery", but it
does so in a valid parse state, resulting in an invalid parse state
instead!

This patch adds a special case when parsing requires clauses of lambda
templates, to skip this diagnostic check.

Fixes https://github.com/llvm/llvm-project/issues/61278
Fixes https://github.com/llvm/llvm-project/issues/61387

Reviewed By: erichkeane

Differential Revision: https://reviews.llvm.org/D146140
2023-03-17 22:29:48 +02:00
Renaud-K
22c1c2d9f9 [flang] Replace !fir.ref<T> -> T conversion with a load
Differential revision: https://reviews.llvm.org/D146186
2023-03-17 13:10:51 -07:00
Lang Hames
5379c46d49 Revert "[JITLink][ORC] Rename MemDeallocPolicy to MemLifetimePolicy, add ..."
This reverts commit 2cc64df0bd while I investigate
bot failures (e.g. https://lab.llvm.org/buildbot/#/builders/3/builds/23081).
2023-03-17 12:58:41 -07:00
Alex Langford
b1e9baea3a [lldb] Enable TestPublicAPIHeaders.py on Apple Silicon
This cleans up the test a bit and enables it to run on apple silicon
machines.
2023-03-17 12:43:14 -07:00
Lang Hames
2cc64df0bd [JITLink][ORC] Rename MemDeallocPolicy to MemLifetimePolicy, add NoAlloc option.
The original MemDeallocPolicy had two options:
* Standard: allocated memory lives until deallocated or abandoned.
* Finalize: allocated memory lives until all finalize actions have been run,
            then is destroyed.

This patch introduces a new 'NoAlloc' option. NoAlloc indicates that the
section should be ignored by the JITLinkMemoryManager -- the memory manager
should allocate neither working memory nor executor address space to blocks in
NoAlloc sections. The NoAlloc option is intended to support metadata sections
(e.g. debug info) that we want to keep in the graph and have fixed up if
necessary, but don't want allocated or transmitted to the executor (or we want
that allocation and transmission to be managed manually by plugins).

Since NoAlloc blocks are ignored by the JITLinkMemoryManager they will not have
working memory allocated to them by default post-allocation. Clients wishing to
modify the content of a block in a NoAlloc section should call
`Block::getMutableMemory(LinkGraph&)` to get writable memory allocated on the
LinkGraph's allocator (this memory will exist for the lifetime of the graph).
If no client requests mutable memory prior to the fixup phase then the generic
link algorithm will do so when it encounters the first edge in any given block.

Addresses of blocks in NoAlloc sections are initialized by the LinkGraph
creator (a LinkGraphBuilder, if the graph is generated from an object file),
and should not be modified by the JITLinkMemoryManager. Plugins are responsible
for updating addresses if they add/remove content from these sections. The
meaning of addresses in NoAlloc-sections is backend/plugin defined, but for
fixup purposes they will be treated the same as addresses in Standard/Finalize
sections. References from Standard/Finalize sections to NoAlloc sections are
expected to be common (these represent metadata tracking executor addresses).
References from NoAlloc sections to Standard/Finalize sections are expected to
be rare/non-existent (they would represent JIT'd code / data tracking metadata
in the controller, which would be surprising). LinkGraphBuilders and specific
backends may impose additional constraints on edges between Standard/Finalize
and NoAlloc sections where required for correctness.

Differential Revision: https://reviews.llvm.org/D146183
2023-03-17 12:35:41 -07:00
Matt Arsenault
ce6c36bab5 RegAllocGreedy: Don't use Register reference 2023-03-17 15:22:13 -04:00
Matt Arsenault
33260cf2c5 Intrinsics: Make vector reduce intrinsics speculatable 2023-03-17 15:20:51 -04:00
Craig Topper
101cf0b8ab [RISCV] Add isReMaterializable to FLI instructions.
Reviewed By: reames

Differential Revision: https://reviews.llvm.org/D146321
2023-03-17 12:16:37 -07:00
Craig Topper
0a895c39ad [RISCV] Add isAsCheapAsAMove to FLI instructions.
This can prevent unnecessarily hoisting out of loops.

Test case cribbed from AArch64.

I also intend to make them rematerializable.

Differential Revision: https://reviews.llvm.org/D146314
2023-03-17 12:16:14 -07:00
Craig Topper
f36ec414c9 [RISCV] Add test case showing fli being hoisted out of a loop and creating extra copies/spills.
Test case for D146314.

Differential Revision: https://reviews.llvm.org/D146315
2023-03-17 12:16:14 -07:00
Louis Dionne
8ae4f83335 [libc++][NFC] Move the stdlib= test suite configuration for Apple into the cfg.in files
This centralizes where configuration lives.
2023-03-17 15:08:35 -04:00
Frederik Gossen
f0594b6fd4 [MLIR] Add label to print-ir pass
Differential Revision: https://reviews.llvm.org/D145523
2023-03-17 14:58:14 -04:00
Louis Dionne
eba76ec994 [libc++][NFC] Precise comments in test suite setup 2023-03-17 14:53:24 -04:00
Alexey Bataev
0ad87ffdcc [SLP]Introduce shuffle of the nodes + gather/vectorbuild of the remaining scalars.
Currently compiler does not support mixing of shuffled nodes
+ gather/buildvector of the remaining scalar values. It may reduce total
  number of instructions and improve performance of the
  gather/buildvector sequences.

Part of D110978

Differential Revision: https://reviews.llvm.org/D146167
2023-03-17 11:18:36 -07:00
Jay Foad
ac62e7b6cb [AMDGPU] Remove some unneeded curly braces 2023-03-17 18:09:13 +00:00
Joseph Huber
179a7f1ea2 [libc] Fix dependency to unit tests, and quitting in non-GPU mode
Summary:
Fixes the lack of a dependency after changing the order of some
includes. Also we weren't running any tests as the GPU was always
disabling them. Fix the logic.
2023-03-17 13:08:01 -05:00
Jay Foad
53076d34e3 [AMDGPU] Simplify SMEM Real instruction definitions. NFC.
Only override InOperandList when the Real instruction needs a different
type for $offset than the Pseudo.

Differential Revision: https://reviews.llvm.org/D146313
2023-03-17 18:05:23 +00:00
Joseph Huber
39e91098b5 [libc] Enable integration tests targeting the GPU
This patch enables integration tests running on the GPU. This uses the
RPC interface implemented in D145913 to compile the necessary
dependencies for the integration test object. We can then use this to
compile the objects for the GPU directly and execute them using the AMD
HSA loader combined with its RPC server. For example, the compiler is
performing the following actions to execute the integration tests.

```
$ clang++ --target=amdgcn-amd-amdhsa -mcpu=gfx1030 -nostdlib -flto -ffreestanding \
    crt1.o io.o quick_exit.o test.o rpc_client.o args_test.o -o image
$ ./amdhsa_loader image 1 2 5
args_test.cpp:24: Expected 'my_streq(argv[3], "3")' to be true, but is false
```

This currently only works with a single threaded client implementation
running on AMDGPU. Further work will implement multiple clients for AMD
and the ability to run on NVPTX as well.

Depends on D145913

Reviewed By: sivachandra, JonChesterfield

Differential Revision: https://reviews.llvm.org/D146256
2023-03-17 12:55:32 -05:00
Joseph Huber
8e4f9b1fcb [libc] Add initial support for an RPC mechanism for the GPU
This patch adds initial support for an RPC client / server architecture.
The GPU is unable to perform several system utilities on its own, so in
order to implement features like printing or memory allocation we need
to be able to communicate with the executing process. This is done via a
buffer of "sharable" memory. That is, a buffer with a unified pointer
that both the client and server can use to communicate.

The implementation here is based off of Jon Chesterfields minimal RPC
example in his work. We use an `inbox` and `outbox` to communicate
between if there is an RPC request and to signify when work is done.
We use a fixed-size buffer for the communication channel. This is fixed
size so that we can ensure that there is enough space for all
compute-units on the GPU to issue work to any of the ports. Right now
the implementation is single threaded so there is only a single buffer
that is not shared.

This implementation still has several features missing to be complete.
Such as multi-threaded support and asynchrnonous calls.

Depends on D145912

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D145913
2023-03-17 12:55:31 -05:00
Dave Lee
8c040d0f49 [lldb] Fix d875838e8b 2023-03-17 10:45:46 -07:00
Quinn Dawkins
72e8b286f0 [mlir][spirv] Allow vectors of index types in elementwise conversions
Currently the conversion of elementwise ops only checks for scalar index
types when checking for bitwidth emulation.

Differential Revision: https://reviews.llvm.org/D146307
2023-03-17 13:33:56 -04:00
Paulo Matos
8d0c889752 [clang][WebAssembly] Initial support for reference type funcref in clang
This is the funcref counterpart to 890146b. We introduce a new attribute
that marks a function pointer as a funcref. It also implements builtin
__builtin_wasm_ref_null_func(), that returns a null funcref value.

Differential Revision: https://reviews.llvm.org/D128440
2023-03-17 18:31:44 +01:00
Dave Lee
d875838e8b [lldb][test] Replace use of p with expression in Shell tests (NFC)
In Shell tests, replace use of the `p` alias with the `expression` command.

To avoid conflating tests of the alias with tests of the expression command,
this patch canonicalizes to the use `expression`.

See also D141539 which made the same change to API tests.

Differential Revision: https://reviews.llvm.org/D146230
2023-03-17 10:29:24 -07:00
Jonas Devlieghere
147b609640
[lldb] Unify WatchpointSP variable names (NFC)
LLDB uses `_up`, `_sp` and `_wp` suffixes for unique, shared and weak
pointers respectively. This can become confusing in combination with
watchpoints which are commonly abbreviated to `wp`. Update
CommandObjectWatchpoint to use `watch_sp` for all `WatchpointSP`
variables.
2023-03-17 10:09:40 -07:00
Valentin Clement
9be446588e
Revert "[flang] Feature list plugin"
This reverts commit bde91fd03f.

Failing buildbot: https://lab.llvm.org/buildbot/#/builders/181/builds/15552
2023-03-17 17:59:22 +01:00
Valentin Clement
49d718db86
[flang] Pass box address for bind(c) assumed type dummy argument
When interfacing with C code, assumed type should be passed as
basic pointer.

Reviewed By: PeteSteinfeld

Differential Revision: https://reviews.llvm.org/D146300
2023-03-17 17:58:53 +01:00
Jonas Devlieghere
2a76429778
[lldb] Set the watchpoint spec for expression watchpoints
When setting a variable watchpoint, the watchpoint stores the variable
name in the watchpoint spec. For expression variables we should store
the expression in the watchpoint spec. This patch adds that
functionality.

rdar://106096860

Differential revision: https://reviews.llvm.org/D146262
2023-03-17 09:55:57 -07:00
Valentin Clement
3132c78aea
[flang][NFC] Fix subroutine name 2023-03-17 17:39:13 +01:00
Joseph Huber
27a2940b8c [Libomptarget] Emit a special warning when no images are found
When offloading is mandatory we can emit a more helpful message if we
did not find any compatible images with the user's system.

Fixes #60221

Reviewed By: ye-luo

Differential Revision: https://reviews.llvm.org/D142369
2023-03-17 11:37:43 -05:00
Florian Hahn
962c306a11
[LV] Don't consider pointer as uniform if it is also stored.
Update isVectorizedMemAccessUse to also check if the pointer is stored.
This prevents LV to incorrectly consider a pointer as uniform if it is
used as both pointer and stored by the same StoreInst.

Fixes #61396.
2023-03-17 16:26:16 +00:00
Nikita Popov
3ddc88c380 Revert "[AST] Use ModRefInfo to represent access kind (NFC)"
This reverts commit 2c78a9e65c.

Fails to compile on mlir-s390x-linux buildbot using GCC 9.4 with:

    llvm/lib/Analysis/AliasSetTracker.cpp: In member function 'void llvm::AliasSet::mergeSetIn(llvm::AliasSet&, llvm::AliasSetTracker&, llvm::BatchAAResults&)':
    llvm/lib/Analysis/AliasSetTracker.cpp:50:19: error: invalid operands of types 'unsigned char:2' and 'unsigned char:2' to binary 'operator|'
2023-03-17 17:24:35 +01:00
Aart Bik
4e4af1338d [mlir][gpu][nvvm] fixed bug with literal for inline asm for mma instruction
The 'mma.sp.sync.aligned' family of instructions expects
the sparsity selector as a direct literal (0x0 or 0x1).
The current MLIR inline asm passed this as a value in
register, which broke the downstream assemblers

This is a small step towards supporting 2:4 sparsity on
NVidia GPUs in the sparse compiler of MLIR.

Reviewed By: ThomasRaoux, guraypp

Differential Revision: https://reviews.llvm.org/D146110
2023-03-17 09:22:15 -07:00
Graham Hunter
9aa01c4e89 [LV] Remove scalable constraints on creating bitcasts
InnerLoopVectorizer::createBitOrPointerCast only supported fixed
length vectors since it hadn't been updated. Supporting scalable
vectors is just a matter of changing types and using elementcount
instead of numelements, since there's nothing which actually relies
on knowing the exact length of the vector.

Original written by mgabka.

Split out from D145163.
2023-03-17 16:19:33 +00:00
Craig Topper
807d397c75 [clang] Fix two unused variable warnings from if statements. NFC 2023-03-17 09:18:13 -07:00
Nikita Popov
e775c926df [LICM] Regenerate test checks (NFC) 2023-03-17 17:17:13 +01:00
Andrew Gozillon
0cd31a7d30 [Flang][Driver] Add support for fopenmp-is-device and fembed-offload-object to Flang ToolChain
This allows-fembed-offload-object's and -fopenmp-is-device
compiler invocation arguments to be passed to the Flang frontend
during split compilation when offloading in OpenMP.

An example use case is when passing an offload-arch alongside
-fopenmp to embed device objects compiled for the offload-arch
within the host architecture.

This borrows from existing clangDriver+Clang.h/.cpp work and the intent
is currently to reuse as much of the existing infrastructure and design as
we can to achieve offloading for Flang+OpenMP. An overview of
Clang's offloading design can be found
here: https://clang.llvm.org/docs/OffloadingDesign.html

Reviewers:
awarzynski
jhuber6

Differential Revision: https://reviews.llvm.org/D145815
2023-03-17 11:12:16 -05:00
Arthur Eubanks
55140fbbcd [StandardInstrumentations] Check that module analyses are properly invalidated
Followup to D146003/D146160

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D146238
2023-03-17 09:11:43 -07:00
Stefan Gränitz
ef006eb0bc [CodeView] Add source languages ObjC and ObjC++
This patch adds llvm::codeview::SourceLanguage entries, DWARF translations, and PDB source file extensions in LLVM and allow LLDB's PDB parsers to recognize them correctly.

The CV_CFL_LANG enum in the Visual Studio 2022 documentation https://learn.microsoft.com/en-us/visualstudio/debugger/debug-interface-access/cv-cfl-lang defines:
```
    CV_CFL_OBJC     = 0x11,
    CV_CFL_OBJCXX   = 0x12,
```

Since the initial commit in D24317, ObjC was emitted as C language and ObjC++ as Masm.

Reviewed By: DavidSpickett

Differential Revision: https://reviews.llvm.org/D146221
2023-03-17 17:09:31 +01:00
Roy Sundahl
03aa02adb0 [fuzzer] Use puts() rather than printf() in CopyFileToErr()
CopyFileToErr() uses Printf("%s", ...) which fails with a negative size on
files >2Gb (Its path is through var-args wrappers to an unnecessary "%s"
expansion and subject to int overflows) Using puts() in place of printf()
bypasses this path and writes the string directly to stderr. This avoids the
present loss of data when a crashed worker has generated >2Gb of output.

rdar://99384640

Reviewed By: yln

Differential Revision: https://reviews.llvm.org/D146189
2023-03-17 09:08:40 -07:00
Nikita Popov
2c78a9e65c [AST] Use ModRefInfo to represent access kind (NFC)
AST was using a custom enum with exactly the same semantics. Use
the standard one instead.
2023-03-17 17:07:27 +01:00
Craig Topper
4743c03ca8 [Docs] Add release notes for D146089. 2023-03-17 09:03:08 -07:00
Ilya Biryukov
4361ba791c Revert "[Coroutines] Fix premature conversion of return object"
This reverts commit 54225c457a.
The lack of RVO causes compile errors in our code.
Reverting to unblock our integrate.

See D145639 for full discussion.
2023-03-17 17:01:43 +01:00
Louis Dionne
c54c90da4f [libc++][NFC] Fix typo in comment 2023-03-17 11:57:34 -04:00
Matt Arsenault
ec2234a21a InstCombine: Fold is.fpclass for single infinity to fcmp
llvm.is.fpclass(x, fcPosInf) -> fcmp oeq x, +inf
llvm.is.fpclass(x, fcNegInf) -> fcmp oeq x, -inf
llvm.is.fpclass(x, ~fcPosInf) -> fcmp one x, +inf
llvm.is.fpclass(x, ~fcNegInf) -> fcmp one x, -inf

llvm.is.fpclass(x, fcPosInf|fcNan) -> fcmp ueq x, +inf
llvm.is.fpclass(x, fcNegInf|fcNan) -> fcmp ueq, -inf
llvm.is.fpclass(x, ~fcPosInf & ~fcNan) -> fcmp one, x, +inf
llvm.is.fpclass(x, ~fcNegInf & ~fcNan) -> fcmp one, x, -inf

This regresses some of the logic of fcmp tests. These should be restored
in a future patch to better handle combining logic of fcmp and class.
2023-03-17 11:52:16 -04:00
David Spickett
9f93b71f20 [flang] Use llvm-readobj instead of llvm-readelf in rv64 test
In some circumstances llvm-readelf symlink to llvm-readobj appears
to not be available. For want of a proper fix in CMake, use llvm-readobj
in the test instead.
2023-03-17 15:45:42 +00:00
Matt Arsenault
80512789b6 InstCombine: Fold is.fpclass nan|zero to fcmp ueq 0 2023-03-17 11:42:38 -04:00
Matt Arsenault
2726fd2e8c Revert "InstCombine: Fold is.fpclass nan|zero to fcmp ueq 0"
This reverts commit b5ff7640cd.

Merge resolution gone wrong merged two unrelated patches
2023-03-17 11:42:38 -04:00
Philip Reames
3a1fb672f7 [LSR] Cleanup term-fold tests
Autogen for naming change, and remove comments about C code inspiration.  Multiple of these are out of sync with the actual IR, and these are IR tests anyways.
2023-03-17 08:40:11 -07:00