[AMDGPU] Add LDS encoding granularity to TargetParser
Model LDS encoding granularity with dedicated features and expose the
byte-valued getLDSEncodingGranule query for GPUKind and subarch. Keep
encoding independent of the hardware allocation granularity used for
occupancy; GFX10.3, GFX11 and GFX12.0 encode in 512-byte units while
allocating 1024-byte blocks.
Migrate program resource register and PAL metadata encoding to the new
query and remove getLdsDwGranularity from AMDGPUBaseInfo. gfx9-4-generic
uses gfx950's 1280-byte encoding granule independently of LDS capacity.
Test encoding queries, feature membership, generic-target validation and
encoded LDS sizes, including the GFX10.3 allocation/encoding distinction.
Change-Id: I9d3c2c041605e9a45fa8fbda09fc3460a74953ea
[WebKit Checkers][NFC] Thread the sink type through the local vars checker (#224862)
So an upcoming borrow checker can track assignment through indirection.
For example, in `out = &vec`, where `out`'s declared type is
`Vector<char>*&`, the relevant sink type is `Vector<char>*`.
Assisted-by: Claude
Fix `fp128` reaching `llvm_unreachable` on 32-bit PowerPC (#216613)
`fp128` is a legal type that is passed in vector registers when `vsx` is
enabled on 32-bit PowerPC: the switch statement didn't account for that,
causing an LLVM assertion.
Fixes #213355
cc @folkertdev
(cherry picked from commit 8d1b38f87103eb339224d1e6d397aad191f919e6)
workflows/release-binaries: Fix zstd compression (#219587)
23.1.0 was the first e2e release with zstd archives. I noticed that once
it shipped they didn't have a meaningful size improvement over the
pre-existing archives. Turns out this is because by default zstd
compresses over a 128MB window which wasn't large enough to get
meaningful savings. We now use 1GB for this which uses more memory but
should take the archive from the 1.8GB that the xz release is, to ~1gb.
I played around with a few options and this was the best time vs
compress vs memory usage ratio.
Assisted-By: codex
(cherry picked from commit 9f51fa4e9ead0da931c1f7b5d2aa3fdbc62c845e)
[cmake] FindLibXml2: keep user-provided LIBXML2_DEFINITIONS (#221294)
LLVM's `FindLibXml2.cmake` (added in #166867) unconditionally does
`set(LIBXML2_DEFINITIONS ${PC_LIBXML_CFLAGS_OTHER})` and puts
`PC_LIBXML_CFLAGS_OTHER` on the imported targets. CMake's own
`FindLibXml2` module only takes pkg-config's flags when the library it
found is the one pkg-config describes; otherwise it keeps whatever
`LIBXML2_DEFINITIONS` the user passed and exposes it through
`INTERFACE_COMPILE_OPTIONS`.
This matters when cross-compiling against a static libxml2 on Windows.
Passing `-DLIBXML2_DEFINITIONS=-DLIBXML_STATIC
-DLIBXML2_LIBRARIES=.../libxml2s.lib` worked with LLVM 22 (CMake's
module): the define reached both the `xmlReadMemory` configure check and
the consumers of `LibXml2::LibXml2`. With LLVM 23 it is silently
dropped, `xmlexports.h` declares the API `__declspec(dllimport)`, the
check fails to link against the static library and
`LLVM_ENABLE_LIBXML2=FORCE_ON` aborts with `Failed to configure
libxml2`. (pkg-config on the Linux host finds the host's libxml2, so
[23 lines not shown]
[libc] Add getgrnam_r and getgrgid_r entrypoints (#224722)
Add the reentrant group database lookup entrypoints getgrnam_r and
getgrgid_r along with grp::find_by_name and grp::find_by_gid in
grp_utils.
Each lookup opens a ScopedFlatFileDatabase<struct group> stream so that
reentrant lookups do not disturb an in-progress getgrent iteration.
Track group_file_path alongside the iteration database so scoped streams
opened by reentrant lookups honour test path overrides.
* Add getgrnam_r and getgrgid_r entrypoints
* Add find_by_name and find_by_gid lookup helpers in grp_utils
* Define getgrnam_r and getgrgid_r in include/grp.yaml
* Add hermetic unit tests for getgrnam_r and getgrgid_r
Assisted-by: Automated tooling, human reviewed.
ARM: Fix mixed dead and not-dead LR operands in vlldm-vlstm-uops.mir (#224825)
This operand list had LR listed twice, once from its implicit-defs on
the instruction definition, and another in the variadic argument list.
One had a dead flag, and the other didn't which should be a verifier
error in the future, so remove the redundant operand.
Co-authored-by: Claude (Claude-Opus-4.8) <noreply at anthropic.com>
[libc][math] Make pow function correctly rounded for all rounding modes. (#222827)
Fix overflow issues reported by Paul Zimmermann.
Algorithm overview:
Evaluate mainly as:
```
x^y = 2^(y * log2(x))
```
- Fast path:
- Compute `log2(x) = e_x + log2(m_x)` in double-double precision.
- Scale `y * log2(x)` and evaluate `2^(y * log2(x)) = 2^hi * 2^mid *
2^lo`
using a 64-entry lookup table for `2^mid` and a degree-5 polynomial
evaluated with Estrin's scheme for `2^lo`.
- Perform Ziv's rounding test.
- 128-bit accurate path (pow_accurate_128.h):
[24 lines not shown]
[AMDGPU] Add LDS encoding granularity to TargetParser
Model LDS encoding granularity with dedicated features and expose the
byte-valued getLDSEncodingGranule query for GPUKind and subarch. Keep
encoding independent of the hardware allocation granularity used for
occupancy; GFX10.3, GFX11 and GFX12.0 encode in 512-byte units while
allocating 1024-byte blocks.
Migrate program resource register and PAL metadata encoding to the new
query and remove getLdsDwGranularity from AMDGPUBaseInfo. gfx9-4-generic
uses gfx950's 1280-byte encoding granule independently of LDS capacity.
Test encoding queries, feature membership, generic-target validation and
encoded LDS sizes, including the GFX10.3 allocation/encoding distinction.
Change-Id: I9d3c2c041605e9a45fa8fbda09fc3460a74953ea
[AMDGPU] Add getLDSAllocGranule to TargetParser
Model hardware LDS allocation granularity with dedicated features and
expose byte-valued queries for GPUKind and subarch. Use the allocation
query for occupancy while retaining the existing LDS encoding helper.
GFX10.3, GFX11 and GFX12.0 allocate in 1024-byte blocks, even though LDS
size is encoded in 512-byte units. Correct their allocation values and
occupancy expectations as discussed in #219495. gfx9-4-generic uses
gfx950's 1280-byte allocation granule independently of its 64 KiB capacity.
Test allocation feature membership, per-GPU assignments, query overloads,
fallbacks, generic-target validation and occupancy.
Change-Id: Ic0c9345e7657ec3c6978a646628598cb7608b390
[libc][math] Add code size optimized float-only options for exp*f funtions. (#224735)
- Add float-only implementations for expf, exp2f, and exp10f optimized
for code-size.
- Reorganize function selections:
- `src/__support/math/func.h` - select implementation
- `src/__support/math/func_<type>_eval.h` - implementation with `<type>`
as intermediate computational type.
- keep different `<type>-eval` in `type_eval` namespace, so that all
options are available to be tested.
- Update smoke, unit, exhaustive tests to test all variants.
Assisted-by: Gemini is used for code size analysis and test refactoring.
---------
Co-authored-by: Muhammad Bassiouni <60100307+bassiounix at users.noreply.github.com>
[BoundsSafety][test] Add late-parsed counted_by type-attribute coverage
New tests exercising the late-parse fill-in mechanism:
- Sema/attr-counted-by-weird-type-positions{,-late-parsed}.c: counted_by
in assorted type positions, nested pointers, and rejection cases.
- Sema/attr-bounds-safety-function-ptr-param.c: attributes on
function-pointer-typed members.
- Modules/ and PCH/ bounds-safety-attributed-type-late-parsed: the
resolved type round-trips through serialization.
- Sema/attr-counted-by-late-parsed-regressions.c: guards against the
double-free on a nested-record decl-spec attribute and the null-count
escape on a free-function parameter.
[BoundsSafety] Create incomplete counted_by types and wire up the refill
Activate late parsing for the counted_by family (counted_by / sized_by and
their _or_null variants) in type-attribute position, under
-fexperimental-late-parse-attributes, on top of the type-attribute handling,
the validation helper and the refill machinery added in the previous commits.
When such an attribute is seen during type construction and its argument
can't be resolved yet, build the CountAttributedType immediately with
getIncompleteCountAttributedType and record it against the enclosing record;
its count expression is filled in at the closing brace via the refill logic.
Because enclosing types refer to the node by pointer, completing it in place
leaves the type chain untouched -- no rebuild, no TypeLoc re-emission.
- Sema::ActOnLateParsedTypeAttr builds the incomplete node; the parser
callback stores it on the LateParsedTypeAttribute and records the
attribute in the record currently being parsed.
Parser::CompleteLateParsedTypeAttributes drains that list at the closing
brace; a nested anonymous record hands its pending attributes up to the
[9 lines not shown]
[BoundsSafety] Handle the counted_by family as a type attribute
counted_by / sized_by (and their _or_null variants) were handled in only one
way: a declaration-position attribute went through handleCountedByAttrField,
which validated it and then patched the field afterwards with
FieldDecl::setType. There was no type-position handling at all.
Build the type during type construction instead, from a single handler that
serves both positions:
- Add HandleCountedByAttrOnType and dispatch the counted_by family to it
from processTypeAttrs, going through the shared
validateBoundsAttrTypeForTypePosition leaf.
- Remove handleCountedByAttrField. Its FieldDecl-based type-shape checks in
Sema::CheckCountedByAttrOnField are superseded by
Sema::ValidateBoundsAttrTypeShape, added in the previous commit and now
reached from the type path, and are deleted; no diagnostic is dropped. The
checks that genuinely need the FieldDecl (union member, non-flexible
array, cross-struct count) stay in CheckCountedByAttrOnField and run from
[11 lines not shown]
[BoundsSafety][NFC] Thread a late-parsed attribute list through declarators
A late-parsed type attribute is written in the middle of a declarator, so the
list it lands in has to travel with the declarator pieces until the enclosing
record can supply its argument. Add that storage and plumbing, with nothing
producing or consuming it yet:
- Move CachedTokens and LateParsedAttrList earlier in DeclSpec.h so DeclSpec,
Declarator and DeclaratorChunk can hold one.
- Give DeclSpec, Declarator and DeclaratorChunk a LateParsedAttrList, and let
Declarator::AddTypeInfo carry one onto the chunk it appends.
- Give ParseSpecifierQualifierList and ParseTypeQualifierListOpt an optional
LateParsedAttrList parameter, passed down to ParseDeclarationSpecifiers.
No functional change: the lists stay empty and no caller passes one. The next
commit populates them.
[BoundsSafety][NFC] Add the Sema/Parser bridge for late-parsed type attributes
A late-parsed bounds attribute has to build its type when the attribute is
seen, but its argument isn't parseable until the enclosing record is complete.
Building that type needs the Parser (which owns the cached tokens) and Sema
(which owns type construction) to meet:
- Sema::ActOnLateParsedTypeAttr validates a counted_by-family attribute for
the type position and, if valid, wraps the type in a CountAttributedType
whose count is not yet known, handing the node back for completion.
- Parser::ProcessLateParsedTypeAttrCallback is the Parser-side entry point,
registered on Sema so Sema can call back without including Parser.h (the
same pattern as LateTemplateParserCallback). It reuses an already-built
node so several declarators sharing one attribute share one type.
No functional change: nothing records late-parsed type attributes yet, so the
callback is never invoked. The next commit wires it up.