[clang] [OpenMP] Fix atomic compare handling with overloaded operators (PR #141142)

2025-05-28 Thread Johannes Doerfert via cfe-commits
@@ -12062,32 +12154,56 @@ bool OpenMPAtomicCompareCaptureChecker::checkForm3(IfStmt *S, X = BO->getLHS(); D = BO->getRHS(); - auto *Cond = dyn_cast(S->getCond()); - if (!Cond) { + if (auto *Cond = dyn_cast(S->getCond())) { +C = Cond; +if (Cond->getOpcode() != B

[clang] [OpenMP] Fix atomic compare handling with overloaded operators (PR #141142)

2025-05-28 Thread Johannes Doerfert via cfe-commits
@@ -991,3 +991,34 @@ int mixed() { // expected-note@+1 {{in instantiation of function template specialization 'mixed' requested here}} return mixed(); } + +#ifdef OMP51 +struct U {}; +struct U operator<(U, U); +struct U operator>(U, U); +struct U operator==(U, U); + +templ

[clang] [OpenMP] Allow begin/end declare variant in executable context (PR #139344)

2025-05-12 Thread Johannes Doerfert via cfe-commits
https://github.com/jdoerfert closed https://github.com/llvm/llvm-project/pull/139344 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [OpenMP] Allow begin/end declare variant in executable context (PR #139344)

2025-05-09 Thread Johannes Doerfert via cfe-commits
https://github.com/jdoerfert created https://github.com/llvm/llvm-project/pull/139344 We are missing a few declerative directives in the parser for executable and declerative directives causing us to error out if they are inside of functions. This adds support for begin/end declare variant by

[clang] [llvm] [OpenMP] implementation set controls elision for begin declare variant (PR #139287)

2025-05-09 Thread Johannes Doerfert via cfe-commits
https://github.com/jdoerfert closed https://github.com/llvm/llvm-project/pull/139287 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [OpenMP] implementation set controls elision for begin declare variant (PR #139287)

2025-05-09 Thread Johannes Doerfert via cfe-commits
https://github.com/jdoerfert updated https://github.com/llvm/llvm-project/pull/139287 Rate limit ยท GitHub body { background-color: #f6f8fa; color: #24292e; font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans

[clang] [llvm] [OpenMP] implementation set controls elision for begin declare variant (PR #139287)

2025-05-09 Thread Johannes Doerfert via cfe-commits
https://github.com/jdoerfert updated https://github.com/llvm/llvm-project/pull/139287 >From 4ae732bc3cb75a694e0c527a323459dfe048ea2e Mon Sep 17 00:00:00 2001 From: Johannes Doerfert Date: Fri, 9 May 2025 09:10:39 -0700 Subject: [PATCH] [OpenMP] implementation set triggers elision for begin dec

[clang] [llvm] [OpenMP] implementation set controls elision for begin declare variant (PR #139287)

2025-05-09 Thread Johannes Doerfert via cfe-commits
https://github.com/jdoerfert created https://github.com/llvm/llvm-project/pull/139287 The device and implementation set should trigger elision of tokens if they do not match statically in a begin/end declare variant. This simply extends the logic from the device set only and includes the imple

[clang] [llvm] [clang] [OpenMP] New OpenMP 6.0 self_maps clause - CodeGen (PR #134131)

2025-05-07 Thread Johannes Doerfert via cfe-commits
@@ -9820,7 +9822,8 @@ void CGOpenMPRuntime::adjustTargetSpecificDataForLambdas( void CGOpenMPRuntime::processRequiresDirective(const OMPRequiresDecl *D) { for (const OMPClause *Clause : D->clauselists()) { -if (Clause->getClauseKind() == OMPC_unified_shared_memory) { +

[clang] [Clang][Driver] Enable internalization by default for AMDGPU (PR #138365)

2025-05-02 Thread Johannes Doerfert via cfe-commits
https://github.com/jdoerfert approved this pull request. https://github.com/llvm/llvm-project/pull/138365 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [compiler-rt] [llvm] [openmp] [PGO][Offload] Add GPU profiling flags to driver (PR #94268)

2025-03-12 Thread Johannes Doerfert via cfe-commits
@@ -259,10 +259,9 @@ static void getAArch64MultilibFlags(const Driver &D, processMultilibCustomFlags(Result, Args); } -static void getARMMultilibFlags(const Driver &D, - const llvm::Triple &Triple, - c

[clang] [compiler-rt] [llvm] [openmp] [PGO][Offload] Add GPU profiling flags to driver (PR #94268)

2025-03-12 Thread Johannes Doerfert via cfe-commits
@@ -1765,6 +1771,11 @@ def fprofile_use_EQ : Joined<["-"], "fprofile-use=">, Visibility<[ClangOption, CLOption]>, MetaVarName<"">, HelpText<"Use instrumentation data for profile-guided optimization. If pathname is a directory, it reads from /default.profdata. Other

[clang] [compiler-rt] [llvm] [openmp] [PGO][Offload] Profile profraw generation for GPU instrumentation #76587 (PR #93365)

2025-02-11 Thread Johannes Doerfert via cfe-commits
@@ -1359,4 +1362,107 @@ COMPILER_RT_VISIBILITY int __llvm_profile_set_file_object(FILE *File, return 0; } +int __llvm_write_custom_profile(const char *Target, +const __llvm_profile_data *DataBegin, +const __llv

[clang] [compiler-rt] [llvm] [openmp] [PGO][Offload] Profile profraw generation for GPU instrumentation #76587 (PR #93365)

2025-02-11 Thread Johannes Doerfert via cfe-commits
https://github.com/jdoerfert approved this pull request. LG, one minor comment https://github.com/llvm/llvm-project/pull/93365 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [compiler-rt] [llvm] [openmp] [PGO][Offload] Profile profraw generation for GPU instrumentation #76587 (PR #93365)

2025-02-11 Thread Johannes Doerfert via cfe-commits
https://github.com/jdoerfert edited https://github.com/llvm/llvm-project/pull/93365 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [Clang] Add __builtin_assume_dereferenceable to encode deref assumption. (PR #121789)

2025-01-10 Thread Johannes Doerfert via cfe-commits
jdoerfert wrote: > I'm concerned about the soundness of our current implementation for these > assumptions, see my comment at [#120962 > (comment)](https://github.com/llvm/llvm-project/pull/120962#issuecomment-2582864870). > Not sure we should be exposing the current implementation from clang.

[clang] [llvm] [Clang] Add __builtin_assume_dereferenceable to encode deref assumption. (PR #121789)

2025-01-09 Thread Johannes Doerfert via cfe-commits
https://github.com/jdoerfert approved this pull request. LG, one suggestion for the docs. https://github.com/llvm/llvm-project/pull/121789 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commi

[clang] [llvm] [Clang] Add __builtin_assume_dereferenceable to encode deref assumption. (PR #121789)

2025-01-09 Thread Johannes Doerfert via cfe-commits
@@ -2761,6 +2761,47 @@ etc.). Query for this feature with ``__has_builtin(__builtin_assume_separate_storage)``. +``__builtin_assume_dereferenceable`` +- + +``__builtin_assume_dereferenceable`` is used to provide the optimizer with the +kno

[clang] [llvm] [Clang] Add __builtin_assume_dereferenceable to encode deref assumption. (PR #121789)

2025-01-09 Thread Johannes Doerfert via cfe-commits
https://github.com/jdoerfert edited https://github.com/llvm/llvm-project/pull/121789 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [Clang] Add __builtin_assume_dereferenceable to encode deref assumption. (PR #121789)

2025-01-09 Thread Johannes Doerfert via cfe-commits
@@ -0,0 +1,36 @@ +// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py +// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s | FileCheck %s + +// CHECK-LABEL: @test1( +// CHECK-NEXT: entry: +// CHECK-NEXT:[[A_ADDR:%.*]] = alloca ptr,

[clang] [llvm] [Clang] Add __builtin_assume_dereferenceable to encode deref assumption. (PR #121789)

2025-01-08 Thread Johannes Doerfert via cfe-commits
@@ -2761,6 +2761,41 @@ etc.). Query for this feature with ``__has_builtin(__builtin_assume_separate_storage)``. +``__builtin_assume_dereferenceable`` +- + +``__builtin_assume_derefernceable`` is used to provide the optimizer with the +know

[clang] [llvm] [Clang] Add __builtin_assume_dereferenceable to encode deref assumption. (PR #121789)

2025-01-08 Thread Johannes Doerfert via cfe-commits
https://github.com/jdoerfert requested changes to this pull request. https://github.com/llvm/llvm-project/pull/121789 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [Clang] Add __builtin_assume_dereferenceable to encode deref assumption. (PR #121789)

2025-01-08 Thread Johannes Doerfert via cfe-commits
@@ -0,0 +1,36 @@ +// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py +// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s | FileCheck %s + +// CHECK-LABEL: @test1( +// CHECK-NEXT: entry: +// CHECK-NEXT:[[A_ADDR:%.*]] = alloca ptr,

[clang] [OpenMP] Allow GPUs to be targeted directly via `-fopenmp`. (PR #122149)

2025-01-08 Thread Johannes Doerfert via cfe-commits
jdoerfert wrote: > I get it, but that doesn't look like the case. If you look at the test case, > the `target` region in `bar` is simply ignored. To me this looks like > treating the entire TU being wrapped into a giant target region instead of > compiling for host. That is a good point. I th

[clang] [OpenMP] Allow GPUs to be targeted directly via `-fopenmp`. (PR #122149)

2025-01-08 Thread Johannes Doerfert via cfe-commits
jdoerfert wrote: > I see it in a different way. `#pragma omp target parallel` (let's just assume > this is valid code) is different from `#pragma omp parallel`, no matter what > target is. However, this patch is to say, when targeting a GPU, `#pragma omp > parallel` **is** `#pragma omp target

[clang] [OpenMP] Allow GPUs to be targeted directly via `-fopenmp`. (PR #122149)

2025-01-08 Thread Johannes Doerfert via cfe-commits
https://github.com/jdoerfert approved this pull request. > We can't expect to have regular OpenMP code working in the same way as OpenMP > offloading code when targeting a GPU meanwhile the code is not wrapped into > target region or declare target The way I see this is: If the target is a GPU

[clang] [llvm] [Clang] Add __builtin_assume_dereferenceable to encode deref assumption. (PR #121789)

2025-01-07 Thread Johannes Doerfert via cfe-commits
@@ -2761,6 +2761,41 @@ etc.). Query for this feature with ``__has_builtin(__builtin_assume_separate_storage)``. +``__builtin_assume_dereferenceable`` +- + +``__builtin_assume_derefernceable`` is used to provide the optimizer with the +know

[clang] [OpenMP] codegen support for masked combined construct parallel masked taskloop (PR #121741)

2025-01-06 Thread Johannes Doerfert via cfe-commits
https://github.com/jdoerfert approved this pull request. Looks like the old master directive implementation. https://github.com/llvm/llvm-project/pull/121741 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman

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

2024-11-08 Thread Johannes Doerfert via cfe-commits
https://github.com/jdoerfert approved this pull request. LG https://github.com/llvm/llvm-project/pull/110179 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2024-11-08 Thread Johannes Doerfert via cfe-commits
@@ -0,0 +1,191 @@ +//===-- gpuintrin.h - Generic GPU 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] [libc] [Clang] Implement resource directory headers for common GPU intrinsics (PR #110179)

2024-11-08 Thread Johannes Doerfert via cfe-commits
https://github.com/jdoerfert edited https://github.com/llvm/llvm-project/pull/110179 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2024-11-05 Thread Johannes Doerfert via cfe-commits
@@ -0,0 +1,154 @@ +//===-- 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] [libc] [Clang] Implement resource directory headers for common GPU intrinsics (PR #110179)

2024-11-05 Thread Johannes Doerfert via cfe-commits
@@ -0,0 +1,184 @@ +//===-- nvptxintrin.h - NVPTX 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] [libc] [Clang] Implement resource directory headers for common GPU intrinsics (PR #110179)

2024-11-05 Thread Johannes Doerfert via cfe-commits
@@ -0,0 +1,86 @@ +//===-- gpuintrin.h - Generic GPU 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: Apa

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

2024-11-05 Thread Johannes Doerfert via cfe-commits
@@ -0,0 +1,154 @@ +//===-- nvptxintrin.h - NVPTX 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] [libc] [Clang] Implement resource directory headers for common GPU intrinsics (PR #110179)

2024-11-05 Thread Johannes Doerfert via cfe-commits
@@ -0,0 +1,154 @@ +//===-- 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] [libc] [Clang] Implement resource directory headers for common GPU intrinsics (PR #110179)

2024-11-05 Thread Johannes Doerfert via cfe-commits
@@ -0,0 +1,86 @@ +//===-- gpuintrin.h - Generic GPU 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: Apa

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

2024-11-05 Thread Johannes Doerfert via cfe-commits
@@ -0,0 +1,154 @@ +//===-- 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] [libc] [Clang] Implement resource directory headers for common GPU intrinsics (PR #110179)

2024-11-05 Thread Johannes Doerfert via cfe-commits
@@ -0,0 +1,86 @@ +//===-- gpuintrin.h - Generic GPU 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: Apa

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

2024-11-05 Thread Johannes Doerfert via cfe-commits
@@ -0,0 +1,154 @@ +//===-- 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] [libc] [Clang] Implement resource directory headers for common GPU intrinsics (PR #110179)

2024-11-05 Thread Johannes Doerfert via cfe-commits
@@ -0,0 +1,86 @@ +//===-- gpuintrin.h - Generic GPU 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: Apa

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

2024-11-05 Thread Johannes Doerfert via cfe-commits
@@ -0,0 +1,154 @@ +//===-- 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] [libc] [Clang] Implement resource directory headers for common GPU intrinsics (PR #110179)

2024-11-05 Thread Johannes Doerfert via cfe-commits
https://github.com/jdoerfert commented: I left many minor comments but nothing blocking. @jhuber6 Were there any conceptual concerns in the thread? https://github.com/llvm/llvm-project/pull/110179 ___ cfe-commits mailing list cfe-commits@lists.llvm.o

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

2024-11-05 Thread Johannes Doerfert via cfe-commits
https://github.com/jdoerfert edited https://github.com/llvm/llvm-project/pull/110179 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] OpenMP offload 'simd' directive (PR #91261)

2024-09-27 Thread Johannes Doerfert via cfe-commits
@@ -164,9 +164,57 @@ uint32_t roundToWarpsize(uint32_t s) { uint32_t kmpcMin(uint32_t x, uint32_t y) { return x < y ? x : y; } +static int32_t nvptx_simd_reduce_nowait(void *reduce_data, +ShuffleReductFnTy shflFct, +

[clang] [llvm] OpenMP offload 'simd' directive (PR #91261)

2024-09-27 Thread Johannes Doerfert via cfe-commits
@@ -287,7 +303,7 @@ __kmpc_parallel_51(IdentTy *ident, int32_t, int32_t if_expr, // Set to true for workers participating in the parallel region. uint32_t TId = mapping::getThreadIdInBlock(); - bool ThreadIsActive = TId < state::getEffectivePTeamSize(); + bool ThreadIsAc

[clang] [llvm] OpenMP offload 'simd' directive (PR #91261)

2024-09-27 Thread Johannes Doerfert via cfe-commits
@@ -2974,10 +2974,8 @@ StmtResult Parser::ParseOpenMPDeclarativeOrExecutableDirective( Sema::CompoundScopeRAII Scope(Actions); AssociatedStmt = ParseStatement(); -if (AssociatedStmt.isUsable() && isOpenMPLoopDirective(DKind) && -getLangOpts

[clang] [llvm] OpenMP offload 'simd' directive (PR #91261)

2024-09-27 Thread Johannes Doerfert via cfe-commits
@@ -1210,12 +1211,16 @@ CallInst *CodeExtractor::emitCallAndSwitchStatement(Function *newFunction, if (ArgsInZeroAddressSpace && DL.getAllocaAddrSpace() != 0) { auto *StructSpaceCast = new AddrSpaceCastInst( - Struct, PointerType ::get(Context, 0), "structA

[clang] [llvm] OpenMP offload 'simd' directive (PR #91261)

2024-09-27 Thread Johannes Doerfert via cfe-commits
@@ -470,6 +484,11 @@ class OpenMPIRBuilder { /// all functions are finalized. void finalize(Function *Fn = nullptr); + CallInst *globalizeAlloca(AllocaInst *Alloca, SmallVector&); + void globalizeParallelVars(Function *CurFn); + SmallPtrSet

[clang] [llvm] OpenMP offload 'simd' directive (PR #91261)

2024-09-27 Thread Johannes Doerfert via cfe-commits
@@ -790,8 +794,167 @@ void OpenMPIRBuilder::finalize(Function *Fn) { "OMPIRBuilder finalization \n"; }; - if (!OffloadInfoManager.empty()) + if (!OffloadInfoManager.empty()) createOffloadEntriesAndInfoMetadata(ErrorReportFn); + + if (Config.EmitLLVMUse

[clang] [llvm] OpenMP offload 'simd' directive (PR #91261)

2024-09-27 Thread Johannes Doerfert via cfe-commits
@@ -1033,6 +1033,7 @@ static FieldDecl *addFieldToRecordDecl(ASTContext &C, DeclContext *DC, CGOpenMPRuntime::CGOpenMPRuntime(CodeGenModule &CGM) : CGM(CGM), OMPBuilder(CGM.getModule()) { + jdoerfert wrote: Cleanup the PR please. https://github.com/llvm

[clang] [llvm] OpenMP offload 'simd' directive (PR #91261)

2024-09-27 Thread Johannes Doerfert via cfe-commits
@@ -2824,155 +2829,78 @@ void CGOpenMPRuntimeGPU::emitReduction( return; } - assert((TeamsReduction || ParallelReduction) && - "Invalid reduction selection in emitReduction."); - - llvm::SmallDenseMap VarFieldMap; - llvm::SmallVector PrivatesReductions(Private

[clang] [llvm] OpenMP offload 'simd' directive (PR #91261)

2024-09-27 Thread Johannes Doerfert via cfe-commits
@@ -1402,6 +1402,7 @@ void CodeGenFunction::EmitOMPReductionClauseInit( } const auto *VD = cast(cast(TaskRedRef)->getDecl()); +llvm::dbgs() << "Emitting " << VD->getName() << " " << VD << "\n"; jdoerfert wrote: leftover, same as all the commented out

[clang] [llvm] OpenMP offload 'simd' directive (PR #91261)

2024-09-27 Thread Johannes Doerfert via cfe-commits
@@ -167,6 +167,9 @@ double omp_get_wtick(void); double omp_get_wtime(void); ///} + +int omp_get_simd_lane(void); jdoerfert wrote: ompx_, assuming this is not in the standard. https://github.com/llvm/llvm-project/pull/91261 ___

[clang] [llvm] OpenMP offload 'simd' directive (PR #91261)

2024-09-27 Thread Johannes Doerfert via cfe-commits
@@ -322,6 +322,40 @@ uint32_t mapping::getNumberOfProcessorElements() { return static_cast(config::getHardwareParallelism()); } +uint32_t mapping::getSimdLen() { + return 1; jdoerfert wrote: How does this work if it's always 1? https://github.com/llvm/llv

[clang] [llvm] OpenMP offload 'simd' directive (PR #91261)

2024-09-27 Thread Johannes Doerfert via cfe-commits
@@ -87,8 +87,10 @@ extern "C" { int32_t num_threads, void *fn, void **args, const int64_t nargs) { + //printf("SPMD mode\n")

[clang] [llvm] OpenMP offload 'simd' directive (PR #91261)

2024-09-27 Thread Johannes Doerfert via cfe-commits
@@ -336,13 +337,15 @@ class CheckVarsEscapingDeclContext final return; if (!D->hasAssociatedStmt()) return; + if (const auto *S = dyn_cast_or_null(D->getAssociatedStmt())) { // Do not analyze directives that do not actually require captu

[clang] [llvm] OpenMP offload 'simd' directive (PR #91261)

2024-09-27 Thread Johannes Doerfert via cfe-commits
@@ -105,6 +105,13 @@ uint32_t getMaxTeamThreads(bool IsSPMD); /// Return the number of processing elements on the device. uint32_t getNumberOfProcessorElements(); +uint32_t getSimdLen(); +uint32_t getSimdGroup(); +uint32_t getSimdLane(); +bool isSimdLeader(); +uint32_t getNumS

[clang] [llvm] OpenMP offload 'simd' directive (PR #91261)

2024-09-27 Thread Johannes Doerfert via cfe-commits
https://github.com/jdoerfert commented: There is too much unrelated stuff, printfs, commented code, etc. too review it properly. I left high-level comments, including why there is a hardcoded simdlen of 1 and globalization for all allocas. https://github.com/llvm/llvm-project/pull/91261 _

[clang] [llvm] OpenMP offload 'simd' directive (PR #91261)

2024-09-27 Thread Johannes Doerfert via cfe-commits
@@ -184,7 +196,7 @@ __kmpc_parallel_51(IdentTy *ident, int32_t, int32_t if_expr, // set, but they do not have individual ThreadStates yet. If they ever // modify the ICVs beyond this point a ThreadStates will be allocated. - bool IsActiveParallelRegion = NumThreads > 1; +

[clang] [llvm] OpenMP offload 'simd' directive (PR #91261)

2024-09-27 Thread Johannes Doerfert via cfe-commits
https://github.com/jdoerfert edited https://github.com/llvm/llvm-project/pull/91261 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2024-09-27 Thread Johannes Doerfert via cfe-commits
@@ -0,0 +1,184 @@ +//===-- nvptxintrin.h - NVPTX 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-09-27 Thread Johannes Doerfert 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-09-27 Thread Johannes Doerfert via cfe-commits
@@ -0,0 +1,184 @@ +//===-- nvptxintrin.h - NVPTX 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-09-27 Thread Johannes Doerfert 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-09-27 Thread Johannes Doerfert 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-09-27 Thread Johannes Doerfert via cfe-commits
https://github.com/jdoerfert commented: I believe this is useful. Left lots of minor comments. https://github.com/llvm/llvm-project/pull/110179 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-

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

2024-09-27 Thread Johannes Doerfert via cfe-commits
jdoerfert wrote: > This way the common intrinsics would be defined in a single location, and it > would be harder for someone to add a new intrinsic without realizing that all > files should implement a common interface. That's one of the reasons mapping.{h,cpp} in DeviceRTL uses the extra lev

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

2024-09-27 Thread Johannes Doerfert 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-09-27 Thread Johannes Doerfert via cfe-commits
@@ -0,0 +1,18 @@ +//===-- gpuintrin.h - Generic GPU 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: Apa

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

2024-09-27 Thread Johannes Doerfert 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-09-27 Thread Johannes Doerfert 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-09-27 Thread Johannes Doerfert 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-09-27 Thread Johannes Doerfert 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-09-27 Thread Johannes Doerfert 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-09-27 Thread Johannes Doerfert via cfe-commits
@@ -0,0 +1,184 @@ +//===-- nvptxintrin.h - NVPTX 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-09-27 Thread Johannes Doerfert via cfe-commits
https://github.com/jdoerfert edited https://github.com/llvm/llvm-project/pull/110179 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2024-09-27 Thread Johannes Doerfert via cfe-commits
@@ -0,0 +1,184 @@ +//===-- nvptxintrin.h - NVPTX 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-09-27 Thread Johannes Doerfert 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-09-27 Thread Johannes Doerfert 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-09-27 Thread Johannes Doerfert 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-09-27 Thread Johannes Doerfert 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] [lld] [llvm] [mlir] [IR] Introduce `T` to `DataLayout` to represent flat address space if a target supports it (PR #108786)

2024-09-24 Thread Johannes Doerfert via cfe-commits
jdoerfert wrote: > IIUC, the query 1) you were referring to was `Type::canLosslesslyBitCastTo`. > If that's the case, it does nothing for AS cast. I don't know what I was thinking of, the above or `CastInst::castIsValid`, neither is very helpful. I am personally not opposed to the DL solution

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

2024-09-19 Thread Johannes Doerfert via cfe-commits
jdoerfert wrote: > > +1 to @efriedma-quic and @jdoerfert's comments. DataLayout should remain as > > generic as possible. Trying to encode a concept of "_the_ flat address > > space" in it seems way too specific to one optimization for one or two > > targets. > > This isn't purely a nice to h

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

2024-09-17 Thread Johannes Doerfert via cfe-commits
jdoerfert wrote: @efriedma-quic's comment resonates with me. At least all use cases that come to my mind right now are basically questions of the following form: 1) Can I transform a pointer lossless from from AS(A) to AS(B)? 2) Is AS(A) "better"/more specialized than AS(B)? 3) Give me the most

[clang] [llvm] [clang][OpenMP] Prototype #1 of directive splitting (PR #108855)

2024-09-17 Thread Johannes Doerfert via cfe-commits
jdoerfert wrote: How many other (codegen) tests would this affect? https://github.com/llvm/llvm-project/pull/108855 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [Offload] Introduce the concept of "default streams" (PR #95371)

2024-08-30 Thread Johannes Doerfert via cfe-commits
https://github.com/jdoerfert updated https://github.com/llvm/llvm-project/pull/95371 >From 34c8bf739040b9d3d0bf625cdadf12b282249ccf Mon Sep 17 00:00:00 2001 From: Johannes Doerfert Date: Fri, 7 Jun 2024 17:06:02 -0700 Subject: [PATCH 1/2] [Offload][CUDA] Add initial cuda_runtime.h overlay This

[clang] [llvm] [Offload] Provide a kernel library useable by the offload runtime (PR #104168)

2024-08-21 Thread Johannes Doerfert via cfe-commits
@@ -393,22 +393,17 @@ struct CUDADeviceTy : public GenericDeviceTy { return Plugin::success(); } - virtual Error callGlobalConstructors(GenericPluginTy &Plugin, - DeviceImageTy &Image) override { -// Check for the presense of gl

[clang] [llvm] [OpenMP] Map `omp_default_mem_alloc` to global memory (PR #104790)

2024-08-20 Thread Johannes Doerfert via cfe-commits
https://github.com/jdoerfert approved this pull request. LG https://github.com/llvm/llvm-project/pull/104790 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [Offload] Provide a kernel library useable by the offload runtime (PR #104168)

2024-08-14 Thread Johannes Doerfert via cfe-commits
https://github.com/jdoerfert updated https://github.com/llvm/llvm-project/pull/104168 >From 73daf3f9968f07e7f52b6e2ed956773d873634f3 Mon Sep 17 00:00:00 2001 From: Johannes Doerfert Date: Mon, 12 Aug 2024 11:53:06 -0700 Subject: [PATCH] [Offload] Provide a kernel library useable by the offload

[clang] [llvm] [Offload] Provide a kernel library useable by the offload runtime (PR #104168)

2024-08-14 Thread Johannes Doerfert via cfe-commits
https://github.com/jdoerfert updated https://github.com/llvm/llvm-project/pull/104168 >From bda519493667d3554365061475308da3786bfa9d Mon Sep 17 00:00:00 2001 From: Johannes Doerfert Date: Mon, 12 Aug 2024 11:53:06 -0700 Subject: [PATCH] [Offload] Provide a kernel library useable by the offload

[clang] [llvm] [Offload] Provide a kernel library useable by the offload runtime (PR #104168)

2024-08-14 Thread Johannes Doerfert via cfe-commits
@@ -1533,6 +1533,55 @@ Error GenericDeviceTy::printInfo() { return Plugin::success(); } +Expected +GenericDeviceTy::getKernel(llvm::StringRef Name, DeviceImageTy *ImagePtr) { + + GenericKernelTy *&KernelPtr = KernelMap[Name]; + if (!KernelPtr) { jdoerfert

[clang] [llvm] [Offload] Provide a kernel library useable by the offload runtime (PR #104168)

2024-08-14 Thread Johannes Doerfert via cfe-commits
@@ -0,0 +1,53 @@ +//===-- Kenrels/Memory.cpp - Memory related kernel definitions ===// +// +// 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: Apa

[clang] [llvm] [Offload] Provide a kernel library useable by the offload runtime (PR #104168)

2024-08-14 Thread Johannes Doerfert via cfe-commits
@@ -392,25 +392,52 @@ EXTERN void *omp_target_memset(void *Ptr, int ByteVal, size_t NumBytes, DP("filling memory on host via memset"); memset(Ptr, ByteVal, NumBytes); // ignore return value, memset() cannot fail } else { -// TODO: replace the omp_target_memset()

[clang] [llvm] [Offload] Provide a kernel library useable by the offload runtime (PR #104168)

2024-08-14 Thread Johannes Doerfert via cfe-commits
https://github.com/jdoerfert updated https://github.com/llvm/llvm-project/pull/104168 >From 9e529ede3a97513ec0afee6c4538e7299d2933f0 Mon Sep 17 00:00:00 2001 From: Johannes Doerfert Date: Mon, 12 Aug 2024 11:53:06 -0700 Subject: [PATCH] [Offload] Provide a kernel library useable by the offload

[clang] [llvm] [Offload] Provide a kernel library useable by the offload runtime (PR #104168)

2024-08-14 Thread Johannes Doerfert via cfe-commits
https://github.com/jdoerfert created https://github.com/llvm/llvm-project/pull/104168 As mentioned in #68706, it is useful to be able to call kernels from the runtime, e.g., to perform memset. This patch provides a kernel library that can be invoked from the offload runtime directly and implem

[clang] [Clang] Fix 'nvlink-wrapper' not ignoring `-plugin` like lld does (PR #104056)

2024-08-14 Thread Johannes Doerfert via cfe-commits
https://github.com/jdoerfert approved this pull request. https://github.com/llvm/llvm-project/pull/104056 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [Offload][CUDA] Allow CUDA kernels to use LLVM/Offload (PR #94549)

2024-08-14 Thread Johannes Doerfert via cfe-commits
jdoerfert wrote: One buildbot error was unrelated, the others where fixed by making the tests more robust. https://github.com/llvm/llvm-project/pull/94549 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/l

[clang] [llvm] [LinkerWrapper] Always pass `-flto` if the linker supports it (PR #102972)

2024-08-13 Thread Johannes Doerfert via cfe-commits
https://github.com/jdoerfert approved this pull request. LG, but keep the TODOs. https://github.com/llvm/llvm-project/pull/102972 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [LinkerWrapper] Always pass `-flto` if the linker supports it (PR #102972)

2024-08-13 Thread Johannes Doerfert via cfe-commits
https://github.com/jdoerfert deleted https://github.com/llvm/llvm-project/pull/102972 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

  1   2   3   4   5   >