Skip to content

LLVM and SPIRV-LLVM-Translator pulldown (WW29) #6420

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1,459 commits into from
Jul 12, 2022

Conversation

dwoodwor-intel
Copy link
Contributor

@dwoodwor-intel dwoodwor-intel commented Jul 8, 2022

petrhosek and others added 30 commits July 6, 2022 17:17
This can now be used with -static-libgcc.

Differential Revision: https://reviews.llvm.org/D129218
…rocessing.

This mostly affects PGO/LTO builds which use module flags describing the call
graph. Fixes Issue #51893.

Reviewed By: dexonsmith

Differential Revision: https://reviews.llvm.org/D125999
Create a TargetCharacteristics class to centralize the few items of
target specific information that are relevant to semantics.  Use the
new class for all target queries, including derived type component layout
modeling.

Future work will initialize this class with target information
provided or forwarded by the drivers, and use it to fold layout-dependent
intrinsic functions like TRANSFER().

Differential Revision: https://reviews.llvm.org/D129018

Updates: Attempts to work around build issues on Windows.
Reverting while I investigate build failures

This reverts commit e3dc568.
Compiler can generate calls to some functions implicitly, even under
constraints of freestanding environment. Make sure these functions are
available in our runtime objects.

Fixes test failures on some systems after https://reviews.llvm.org/D128960.

Reviewed By: yota9

Differential Revision: https://reviews.llvm.org/D129168
`dxil` is an architecture supported by the DirectX backend. These
intrinsics will likely be shared with other DirectX architectures like
`dxbc`. Using a common prefix `dx` will make it more intuitive.

Also the `dx` prefix is already set in the Triple, which causes
intrinsics described here to be unmatchable via the ClangBuiltin
mechanism.
Adds optional dependency on cpp-httplib, a lightweight header-only HTTP server.

Reviewed By: phosek

Differential Revision: https://reviews.llvm.org/D113218
Proposing to move the check for scalar MASS conversion from constructor
of PPCTargetLowering to the lowerLibCallBase function which decides
about the lowering.

The Target machine option Options.PPCGenScalarMASSEntries is set in
PPCTargetMachine.cpp. But an object of the class PPCTargetLowering
is created in one of the included header files. So, the constructor will run
before setting PPCGenScalarMASSEntries to correct value. So, we cannot
check this option in the constructor.

Differential: https://reviews.llvm.org/D128653
Reviewer: @bmahjour
The number of spaces between `#` and `pragma` can differ due to
different indention levels in the preprocessor directives. Therefore
allow any number of spaces.

The test used to put an exclamation mark in its diagnostic. This adds
little benefit and only makes it harder to copy the offending filename.
As drive-by this exclamation mark has been removed.

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D129047
This provides a minimal HTTP server interface and an implementation wrapping [[ https://github.com/yhirose/cpp-httplib | cpp-httplib ]] in the Debuginfod library. If the Curl HTTP client is available (D112753) the server is tested by pinging it with the client.

Reviewed By: dblaikie

Differential Revision: https://reviews.llvm.org/D114415
After checking the libc++abi.dylib shipped in macOS 10.13, I can confirm
that it contains the align_val_t variants of operator new and operator
delete. However, the libc++abi.dylib shipped on macOS 10.12 does not.

Differential Revision: https://reviews.llvm.org/D129198
Introduce an off-by default `-Winvalid-utf8` warning
that detects invalid UTF-8 code units sequences in comments.

Invalid UTF-8 in other places is already diagnosed,
as that cannot appear in identifiers and other grammar constructs.

The warning is off by default as its likely to be somewhat disruptive
otherwise.

This warning allows clang to conform to the yet-to be approved WG21
"P2295R5 Support for UTF-8 as a portable source file encoding"
paper.

Reviewed By: aaron.ballman, #clang-language-wg

Differential Revision: https://reviews.llvm.org/D128059
…nsulation

Instead of marking private symbols with internal_linkage (which leads to
one copy per translation unit -- rather wasteful), use an ABI tag that
gets rev'd with each libc++ version. That way, we know that we can't have
name collisions between implementation-detail functions across libc++
versions, so we'll never violate the ODR. However, within a single program,
each symbol still has a proper name with external linkage, which means
that the linker is free to deduplicate symbols even across TUs.

This actually means that we can guarantee that versions of libc++ can
be mixed within the same program without ever having to take a code size
hit, and without having to manually opt-in -- it should just work out of
the box.

Differential Revision: https://reviews.llvm.org/D127444
Vectors are defined to be tightly packed, regardless of the element
type.  The AsmPrinter didn't realize this, and was allocating extra
padding.

Fixes llvm/llvm-project#49286
Fixes llvm/llvm-project#53246
Fixes llvm/llvm-project#55522

Differential Revision: https://reviews.llvm.org/D129164
…cking local debuginfo.

This library implements the class `DebuginfodCollection`, which scans a set of directories for binaries, classifying them according to whether they contain debuginfo. This also provides the `DebuginfodServer`, an `HTTPServer` which serves debuginfod's `/debuginfo` and `/executable` endpoints. This is intended as the final new supporting library required for `llvm-debuginfod`.

As implemented here, `DebuginfodCollection` only finds ELF binaries and DWARF debuginfo. All other files are ignored. However, the class interface is format-agnostic. Generalizing to support other platforms will require refactoring of LLVM's object parsing libraries to eliminate use of `report_fatal_error` ([[ https://github.com/llvm/llvm-project/blob/main/llvm/lib/Object/WasmObjectFile.cpp#L74 | e.g. when reading WASM files ]]), so that the debuginfod daemon does not crash when it encounters a malformed file on the disk.

The `DebuginfodCollection` is tested by end-to-end tests of the debuginfod server (D114846).

Reviewed By: mysterymath

Differential Revision: https://reviews.llvm.org/D114845
The length of valid codepoints was incorrectly
calculated which was not caught before because the
absence of tests for the valid codepoints scenario.

Differential Revision: https://reviews.llvm.org/D129223
This adds special-case treatment for parameter packs in
make_unique-like functions to forward parameter names to inlay hints.
The parameter packs are being resolved recursively by traversing the
function body of forwarding functions looking for expressions matching
the (std::forwarded) parameters expanded from a pack.
The implementation checks whether parameters are being passed by
(rvalue) reference or value and adds reference inlay hints accordingly.
The traversal has a limited recursion stack depth, and recursive calls
like std::make_tuple are cut off to avoid hinting duplicate parameter
names.

Reviewed By: sammccall

Differential Revision: https://reviews.llvm.org/D124690
This reverts commit 4174f0c.

Also revert follow-up "[Clang] Fix invalid utf-8 detection"
This reverts commit bf45e27.

The second commit broke tests, see comments on
https://reviews.llvm.org/D129223, and it sounds like the first
commit isn't valid without the second one. So reverting both for now.
Silence warning from MSVC when handling ##__VA_ARGS

Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D129227
svenvh and others added 6 commits July 8, 2022 14:35
…el#1512)

This change is incomplete, and will not properly convert every single LLVM IR
file to SPIR-V. However, it will convert many files. Areas that are known to
require more investigation:
* ptr-valued extractvalue, especially from cmpxchg instructions
* return values of functions
* llvm.*.annotation support
* function pointer extensions
* pointer types in structs

Original commit:
KhronosGroup/SPIRV-LLVM-Translator@21fee92
Substitution rules in Itanium mangled names are unfortunately more complex and
harder to parse than they should be, and there were two bugs that cropped in the
current implementation (as found by running c++filt on the resulting names and
discovering that they didn't demangle correctly).

The first bug was that unqualified names double-registered the underlying
pointer type. A mangled pointer type like PU3AS419__spirv_DeviceEvent should
generate three substitutable names:
*       19__spirv_DeviceEvent [a user-defined type gets an entry]
*  U3AS419__spirv_DeviceEvent [qualifiers of a pointer get an entry]
* PU3AS419__spirv_DeviceEvent [the pointer as a whole gets an entry]

However, if there's no qualifiers--we get a P19__spirv_DeviceEvent instead--
the original code was still adding multiple entries as follows:
*  19__spirv_DeviceEvent [a user-defined type gets an entry]
*  19__spirv_DeviceEvent [qualifiers of a pointer, but there are none!]
* P19__spirv_DeviceEvent [the pointer as a whole gets an entry]

The second bug is in the representation of the block pointer type for kernels:
this is mangled as U13block_pointerFvvE. This type actually gets two entries:
*                 FvvE [void(void) function type]
* U13block_pointerFvvE [block_pointer-qualified function type]

We weren't adding any entries for either of these types, causing later type
entries to be offset by two. With this patch, these type entries *still* aren't
added, so the mangling is incorrect if multiple block types are present in a
function declaration. Since such functions don't exist for OpenCL/SPIR-V, it's
okay that these cases are not correctly handled.

Original commit:
KhronosGroup/SPIRV-LLVM-Translator@9b280f4
* Implement support for @llvm.sadd.sat intrinsic.
* Rename LowerSaddWithOverflow to LowerSaddIntrinsics.

Original commit:
KhronosGroup/SPIRV-LLVM-Translator@0af7e64
Emit (in OCLToSPIRV) and decode (in SPIRVToOCL) the SignExtend and
ZeroExtend Image Operands introduced by SPIR-V version 1.4 to preserve
signedness of image read and write operations.  This allows
distinguishing between e.g. `read_imagei` and `read_imageui` and
enables a lossless LLVM -> SPIR-V -> LLVM conversion for those OpenCL
builtins.

Before SPIR-V 1.4, there was no way to represent the signedness of the
image operations and llvm-spirv defaulted to signed.  This commit
leaves that behaviour unchanged if llvm-spirv's maximum version is set
to SPIR-V 1.3 or below.  Add the `--spirv-max-version=1.3` flag to
some tests that rely on the old behaviour.

Original commit:
KhronosGroup/SPIRV-LLVM-Translator@bb4ead0
@dwoodwor-intel dwoodwor-intel added the disable-lint Skip linter check step and proceed with build jobs label Jul 8, 2022
@dwoodwor-intel dwoodwor-intel requested review from a team and pvchupin as code owners July 8, 2022 18:50
@dwoodwor-intel
Copy link
Contributor Author

It looks like the sphinx build failure has been fixed upstream; I've cherry-picked that commit.

This reverts commit 4256e4e. This
change enabled a test that is failing on Windows, so I'm leaving it out
of this week's pulldown.
@dwoodwor-intel
Copy link
Contributor Author

A couple more test fixes:

  • d278c67 adds a new testcase that also needs to be updated for the new static_assert error format
  • KhronosGroup/SPIRV-LLVM-Translator@bb4ead0 enables a test that is failing on Windows, so I'm leaving it out of this week's pulldown (via a revert) and I'll try to figure out what's going on with it and pull it in for next week instead.

@dwoodwor-intel
Copy link
Contributor Author

dwoodwor-intel commented Jul 11, 2022

I'm seeing some test failures that look like they're caused by intel/llvm-test-suite#1076 — they should be fixed by #6400 so I've merged that in

@dwoodwor-intel
Copy link
Contributor Author

@intel/llvm-gatekeepers, it looks like all of the (non-lint) tests are passing now, except that ProtexIP step crashed/was terminated after running for 20 hours. Is that expected for pulldowns? Should I go ahead with the merge?

@bader
Copy link
Contributor

bader commented Jul 12, 2022

@intel/llvm-gatekeepers, it looks like all of the (non-lint) tests are passing now, except that ProtexIP step crashed/was terminated after running for 20 hours. Is that expected for pulldowns? Should I go ahead with the merge?

No, it's not expected. I expect this job to work for any PR. If you are 100% sure that the changes you did on top of pulled ones are fine, you can merge it.

@dwoodwor-intel, do you track the llvm-spirv changes made here? be9bfe6 reverts on of the commits. Will you merge it with next pulldown or cherry-pick separately?

@dwoodwor-intel
Copy link
Contributor Author

No, it's not expected. I expect this job to work for any PR. If you are 100% sure that the changes you did on top of pulled ones are fine, you can merge it.

Those should be fine; I'll go ahead with the merge.

@dwoodwor-intel, do you track the llvm-spirv changes made here? be9bfe6 reverts on of the commits. Will you merge it with next pulldown or cherry-pick separately?

Yes, I've updated the commit hash in the message above to not include the reverted commit and my plan is to merge it with the next pulldown instead.

@dwoodwor-intel
Copy link
Contributor Author

/merge

@bb-sycl
Copy link
Contributor

bb-sycl commented Jul 12, 2022

Tue 12 Jul 2022 05:29:40 PM UTC --- Start to merge the commit into sycl branch. It will take several minutes.

@bb-sycl
Copy link
Contributor

bb-sycl commented Jul 12, 2022

Tue 12 Jul 2022 06:00:24 PM UTC --- Merge the branch in this PR to base automatically. Will close the PR later.

@bb-sycl bb-sycl merged commit d7d0880 into intel:sycl Jul 12, 2022
@dwoodwor-intel
Copy link
Contributor Author

I hunted down the Windows bug in LLVM-SPIRV :: test/transcoding/image_signedness.ll that forced me to back out KhronosGroup/SPIRV-LLVM-Translator@bb4ead0 and posted a fix here: KhronosGroup/SPIRV-LLVM-Translator#1550

@bader
Copy link
Contributor

bader commented Jul 14, 2022

Thanks a lot!
KhronosGroup/SPIRV-LLVM-Translator#1550 is merged, so I hope we can merge both patches with the next pulldown.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
disable-lint Skip linter check step and proceed with build jobs
Projects
None yet
Development

Successfully merging this pull request may close these issues.