Skip to content

Commit caaa027

Browse files
SC llvm teamSC llvm team
SC llvm team
authored and
SC llvm team
committed
Merged main:1964118ace49 into amd-gfx:a0a17ac92a9a
Local branch amd-gfx a0a17ac Merged main:ca003ee06d0e into amd-gfx:a86283a53947 Remote branch main 1964118 [mlir][sparse] fix codegen header ordering of methods into sections (llvm#68175)
2 parents a0a17ac + 1964118 commit caaa027

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+1654
-1202
lines changed

.github/CODEOWNERS

+24
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,28 @@
1+
# This file lists reviewers that are auto-assigned when a pull request modifies
2+
# certain files or directories. If you add yourself to this file, you commit to
3+
# reviewing a large fraction of pull requests in the relevant area.
4+
#
5+
# The GitHub "code owners" mechanism is used exclusively to auto-assign
6+
# reviewers and does not carry significance beyond that. It is not necessary
7+
# to receive an approval from a "code owner" in particular -- any LLVM project
8+
# member can approve pull requests.
9+
#
10+
# Note that GitHub's concept of "code owner" is independent from LLVM's own
11+
# "code owner" concept, they merely happen to share terminology. See
12+
# https://llvm.org/docs/DeveloperPolicy.html#code-owners, as well as the
13+
# CODE_OWNERS.txt files in the respective subproject directories.
14+
115
/libcxx/ @llvm/reviewers-libcxx
216
/libcxxabi/ @llvm/reviewers-libcxxabi
317
/libunwind/ @llvm/reviewers-libunwind
418
/runtimes/ @llvm/reviewers-libcxx
19+
20+
/llvm/lib/Analysis/BasicAliasAnalysis.cpp @nikic
21+
/llvm/lib/Analysis/InstructionSimplify.cpp @nikic
22+
/llvm/lib/Analysis/LazyValueInfo.cpp @nikic
23+
/llvm/lib/Analysis/ScalarEvolution.cpp @nikic
24+
/llvm/lib/Analysis/ValueTracking.cpp @nikic
25+
/llvm/lib/IR/ConstantRange.cpp @nikic
26+
/llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp @nikic
27+
/llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp @nikic
28+
/llvm/lib/Transforms/InstCombine/ @nikic

clang/docs/ReleaseNotes.rst

+5-5
Original file line numberDiff line numberDiff line change
@@ -594,11 +594,11 @@ Static Analyzer
594594

595595
- A few crashes have been found and fixed using randomized testing related
596596
to the use of ``_BitInt()`` in tidy checks and in clang analysis. See
597-
`#67212 <https://github.com/llvm/llvm-project/pull/67212>`_,
598-
`#66782 <https://github.com/llvm/llvm-project/pull/66782>`_,
599-
`#65889 <https://github.com/llvm/llvm-project/pull/65889>`_,
600-
`#65888 <https://github.com/llvm/llvm-project/pull/65888>`_, and
601-
`#65887 <https://github.com/llvm/llvm-project/pull/65887>`_
597+
`#67212 <https://github.com/llvm/llvm-project/pull/67212>`_,
598+
`#66782 <https://github.com/llvm/llvm-project/pull/66782>`_,
599+
`#65889 <https://github.com/llvm/llvm-project/pull/65889>`_,
600+
`#65888 <https://github.com/llvm/llvm-project/pull/65888>`_, and
601+
`#65887 <https://github.com/llvm/llvm-project/pull/65887>`_
602602

603603
.. _release-notes-sanitizers:
604604

clang/test/Driver/hip-offload-compress-zlib.hip

+5-7
Original file line numberDiff line numberDiff line change
@@ -20,28 +20,26 @@
2020

2121
// Test uncompress of bundled bitcode.
2222

23-
// RUN: %clang --hip-link -v --target=x86_64-linux-gnu \
23+
// RUN: %clang --hip-link -### -v --target=x86_64-linux-gnu \
2424
// RUN: --offload-arch=gfx1100 --offload-arch=gfx1101 \
2525
// RUN: -fgpu-rdc -nogpulib \
2626
// RUN: %T/a.bc --offload-device-only \
2727
// RUN: 2>&1 | FileCheck -check-prefix=UNBUNDLE %s
2828

29-
// UNBUNDLE: clang-offload-bundler{{.*}} -type=bc
29+
// UNBUNDLE: clang-offload-bundler{{.*}} "-type=bc"
3030
// UNBUNDLE-SAME: -targets={{.*}}hip-amdgcn-amd-amdhsa-gfx1100,hip-amdgcn-amd-amdhsa-gfx1101
3131
// UNBUNDLE-SAME: -unbundle
3232
// UNBUNDLE-SAME: -verbose
33-
// UNBUNDLE: Compressed bundle format
3433

3534
// Test compress bundled code objects.
3635

37-
// RUN: %clang -c -v --target=x86_64-linux-gnu \
36+
// RUN: %clang -c -### -v --target=x86_64-linux-gnu \
3837
// RUN: -x hip --offload-arch=gfx1100 --offload-arch=gfx1101 \
3938
// RUN: -nogpuinc -nogpulib \
4039
// RUN: %S/Inputs/hip_multiple_inputs/a.cu \
4140
// RUN: --offload-compress \
4241
// RUN: 2>&1 | FileCheck -check-prefix=CO %s
4342

44-
// CO: clang-offload-bundler{{.*}} -type=o
43+
// CO: clang-offload-bundler{{.*}} "-type=o"
4544
// CO-SAME: -targets={{.*}}hipv4-amdgcn-amd-amdhsa--gfx1100,hipv4-amdgcn-amd-amdhsa--gfx1101
46-
// CO-SAME: -compress -verbose
47-
// CO: Compressed bundle format
45+
// CO-SAME: "-compress" "-verbose"

clang/test/Driver/hip-offload-compress-zstd.hip

+5-7
Original file line numberDiff line numberDiff line change
@@ -20,28 +20,26 @@
2020

2121
// Test uncompress of bundled bitcode.
2222

23-
// RUN: %clang --hip-link -v --target=x86_64-linux-gnu \
23+
// RUN: %clang --hip-link -### -v --target=x86_64-linux-gnu \
2424
// RUN: --offload-arch=gfx1100 --offload-arch=gfx1101 \
2525
// RUN: -fgpu-rdc -nogpulib \
2626
// RUN: %T/a.bc --offload-device-only \
2727
// RUN: 2>&1 | FileCheck -check-prefix=UNBUNDLE %s
2828

29-
// UNBUNDLE: clang-offload-bundler{{.*}} -type=bc
29+
// UNBUNDLE: clang-offload-bundler{{.*}} "-type=bc"
3030
// UNBUNDLE-SAME: -targets={{.*}}hip-amdgcn-amd-amdhsa-gfx1100,hip-amdgcn-amd-amdhsa-gfx1101
3131
// UNBUNDLE-SAME: -unbundle
3232
// UNBUNDLE-SAME: -verbose
33-
// UNBUNDLE: Compressed bundle format
3433

3534
// Test compress bundled code objects.
3635

37-
// RUN: %clang -c -v --target=x86_64-linux-gnu \
36+
// RUN: %clang -c -### -v --target=x86_64-linux-gnu \
3837
// RUN: -x hip --offload-arch=gfx1100 --offload-arch=gfx1101 \
3938
// RUN: -nogpuinc -nogpulib \
4039
// RUN: %S/Inputs/hip_multiple_inputs/a.cu \
4140
// RUN: --offload-compress \
4241
// RUN: 2>&1 | FileCheck -check-prefix=CO %s
4342

44-
// CO: clang-offload-bundler{{.*}} -type=o
43+
// CO: clang-offload-bundler{{.*}} "-type=o"
4544
// CO-SAME: -targets={{.*}}hipv4-amdgcn-amd-amdhsa--gfx1100,hipv4-amdgcn-amd-amdhsa--gfx1101
46-
// CO-SAME: -compress -verbose
47-
// CO: Compressed bundle format
45+
// CO-SAME: "-compress" "-verbose"

flang/include/flang/ISO_Fortran_binding.h

+8-7
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,8 @@ namespace cfi_internal {
127127
template <typename T> struct FlexibleArray : T {
128128
RT_API_ATTRS T &operator[](int index) { return *(this + index); }
129129
const RT_API_ATTRS T &operator[](int index) const { return *(this + index); }
130-
operator T *() { return this; }
131-
operator const T *() const { return this; }
130+
RT_API_ATTRS operator T *() { return this; }
131+
RT_API_ATTRS operator const T *() const { return this; }
132132
};
133133
} // namespace cfi_internal
134134
#endif
@@ -182,19 +182,20 @@ template <> struct CdescStorage<0> : public CFI_cdesc_t {};
182182
#ifdef __cplusplus
183183
extern "C" {
184184
#endif
185-
void *CFI_address(const CFI_cdesc_t *, const CFI_index_t subscripts[]);
186-
int CFI_allocate(CFI_cdesc_t *, const CFI_index_t lower_bounds[],
185+
RT_API_ATTRS void *CFI_address(
186+
const CFI_cdesc_t *, const CFI_index_t subscripts[]);
187+
RT_API_ATTRS int CFI_allocate(CFI_cdesc_t *, const CFI_index_t lower_bounds[],
187188
const CFI_index_t upper_bounds[], size_t elem_len);
188189
RT_API_ATTRS int CFI_deallocate(CFI_cdesc_t *);
189190
int CFI_establish(CFI_cdesc_t *, void *base_addr, CFI_attribute_t, CFI_type_t,
190191
size_t elem_len, CFI_rank_t, const CFI_index_t extents[]);
191-
int CFI_is_contiguous(const CFI_cdesc_t *);
192+
RT_API_ATTRS int CFI_is_contiguous(const CFI_cdesc_t *);
192193
RT_API_ATTRS int CFI_section(CFI_cdesc_t *, const CFI_cdesc_t *source,
193194
const CFI_index_t lower_bounds[], const CFI_index_t upper_bounds[],
194195
const CFI_index_t strides[]);
195-
int CFI_select_part(CFI_cdesc_t *, const CFI_cdesc_t *source,
196+
RT_API_ATTRS int CFI_select_part(CFI_cdesc_t *, const CFI_cdesc_t *source,
196197
size_t displacement, size_t elem_len);
197-
int CFI_setpointer(
198+
RT_API_ATTRS int CFI_setpointer(
198199
CFI_cdesc_t *, const CFI_cdesc_t *source, const CFI_index_t lower_bounds[]);
199200
#ifdef __cplusplus
200201
} // extern "C"

flang/include/flang/Runtime/api-attrs.h

+10-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
/*
4646
* RT_OFFLOAD_API_GROUP_BEGIN/END pair is placed around definitions
4747
* of functions that can be referenced in other modules of Flang
48-
* runtime. For OpenMP offload these functions are made "declare target"
48+
* runtime. For OpenMP offload, these functions are made "declare target"
4949
* making sure they are compiled for the target even though direct
5050
* references to them from other "declare target" functions may not
5151
* be seen. Host-only functions should not be put in between these
@@ -54,6 +54,15 @@
5454
#define RT_OFFLOAD_API_GROUP_BEGIN RT_EXT_API_GROUP_BEGIN
5555
#define RT_OFFLOAD_API_GROUP_END RT_EXT_API_GROUP_END
5656

57+
/*
58+
* RT_OFFLOAD_VAR_GROUP_BEGIN/END pair is placed around definitions
59+
* of variables (e.g. globals or static class members) that can be
60+
* referenced in functions marked with RT_OFFLOAD_API_GROUP_BEGIN/END.
61+
* For OpenMP offload, these variables are made "declare target".
62+
*/
63+
#define RT_OFFLOAD_VAR_GROUP_BEGIN RT_EXT_API_GROUP_BEGIN
64+
#define RT_OFFLOAD_VAR_GROUP_END RT_EXT_API_GROUP_END
65+
5766
/*
5867
* RT_VAR_GROUP_BEGIN/END pair is placed around definitions
5968
* of module scope variables referenced by Flang runtime (directly

flang/include/flang/Runtime/assign.h

+5-5
Original file line numberDiff line numberDiff line change
@@ -30,23 +30,23 @@ class Descriptor;
3030

3131
extern "C" {
3232
// API for lowering assignment
33-
void RTNAME(Assign)(Descriptor &to, const Descriptor &from,
33+
void RTDECL(Assign)(Descriptor &to, const Descriptor &from,
3434
const char *sourceFile = nullptr, int sourceLine = 0);
3535
// This variant has no finalization, defined assignment, or allocatable
3636
// reallocation.
37-
void RTNAME(AssignTemporary)(Descriptor &to, const Descriptor &from,
37+
void RTDECL(AssignTemporary)(Descriptor &to, const Descriptor &from,
3838
const char *sourceFile = nullptr, int sourceLine = 0);
39-
void RTNAME(CopyOutAssign)(Descriptor &to, const Descriptor &from,
39+
void RTDECL(CopyOutAssign)(Descriptor &to, const Descriptor &from,
4040
bool skipToInit, const char *sourceFile = nullptr, int sourceLine = 0);
4141
// This variant is for assignments to explicit-length CHARACTER left-hand
4242
// sides that might need to handle truncation or blank-fill, and
4343
// must maintain the character length even if an allocatable array
4444
// is reallocated.
45-
void RTNAME(AssignExplicitLengthCharacter)(Descriptor &to,
45+
void RTDECL(AssignExplicitLengthCharacter)(Descriptor &to,
4646
const Descriptor &from, const char *sourceFile = nullptr,
4747
int sourceLine = 0);
4848
// This variant is assignments to whole polymorphic allocatables.
49-
void RTNAME(AssignPolymorphic)(Descriptor &to, const Descriptor &from,
49+
void RTDECL(AssignPolymorphic)(Descriptor &to, const Descriptor &from,
5050
const char *sourceFile = nullptr, int sourceLine = 0);
5151
} // extern "C"
5252
} // namespace Fortran::runtime

flang/include/flang/Runtime/descriptor.h

+2
Original file line numberDiff line numberDiff line change
@@ -427,11 +427,13 @@ static_assert(sizeof(Descriptor) == sizeof(ISO::CFI_cdesc_t));
427427
template <int MAX_RANK = maxRank, bool ADDENDUM = false, int MAX_LEN_PARMS = 0>
428428
class alignas(Descriptor) StaticDescriptor {
429429
public:
430+
RT_OFFLOAD_VAR_GROUP_BEGIN
430431
static constexpr int maxRank{MAX_RANK};
431432
static constexpr int maxLengthTypeParameters{MAX_LEN_PARMS};
432433
static constexpr bool hasAddendum{ADDENDUM || MAX_LEN_PARMS > 0};
433434
static constexpr std::size_t byteSize{
434435
Descriptor::SizeInBytes(maxRank, hasAddendum, maxLengthTypeParameters)};
436+
RT_OFFLOAD_VAR_GROUP_END
435437

436438
RT_API_ATTRS Descriptor &descriptor() {
437439
return *reinterpret_cast<Descriptor *>(storage_);

flang/runtime/CMakeLists.txt

+6
Original file line numberDiff line numberDiff line change
@@ -150,10 +150,16 @@ option(FLANG_EXPERIMENTAL_CUDA_RUNTIME
150150

151151
# List of files that are buildable for all devices.
152152
set(supported_files
153+
ISO_Fortran_binding.cpp
154+
assign.cpp
155+
derived.cpp
153156
descriptor.cpp
157+
stat.cpp
154158
terminator.cpp
159+
tools.cpp
155160
transformational.cpp
156161
type-code.cpp
162+
type-info.cpp
157163
)
158164

159165
if (FLANG_EXPERIMENTAL_CUDA_RUNTIME)

flang/runtime/ISO_Fortran_binding.cpp

+14-9
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@
1919
namespace Fortran::ISO {
2020
extern "C" {
2121

22-
void *CFI_address(
22+
RT_EXT_API_GROUP_BEGIN
23+
24+
RT_API_ATTRS void *CFI_address(
2325
const CFI_cdesc_t *descriptor, const CFI_index_t subscripts[]) {
2426
char *p{static_cast<char *>(descriptor->base_addr)};
2527
const CFI_rank_t rank{descriptor->rank};
@@ -30,8 +32,9 @@ void *CFI_address(
3032
return p;
3133
}
3234

33-
int CFI_allocate(CFI_cdesc_t *descriptor, const CFI_index_t lower_bounds[],
34-
const CFI_index_t upper_bounds[], std::size_t elem_len) {
35+
RT_API_ATTRS int CFI_allocate(CFI_cdesc_t *descriptor,
36+
const CFI_index_t lower_bounds[], const CFI_index_t upper_bounds[],
37+
std::size_t elem_len) {
3538
if (!descriptor) {
3639
return CFI_INVALID_DESCRIPTOR;
3740
}
@@ -81,7 +84,7 @@ int CFI_allocate(CFI_cdesc_t *descriptor, const CFI_index_t lower_bounds[],
8184
return CFI_SUCCESS;
8285
}
8386

84-
int CFI_deallocate(CFI_cdesc_t *descriptor) {
87+
RT_API_ATTRS int CFI_deallocate(CFI_cdesc_t *descriptor) {
8588
if (!descriptor) {
8689
return CFI_INVALID_DESCRIPTOR;
8790
}
@@ -101,7 +104,7 @@ int CFI_deallocate(CFI_cdesc_t *descriptor) {
101104
return CFI_SUCCESS;
102105
}
103106

104-
int CFI_establish(CFI_cdesc_t *descriptor, void *base_addr,
107+
RT_API_ATTRS int CFI_establish(CFI_cdesc_t *descriptor, void *base_addr,
105108
CFI_attribute_t attribute, CFI_type_t type, std::size_t elem_len,
106109
CFI_rank_t rank, const CFI_index_t extents[]) {
107110
int cfiStatus{VerifyEstablishParameters(descriptor, base_addr, attribute,
@@ -121,7 +124,7 @@ int CFI_establish(CFI_cdesc_t *descriptor, void *base_addr,
121124
return CFI_SUCCESS;
122125
}
123126

124-
int CFI_is_contiguous(const CFI_cdesc_t *descriptor) {
127+
RT_API_ATTRS int CFI_is_contiguous(const CFI_cdesc_t *descriptor) {
125128
CFI_index_t bytes = descriptor->elem_len;
126129
for (int j{0}; j < descriptor->rank; ++j) {
127130
if (bytes != descriptor->dim[j].sm) {
@@ -132,7 +135,7 @@ int CFI_is_contiguous(const CFI_cdesc_t *descriptor) {
132135
return 1;
133136
}
134137

135-
int CFI_section(CFI_cdesc_t *result, const CFI_cdesc_t *source,
138+
RT_API_ATTRS int CFI_section(CFI_cdesc_t *result, const CFI_cdesc_t *source,
136139
const CFI_index_t lower_bounds[], const CFI_index_t upper_bounds[],
137140
const CFI_index_t strides[]) {
138141
CFI_index_t extent[CFI_MAX_RANK];
@@ -208,7 +211,7 @@ int CFI_section(CFI_cdesc_t *result, const CFI_cdesc_t *source,
208211
return CFI_SUCCESS;
209212
}
210213

211-
int CFI_select_part(CFI_cdesc_t *result, const CFI_cdesc_t *source,
214+
RT_API_ATTRS int CFI_select_part(CFI_cdesc_t *result, const CFI_cdesc_t *source,
212215
std::size_t displacement, std::size_t elem_len) {
213216
if (!result || !source) {
214217
return CFI_INVALID_DESCRIPTOR;
@@ -243,7 +246,7 @@ int CFI_select_part(CFI_cdesc_t *result, const CFI_cdesc_t *source,
243246
return CFI_SUCCESS;
244247
}
245248

246-
int CFI_setpointer(CFI_cdesc_t *result, const CFI_cdesc_t *source,
249+
RT_API_ATTRS int CFI_setpointer(CFI_cdesc_t *result, const CFI_cdesc_t *source,
247250
const CFI_index_t lower_bounds[]) {
248251
if (!result) {
249252
return CFI_INVALID_DESCRIPTOR;
@@ -285,5 +288,7 @@ int CFI_setpointer(CFI_cdesc_t *result, const CFI_cdesc_t *source,
285288
}
286289
return CFI_SUCCESS;
287290
}
291+
292+
RT_EXT_API_GROUP_END
288293
} // extern "C"
289294
} // namespace Fortran::ISO

flang/runtime/assign-impl.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ class Terminator;
1717
// Note that if allocate object and source expression have the same rank, the
1818
// value of the allocate object becomes the value provided; otherwise the value
1919
// of each element of allocate object becomes the value provided (9.7.1.2(7)).
20-
void DoFromSourceAssign(Descriptor &, const Descriptor &, Terminator &);
20+
RT_API_ATTRS void DoFromSourceAssign(
21+
Descriptor &, const Descriptor &, Terminator &);
2122

2223
} // namespace Fortran::runtime
2324
#endif // FORTRAN_RUNTIME_ASSIGN_IMPL_H_

0 commit comments

Comments
 (0)