Skip to content

Commit d112120

Browse files
committed
Merge branch 'main' into linearize_bitcast
2 parents 054b700 + e7de603 commit d112120

File tree

148 files changed

+4231
-980
lines changed

Some content is hidden

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

148 files changed

+4231
-980
lines changed

.ci/metrics/metrics.py

Lines changed: 38 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -130,34 +130,6 @@ def get_per_workflow_metrics(
130130
workflow_jobs = workflow_run.jobs()
131131
if workflow_jobs.totalCount == 0:
132132
continue
133-
if workflow_jobs.totalCount > 1:
134-
raise ValueError(
135-
f"Encountered an unexpected number of jobs: {workflow_jobs.totalCount}"
136-
)
137-
138-
created_at = workflow_jobs[0].created_at
139-
started_at = workflow_jobs[0].started_at
140-
completed_at = workflow_jobs[0].completed_at
141-
142-
job_result = int(workflow_jobs[0].conclusion == "success")
143-
if job_result:
144-
# We still might want to mark the job as a failure if one of the steps
145-
# failed. This is required due to use setting continue-on-error in
146-
# the premerge pipeline to prevent sending emails while we are
147-
# testing the infrastructure.
148-
# TODO(boomanaiden154): Remove this once the premerge pipeline is no
149-
# longer in a testing state and we can directly assert the workflow
150-
# result.
151-
for step in workflow_jobs[0].steps:
152-
if step.conclusion != "success":
153-
job_result = 0
154-
break
155-
156-
queue_time = started_at - created_at
157-
run_time = completed_at - started_at
158-
159-
if run_time.seconds == 0:
160-
continue
161133

162134
if (
163135
workflows_to_track[workflow_run.name] is None
@@ -170,20 +142,45 @@ def get_per_workflow_metrics(
170142
):
171143
break
172144

173-
# The timestamp associated with the event is expected by Grafana to be
174-
# in nanoseconds.
175-
created_at_ns = int(created_at.timestamp()) * 10**9
176-
177-
workflow_metrics.append(
178-
JobMetrics(
179-
workflow_run.name,
180-
queue_time.seconds,
181-
run_time.seconds,
182-
job_result,
183-
created_at_ns,
184-
workflow_run.id,
145+
for workflow_job in workflow_jobs:
146+
created_at = workflow_job.created_at
147+
started_at = workflow_job.started_at
148+
completed_at = workflow_job.completed_at
149+
150+
job_result = int(workflow_job.conclusion == "success")
151+
if job_result:
152+
# We still might want to mark the job as a failure if one of the steps
153+
# failed. This is required due to use setting continue-on-error in
154+
# the premerge pipeline to prevent sending emails while we are
155+
# testing the infrastructure.
156+
# TODO(boomanaiden154): Remove this once the premerge pipeline is no
157+
# longer in a testing state and we can directly assert the workflow
158+
# result.
159+
for step in workflow_job.steps:
160+
if step.conclusion != "success":
161+
job_result = 0
162+
break
163+
164+
queue_time = started_at - created_at
165+
run_time = completed_at - started_at
166+
167+
if run_time.seconds == 0:
168+
continue
169+
170+
# The timestamp associated with the event is expected by Grafana to be
171+
# in nanoseconds.
172+
created_at_ns = int(created_at.timestamp()) * 10**9
173+
174+
workflow_metrics.append(
175+
JobMetrics(
176+
workflow_run.name + "-" + workflow_job.name,
177+
queue_time.seconds,
178+
run_time.seconds,
179+
job_result,
180+
created_at_ns,
181+
workflow_run.id,
182+
)
185183
)
186-
)
187184

188185
return workflow_metrics
189186

clang/lib/CodeGen/CodeGenFunction.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ class CodeGenFunction : public CodeGenTypeCache {
451451
"EBB should be entry block of the current code gen function");
452452
PostAllocaInsertPt = AllocaInsertPt->clone();
453453
PostAllocaInsertPt->setName("postallocapt");
454-
PostAllocaInsertPt->insertAfter(AllocaInsertPt);
454+
PostAllocaInsertPt->insertAfter(AllocaInsertPt->getIterator());
455455
}
456456

457457
return PostAllocaInsertPt;

clang/lib/Driver/Driver.cpp

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6669,9 +6669,21 @@ const ToolChain &Driver::getToolChain(const ArgList &Args,
66696669
case llvm::Triple::CUDA:
66706670
TC = std::make_unique<toolchains::NVPTXToolChain>(*this, Target, Args);
66716671
break;
6672-
case llvm::Triple::AMDHSA:
6673-
TC = std::make_unique<toolchains::ROCMToolChain>(*this, Target, Args);
6672+
case llvm::Triple::AMDHSA: {
6673+
bool CL = llvm::any_of(Args, [&](Arg *A) {
6674+
return (A->getOption().matches(options::OPT_x) &&
6675+
types::isOpenCL(
6676+
types::lookupTypeForExtension(A->getValue()))) ||
6677+
(A->getOption().getKind() == Option::InputClass &&
6678+
StringRef(A->getValue()).rfind('.') != StringRef::npos &&
6679+
types::isOpenCL(types::lookupTypeForExtension(
6680+
&A->getValue()[StringRef(A->getValue()).rfind('.') + 1])));
6681+
});
6682+
TC = CL ? std::make_unique<toolchains::ROCMToolChain>(*this, Target, Args)
6683+
: std::make_unique<toolchains::AMDGPUToolChain>(*this, Target,
6684+
Args);
66746685
break;
6686+
}
66756687
case llvm::Triple::AMDPAL:
66766688
case llvm::Triple::Mesa3D:
66776689
TC = std::make_unique<toolchains::AMDGPUToolChain>(*this, Target, Args);

clang/lib/Sema/SemaDecl.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11380,8 +11380,11 @@ static bool CheckMultiVersionAdditionalRules(Sema &S, const FunctionDecl *OldFD,
1138011380
return true;
1138111381

1138211382
// Only allow transition to MultiVersion if it hasn't been used.
11383-
if (OldFD && CausesMV && OldFD->isUsed(false))
11384-
return S.Diag(NewFD->getLocation(), diag::err_multiversion_after_used);
11383+
if (OldFD && CausesMV && OldFD->isUsed(false)) {
11384+
S.Diag(NewFD->getLocation(), diag::err_multiversion_after_used);
11385+
S.Diag(OldFD->getLocation(), diag::note_previous_declaration);
11386+
return true;
11387+
}
1138511388

1138611389
return S.areMultiversionVariantFunctionsCompatible(
1138711390
OldFD, NewFD, S.PDiag(diag::err_multiversion_noproto),

clang/test/Driver/amdgpu-toolchain.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,6 @@
3636
// RUN: %clang -target amdgcn-amd-amdhsa -march=gfx90a -stdlib -startfiles \
3737
// RUN: -nogpulib -nogpuinc -### %s 2>&1 | FileCheck -check-prefix=STARTUP %s
3838
// STARTUP: ld.lld{{.*}}"-lc" "-lm" "{{.*}}crt1.o"
39+
//
40+
// RUN: %clang -### --target=amdgcn-amd-amdhsa -mcpu=gfx906 %s 2>&1 | FileCheck -check-prefix=ROCM %s
41+
// ROCM-NOT: -mlink-builtin-bitcode

clang/test/Sema/attr-cpuspecific.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ int allow_fwd_decl2(void);
4444
void use_fwd_decl(void) {
4545
allow_fwd_decl2();
4646
}
47-
// expected-error@+1 {{function declaration cannot become a multiversioned function after first usage}}
47+
// expected-error@+2 {{function declaration cannot become a multiversioned function after first usage}}
48+
// expected-note@-5 {{previous declaration is here}}
4849
int __attribute__((cpu_dispatch(atom))) allow_fwd_decl2(void) {}
4950

5051

clang/test/Sema/attr-target-mv.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ int use3(void) {
6666
return mv_after_use();
6767
}
6868

69-
// expected-error@+1 {{function declaration cannot become a multiversioned function after first usage}}
69+
// expected-error@+2 {{function declaration cannot become a multiversioned function after first usage}}
70+
// expected-note@-6 {{previous declaration is here}}
7071
int __attribute__((target("arch=sandybridge"))) mv_after_use(void) { return 2; }
7172

7273
int __attribute__((target("sse4.2,arch=sandybridge"))) mangle(void) { return 1; }

clang/test/Sema/attr-target-version.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ int bar() {
8888
nodef();
8989
return def();
9090
}
91-
// expected-error@+1 {{function declaration cannot become a multiversioned function after first usage}}
91+
// expected-error@+2 {{function declaration cannot become a multiversioned function after first usage}}
92+
// expected-note@-13 {{previous declaration is here}}
9293
int __attribute__((target_version("sha2"))) def(void) { return 1; }
9394

9495
int __attribute__((target_version("sve"))) prot();

flang/docs/ModFiles.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,3 +164,13 @@ a diagnostic but we still wouldn't have line numbers.
164164
To provide line numbers and character positions or source lines as the user
165165
wrote them we would have to save some amount of provenance information in the
166166
module file as well.
167+
168+
## Hermetic modules files
169+
170+
Top-level module files for libraries can be build with `-fhermetic-module-files`.
171+
This option causes these module files to contain copies of all of the non-intrinsic
172+
modules on which they depend, so that non-top-level local modules and the
173+
modules of dependent libraries need not also be packaged with the library.
174+
When the compiler reads a hermetic module file, the copies of the dependent
175+
modules are read into their own scope, and will not conflict with other modules
176+
of the same name that client code might `USE`.

flang/include/flang/Common/Fortran-features.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ ENUM_CLASS(UsageWarning, Portability, PointerToUndefinable,
7373
PreviousScalarUse, RedeclaredInaccessibleComponent, ImplicitShared,
7474
IndexVarRedefinition, IncompatibleImplicitInterfaces, BadTypeForTarget,
7575
VectorSubscriptFinalization, UndefinedFunctionResult, UselessIomsg,
76-
MismatchingDummyProcedure, SubscriptedEmptyArray, UnsignedLiteralTruncation)
76+
MismatchingDummyProcedure, SubscriptedEmptyArray, UnsignedLiteralTruncation,
77+
CompatibleDeclarationsFromDistinctModules)
7778

7879
using LanguageFeatures = EnumSet<LanguageFeature, LanguageFeature_enumSize>;
7980
using UsageWarnings = EnumSet<UsageWarning, UsageWarning_enumSize>;

0 commit comments

Comments
 (0)