https://github.com/AlexisPerry created
https://github.com/llvm/llvm-project/pull/95043
This PR adds -mtune as a valid flang flag and passes the information through to
LLVM IR as an attribute on all functions. No specific architecture
optimizations are added at this time.
>From 2312d31b14aecc
llvmbot wrote:
@llvm/pr-subscribers-flang-driver
@llvm/pr-subscribers-flang-codegen
Author: Alexis Perry-Holby (AlexisPerry)
Changes
This PR adds -mtune as a valid flang flag and passes the information through to
LLVM IR as an attribute on all functions. No specific architecture
optimiz
llvmbot wrote:
@llvm/pr-subscribers-mlir-llvm
Author: Alexis Perry-Holby (AlexisPerry)
Changes
This PR adds -mtune as a valid flang flag and passes the information through to
LLVM IR as an attribute on all functions. No specific architecture
optimizations are added at this time.
---
P
github-actions[bot] wrote:
:warning: C/C++ code formatter, clang-format found issues in your code.
:warning:
You can test this locally with the following command:
``bash
git-clang-format --diff d3c0ed387c478dc07daac575b2ec1216b8044b56
2312d31b14aecc6eeea2e81d221ee004e5de3efc --
https://github.com/AlexisPerry updated
https://github.com/llvm/llvm-project/pull/95043
>From 2312d31b14aecc6eeea2e81d221ee004e5de3efc Mon Sep 17 00:00:00 2001
From: Alexis Perry-Holby
Date: Thu, 6 Jun 2024 14:02:52 -0600
Subject: [PATCH 1/2] [flang] Add basic -mtune support
---
clang/include/
https://github.com/Dinistro commented:
This is missing tests for the LLVM import and export. I suspect that this is
currently still part of the function's passthrough dictionary, which should be
changed.
https://github.com/llvm/llvm-project/pull/95043
__
https://github.com/Dinistro edited
https://github.com/llvm/llvm-project/pull/95043
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -411,6 +412,13 @@ void Flang::addTargetOptions(const ArgList &Args,
}
// TODO: Add target specific flags, ABI, mtune option etc.
+ if (const Arg *A = Args.getLastArg(options::OPT_mtune_EQ)) {
+CmdArgs.push_back("-tune-cpu");
+if (strcmp(A->getValue(), "native")
@@ -58,6 +58,15 @@ def FramePointerKindAttr : LLVM_Attr<"FramePointerKind",
"framePointerKind"> {
let assemblyFormat = "`<` $framePointerKind `>`";
}
+//===--===//
+// TuneCPUAttr
+//===
https://github.com/tarunprabhu commented:
Is there a way to test that the attribute is lowered to FIR and perhaps also on
to LLVM? `flang/test/Lower/` has some tests which check for the presence of
certain constructs in the LLVM IR. Could something be written similar to those?
https://github.c
@@ -371,7 +371,7 @@ static mlir::LogicalResult convertFortranSourceToMLIR(
ctx, semanticsContext, defKinds, semanticsContext.intrinsics(),
semanticsContext.targetCharacteristics(), parsing.allCooked(),
targetTriple, kindMap, loweringOptions, envDefaults,
-
https://github.com/tarunprabhu edited
https://github.com/llvm/llvm-project/pull/95043
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -58,6 +58,15 @@ def FramePointerKindAttr : LLVM_Attr<"FramePointerKind",
"framePointerKind"> {
let assemblyFormat = "`<` $framePointerKind `>`";
}
+//===--===//
+// TuneCPUAttr
+//===
@@ -371,7 +371,7 @@ static mlir::LogicalResult convertFortranSourceToMLIR(
ctx, semanticsContext, defKinds, semanticsContext.intrinsics(),
semanticsContext.targetCharacteristics(), parsing.allCooked(),
targetTriple, kindMap, loweringOptions, envDefaults,
-
@@ -411,6 +412,13 @@ void Flang::addTargetOptions(const ArgList &Args,
}
// TODO: Add target specific flags, ABI, mtune option etc.
+ if (const Arg *A = Args.getLastArg(options::OPT_mtune_EQ)) {
+CmdArgs.push_back("-tune-cpu");
+if (strcmp(A->getValue(), "native")
https://github.com/banach-space edited
https://github.com/llvm/llvm-project/pull/95043
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/banach-space commented:
Thanks for working on this @AlexisPerry ! Could you add some tests?
https://github.com/llvm/llvm-project/pull/95043
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailma
@@ -32,6 +32,9 @@ class TargetOptions {
/// If given, the name of the target CPU to generate code for.
std::string cpu;
+ /// If given, the name of the target CPU to tune code for.
+ std::string tuneCPU;
banach-space wrote:
I'm fine with longer self-doc
https://github.com/AlexisPerry updated
https://github.com/llvm/llvm-project/pull/95043
>From 2312d31b14aecc6eeea2e81d221ee004e5de3efc Mon Sep 17 00:00:00 2001
From: Alexis Perry-Holby
Date: Thu, 6 Jun 2024 14:02:52 -0600
Subject: [PATCH 1/3] [flang] Add basic -mtune support
---
clang/include/
@@ -411,6 +412,13 @@ void Flang::addTargetOptions(const ArgList &Args,
}
// TODO: Add target specific flags, ABI, mtune option etc.
+ if (const Arg *A = Args.getLastArg(options::OPT_mtune_EQ)) {
+CmdArgs.push_back("-tune-cpu");
+if (strcmp(A->getValue(), "native")
https://github.com/AlexisPerry updated
https://github.com/llvm/llvm-project/pull/95043
>From 2312d31b14aecc6eeea2e81d221ee004e5de3efc Mon Sep 17 00:00:00 2001
From: Alexis Perry-Holby
Date: Thu, 6 Jun 2024 14:02:52 -0600
Subject: [PATCH 1/4] [flang] Add basic -mtune support
---
clang/include/
https://github.com/AlexisPerry updated
https://github.com/llvm/llvm-project/pull/95043
>From 2312d31b14aecc6eeea2e81d221ee004e5de3efc Mon Sep 17 00:00:00 2001
From: Alexis Perry-Holby
Date: Thu, 6 Jun 2024 14:02:52 -0600
Subject: [PATCH 1/4] [flang] Add basic -mtune support
---
clang/include/
tarunprabhu wrote:
Why do you have the first `target-cpu` check on its own? Is it intended to
check for the _absence_ of the `tune-cpu` attribute when `target-cpu` is
provided on the command line? If so, there should be a `CPU-NOT` annotation as
well. Otherwi
tarunprabhu wrote:
Consider replacing `#0` with `#{{[0-9]+}}`. While the attributes are almost
certainly going to be in `#0` for such a small function, you don't actually
_require_ this to match `#0`, so you it might be better to let it match any
number.
Al
https://github.com/tarunprabhu edited
https://github.com/llvm/llvm-project/pull/95043
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/AlexisPerry updated
https://github.com/llvm/llvm-project/pull/95043
>From 2312d31b14aecc6eeea2e81d221ee004e5de3efc Mon Sep 17 00:00:00 2001
From: Alexis Perry-Holby
Date: Thu, 6 Jun 2024 14:02:52 -0600
Subject: [PATCH 1/5] [flang] Add basic -mtune support
---
clang/include/
AlexisPerry wrote:
Thank you for the catch! Yes, the CPU-NOT line was missing. I have rectified
this.
https://github.com/llvm/llvm-project/pull/95043
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://l
AlexisPerry wrote:
Those are great suggestions, thank you. I have made the appropriate updates.
https://github.com/llvm/llvm-project/pull/95043
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.ll
@@ -371,7 +371,7 @@ static mlir::LogicalResult convertFortranSourceToMLIR(
ctx, semanticsContext, defKinds, semanticsContext.intrinsics(),
semanticsContext.targetCharacteristics(), parsing.allCooked(),
targetTriple, kindMap, loweringOptions, envDefaults,
-
@@ -1796,6 +1797,10 @@ void
ModuleImport::processFunctionAttributes(llvm::Function *func,
attr.isStringAttribute())
funcOp.setTargetCpuAttr(StringAttr::get(context, attr.getValueAsString()));
+ if (llvm::Attribute attr = func->getFnAttribute("tune-cpu");
+ att
https://github.com/AlexisPerry updated
https://github.com/llvm/llvm-project/pull/95043
>From 2312d31b14aecc6eeea2e81d221ee004e5de3efc Mon Sep 17 00:00:00 2001
From: Alexis Perry-Holby
Date: Thu, 6 Jun 2024 14:02:52 -0600
Subject: [PATCH 1/6] [flang] Add basic -mtune support
---
clang/include/
@@ -32,6 +32,9 @@ class TargetOptions {
/// If given, the name of the target CPU to generate code for.
std::string cpu;
+ /// If given, the name of the target CPU to tune code for.
+ std::string tuneCPU;
AlexisPerry wrote:
Thank you for the suggestion.
https://github.com/AlexisPerry updated
https://github.com/llvm/llvm-project/pull/95043
>From 2312d31b14aecc6eeea2e81d221ee004e5de3efc Mon Sep 17 00:00:00 2001
From: Alexis Perry-Holby
Date: Thu, 6 Jun 2024 14:02:52 -0600
Subject: [PATCH 1/7] [flang] Add basic -mtune support
---
clang/include/
@@ -1796,6 +1797,10 @@ void
ModuleImport::processFunctionAttributes(llvm::Function *func,
attr.isStringAttribute())
funcOp.setTargetCpuAttr(StringAttr::get(context, attr.getValueAsString()));
+ if (llvm::Attribute attr = func->getFnAttribute("tune-cpu");
+ att
https://github.com/AlexisPerry updated
https://github.com/llvm/llvm-project/pull/95043
>From 2312d31b14aecc6eeea2e81d221ee004e5de3efc Mon Sep 17 00:00:00 2001
From: Alexis Perry-Holby
Date: Thu, 6 Jun 2024 14:02:52 -0600
Subject: [PATCH 1/8] [flang] Add basic -mtune support
---
clang/include/
@@ -371,7 +371,7 @@ static mlir::LogicalResult convertFortranSourceToMLIR(
ctx, semanticsContext, defKinds, semanticsContext.intrinsics(),
semanticsContext.targetCharacteristics(), parsing.allCooked(),
targetTriple, kindMap, loweringOptions, envDefaults,
-
@@ -1796,6 +1797,10 @@ void
ModuleImport::processFunctionAttributes(llvm::Function *func,
attr.isStringAttribute())
funcOp.setTargetCpuAttr(StringAttr::get(context, attr.getValueAsString()));
+ if (llvm::Attribute attr = func->getFnAttribute("tune-cpu");
+ att
https://github.com/AlexisPerry updated
https://github.com/llvm/llvm-project/pull/95043
>From 2312d31b14aecc6eeea2e81d221ee004e5de3efc Mon Sep 17 00:00:00 2001
From: Alexis Perry-Holby
Date: Thu, 6 Jun 2024 14:02:52 -0600
Subject: [PATCH 1/9] [flang] Add basic -mtune support
---
clang/include/
https://github.com/tarunprabhu commented:
Thanks for the changes. LGTM, but wait for @banach-space to approve.
https://github.com/llvm/llvm-project/pull/95043
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailma
@@ -0,0 +1,9 @@
+; RUN: mlir-translate -import-llvm -split-input-file %s | FileCheck %s
+
+; CHECK-LABEL: llvm.func @tune_cpu()
+; CHECK-SAME: tune_cpu = "pentium4"
Dinistro wrote:
Can you add a check that ensures that this is not also placed in the
passthrough
@@ -411,6 +412,13 @@ void Flang::addTargetOptions(const ArgList &Args,
}
// TODO: Add target specific flags, ABI, mtune option etc.
+ if (const Arg *A = Args.getLastArg(options::OPT_mtune_EQ)) {
+CmdArgs.push_back("-tune-cpu");
+if (strcmp(A->getValue(), "native")
banach-space wrote:
This is probably a border-line case, but I would consider this a "driver"
rather than a "lowering" test. I'm biased though 😅
https://github.com/llvm/llvm-project/pull/95043
___
cfe-commits mailin
https://github.com/banach-space approved this pull request.
LGTM, thanks for implementing this 🙏🏻
https://github.com/llvm/llvm-project/pull/95043
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/c
@@ -0,0 +1,9 @@
+; RUN: mlir-translate -import-llvm -split-input-file %s | FileCheck %s
+
+; CHECK-LABEL: llvm.func @tune_cpu()
+; CHECK-SAME: tune_cpu = "pentium4"
AlexisPerry wrote:
>From what I can see, L1685 of ModuleImport.cpp has tune-cpu listed among the
@@ -411,6 +412,13 @@ void Flang::addTargetOptions(const ArgList &Args,
}
// TODO: Add target specific flags, ABI, mtune option etc.
+ if (const Arg *A = Args.getLastArg(options::OPT_mtune_EQ)) {
+CmdArgs.push_back("-tune-cpu");
+if (strcmp(A->getValue(), "native")
AlexisPerry wrote:
I hear you. I modeled this test closely after target-features-*.f90 in that
same directory, which is why I put it in flang/test/Lower. I am willing to
move it to flang/test/Driver, but if I do so should I also move the
target-features-*.f
https://github.com/AlexisPerry edited
https://github.com/llvm/llvm-project/pull/95043
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/AlexisPerry updated
https://github.com/llvm/llvm-project/pull/95043
>From 2312d31b14aecc6eeea2e81d221ee004e5de3efc Mon Sep 17 00:00:00 2001
From: Alexis Perry-Holby
Date: Thu, 6 Jun 2024 14:02:52 -0600
Subject: [PATCH 01/10] [flang] Add basic -mtune support
---
clang/includ
AlexisPerry wrote:
I have lost my upstream commit privileges due to inactivity, so once this is
fully approved, could someone merge it on my behalf? Thank you.
https://github.com/llvm/llvm-project/pull/95043
___
cfe-commits mailing list
cfe-commits@l
https://github.com/Dinistro approved this pull request.
The MLIR side looks good to me % one remaining nit comment. Thanks for
addressing the comments.
https://github.com/llvm/llvm-project/pull/95043
___
cfe-commits mailing list
cfe-commits@lists.llvm
https://github.com/Dinistro edited
https://github.com/llvm/llvm-project/pull/95043
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -0,0 +1,9 @@
+; RUN: mlir-translate -import-llvm -split-input-file %s | FileCheck %s
+
+; CHECK-LABEL: llvm.func @tune_cpu()
+; CHECK-SAME: tune_cpu = "pentium4"
Dinistro wrote:
Given that we are both not entirely sure what happens, it might be sensible to
ch
banach-space wrote:
> if I do so should I also move the target-features-*.f90 tests?
Yes, but to me that would qualify as an "unrelated change" (i.e. sth for a
separate PR, no need to worry about it here).
In general, this PR is about enabling a flag in Flan
@@ -0,0 +1,9 @@
+; RUN: mlir-translate -import-llvm -split-input-file %s | FileCheck %s
+
+; CHECK-LABEL: llvm.func @tune_cpu()
+; CHECK-SAME: tune_cpu = "pentium4"
AlexisPerry wrote:
Alright, after some digging, I can confirm that `tune-cpu` is listed among the
https://github.com/AlexisPerry updated
https://github.com/llvm/llvm-project/pull/95043
>From 2312d31b14aecc6eeea2e81d221ee004e5de3efc Mon Sep 17 00:00:00 2001
From: Alexis Perry-Holby
Date: Thu, 6 Jun 2024 14:02:52 -0600
Subject: [PATCH 01/11] [flang] Add basic -mtune support
---
clang/includ
AlexisPerry wrote:
Thanks for explaining more thoroughly. I have moved the test to the Driver
directory as requested.
https://github.com/llvm/llvm-project/pull/95043
___
cfe-commits mailing list
cfe-commits@lists.ll
AlexisPerry wrote:
I believe I've addressed all the review comments and all the checks have
passed. Could someone with commit access please merge this on my behalf?
Thank you.
https://github.com/llvm/llvm-project/pull/95043
___
cfe-commits mailing
https://github.com/banach-space closed
https://github.com/llvm/llvm-project/pull/95043
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
llvm-ci wrote:
LLVM Buildbot has detected a new failure on builder `clang-cuda-l4` running on
`cuda-l4-0` while building `clang,flang,mlir` at step 3 "annotate".
Full details are available at:
https://lab.llvm.org/buildbot/#/builders/101/builds/691
Here is the relevant piece of the build log
llvm-ci wrote:
LLVM Buildbot has detected a new failure on builder `flang-aarch64-libcxx`
running on `linaro-flang-aarch64-libcxx` while building `clang,flang,mlir` at
step 6 "test-build-unified-tree-check-flang".
Full details are available at:
https://lab.llvm.org/buildbot/#/builders/89/buil
banach-space wrote:
> LLVM Buildbot has detected a new failure on builder `flang-aarch64-libcxx`
> running on `linaro-flang-aarch64-libcxx` while building `clang,flang,mlir` at
> step 6 "test-build-unified-tree-check-flang".
>
> Full details are available at:
> https://lab.llvm.org/buildbot/#
61 matches
Mail list logo