[clang] [llvm] clang/AMDGPU: Set noalias.addrspace metadata on atomicrmw (PR #102462)

2024-10-07 Thread Matt Arsenault via cfe-commits
https://github.com/arsenm edited https://github.com/llvm/llvm-project/pull/102462 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [clang][llvm][SPIR-V] Explicitly encode native integer widths for SPIR-V (PR #110695)

2024-10-07 Thread Matt Arsenault via cfe-commits
@@ -1,12 +1,14 @@ ; This test aims to check ability to support "Arithmetic with Overflow" intrinsics ; in the special case when those intrinsics are being generated by the CodeGenPrepare; -; pass during translations with optimization (note -O3 in llc arguments). +; pass during

[clang] [llvm] Implement operand bundles for floating-point operations (PR #109798)

2024-10-07 Thread Matt Arsenault via cfe-commits
arsenm wrote: > WRT eliminating the constrained intrinsics completely, I thought that operand > bundles could only be attached to function calls and not regular > instructions? If I'm wrong, we _still_ have a problem because there are so > many uses of the regular FP instructions that we can't

[clang] [llvm] [SystemZ] Add support for half (fp16) (PR #109164)

2024-10-07 Thread Matt Arsenault via cfe-commits
@@ -0,0 +1,201 @@ +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5 +; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z16 | FileCheck %s +; +; Tests for 16-bit floating point (half). + +; Incoming half arguments added together and

[clang] [llvm] [SystemZ] Add support for half (fp16) (PR #109164)

2024-10-07 Thread Matt Arsenault via cfe-commits
@@ -784,6 +791,20 @@ bool SystemZTargetLowering::useSoftFloat() const { return Subtarget.hasSoftFloat(); } +MVT SystemZTargetLowering::getRegisterTypeForCallingConv( + LLVMContext &Context, CallingConv::ID CC, + EVT VT) const { + // 128-bit single-element vector t

[clang] [llvm] [SystemZ] Add support for half (fp16) (PR #109164)

2024-10-07 Thread Matt Arsenault via cfe-commits
@@ -1597,6 +1618,15 @@ bool SystemZTargetLowering::splitValueIntoRegisterParts( return true; } + // Convert f16 to f32 (Out-arg). + if (PartVT == MVT::f16) { +assert(NumParts == 1 && ""); arsenm wrote: Remove && "" or make it a meaningful message

[clang] [llvm] [SystemZ] Add support for half (fp16) (PR #109164)

2024-10-07 Thread Matt Arsenault via cfe-commits
@@ -0,0 +1,201 @@ +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5 +; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z16 | FileCheck %s +; +; Tests for 16-bit floating point (half). + +; Incoming half arguments added together and

[clang] [llvm] [SystemZ] Add support for half (fp16) (PR #109164)

2024-10-07 Thread Matt Arsenault via cfe-commits
@@ -0,0 +1,201 @@ +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5 +; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z16 | FileCheck %s +; +; Tests for 16-bit floating point (half). + +; Incoming half arguments added together and

[clang] [llvm] [SystemZ] Add support for half (fp16) (PR #109164)

2024-10-07 Thread Matt Arsenault via cfe-commits
@@ -0,0 +1,85 @@ +// RUN: %clang_cc1 -triple s390x-linux-gnu \ +// RUN: -ffloat16-excess-precision=standard -emit-llvm -o - %s \ +// RUN: | FileCheck %s -check-prefix=STANDARD + +// RUN: %clang_cc1 -triple s390x-linux-gnu \ +// RUN: -ffloat16-excess-precision=none -emit-llvm -o -

[clang] [llvm] [SystemZ] Add support for half (fp16) (PR #109164)

2024-10-07 Thread Matt Arsenault via cfe-commits
@@ -784,6 +791,20 @@ bool SystemZTargetLowering::useSoftFloat() const { return Subtarget.hasSoftFloat(); } +MVT SystemZTargetLowering::getRegisterTypeForCallingConv( + LLVMContext &Context, CallingConv::ID CC, + EVT VT) const { + // 128-bit single-element vector t

[clang] [Clang] Automatically enable `-fconvergent-functions` on GPU targets (PR #111076)

2024-10-04 Thread Matt Arsenault via cfe-commits
arsenm wrote: > Think it would be useful to put that on functions in the wrapper headers that > definitely aren't convergent? E.g. getting a thread id. You could, but it's trivially inferable in those cases anyway https://github.com/llvm/llvm-project/pull/111076

[clang] [Clang] Automatically enable `-fconvergent-functions` on GPU targets (PR #111076)

2024-10-04 Thread Matt Arsenault via cfe-commits
https://github.com/arsenm approved this pull request. https://github.com/llvm/llvm-project/pull/111076 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Automatically enable `-fconvergent-functions` on GPU targets (PR #111076)

2024-10-03 Thread Matt Arsenault via cfe-commits
@@ -4106,9 +4106,10 @@ bool CompilerInvocation::ParseLangArgs(LangOptions &Opts, ArgList &Args, Opts.Blocks = Args.hasArg(OPT_fblocks) || (Opts.OpenCL && Opts.OpenCLVersion == 200); - Opts.ConvergentFunctions = Args.hasArg(OPT_fconvergent_functions) || -

[clang] [Clang] Automatically enable `-fconvergent-functions` on GPU targets (PR #111076)

2024-10-03 Thread Matt Arsenault via cfe-commits
arsenm wrote: > -fno-convergent-functions to opt-out if you want to test broken behavior. You may legitimately know there are no convergent functions in the TU. We also have the noconvergent source attribute now for this https://github.com/llvm/llvm-project/pull/111076 __

[clang] [Clang] Implement resource directory headers for common GPU intrinsics (PR #110179)

2024-10-02 Thread Matt Arsenault via cfe-commits
@@ -0,0 +1,187 @@ +//===-- amdgpuintrin.h - AMDPGU intrinsic functions ---===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Ap

[clang] [Clang] Implement resource directory headers for common GPU intrinsics (PR #110179)

2024-10-02 Thread Matt Arsenault via cfe-commits
@@ -0,0 +1,187 @@ +//===-- amdgpuintrin.h - AMDPGU intrinsic functions ---===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Ap

[clang] [llvm] [llvm][opt][Transforms][SPIR-V] Enable `InferAddressSpaces` for SPIR-V (PR #110897)

2024-10-02 Thread Matt Arsenault via cfe-commits
@@ -91,6 +97,88 @@ SPIRVTargetMachine::SPIRVTargetMachine(const Target &T, const Triple &TT, setRequiresStructuredCFG(false); } +enum AddressSpace { + Function = storageClassToAddressSpace(SPIRV::StorageClass::Function), + CrossWorkgroup = + storageClassToAddressSpac

[clang] [llvm] [llvm][opt][Transforms][SPIR-V] Enable `InferAddressSpaces` for SPIR-V (PR #110897)

2024-10-02 Thread Matt Arsenault via cfe-commits
@@ -91,6 +97,88 @@ SPIRVTargetMachine::SPIRVTargetMachine(const Target &T, const Triple &TT, setRequiresStructuredCFG(false); } +enum AddressSpace { + Function = storageClassToAddressSpace(SPIRV::StorageClass::Function), + CrossWorkgroup = + storageClassToAddressSpac

[clang] [llvm] [llvm][opt][Transforms][SPIR-V] Enable `InferAddressSpaces` for SPIR-V (PR #110897)

2024-10-02 Thread Matt Arsenault via cfe-commits
@@ -178,6 +266,9 @@ void SPIRVPassConfig::addIRPasses() { addPass(createSPIRVStructurizerPass()); } + if (TM.getOptLevel() > CodeGenOptLevel::None) +addPass(createInferAddressSpacesPass(AddressSpace::Generic)); arsenm wrote: Not sure why this is a

[clang] [llvm] [llvm][opt][Transforms][SPIR-V] Enable `InferAddressSpaces` for SPIR-V (PR #110897)

2024-10-02 Thread Matt Arsenault via cfe-commits
@@ -91,6 +97,88 @@ SPIRVTargetMachine::SPIRVTargetMachine(const Target &T, const Triple &TT, setRequiresStructuredCFG(false); } +enum AddressSpace { + Function = storageClassToAddressSpace(SPIRV::StorageClass::Function), + CrossWorkgroup = + storageClassToAddressSpac

[clang] [llvm] [llvm][opt][Transforms][SPIR-V] Enable `InferAddressSpaces` for SPIR-V (PR #110897)

2024-10-02 Thread Matt Arsenault via cfe-commits
@@ -91,6 +97,88 @@ SPIRVTargetMachine::SPIRVTargetMachine(const Target &T, const Triple &TT, setRequiresStructuredCFG(false); } +enum AddressSpace { + Function = storageClassToAddressSpace(SPIRV::StorageClass::Function), + CrossWorkgroup = + storageClassToAddressSpac

[clang] [llvm] [llvm][opt][Transforms][SPIR-V] Enable `InferAddressSpaces` for SPIR-V (PR #110897)

2024-10-02 Thread Matt Arsenault via cfe-commits
@@ -0,0 +1,29 @@ +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py arsenm wrote: You don't need to duplicate all of these tests. You just need some basic samples that the target is implemented, the full set is testing pass mechanics whi

[clang] [llvm] [mlir] [NFC][TableGen] Change `Record::getSuperClasses` to use const Record* (PR #110845)

2024-10-02 Thread Matt Arsenault via cfe-commits
https://github.com/arsenm approved this pull request. https://github.com/llvm/llvm-project/pull/110845 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [mlir] [TableGen] Change `DefInit::Def` to a const Record pointer (PR #110747)

2024-10-02 Thread Matt Arsenault via cfe-commits
https://github.com/arsenm approved this pull request. https://github.com/llvm/llvm-project/pull/110747 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [mlir] [TableGen] Change `DefInit::Def` to a const Record pointer (PR #110747)

2024-10-02 Thread Matt Arsenault via cfe-commits
@@ -1660,7 +1660,7 @@ class Record { // this record. SmallVector Locs; SmallVector ForwardDeclarationLocs; - SmallVector ReferenceLocs; + mutable SmallVector ReferenceLocs; arsenm wrote: You have the const_cast on the addition, so this is unnecessary?

[clang] [llvm] [clang][llvm][SPIR-V] Explicitly encode native integer widths for SPIR-V (PR #110695)

2024-10-02 Thread Matt Arsenault via cfe-commits
@@ -1,56 +0,0 @@ -; This test aims to check ability to support "Arithmetic with Overflow" intrinsics arsenm wrote: The codegen prepare behavior is still backend code to be tested. You can just run codegenprepare as a standalone pass too (usually would have sepa

[clang] [flang] [llvm] [mlir] Make Ownership of MachineModuleInfo in Its Wrapper Pass External (PR #110443)

2024-10-02 Thread Matt Arsenault via cfe-commits
@@ -0,0 +1,102 @@ +//===-- LLVMTargetMachineC.cpp ===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Ap

[clang] [llvm] [clang][llvm][SPIR-V] Explicitly encode native integer widths for SPIR-V (PR #110695)

2024-10-02 Thread Matt Arsenault via cfe-commits
arsenm wrote: > with the PR pulled in (on top of LLVM's HEAD > [aadfba9](https://github.com/llvm/llvm-project/commit/aadfba9b2aa107f9cada2fd9bcbe612cbf560650)), > the compilation command is: `clang++ -cl-std=CL2.0 -emit-llvm -c -x cl -g0 > --target=spir -Xclang -finclude-default-header -O2 tes

[clang] [llvm] [clang][llvm][SPIR-V] Explicitly encode native integer widths for SPIR-V (PR #110695)

2024-10-01 Thread Matt Arsenault via cfe-commits
arsenm wrote: > 1. Usually (or at least AFAIK) optimization passes won't consider datalayout > automatically, The datalayout is a widely used global constant. There's no option of "not considering it" > Do you plan to go over LLVM passes adding this check? There's nothing new to do here. T

[clang] [llvm] [clang][llvm][SPIR-V] Explicitly encode native integer widths for SPIR-V (PR #110695)

2024-10-01 Thread Matt Arsenault via cfe-commits
https://github.com/arsenm edited https://github.com/llvm/llvm-project/pull/110695 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [clang][llvm][SPIR-V] Explicitly encode native integer widths for SPIR-V (PR #110695)

2024-10-01 Thread Matt Arsenault via cfe-commits
@@ -1,56 +0,0 @@ -; This test aims to check ability to support "Arithmetic with Overflow" intrinsics arsenm wrote: > Right but it's relying on a non-guaranteed maybe-optimisation firing, as far > as I can tell. The point is to test the optimization does work.

[clang] [lld] [llvm] [mlir] [IR] Introduce `T` to `DataLayout` to represent flat address space if a target supports it (PR #108786)

2024-10-01 Thread Matt Arsenault via cfe-commits
arsenm wrote: > > I would like to avoid adding additional special properties to AS0, or > > defining the flat concept. > > How can we add a new specification w/o defining it? By not defining it in terms of flat addressing. Just make it the undesirable address space https://github.com/llvm/ll

[clang] [llvm] [clang][llvm][SPIR-V] Explicitly encode native integer widths for SPIR-V (PR #110695)

2024-10-01 Thread Matt Arsenault via cfe-commits
@@ -54,14 +54,14 @@ static std::string computeDataLayout(const Triple &TT) { // memory model used for graphics: PhysicalStorageBuffer64. But it shouldn't // mean anything. if (Arch == Triple::spirv32) -return "e-p:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-" -

[clang] [llvm] [clang][llvm][SPIR-V] Explicitly encode native integer widths for SPIR-V (PR #110695)

2024-10-01 Thread Matt Arsenault via cfe-commits
@@ -1,56 +0,0 @@ -; This test aims to check ability to support "Arithmetic with Overflow" intrinsics arsenm wrote: That is not the nature of this kind of test https://github.com/llvm/llvm-project/pull/110695 ___ cfe-c

[clang] [Clang] Add __builtin_(elementwise|reduce)_(max|min)imum (PR #110198)

2024-10-01 Thread Matt Arsenault via cfe-commits
https://github.com/arsenm approved this pull request. https://github.com/llvm/llvm-project/pull/110198 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [IR] Allow fast math flags on calls with homogeneous FP struct types (PR #110506)

2024-10-01 Thread Matt Arsenault via cfe-commits
https://github.com/arsenm approved this pull request. https://github.com/llvm/llvm-project/pull/110506 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [clang][llvm][SPIR-V] Explicitly encode native integer widths for SPIR-V (PR #110695)

2024-10-01 Thread Matt Arsenault via cfe-commits
@@ -1,56 +0,0 @@ -; This test aims to check ability to support "Arithmetic with Overflow" intrinsics arsenm wrote: This one is testing codegenprepare as part of the normal codegen pipeline, so this one is fine. The other case was a full optimization pipeline +

[clang] [llvm] [clang][llvm][SPIR-V] Explicitly encode native integer widths for SPIR-V (PR #110695)

2024-10-01 Thread Matt Arsenault via cfe-commits
@@ -1,56 +0,0 @@ -; This test aims to check ability to support "Arithmetic with Overflow" intrinsics arsenm wrote: Not sure what the problem is with this test, but it's already covered by another? https://github.com/llvm/llvm-project/pull/110695 _

[clang] [llvm] [clang][llvm][SPIR-V] Explicitly encode native integer widths for SPIR-V (PR #110695)

2024-10-01 Thread Matt Arsenault via cfe-commits
@@ -54,14 +54,14 @@ static std::string computeDataLayout(const Triple &TT) { // memory model used for graphics: PhysicalStorageBuffer64. But it shouldn't // mean anything. if (Arch == Triple::spirv32) -return "e-p:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-" -

[clang] [llvm] [IR] Allow fast math flags on calls with homogeneous FP struct types (PR #110506)

2024-09-30 Thread Matt Arsenault via cfe-commits
@@ -1122,6 +1122,26 @@ define void @fastMathFlagsForArrayCalls([2 x float] %f, [2 x double] %d1, [2 x < ret void } +declare { float, float } @fmf_struct_f32() +declare { double, double } @fmf_struct_f64() +declare { <4 x double>, <4 x double> } @fmf_struct_v4f64() + +; CHEC

[clang] [flang] [llvm] [mlir] Make Ownership of MachineModuleInfo in Its Wrapper Pass External (PR #110443)

2024-09-30 Thread Matt Arsenault via cfe-commits
arsenm wrote: > * Move the MC emission functions in `TargetMachine` to `LLVMTargetMachine`. > With the changes in this PR, we explicitly assume in both > `addPassesToEmitFile` and `addPassesToEmitMC` that the `TargetMachine` is an > `LLVMTargetMachine`; Hence it does not make sense for these f

[clang] [llvm] [mlir] [LLVM][TableGen] Change SeachableTableEmitter to use const RecordKeeper (PR #110032)

2024-09-30 Thread Matt Arsenault via cfe-commits
https://github.com/arsenm approved this pull request. https://github.com/llvm/llvm-project/pull/110032 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] Implement operand bundles for floating-point operations (PR #109798)

2024-09-30 Thread Matt Arsenault via cfe-commits
arsenm wrote: > With the constrained intrinsics the default is safe because optimizations > don't recognize the constrained intrinsic and thus don't know how to optimize > it. If we instead rely on the strictfp attribute then we'll need possibly > thousands of checks for this attribute, we'll

[clang] [llvm] [mlir] [LLVM][TableGen] Change SeachableTableEmitter to use const RecordKeeper (PR #110032)

2024-09-30 Thread Matt Arsenault via cfe-commits
@@ -1556,7 +1557,7 @@ class RecordVal { bool IsUsed = false; /// Reference locations to this record value. - SmallVector ReferenceLocs; + mutable SmallVector ReferenceLocs; arsenm wrote: Is this removed in later patches? https://github.com/llvm/llvm-p

[clang] [Clang] Add __builtin_(elementwise|reduce)_(max|min)imum (PR #110198)

2024-09-30 Thread Matt Arsenault via cfe-commits
@@ -273,6 +273,74 @@ void test_builtin_elementwise_min(int i, short s, double d, float4 v, int3 iv, u // expected-error@-1 {{1st argument must be a vector, integer or floating point type (was '_Complex float')}} } +void test_builtin_elementwise_maximum(int i, short s, floa

[clang] [Clang] Add __builtin_(elementwise|reduce)_(max|min)imum (PR #110198)

2024-09-26 Thread Matt Arsenault via cfe-commits
@@ -706,6 +706,12 @@ Unless specified otherwise operation(±0) = ±0 and operation(±infinity) = ±in representable values for the signed/unsigned integer type. T __builtin_elementwise_sub_sat(T x, T y) return the difference of x and

[clang] [cuda][[HIP] `__constant__` should imply constant (PR #110182)

2024-09-26 Thread Matt Arsenault via cfe-commits
arsenm wrote: If it's not legal for it to be marked as constant, it's also not legal to use constant address space https://github.com/llvm/llvm-project/pull/110182 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/

[clang] [lld] [llvm] [mlir] [IR] Introduce `T` to `DataLayout` to represent flat address space if a target supports it (PR #108786)

2024-09-25 Thread Matt Arsenault via cfe-commits
arsenm wrote: > Both in InferAddressSpaces, and in Attributor, you don't really care about > whether a flat address-space exists. Right, this is more of an undesirable address space. Optimizations don't need to know anything about its behavior beyond that. > In reply to your question above

[clang] [lld] [llvm] [mlir] [IR] Introduce `T` to `DataLayout` to represent flat address space if a target supports it (PR #108786)

2024-09-25 Thread Matt Arsenault via cfe-commits
@@ -579,7 +579,7 @@ static StringRef computeDataLayout(const Triple &TT) { "-p7:160:256:256:32-p8:128:128-p9:192:256:256:32-i64:64-v16:16-v24:32-" "v32:32-v48:64-v96:" "128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64-S32-A5-" - "G

[clang] [lld] [llvm] [mlir] [IR] Introduce `T` to `DataLayout` to represent flat address space if a target supports it (PR #108786)

2024-09-25 Thread Matt Arsenault via cfe-commits
arsenm wrote: > Just to clarify, does this mean any two non-flat address space pointers > _cannot_ alias? This should change nothing about aliasing. The IR assumption is any address space may alias any other https://github.com/llvm/llvm-project/pull/108786 ___

[clang] [lld] [llvm] [mlir] [IR] Introduce `T` to `DataLayout` to represent flat address space if a target supports it (PR #108786)

2024-09-25 Thread Matt Arsenault via cfe-commits
arsenm wrote: > There are targets that use a different integer to denote flat (e.g. see SPIR > & SPIR-V). Whilst I know that there are objections to that, the fact remains > that they had historical reason (wanted to make legacy OCL convention that > the default is private work, and given that

[clang] [lld] [llvm] [mlir] [IR] Introduce `T` to `DataLayout` to represent flat address space if a target supports it (PR #108786)

2024-09-25 Thread Matt Arsenault via cfe-commits
@@ -66,12 +66,12 @@ NVPTXTargetInfo::NVPTXTargetInfo(const llvm::Triple &Triple, HasFloat16 = true; if (TargetPointerWidth == 32) -resetDataLayout("e-p:32:32-i64:64-i128:128-v16:16-v32:32-n16:32:64"); +resetDataLayout("e-p:32:32-i64:64-i128:128-v16:16-v32:32-n16:32

[clang] [llvm] [AMDGPU] Convert AMDGPUResourceUsageAnalysis pass from Module to MF pass (PR #102913)

2024-09-25 Thread Matt Arsenault via cfe-commits
https://github.com/arsenm approved this pull request. I think we need more thought about how the ABI for this will work, but we need to start somewhere https://github.com/llvm/llvm-project/pull/102913 ___ cfe-commits mailing list cfe-commits@lists.ll

[clang] [llvm] Implement operand bundles for floating-point operations (PR #109798)

2024-09-25 Thread Matt Arsenault via cfe-commits
arsenm wrote: > If we can't keep the constrained semantics and near-100% guarantee that no > new exceptions will be introduced then operand bundles are not a replacement > for the constrained intrinsics. We would still need a call / function attribute to indicate strictfp calls, and such call

[clang] [llvm] [AMDGPU] Infer amdgpu-no-flat-scratch-init attribute in AMDGPUAttributor (PR #94647)

2024-09-25 Thread Matt Arsenault via cfe-commits
https://github.com/arsenm edited https://github.com/llvm/llvm-project/pull/94647 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [AMDGPU] Infer amdgpu-no-flat-scratch-init attribute in AMDGPUAttributor (PR #94647)

2024-09-25 Thread Matt Arsenault via cfe-commits
@@ -434,6 +434,15 @@ struct AAAMDAttributesFunction : public AAAMDAttributes { indicatePessimisticFixpoint(); return; } + +for (Instruction &I : instructions(F)) { + if (isa(I) && arsenm wrote: Simple example, where the cast is still d

[clang] [llvm] [AMDGPU] Infer amdgpu-no-flat-scratch-init attribute in AMDGPUAttributor (PR #94647)

2024-09-25 Thread Matt Arsenault via cfe-commits
@@ -434,6 +434,15 @@ struct AAAMDAttributesFunction : public AAAMDAttributes { indicatePessimisticFixpoint(); return; } + +for (Instruction &I : instructions(F)) { + if (isa(I) && arsenm wrote: 5->3 is an illegal address space cast, bu

[clang] [llvm] Implement operand bundles for floating-point operations (PR #109798)

2024-09-25 Thread Matt Arsenault via cfe-commits
arsenm wrote: Also it's silly that we need to do bitcode autoupgrade of "experimental" intrinsics, but x86 started shipping with strictfp enabled in production before they graduated. We might as well drop the experimental bit then https://github.com/llvm/llvm-project/pull/109798 _

[clang] [llvm] Implement operand bundles for floating-point operations (PR #109798)

2024-09-25 Thread Matt Arsenault via cfe-commits
@@ -357,6 +357,9 @@ class IRBuilderBase { void setConstrainedFPCallAttr(CallBase *I) { I->addFnAttr(Attribute::StrictFP); +MemoryEffects ME = MemoryEffects::inaccessibleMemOnly(); arsenm wrote: It shouldn't be necessary to touch the attributes. The

[clang] [llvm] [AMDGPU] Convert AMDGPUResourceUsageAnalysis pass from Module to MF pass (PR #102913)

2024-09-25 Thread Matt Arsenault via cfe-commits
@@ -78,15 +78,15 @@ void MCResourceInfo::finalize(MCContext &OutContext) { } MCSymbol *MCResourceInfo::getMaxVGPRSymbol(MCContext &OutContext) { - return OutContext.getOrCreateSymbol("max_num_vgpr"); + return OutContext.getOrCreateSymbol("amdgcn.max_num_vgpr"); -

[clang] [clang] Use std::optional::value_or (NFC) (PR #109894)

2024-09-24 Thread Matt Arsenault via cfe-commits
https://github.com/arsenm approved this pull request. https://github.com/llvm/llvm-project/pull/109894 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Don't emit int TBAA metadata on more complex FP math libcalls. (PR #107598)

2024-09-24 Thread Matt Arsenault via cfe-commits
arsenm wrote: Superseded by #108853 https://github.com/llvm/llvm-project/pull/107598 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Don't emit int TBAA metadata on more complex FP math libcalls. (PR #107598)

2024-09-24 Thread Matt Arsenault via cfe-commits
https://github.com/arsenm closed https://github.com/llvm/llvm-project/pull/107598 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][codegen] Don't mark "int" TBAA on FP libcalls with indirect args (PR #108853)

2024-09-24 Thread Matt Arsenault via cfe-commits
https://github.com/arsenm approved this pull request. https://github.com/llvm/llvm-project/pull/108853 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [AMDGPU] Convert AMDGPUResourceUsageAnalysis pass from Module to MF pass (PR #102913)

2024-09-24 Thread Matt Arsenault via cfe-commits
arsenm wrote: > If we already have per-function metadata, I'm wondering how difficult it > would be to put this handling in the linker. AFAIK there's already handling > for `call-graph-profile` which can inform the linker of the call-graph, so we > could potentially just walk that graph, find

[clang] [clang][codegen] Don't mark "int" TBAA on FP libcalls with indirect args (PR #108853)

2024-09-24 Thread Matt Arsenault via cfe-commits
https://github.com/arsenm approved this pull request. LGTM, but like I mentioned on #107598, it would be good if there was a test that requires the argument check, and the return check isn't sufficient https://github.com/llvm/llvm-project/pull/108853 ___

[libclc] [libclc] use default paths with find_program when possible (PR #105969)

2024-09-23 Thread Matt Arsenault via cfe-commits
arsenm wrote: > So it should be built along with the core of LLVM? Also, we package LLVM per > version per subproject. Yes, it should be built along with the core (but doesn't need to ship in the same package as the core). https://github.com/llvm/llvm-project/pull/105969 __

[libclc] [libclc] use default paths with find_program when possible (PR #105969)

2024-09-23 Thread Matt Arsenault via cfe-commits
arsenm wrote: > Nixpkgs has no intention of moving away from standalone builds. I encourage you to acquire that intention. IMO libclc should not support the standalone build, and this should be version locked to the exact compiler commit. It's compiler data, not a real library https://github

[libclc] [libclc] use default paths with find_program when possible (PR #105969)

2024-09-23 Thread Matt Arsenault via cfe-commits
https://github.com/arsenm commented: The nix build should probably migrate to using the non-standalone build https://github.com/llvm/llvm-project/pull/105969 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman

[libclc] [libclc] use default paths with find_program when possible (PR #105969)

2024-09-23 Thread Matt Arsenault via cfe-commits
@@ -55,7 +55,7 @@ if( LIBCLC_STANDALONE_BUILD OR CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DI # Import required tools if( NOT EXISTS ${LIBCLC_CUSTOM_LLVM_TOOLS_BINARY_DIR} ) foreach( tool IN ITEMS clang llvm-as llvm-link opt ) - find_program( LLVM_TOOL_${tool

[libclc] [libclc] use default paths with find_program when possible (PR #105969)

2024-09-23 Thread Matt Arsenault via cfe-commits
https://github.com/arsenm edited https://github.com/llvm/llvm-project/pull/105969 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [flang] [llvm] [mlir] Make MMIWP not have ownership over MMI + Make MMI Only Use an External MCContext (PR #105541)

2024-09-22 Thread Matt Arsenault via cfe-commits
arsenm wrote: > @aeubanks @arsenm after looking into this in more detail, I realized that the > `getContext` method of `MMI` is heavily used in the `AsmPrinter` to create > symbols. Also not having it makes it harder for the `MMI` to create machine > functions using `getOrCreateMachineFunction

[clang] [llvm] [Support] Add scaling support in `indent` (PR #109478)

2024-09-20 Thread Matt Arsenault via cfe-commits
@@ -774,18 +774,27 @@ class buffer_unique_ostream : public raw_svector_ostream { // you can use // OS << indent(6) << "more stuff"; // which has better ergonomics (and clang-formats better as well). +// +// If indentation is always in increments of a fixed value, you can use Sc

[clang] [llvm] [Support] Add scaling support in `indent` (PR #109478)

2024-09-20 Thread Matt Arsenault via cfe-commits
https://github.com/arsenm approved this pull request. https://github.com/llvm/llvm-project/pull/109478 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [flang] [llvm] [mlir] Make MMIWP not have ownership over MMI + Make MMI Only Use an External MCContext (PR #105541)

2024-09-20 Thread Matt Arsenault via cfe-commits
arsenm wrote: > @aeubanks It's not impossible to separate them completely. `MCContext` is > needed during initialization and finalization of the > `MachineModuleInfoWrapperPass` (and its new pass manager variant) to set the > diagnostics handler. > > In theory, you can just pass the context t

[clang] [lldb] [llvm] [mlir] [APInt] Fix APInt constructions where value does not fit bitwidth (NFCI) (PR #80309)

2024-09-20 Thread Matt Arsenault via cfe-commits
@@ -1806,7 +1806,7 @@ bool AMDGPUDAGToDAGISel::SelectGlobalSAddr(SDNode *N, // instructions to perform VALU adds with immediates or inline literals. unsigned NumLiterals = !TII->isInlineConstant(APInt(32, COffsetVal & 0x)) + - !TII->isInli

[clang] [lldb] [llvm] [mlir] [APInt] Fix APInt constructions where value does not fit bitwidth (NFCI) (PR #80309)

2024-09-20 Thread Matt Arsenault via cfe-commits
@@ -4377,7 +4377,7 @@ AMDGPUInstructionSelector::selectGlobalSAddr(MachineOperand &Root) const { // instructions to perform VALU adds with immediates or inline literals. unsigned NumLiterals = !TII.isInlineConstant(APInt(32, ConstOffset & 0xfff

[clang] [clang][codegen] Don't mark "int" TBAA on FP libcalls with indirect args (PR #108853)

2024-09-18 Thread Matt Arsenault via cfe-commits
@@ -690,23 +690,46 @@ static RValue emitLibraryCall(CodeGenFunction &CGF, const FunctionDecl *FD, const CallExpr *E, llvm::Constant *calleeValue) { CodeGenFunction::CGFPOptionsRAII FPOptsRAII(CGF, E); CGCallee callee = CGCallee::forDirect(call

[clang] [llvm] [AMDGPU] Infer amdgpu-no-flat-scratch-init attribute in AMDGPUAttributor (PR #94647)

2024-09-15 Thread Matt Arsenault via cfe-commits
@@ -678,6 +690,37 @@ struct AAAMDAttributesFunction : public AAAMDAttributes { return !A.checkForAllCallLikeInstructions(DoesNotRetrieve, *this, UsedAssumedInformation); } + + // Returns true if FlatScratchInit is needed, i.e

[clang] [llvm] [AMDGPU] Infer amdgpu-no-flat-scratch-init attribute in AMDGPUAttributor (PR #94647)

2024-09-15 Thread Matt Arsenault via cfe-commits
@@ -678,6 +690,37 @@ struct AAAMDAttributesFunction : public AAAMDAttributes { return !A.checkForAllCallLikeInstructions(DoesNotRetrieve, *this, UsedAssumedInformation); } + + // Returns true if FlatScratchInit is needed, i.e

[clang] [llvm] [AMDGPU] Infer amdgpu-no-flat-scratch-init attribute in AMDGPUAttributor (PR #94647)

2024-09-15 Thread Matt Arsenault via cfe-commits
@@ -434,6 +434,15 @@ struct AAAMDAttributesFunction : public AAAMDAttributes { indicatePessimisticFixpoint(); return; } + +for (Instruction &I : instructions(F)) { + if (isa(I) && arsenm wrote: For a nightmare of an edge case, addrspac

[clang] [llvm] [AMDGPU] Change CF intrinsics lowering to reconverge on predecessors. (PR #92809)

2024-09-15 Thread Matt Arsenault via cfe-commits
arsenm wrote: Replaced by #108596 https://github.com/llvm/llvm-project/pull/92809 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [AMDGPU] Change CF intrinsics lowering to reconverge on predecessors. (PR #92809)

2024-09-15 Thread Matt Arsenault via cfe-commits
https://github.com/arsenm closed https://github.com/llvm/llvm-project/pull/92809 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [AMDGPU] Convert AMDGPUResourceUsageAnalysis pass from Module to MF pass (PR #102913)

2024-09-15 Thread Matt Arsenault via cfe-commits
@@ -40,12 +42,19 @@ class AMDGPUAsmPrinter final : public AsmPrinter { AMDGPUResourceUsageAnalysis *ResourceUsage; + MCResourceInfo RI; + SIProgramInfo CurrentProgramInfo; std::unique_ptr HSAMetadataStream; MCCodeEmitter *DumpCodeInstEmitter = nullptr; + //

[clang] [llvm] [AMDGPU] Convert AMDGPUResourceUsageAnalysis pass from Module to MF pass (PR #102913)

2024-09-15 Thread Matt Arsenault via cfe-commits
@@ -0,0 +1,225 @@ +//===- AMDGPUMCResourceInfo.cpp --- MC Resource Info --===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Ap

[clang] [llvm] [AMDGPU] Convert AMDGPUResourceUsageAnalysis pass from Module to MF pass (PR #102913)

2024-09-15 Thread Matt Arsenault via cfe-commits
@@ -0,0 +1,225 @@ +//===- AMDGPUMCResourceInfo.cpp --- MC Resource Info --===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Ap

[clang] Don't emit int TBAA metadata on more complex FP math libcalls. (PR #107598)

2024-09-13 Thread Matt Arsenault via cfe-commits
@@ -0,0 +1,31 @@ +// RUN: %clang_cc1 %s -O3 -fmath-errno -emit-llvm -triple x86_64-unknown-unknown -o - %s | FileCheck %s -check-prefixes=CHECK +// RUN: %clang_cc1 %s -O3 -fmath-errno -emit-llvm -triple x86_64-pc-win64 -o - %s | FileCheck %s -check-prefixes=CHECK +// RUN: %clan

[clang] Don't emit int TBAA metadata on more complex FP math libcalls. (PR #107598)

2024-09-13 Thread Matt Arsenault via cfe-commits
@@ -686,6 +686,20 @@ static Value *EmitSignBit(CodeGenFunction &CGF, Value *V) { return CGF.Builder.CreateICmpSLT(V, Zero); } +static bool hasPointerArgsOrPointerReturnType(const Value *V) { + if (const CallBase *CB = dyn_cast(V)) { +for (const Value *A : CB->args()) {

[clang] Don't emit int TBAA metadata on more complex FP math libcalls. (PR #107598)

2024-09-13 Thread Matt Arsenault via cfe-commits
@@ -699,9 +713,12 @@ static RValue emitLibraryCall(CodeGenFunction &CGF, const FunctionDecl *FD, bool ConstWithoutErrnoAndExceptions = Context.BuiltinInfo.isConstWithoutErrnoAndExceptions(BuiltinID); // Restrict to target with errno, for example, MacOS doesn't

[clang] Don't emit int TBAA metadata on more complex FP math libcalls. (PR #107598)

2024-09-13 Thread Matt Arsenault via cfe-commits
@@ -686,6 +686,20 @@ static Value *EmitSignBit(CodeGenFunction &CGF, Value *V) { return CGF.Builder.CreateICmpSLT(V, Zero); } +static bool hasPointerArgsOrPointerReturnType(const Value *V) { + if (const CallBase *CB = dyn_cast(V)) { +for (const Value *A : CB->args()) {

[clang] [llvm] [SPIRV][RFC] Rework / extend support for memory scopes (PR #106429)

2024-09-13 Thread Matt Arsenault via cfe-commits
@@ -251,6 +251,24 @@ SPIRV::MemorySemantics::MemorySemantics getMemSemantics(AtomicOrdering Ord) { llvm_unreachable(nullptr); } +SPIRV::Scope::Scope getMemScope(const LLVMContext &Ctx, SyncScope::ID ID) { + SmallVector SSNs; + Ctx.getSyncScopeNames(SSNs); + + StringRef M

[clang] Don't emit int TBAA metadata on more complex FP math libcalls. (PR #107598)

2024-09-11 Thread Matt Arsenault via cfe-commits
@@ -699,9 +699,20 @@ static RValue emitLibraryCall(CodeGenFunction &CGF, const FunctionDecl *FD, bool ConstWithoutErrnoAndExceptions = Context.BuiltinInfo.isConstWithoutErrnoAndExceptions(BuiltinID); // Restrict to target with errno, for example, MacOS doesn't

[clang] Don't emit int TBAA metadata on more complex FP math libcalls. (PR #107598)

2024-09-11 Thread Matt Arsenault via cfe-commits
@@ -699,9 +699,20 @@ static RValue emitLibraryCall(CodeGenFunction &CGF, const FunctionDecl *FD, bool ConstWithoutErrnoAndExceptions = Context.BuiltinInfo.isConstWithoutErrnoAndExceptions(BuiltinID); // Restrict to target with errno, for example, MacOS doesn't

[clang] [llvm] [SPIRV][RFC] Rework / extend support for memory scopes (PR #106429)

2024-09-11 Thread Matt Arsenault via cfe-commits
@@ -251,6 +251,24 @@ SPIRV::MemorySemantics::MemorySemantics getMemSemantics(AtomicOrdering Ord) { llvm_unreachable(nullptr); } +SPIRV::Scope::Scope getMemScope(const LLVMContext &Ctx, SyncScope::ID ID) { + SmallVector SSNs; + Ctx.getSyncScopeNames(SSNs); + + StringRef M

[clang] [llvm] [SPIRV][RFC] Rework / extend support for memory scopes (PR #106429)

2024-09-11 Thread Matt Arsenault via cfe-commits
@@ -58,7 +58,35 @@ class SPIRVTargetCodeGenInfo : public CommonSPIRTargetCodeGenInfo { SPIRVTargetCodeGenInfo(CodeGen::CodeGenTypes &CGT) : CommonSPIRTargetCodeGenInfo(std::make_unique(CGT)) {} void setCUDAKernelCallingConvention(const FunctionType *&FT) const overri

[clang] [llvm] [SPIRV][RFC] Rework / extend support for memory scopes (PR #106429)

2024-09-11 Thread Matt Arsenault via cfe-commits
@@ -766,8 +766,19 @@ static void EmitAtomicOp(CodeGenFunction &CGF, AtomicExpr *Expr, Address Dest, // LLVM atomic instructions always have synch scope. If clang atomic // expression has no scope operand, use default LLVM synch scope. if (!ScopeModel) { +llvm::SyncSc

[clang] [TBAA] Emit "omnipotent char" for intrinsics with type cast (PR #107793)

2024-09-11 Thread Matt Arsenault via cfe-commits
arsenm wrote: > Hi, @paulwalker-arm, ACLE allows users to do instruction-level development, > but mixing intrinsic and regular C code may break some of the rules set by > the compiler. The rules are still there. You can always use a union or copy to avoid violating the rules. I don't think i

[clang] [clang] fix half && bfloat16 convert node expr codegen (PR #89051)

2024-09-08 Thread Matt Arsenault via cfe-commits
https://github.com/arsenm approved this pull request. https://github.com/llvm/llvm-project/pull/89051 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [TableGen] Change SetTheory set/vec to use const Record * (PR #107692)

2024-09-08 Thread Matt Arsenault via cfe-commits
https://github.com/arsenm approved this pull request. lgtm assuming the const_cast goes away in a subsequent change https://github.com/llvm/llvm-project/pull/107692 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin

[clang] [TBAA] Emit "omnipotent char" for intrinsics with type cast (PR #107793)

2024-09-08 Thread Matt Arsenault via cfe-commits
arsenm wrote: I don't understand this. The code is a strict aliasing violation, so why should clang work around it? https://github.com/llvm/llvm-project/pull/107793 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bi

<    1   2   3   4   5   6   7   8   9   10   >