[clang] [NFC][Clang][OpenMP] Add helper functions/utils for finding/comparing attach base-ptrs. (PR #155625)

2025-08-29 Thread Abhinav Gaba via cfe-commits
abhinavgaba wrote: > better to split the patch by the supported types or other criteria That's going to be a bit complicated. Trying to break the change based on functional components was leaving clang in a bad intermediate state. That's why #145454 was pulled into the main PR #153683. Simila

[clang] [NFC][Clang][OpenMP] Add helper functions/utils for finding/comparing attach base-ptrs. (PR #155625)

2025-08-29 Thread Abhinav Gaba via cfe-commits
https://github.com/abhinavgaba updated https://github.com/llvm/llvm-project/pull/155625 >From 8256e93c46ddd4e0fdd4125b769f040741e56890 Mon Sep 17 00:00:00 2001 From: Abhinav Gaba Date: Wed, 27 Aug 2025 07:02:36 -0700 Subject: [PATCH 1/3] [NFC][Clang] Add helper functions/utils for finding/comp

[clang] [NFC][Clang][OpenMP] Add helper functions/utils for finding/comparing attach base-ptrs. (PR #155625)

2025-08-28 Thread Abhinav Gaba via cfe-commits
https://github.com/abhinavgaba updated https://github.com/llvm/llvm-project/pull/155625 >From 8256e93c46ddd4e0fdd4125b769f040741e56890 Mon Sep 17 00:00:00 2001 From: Abhinav Gaba Date: Wed, 27 Aug 2025 07:02:36 -0700 Subject: [PATCH 1/2] [NFC][Clang] Add helper functions/utils for finding/comp

[clang] [NFC][Clang][OpenMP] Add helper functions/utils for finding/comparing attach base-ptrs. (PR #155625)

2025-08-27 Thread Abhinav Gaba via cfe-commits
@@ -6765,12 +6765,256 @@ llvm::Value *CGOpenMPRuntime::emitNumThreadsForTargetDirective( namespace { LLVM_ENABLE_BITMASK_ENUMS_IN_NAMESPACE(); +/// Utility to compare expression locations. +/// Returns true if expr-loc of LHS is less-than that of RHS. +/// This function asser

[clang] [NFC][Clang][OpenMP] Add helper functions/utils for finding/comparing attach base-ptrs. (PR #155625)

2025-08-27 Thread Abhinav Gaba via cfe-commits
https://github.com/abhinavgaba ready_for_review https://github.com/llvm/llvm-project/pull/155625 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [NFC][Clang][OpenMP] Add helper functions/utils for finding/comparing attach base-ptrs. (PR #155625)

2025-08-27 Thread Abhinav Gaba via cfe-commits
https://github.com/abhinavgaba created https://github.com/llvm/llvm-project/pull/155625 These have been pulled out of the codegen PR #153683, to reduce the size of that PR. >From 8256e93c46ddd4e0fdd4125b769f040741e56890 Mon Sep 17 00:00:00 2001 From: Abhinav Gaba Date: Wed, 27 Aug 2025 07:02:

[clang] [llvm] [OpenMP][WIP] Use ATTACH maps for array-sections/subscripts on pointers. (PR #153683)

2025-08-22 Thread Abhinav Gaba via cfe-commits
https://github.com/abhinavgaba edited https://github.com/llvm/llvm-project/pull/153683 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [OpenMP][WIP] Use ATTACH maps for array-sections/subscripts on pointers. (PR #153683)

2025-08-17 Thread Abhinav Gaba via cfe-commits
https://github.com/abhinavgaba edited https://github.com/llvm/llvm-project/pull/153683 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [OpenMP][WIP] Use ATTACH maps for array-sections/subscripts on pointers. (PR #153683)

2025-08-14 Thread Abhinav Gaba via cfe-commits
https://github.com/abhinavgaba edited https://github.com/llvm/llvm-project/pull/153683 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [OpenMP][WIP] Use ATTACH maps for array-sections/subscripts on pointers. (PR #153683)

2025-08-14 Thread Abhinav Gaba via cfe-commits
@@ -40,11 +40,28 @@ void foo() { } #endif -// CHECK: @.offload_sizes = private unnamed_addr constant [5 x i64] [i64 8, i64 0, i64 0, i64 0, i64 4] -// CHECK-NOT: @.offload_sizes = private unnamed_addr constant [6 x i64] [i64 8, i64 0, i64 0, i64 0, i64 8, i64 4] -// CHECK: @

[clang] [llvm] [OpenMP][WIP] Use ATTACH maps for array-sections/subscripts on pointers. (PR #153683)

2025-08-14 Thread Abhinav Gaba via cfe-commits
@@ -40,11 +40,28 @@ void foo() { } #endif -// CHECK: @.offload_sizes = private unnamed_addr constant [5 x i64] [i64 8, i64 0, i64 0, i64 0, i64 4] -// CHECK-NOT: @.offload_sizes = private unnamed_addr constant [6 x i64] [i64 8, i64 0, i64 0, i64 0, i64 8, i64 4] -// CHECK: @

[clang] [llvm] [OpenMP][WIP] Use ATTACH maps for array-sections/subscripts on pointers. (PR #153683)

2025-08-14 Thread Abhinav Gaba via cfe-commits
abhinavgaba wrote: This is currently failing. Please ignore. https://github.com/llvm/llvm-project/pull/153683 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe

[clang] [llvm] [OpenMP][WIP] Use ATTACH maps for array-sections/subscripts on pointers. (PR #153683)

2025-08-14 Thread Abhinav Gaba via cfe-commits
abhinavgaba wrote: This test is currently failing. The IR hasn't been updated. https://github.com/llvm/llvm-project/pull/153683 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/ma

[clang] [llvm] [OpenMP][WIP] Use ATTACH maps for array-sections/subscripts on pointers. (PR #153683)

2025-08-14 Thread Abhinav Gaba via cfe-commits
abhinavgaba wrote: Please look at the comments in this example to see the maps we are emitting. It's a smaller/easier to read test. https://github.com/llvm/llvm-project/pull/153683 ___ cfe-commits mailing list cfe-co

[clang] [OpenMP][wip] Rework 'containing struct'/overlapped mapping handling (PR #153672)

2025-08-14 Thread Abhinav Gaba via cfe-commits
abhinavgaba wrote: Thanks for the PR. I haven't been able to look at how it can work along with the pointer-attachment rework. Please look at https://github.com/llvm/llvm-project/pull/153683/ when you get a chance. The updates tests have comments showing the current maps being emitted. In tha

[clang] [llvm] [OpenMP][WIP] Use ATTACH maps for array-sections/subscripts on pointers. (PR #153683)

2025-08-14 Thread Abhinav Gaba via cfe-commits
https://github.com/abhinavgaba edited https://github.com/llvm/llvm-project/pull/153683 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [Clang][OpenMP] Capture mapped pointers on `target` by reference. (PR #145454)

2025-07-23 Thread Abhinav Gaba via cfe-commits
abhinavgaba wrote: > Even for cases where both the pointer, pointee are mapped, the expectation is > for the pointer to still be captured by-ref. >Why? Because we don't know if the pointer/pointee were both already existing on the device, in which case, there should be no pointer-attachment fo

[clang] [llvm] [Clang][OpenMP] Capture mapped pointers on `target` by reference. (PR #145454)

2025-07-23 Thread Abhinav Gaba via cfe-commits
abhinavgaba wrote: > I have one big question - why do we need this? If pointer is mapped > explicitly, it becomes an attached pointer, which cannot be modified in > target region. How we capture/process it, byref or byval, does not matter, we > can do whatever is better. So, why do we need to

[clang] [llvm] [Clang][OpenMP] Capture mapped pointers on `target` by reference. (PR #145454)

2025-07-22 Thread Abhinav Gaba via cfe-commits
@@ -8811,8 +8829,19 @@ class MappableExprsHandler { ++EI; } } -llvm::stable_sort(DeclComponentLists, [](const MapData &LHS, - const MapData &RHS) { +llvm::stable_sort(DeclComponentLists, [VD](const MapData &L

[clang] [llvm] [Clang][OpenMP] Capture mapped pointers on `target` by reference. (PR #145454)

2025-07-03 Thread Abhinav Gaba via cfe-commits
@@ -8811,8 +8829,19 @@ class MappableExprsHandler { ++EI; } } -llvm::stable_sort(DeclComponentLists, [](const MapData &LHS, - const MapData &RHS) { +llvm::stable_sort(DeclComponentLists, [VD](const MapData &L

[clang] [llvm] [NFC][OpenMP] Add tests for mapping pointers and their dereferences. (PR #146934)

2025-07-03 Thread Abhinav Gaba via cfe-commits
https://github.com/abhinavgaba ready_for_review https://github.com/llvm/llvm-project/pull/146934 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [NFC][OpenMP] Add tests for mapping pointers and their dereferences. (PR #146934)

2025-07-03 Thread Abhinav Gaba via cfe-commits
@@ -0,0 +1,83 @@ +// RUN: %libomptarget-compilexx-run-and-check-generic + +#include +#include + +int x[10]; + +void f1() { + int *p; + p = &x[0]; + p[0] = 111; + p[1] = 222; + p[2] = 333; + p[3] = 444; + +#pragma omp target enter data map(to : p) +#pragma omp target enter

[clang] [NFC][Clang][OpenMP] Refactor mapinfo generation for captured vars (PR #146891)

2025-07-03 Thread Abhinav Gaba via cfe-commits
https://github.com/abhinavgaba ready_for_review https://github.com/llvm/llvm-project/pull/146891 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [NFC][Clang][OpenMP] Refactor mapinfo generation for captured vars (PR #146891)

2025-07-03 Thread Abhinav Gaba via cfe-commits
https://github.com/abhinavgaba updated https://github.com/llvm/llvm-project/pull/146891 >From 9f61909419939491c12384f471df05a504068054 Mon Sep 17 00:00:00 2001 From: Abhinav Gaba Date: Wed, 2 Jul 2025 00:32:33 -0700 Subject: [PATCH 1/2] [NFC][Clang] Refactor mapinfo generation for captured var

[clang] [NFC][Clang][OpenMP] Refactor mapinfo generation for captured vars (PR #146891)

2025-07-03 Thread Abhinav Gaba via cfe-commits
@@ -8727,11 +8733,13 @@ class MappableExprsHandler { } } - /// Generate the base pointers, section pointers, sizes, map types, and - /// mappers associated to a given capture (all included in \a CombinedInfo). - void generateInfoForCapture(const CapturedStmt::Capture

[clang] [NFC][Clang][OpenMP] Refactor mapinfo generation for captured vars (PR #146891)

2025-07-03 Thread Abhinav Gaba via cfe-commits
@@ -8826,6 +8830,51 @@ class MappableExprsHandler { return (HasPresent && !HasPresentR) || (HasAllocs && !HasAllocsR); }); +auto GenerateInfoForComponentLists = +[&](ArrayRef DeclComponentLists, +bool IsEligibleForTargetParamFlag) { +

[clang] [NFC][Clang][OpenMP] Refactor mapinfo generation for captured vars (PR #146891)

2025-07-03 Thread Abhinav Gaba via cfe-commits
https://github.com/abhinavgaba created https://github.com/llvm/llvm-project/pull/146891 The refactored code would allow creating multiple member-of maps for the same captured var, which would be useful for changes like https://github.com/llvm/llvm-project/pull/145454. >From 9f61909419939491c1

[clang] [llvm] [Clang][OpenMP] Capture mapped pointers on `target` by reference. (PR #145454)

2025-06-26 Thread Abhinav Gaba via cfe-commits
https://github.com/abhinavgaba edited https://github.com/llvm/llvm-project/pull/145454 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [Clang][OpenMP] Capture mapped pointers on `target` by reference. (PR #145454)

2025-06-26 Thread Abhinav Gaba via cfe-commits
@@ -8811,8 +8829,19 @@ class MappableExprsHandler { ++EI; } } -llvm::stable_sort(DeclComponentLists, [](const MapData &LHS, - const MapData &RHS) { +llvm::stable_sort(DeclComponentLists, [VD](const MapData &L

[clang] [llvm] [Clang][OpenMP] Capture mapped pointers on `target` by reference. (PR #145454)

2025-06-26 Thread Abhinav Gaba via cfe-commits
https://github.com/abhinavgaba edited https://github.com/llvm/llvm-project/pull/145454 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [Clang][OpenMP] Capture mapped pointers on `target` by reference. (PR #145454)

2025-06-26 Thread Abhinav Gaba via cfe-commits
@@ -8811,8 +8829,19 @@ class MappableExprsHandler { ++EI; } } -llvm::stable_sort(DeclComponentLists, [](const MapData &LHS, - const MapData &RHS) { +llvm::stable_sort(DeclComponentLists, [VD](const MapData &L

[clang] [llvm] [Clang][OpenMP] Capture mapped pointers on `target` by reference. (PR #145454)

2025-06-24 Thread Abhinav Gaba via cfe-commits
@@ -1,174 +1,178 @@ -// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --function-signature --include-generated-funcs --replace-value-regex "__omp_offloading_[0-9a-z]+_[0-9a-z]+" "reduction_size[.].+[.]" "pl_cond[.].+[.|,]" --prefix-fileche

[clang] [llvm] [Clang][OpenMP] Capture mapped pointers on `target` by reference. (PR #145454)

2025-06-24 Thread Abhinav Gaba via cfe-commits
https://github.com/abhinavgaba updated https://github.com/llvm/llvm-project/pull/145454 >From d867ab3a20b1999cb5b00554fdb21cbe6766a1d5 Mon Sep 17 00:00:00 2001 From: Abhinav Gaba Date: Sun, 22 Jun 2025 18:36:16 -0700 Subject: [PATCH 1/3] [Clang][OpenMP] Capture mapped pointers on `target` by r

[clang] [llvm] [Clang][OpenMP] Capture mapped pointers on `target` by reference. (PR #145454)

2025-06-24 Thread Abhinav Gaba via cfe-commits
@@ -8811,8 +8829,19 @@ class MappableExprsHandler { ++EI; } } -llvm::stable_sort(DeclComponentLists, [](const MapData &LHS, - const MapData &RHS) { +llvm::stable_sort(DeclComponentLists, [VD](const MapData &L

[clang] [llvm] [Clang][OpenMP] Capture mapped pointers on `target` by reference. (PR #145454)

2025-06-24 Thread Abhinav Gaba via cfe-commits
abhinavgaba wrote: @alexey-bataev, please review. https://github.com/llvm/llvm-project/pull/145454 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [Clang][OpenMP] Capture mapped pointers on `target` by reference. (PR #145454)

2025-06-24 Thread Abhinav Gaba via cfe-commits
https://github.com/abhinavgaba ready_for_review https://github.com/llvm/llvm-project/pull/145454 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [Clang][OpenMP] Capture mapped pointers on `target` by reference. (PR #145454)

2025-06-24 Thread Abhinav Gaba via cfe-commits
@@ -1,174 +1,178 @@ -// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --function-signature --include-generated-funcs --replace-value-regex "__omp_offloading_[0-9a-z]+_[0-9a-z]+" "reduction_size[.].+[.]" "pl_cond[.].+[.|,]" --prefix-fileche

[clang] [llvm] [Clang][OpenMP] Capture mapped pointers on `target` by reference. (PR #145454)

2025-06-24 Thread Abhinav Gaba via cfe-commits
@@ -8811,8 +8829,19 @@ class MappableExprsHandler { ++EI; } } -llvm::stable_sort(DeclComponentLists, [](const MapData &LHS, - const MapData &RHS) { +llvm::stable_sort(DeclComponentLists, [VD](const MapData &L

[clang] [llvm] [Clang][OpenMP] Capture mapped pointers on `target` by reference. (PR #145454)

2025-06-24 Thread Abhinav Gaba via cfe-commits
@@ -1,174 +1,178 @@ -// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --function-signature --include-generated-funcs --replace-value-regex "__omp_offloading_[0-9a-z]+_[0-9a-z]+" "reduction_size[.].+[.]" "pl_cond[.].+[.|,]" --prefix-fileche

[clang] [llvm] [Clang][OpenMP] Capture mapped pointers on `target` by reference. (PR #145454)

2025-06-23 Thread Abhinav Gaba via cfe-commits
@@ -1,174 +1,178 @@ -// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --function-signature --include-generated-funcs --replace-value-regex "__omp_offloading_[0-9a-z]+_[0-9a-z]+" "reduction_size[.].+[.]" "pl_cond[.].+[.|,]" --prefix-fileche

[clang] [llvm] [Clang][OpenMP] Capture mapped pointers on `target` by reference. (PR #145454)

2025-06-23 Thread Abhinav Gaba via cfe-commits
https://github.com/abhinavgaba created https://github.com/llvm/llvm-project/pull/145454 For the following: ```c int *p; #pragma omp target map(p[0]) //(A) (void)p; #pragma omp target map(p) // (B) (void)p; #pragma omp target map(p, p[0]) // (C) (void)p; #pragma omp ta

[clang] [llvm] [Clang][OpenMP] Capture mapped pointers on `target` by reference. (PR #145454)

2025-06-23 Thread Abhinav Gaba via cfe-commits
https://github.com/abhinavgaba updated https://github.com/llvm/llvm-project/pull/145454 >From d867ab3a20b1999cb5b00554fdb21cbe6766a1d5 Mon Sep 17 00:00:00 2001 From: Abhinav Gaba Date: Sun, 22 Jun 2025 18:36:16 -0700 Subject: [PATCH 1/2] [Clang][OpenMP] Capture mapped pointers on `target` by r

[clang] [llvm] [Clang][OpenMP] Capture mapped pointers on `target` by reference. (PR #145454)

2025-06-23 Thread Abhinav Gaba via cfe-commits
@@ -1,174 +1,178 @@ -// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --function-signature --include-generated-funcs --replace-value-regex "__omp_offloading_[0-9a-z]+_[0-9a-z]+" "reduction_size[.].+[.]" "pl_cond[.].+[.|,]" --prefix-fileche

[clang] [llvm] [Clang][OpenMP] Capture mapped pointers on `target` by reference. (PR #145454)

2025-06-23 Thread Abhinav Gaba via cfe-commits
@@ -1,174 +1,178 @@ -// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --function-signature --include-generated-funcs --replace-value-regex "__omp_offloading_[0-9a-z]+_[0-9a-z]+" "reduction_size[.].+[.]" "pl_cond[.].+[.|,]" --prefix-fileche

[clang] [llvm] [Clang][OpenMP] Fix mapping of arrays of structs with members with mappers (PR #142511)

2025-06-11 Thread Abhinav Gaba via cfe-commits
abhinavgaba wrote: Thanks, Alexey! @sarnex, could you please help merge this? Windows build/test reports some "Slowed tests" that are Driver/Architecture specific, and not related to this change. ``` Slowest Tests: -- 109

[clang] [llvm] [Clang][OpenMP] Fix mapping of arrays of structs with members with mappers (PR #142511)

2025-06-11 Thread Abhinav Gaba via cfe-commits
https://github.com/abhinavgaba updated https://github.com/llvm/llvm-project/pull/142511 >From 9d29860f69dec99aa435ea23c2f2559394ca771e Mon Sep 17 00:00:00 2001 From: Abhinav Gaba Date: Wed, 28 May 2025 14:30:18 -0700 Subject: [PATCH 1/2] Create implicit mappers when mapping arrays of structs w

[clang] [llvm] [Clang][OpenMP] Fix mapping of arrays of structs with members with mappers (PR #142511)

2025-06-10 Thread Abhinav Gaba via cfe-commits
abhinavgaba wrote: @alexey-bataev, @jdoerfert, please help review. Thanks. https://github.com/llvm/llvm-project/pull/142511 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [Clang][OpenMP] Fix mapping of arrays of structs with members with mappers (PR #142511)

2025-06-03 Thread Abhinav Gaba via cfe-commits
https://github.com/abhinavgaba edited https://github.com/llvm/llvm-project/pull/142511 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [Clang][OpenMP] Fix mapping of arrays of structs with members with mappers (PR #142511)

2025-06-03 Thread Abhinav Gaba via cfe-commits
https://github.com/abhinavgaba ready_for_review https://github.com/llvm/llvm-project/pull/142511 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits