Commit Graph

455417 Commits

Author SHA1 Message Date
Julian Lettner
711ff37b55 [TSan] Make sure we only collect non-TSan frames for memory operations r=dvyukov,rsundahl,thetruestblue,wrotki,kubamracek!
A previous change [1] moved retrieval of the caller PC
(`__builtin_return_address(0)` via `CALLERPC`) from an
interface-boundary function into a shared helper function
`ExternalAccess`.  If this function does not get inlined, we fail to
collect the appropriate caller PC for the "TSan interface boundary".

[1] https://reviews.llvm.org/D32360

rdar://78489600

Differential Revision: https://reviews.llvm.org/D146264
2023-03-17 17:40:14 -07:00
Peter Collingbourne
659da71a40 gn build: Pass -fno-emulated-tls when targeting Android.
Matches the CMake build:
93c1a5f3dd/compiler-rt/CMakeLists.txt (L343)
(we always use API level 29).

Differential Revision: https://reviews.llvm.org/D146341
2023-03-17 17:28:40 -07:00
Pavel Kopyl
7adacaa098 [NVPTX] Report fatal error on empty argument type.
Differential Revision: https://reviews.llvm.org/D146331
2023-03-18 01:27:43 +01:00
Paul Kirth
93c1a5f3dd [llvm-readobj] Rename JSON Flag fields to be more consistent
Today the JSON uses `Value` and `RawValue` when printing `Flags`, when really
the `Value` field is always the name of an Enum variant, and `RawValue` is its
underlying numeric value. Similarly, we rename the `RawFlags` key to `Value`,
to match the new scheme. This also allows JSON parsing to use consistent logic
for `Flag` types.

Reviewed By: jhenderson

Differential Revision: https://reviews.llvm.org/D137091
2023-03-18 00:04:47 +00:00
Paul Kirth
23fd6e360c [llvm-readobj] Fix JSON output for Relocations
The existing JSON incorrectly outputs line breaks and other invalid JSON.

Example Before this patch:

```
...
"Relocations":[Section (9) .rela.dyn {
  0xA3B0 R_X86_64_RELATIVE - 0x43D0
  0xA3B8 R_X86_64_RELATIVE - 0x4A30
...
```

Example After this patch:

```
...
"Relocations":[Section (9) .rela.dyn {
{"Relocation":{"Offset":41904,"Type":{"Value":"R_X86_64_RELATIVE","RawValue":8},
"Symbol":{"Value":"","RawValue":0},"Addend":17360}},
{"Relocation":{"Offset":41912,"Type":{"Value":"R_X86_64_RELATIVE","RawValue":8},
"Symbol":{"Value":"","RawValue":0},"Addend":18992}},
{"Relocation":{"Offset":41920,"Type":{"Value":"R_X86_64_RELATIVE","RawValue":8},
"Symbol":{"Value":"","RawValue":0},"Addend":17440}},
...
```

Note there are still issues with the Section, but each Relocation is
now a valid JSON object that can be parsed. Future patches will address
the issues regarding JSON output for the Section.

Reviewed By: jhenderson

Differential Revision: https://reviews.llvm.org/D137089
2023-03-17 23:57:58 +00:00
Paul Kirth
8e1746faa3 [llvm-readobj] Standardize JSON output for Other field
Today, the LLVM output uses special handling when the Other field is 0.
This output makes sense for a command line utility that a human will
read, but JSON is a machine readable format, so being consistent is more
important. Prior to this change, any consumer of the JSON output would
need to handle the Other field specially, since the structure of the
JSON would no longer be consistent.

Changes to JSON output when Other flag == 0:
```
"Other": 0,   ->   "Other": {
                      "RawFlags": 0,
                       "Flags": []
                    },
```

There are no changes to when Other flag != 0:
```
"Other": {        ->   "Other": {
  "RawFlags": 1,          "RawFlags": 1,
  "Flags": [              "Flags": [
      ...                     ...
  ]                       ]
},                     },
```

This patch adds a overload for the JSONELFDumper's printSymbol() method,
that uses consistent output formatting, regardless of the value of the
Other field.

Depends on D137092

Reviewed By: jhenderson

Differential Revision: https://reviews.llvm.org/D137088
2023-03-17 23:38:31 +00:00
Nikolas Klauser
308bcb3f7b [libc++] Use the _LIBCPP_VERBOSE_ABORT macro instead of calling the function directly
These calls were added in D141222.

Reviewed By: #libc, ldionne

Spies: ldionne, libcxx-commits, smeenai, mikhail.ramalho

Differential Revision: https://reviews.llvm.org/D146227
2023-03-18 00:34:28 +01:00
Paul Kirth
552b1b3c44 [llvm-readobj] Use a helper to extract the Other Flags from symbols
Since all ELFDumper implementations will require the same logic when
dealing with Other Flags, we move the logic into a helper so that it can
be easily reused across implementations.

Reviewed By: jhenderson

Differential Revision: https://reviews.llvm.org/D137092
2023-03-17 23:30:12 +00:00
Philip Reames
6f00170159 [LSR] Rework term-fold tests
There were two major problems with the tests.

First, with the pointer size being 32 bit and the original IVs also being 32 bit, almost all of the positive tests were actually unsound.  An upcoming change will add the appropriate safety check, but the test diffs are really hard to understand without switching the tests to 64 bit pointers first.

Second, checking debug messages for failures is a major bad practice.  This should not have been accepted in review at all.  The reason is that it makes the *order* of legality checks visibile and modifying any of them becomes annoying and tedious.
2023-03-17 16:03:08 -07:00
Matthew Voss
d02ff3d578 Revert "[fuzzer] Use puts() rather than printf() in CopyFileToErr()"
This reverts commit 03aa02adb0.

Reverting due to bot failures:
https://lab.llvm.org/buildbot/#/builders/247/builds/2653
2023-03-17 16:00:56 -07:00
Aart Bik
a3bb693420 [mlir][gpu][nvvm] refined sparsity selector test and verification of mma.sp
Reviewed By: ThomasRaoux

Differential Revision: https://reviews.llvm.org/D146319
2023-03-17 15:50:36 -07:00
Daniel Thornburgh
41e4578ae1 [Docs] Fix llvm-cov debuginfod option formatting. 2023-03-17 15:49:21 -07:00
Artem Belevich
a7cf2892e9 [MLIR] Do not hardcode attribute indexes in intrinsic decls
We're not checking the attributes themselves, so hardcoded attribute numbers
only make the tests more fragile, without improving the testing.

Differential Revision: https://reviews.llvm.org/D146334
2023-03-17 15:02:26 -07:00
Jorge Gorbe Moya
e07a872c61 [bazel] add missing dependency to //mlir:SPIRVCommonConversion 2023-03-17 15:00:56 -07:00
Louis Dionne
72f0edf3f4 [libc++] Remove unnecessary main() function in .compile.pass.cpp and .verify.cpp tests
We pretty consistently don't define those cause they are not needed,
and it removes the potential pitfall to think that these tests are
being run. This doesn't touch .compile.fail.cpp tests since those
should be replaced by .verify.cpp tests anyway, and there would be
a lot to fix up.

As a fly-by, I also fixed a bit of formatting, removed a few unused
includes and made some very minor, clearly NFC refactorings such as
in allocator.traits/allocator.traits.members/allocate.verify.cpp where
the old test basically made no sense the way it was written.

Differential Revision: https://reviews.llvm.org/D146236
2023-03-17 17:56:21 -04:00
Peter Collingbourne
9f42b04128 scudo: Don't define mallinfo2 on Android.
On Android, mallinfo2 is an alias of mallinfo, which results
in errors if we try to define both.

Differential Revision: https://reviews.llvm.org/D146324
2023-03-17 14:47:41 -07:00
Matt Arsenault
c98b2e20c9 LiveRangeEdit: Use Register 2023-03-17 17:34:52 -04:00
Artem Belevich
d4ba4c6af7 Revert unintentionally committed "Use nvptxcompile library."
This reverts commit 5f66348e59.
2023-03-17 14:23:42 -07:00
Artem Belevich
fea8faa705 Separate SerializeToCubin from GPUTransforms.
SerializeToCubin depends on CUDA at *runtime* which is undesirable for MLIR's
general use case, as compilation should be doable on any host, regardless of
whether it has a GPU.

SerializeToCubin is needed to run some GPU tests, so when we build mlir-opt,
SerializeToCubin pass is linked in directly into mlir-opt.

Differential Revision: https://reviews.llvm.org/D146330
2023-03-17 14:08:53 -07:00
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