[clang] [llvm] [Offload][Tests] Non-contiguous_update_to_tests (PR #169623)

2026-01-20 Thread Nick Sarnie via cfe-commits

sarnex wrote:

I will fix the above error, just need to XFAIL these new tests.

https://github.com/llvm/llvm-project/pull/169623
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [Offload][Tests] Non-contiguous_update_to_tests (PR #169623)

2026-01-19 Thread LLVM Continuous Integration via cfe-commits

llvm-ci wrote:

LLVM Buildbot has detected a new failure on builder `intel-sycl-gpu` running on 
`intel-sycl-gpu-01` while building `clang,offload` at step 6 
"test-build-unified-tree-check-all".

Full details are available at: 
https://lab.llvm.org/buildbot/#/builders/225/builds/544


Here is the relevant piece of the build log for the reference

```
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
 TEST 'libomptarget :: spirv64-intel :: 
offloading/strided_partial_update_to.c' FAILED 
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 5
/home/test-user/llvm-buildbot-worker/intel-sycl-gpu/build/./bin/clang -fopenmp  
  -I 
/home/test-user/llvm-buildbot-worker/intel-sycl-gpu/llvm-project/offload/test 
-I 
/home/test-user/llvm-buildbot-worker/intel-sycl-gpu/build/runtimes/runtimes-bins/openmp/runtime/src
 -L 
/home/test-user/llvm-buildbot-worker/intel-sycl-gpu/build/runtimes/runtimes-bins/offload
 -L /home/test-user/llvm-buildbot-worker/intel-sycl-gpu/build/./lib -L 
/home/test-user/llvm-buildbot-worker/intel-sycl-gpu/build/./lib -L 
/home/test-user/llvm-buildbot-worker/intel-sycl-gpu/build/runtimes/runtimes-bins/openmp/runtime/src
  -nogpulib 
-Wl,-rpath,/home/test-user/llvm-buildbot-worker/intel-sycl-gpu/build/runtimes/runtimes-bins/offload
 
-Wl,-rpath,/home/test-user/llvm-buildbot-worker/intel-sycl-gpu/build/runtimes/runtimes-bins/openmp/runtime/src
 -Wl,-rpath,/home/test-user/llvm-buildbot-worker/intel-sycl-gpu/build/./lib 
-Wl,-rpath,/home/test-user/llvm-buildbot-worker/intel-sycl-gpu/build/./lib  
-fopenmp-targets=spirv64-intel 
/home/test-user/llvm-buildbot-worker/intel-sycl-gpu/llvm-project/offload/test/offloading/strided_partial_update_to.c
 -o 
/home/test-user/llvm-buildbot-worker/intel-sycl-gpu/build/runtimes/runtimes-bins/offload/test/spirv64-intel/offloading/Output/strided_partial_update_to.c.tmp
 && 
/home/test-user/llvm-buildbot-worker/intel-sycl-gpu/build/runtimes/runtimes-bins/offload/test/spirv64-intel/offloading/Output/strided_partial_update_to.c.tmp
 | /home/test-user/llvm-buildbot-worker/intel-sycl-gpu/build/./bin/FileCheck 
/home/test-user/llvm-buildbot-worker/intel-sycl-gpu/llvm-project/offload/test/offloading/strided_partial_update_to.c
# executed command: 
/home/test-user/llvm-buildbot-worker/intel-sycl-gpu/build/./bin/clang -fopenmp 
-I 
/home/test-user/llvm-buildbot-worker/intel-sycl-gpu/llvm-project/offload/test 
-I 
/home/test-user/llvm-buildbot-worker/intel-sycl-gpu/build/runtimes/runtimes-bins/openmp/runtime/src
 -L 
/home/test-user/llvm-buildbot-worker/intel-sycl-gpu/build/runtimes/runtimes-bins/offload
 -L /home/test-user/llvm-buildbot-worker/intel-sycl-gpu/build/./lib -L 
/home/test-user/llvm-buildbot-worker/intel-sycl-gpu/build/./lib -L 
/home/test-user/llvm-buildbot-worker/intel-sycl-gpu/build/runtimes/runtimes-bins/openmp/runtime/src
 -nogpulib 
-Wl,-rpath,/home/test-user/llvm-buildbot-worker/intel-sycl-gpu/build/runtimes/runtimes-bins/offload
 
-Wl,-rpath,/home/test-user/llvm-buildbot-worker/intel-sycl-gpu/build/runtimes/runtimes-bins/openmp/runtime/src
 -Wl,-rpath,/home/test-user/llvm-buildbot-worker/intel-sycl-gpu/build/./lib 
-Wl,-rpath,/home/test-user/llvm-buildbot-worker/intel-sycl-gpu/build/./lib 
-fopenmp-targets=spirv64-intel 
/home/test-user/llvm-buildbot-worker/intel-sycl-gpu/llvm-project/offload/test/offloading/strided_partial_update_to.c
 -o 
/home/test-user/llvm-buildbot-worker/intel-sycl-gpu/build/runtimes/runtimes-bins/offload/test/spirv64-intel/offloading/Output/strided_partial_update_to.c.tmp
# .---command stderr
# | error: 0: Unresolved external reference to "__kmpc_target_init".
# | clang: error: spirv-link command failed with exit code 1 (use -v to see 
invocation)
# | 
/home/test-user/llvm-buildbot-worker/intel-sycl-gpu/build/bin/clang-linker-wrapper:
 error: 'clang' failed
# | clang: error: linker command failed with exit code 1 (use -v to see 
invocation)
# `-
# error: command failed with exit status: 1

--




```



https://github.com/llvm/llvm-project/pull/169623
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [Offload][Tests] Non-contiguous_update_to_tests (PR #169623)

2026-01-19 Thread Saiyedul Islam via cfe-commits

https://github.com/saiislam closed 
https://github.com/llvm/llvm-project/pull/169623
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [Offload][Tests] Non-contiguous_update_to_tests (PR #169623)

2026-01-19 Thread Saiyedul Islam via cfe-commits

https://github.com/saiislam approved this pull request.

LGTM, thanks!

https://github.com/llvm/llvm-project/pull/169623
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [Offload][Tests] Non-contiguous_update_to_tests (PR #169623)

2026-01-19 Thread Shilei Tian via cfe-commits

https://github.com/shiltian approved this pull request.


https://github.com/llvm/llvm-project/pull/169623
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [Offload][Tests] Non-contiguous_update_to_tests (PR #169623)

2026-01-12 Thread Amit Tiwari via cfe-commits

https://github.com/amitamd7 updated 
https://github.com/llvm/llvm-project/pull/169623

>From ed3677e1c948f1a8931f8d5414aa3dc9a2b7b53d Mon Sep 17 00:00:00 2001
From: amtiwari 
Date: Wed, 26 Nov 2025 03:58:44 -0500
Subject: [PATCH] non-contiguous_update_to_tests

---
 ... => target_update_strided_messages_from.c} |   7 +-
 .../target_update_strided_messages_to.c   |  33 +
 ...t_update_strided_multiple_messages_from.c} |  25 +---
 ...rget_update_strided_multiple_messages_to.c |  25 
 ...et_update_strided_partial_messages_from.c} |  13 +-
 ...arget_update_strided_partial_messages_to.c |  25 
 ...pdate.c => strided_multiple_update_from.c} |   0
 .../offloading/strided_multiple_update_to.c   | 122 ++
 ...update.c => strided_partial_update_from.c} |   0
 .../offloading/strided_partial_update_to.c|  72 +++
 ...strided_update.c => strided_update_from.c} |   0
 offload/test/offloading/strided_update_to.c   |  72 +++
 12 files changed, 354 insertions(+), 40 deletions(-)
 rename clang/test/OpenMP/{target_update_strided_messages.c => 
target_update_strided_messages_from.c} (92%)
 create mode 100644 clang/test/OpenMP/target_update_strided_messages_to.c
 rename clang/test/OpenMP/{target_update_strided_multiple_messages.c => 
target_update_strided_multiple_messages_from.c} (60%)
 create mode 100644 
clang/test/OpenMP/target_update_strided_multiple_messages_to.c
 rename clang/test/OpenMP/{target_update_strided_partial_messages.c => 
target_update_strided_partial_messages_from.c} (59%)
 create mode 100644 
clang/test/OpenMP/target_update_strided_partial_messages_to.c
 rename offload/test/offloading/{strided_multiple_update.c => 
strided_multiple_update_from.c} (100%)
 create mode 100644 offload/test/offloading/strided_multiple_update_to.c
 rename offload/test/offloading/{strided_partial_update.c => 
strided_partial_update_from.c} (100%)
 create mode 100644 offload/test/offloading/strided_partial_update_to.c
 rename offload/test/offloading/{strided_update.c => strided_update_from.c} 
(100%)
 create mode 100644 offload/test/offloading/strided_update_to.c

diff --git a/clang/test/OpenMP/target_update_strided_messages.c 
b/clang/test/OpenMP/target_update_strided_messages_from.c
similarity index 92%
rename from clang/test/OpenMP/target_update_strided_messages.c
rename to clang/test/OpenMP/target_update_strided_messages_from.c
index 1f50af4e52805..eea873849e000 100644
--- a/clang/test/OpenMP/target_update_strided_messages.c
+++ b/clang/test/OpenMP/target_update_strided_messages_from.c
@@ -1,8 +1,6 @@
 // RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s -Wuninitialized
 // RUN: %clang_cc1 -verify -fopenmp-simd -ferror-limit 100 %s -Wuninitialized
 
-void foo(void) {}
-
 int main(int argc, char **argv) {
   int len = 8;
   double data[len];
@@ -11,9 +9,6 @@ int main(int argc, char **argv) {
   #pragma omp target update from(data[0:4:2]) // OK
   {}
   
-  #pragma omp target update to(data[0:len/2:2]) // OK
-  {}
-  
   #pragma omp target update from(data[1:3:2]) // OK
   {}
   
@@ -35,4 +30,4 @@ int main(int argc, char **argv) {
   {}
   
   return 0;
-}
\ No newline at end of file
+}
diff --git a/clang/test/OpenMP/target_update_strided_messages_to.c 
b/clang/test/OpenMP/target_update_strided_messages_to.c
new file mode 100644
index 0..4044c94d499f9
--- /dev/null
+++ b/clang/test/OpenMP/target_update_strided_messages_to.c
@@ -0,0 +1,33 @@
+// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s -Wuninitialized
+// RUN: %clang_cc1 -verify -fopenmp-simd -ferror-limit 100 %s -Wuninitialized
+
+int main(int argc, char **argv) {
+  int len = 8;
+  double data[len];
+
+  // Valid strided array sections
+  #pragma omp target update to(data[0:4:2]) // OK
+  {}
+
+  #pragma omp target update to(data[1:3:2]) // OK
+  {}
+
+  // Missing stride (default = 1)
+  #pragma omp target update to(data[0:4]) // OK
+  {}
+
+  // Invalid stride expressions
+  #pragma omp target update to(data[0:4:0]) // expected-error {{section stride 
is evaluated to a non-positive value 0}} expected-error {{expected at least one 
'to' clause or 'from' clause specified to '#pragma omp target update'}}
+
+  #pragma omp target update to(data[0:4:-1]) // expected-error {{section 
stride is evaluated to a non-positive value -1}} expected-error {{expected at 
least one 'to' clause or 'from' clause specified to '#pragma omp target 
update'}}
+
+  // Missing colon 
+  #pragma omp target update to(data[0:4 2]) // expected-error {{expected ']'}} 
expected-note {{to match this '['}} expected-error {{expected at least one 'to' 
clause or 'from' clause specified to '#pragma omp target update'}}
+  {}
+
+  // Too many colons
+  #pragma omp target update to(data[0:4:2:1]) // expected-error {{expected 
']'}} expected-note {{to match this '['}} expected-error {{expected at least 
one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
+  {}
+
+  return 0;
+}
diff --git a/clang/test/OpenMP/target

[clang] [llvm] [Offload][Tests] Non-contiguous_update_to_tests (PR #169623)

2025-12-30 Thread Amit Tiwari via cfe-commits


@@ -0,0 +1,72 @@
+// This test checks that "update to" clause in OpenMP is supported when the
+// elements are updated in a non-contiguous manner. This test checks that
+// #pragma omp target update to(data[0:4:2]) correctly updates only every
+// other element (stride 2) from the host to the device
+
+// RUN: %libomptarget-compile-run-and-check-generic
+#include 
+#include 
+
+int main() {
+  int len = 8;
+  double data[len];
+
+  // Initialize on host
+  for (int i = 0; i < len; i++) {
+data[i] = i;
+  }
+
+  // Initial values
+  printf("original host array values:\n");
+  for (int i = 0; i < len; i++)
+printf("%f\n", data[i]);
+  printf("\n");
+
+#pragma omp target data map(tofrom : len, data[0 : len])
+  {
+// Initialize device to 20
+#pragma omp target
+for (int i = 0; i < len; i++) {
+  data[i] = 20.0;
+}
+
+// Modify host for strided elements
+data[0] = 10.0;
+data[2] = 10.0;
+data[4] = 10.0;
+data[6] = 10.0;
+
+#pragma omp target update to(data[0 : 4 : 2])
+
+// Verify on device by adding 5
+#pragma omp target
+for (int i = 0; i < len; i++) {
+  data[i] += 5.0;
+}
+  }
+
+  // CHECK: 0.00
+  // CHECK: 1.00
+  // CHECK: 2.00
+  // CHECK: 3.00
+  // CHECK: 4.00
+  // CHECK: 5.00
+  // CHECK: 6.00
+  // CHECK: 7.00
+
+  printf("device array values after update to:\n");
+  for (int i = 0; i < len; i++)
+printf("%f\n", data[i]);
+  printf("\n");
+
+  // CHECK: 15.00
+  // CHECK: 25.00
+  // CHECK: 15.00
+  // CHECK: 25.00
+  // CHECK: 15.00
+  // CHECK: 25.00
+  // CHECK: 15.00
+  // CHECK: 25.00
+
+  return 0;
+}

amitamd7 wrote:

made the change in all the required tests.

https://github.com/llvm/llvm-project/pull/169623
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [Offload][Tests] Non-contiguous_update_to_tests (PR #169623)

2025-12-30 Thread Amit Tiwari via cfe-commits

https://github.com/amitamd7 updated 
https://github.com/llvm/llvm-project/pull/169623

>From 7a0c55a46098159655a582823e2c4f86ec3ca177 Mon Sep 17 00:00:00 2001
From: amtiwari 
Date: Wed, 26 Nov 2025 03:58:44 -0500
Subject: [PATCH] non-contiguous_update_to_tests

---
 ... => target_update_strided_messages_from.c} |   7 +-
 .../target_update_strided_messages_to.c   |  33 +
 ...t_update_strided_multiple_messages_from.c} |  25 +---
 ...rget_update_strided_multiple_messages_to.c |  25 
 ...et_update_strided_partial_messages_from.c} |  13 +-
 ...arget_update_strided_partial_messages_to.c |  25 
 ...pdate.c => strided_multiple_update_from.c} |   0
 .../offloading/strided_multiple_update_to.c   | 122 ++
 ...update.c => strided_partial_update_from.c} |   0
 .../offloading/strided_partial_update_to.c|  72 +++
 ...strided_update.c => strided_update_from.c} |   0
 offload/test/offloading/strided_update_to.c   |  72 +++
 12 files changed, 354 insertions(+), 40 deletions(-)
 rename clang/test/OpenMP/{target_update_strided_messages.c => 
target_update_strided_messages_from.c} (92%)
 create mode 100644 clang/test/OpenMP/target_update_strided_messages_to.c
 rename clang/test/OpenMP/{target_update_strided_multiple_messages.c => 
target_update_strided_multiple_messages_from.c} (60%)
 create mode 100644 
clang/test/OpenMP/target_update_strided_multiple_messages_to.c
 rename clang/test/OpenMP/{target_update_strided_partial_messages.c => 
target_update_strided_partial_messages_from.c} (59%)
 create mode 100644 
clang/test/OpenMP/target_update_strided_partial_messages_to.c
 rename offload/test/offloading/{strided_multiple_update.c => 
strided_multiple_update_from.c} (100%)
 create mode 100644 offload/test/offloading/strided_multiple_update_to.c
 rename offload/test/offloading/{strided_partial_update.c => 
strided_partial_update_from.c} (100%)
 create mode 100644 offload/test/offloading/strided_partial_update_to.c
 rename offload/test/offloading/{strided_update.c => strided_update_from.c} 
(100%)
 create mode 100644 offload/test/offloading/strided_update_to.c

diff --git a/clang/test/OpenMP/target_update_strided_messages.c 
b/clang/test/OpenMP/target_update_strided_messages_from.c
similarity index 92%
rename from clang/test/OpenMP/target_update_strided_messages.c
rename to clang/test/OpenMP/target_update_strided_messages_from.c
index 1f50af4e52805..eea873849e000 100644
--- a/clang/test/OpenMP/target_update_strided_messages.c
+++ b/clang/test/OpenMP/target_update_strided_messages_from.c
@@ -1,8 +1,6 @@
 // RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s -Wuninitialized
 // RUN: %clang_cc1 -verify -fopenmp-simd -ferror-limit 100 %s -Wuninitialized
 
-void foo(void) {}
-
 int main(int argc, char **argv) {
   int len = 8;
   double data[len];
@@ -11,9 +9,6 @@ int main(int argc, char **argv) {
   #pragma omp target update from(data[0:4:2]) // OK
   {}
   
-  #pragma omp target update to(data[0:len/2:2]) // OK
-  {}
-  
   #pragma omp target update from(data[1:3:2]) // OK
   {}
   
@@ -35,4 +30,4 @@ int main(int argc, char **argv) {
   {}
   
   return 0;
-}
\ No newline at end of file
+}
diff --git a/clang/test/OpenMP/target_update_strided_messages_to.c 
b/clang/test/OpenMP/target_update_strided_messages_to.c
new file mode 100644
index 0..4044c94d499f9
--- /dev/null
+++ b/clang/test/OpenMP/target_update_strided_messages_to.c
@@ -0,0 +1,33 @@
+// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s -Wuninitialized
+// RUN: %clang_cc1 -verify -fopenmp-simd -ferror-limit 100 %s -Wuninitialized
+
+int main(int argc, char **argv) {
+  int len = 8;
+  double data[len];
+
+  // Valid strided array sections
+  #pragma omp target update to(data[0:4:2]) // OK
+  {}
+
+  #pragma omp target update to(data[1:3:2]) // OK
+  {}
+
+  // Missing stride (default = 1)
+  #pragma omp target update to(data[0:4]) // OK
+  {}
+
+  // Invalid stride expressions
+  #pragma omp target update to(data[0:4:0]) // expected-error {{section stride 
is evaluated to a non-positive value 0}} expected-error {{expected at least one 
'to' clause or 'from' clause specified to '#pragma omp target update'}}
+
+  #pragma omp target update to(data[0:4:-1]) // expected-error {{section 
stride is evaluated to a non-positive value -1}} expected-error {{expected at 
least one 'to' clause or 'from' clause specified to '#pragma omp target 
update'}}
+
+  // Missing colon 
+  #pragma omp target update to(data[0:4 2]) // expected-error {{expected ']'}} 
expected-note {{to match this '['}} expected-error {{expected at least one 'to' 
clause or 'from' clause specified to '#pragma omp target update'}}
+  {}
+
+  // Too many colons
+  #pragma omp target update to(data[0:4:2:1]) // expected-error {{expected 
']'}} expected-note {{to match this '['}} expected-error {{expected at least 
one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
+  {}
+
+  return 0;
+}
diff --git a/clang/test/OpenMP/target

[clang] [llvm] [Offload][Tests] Non-contiguous_update_to_tests (PR #169623)

2025-12-30 Thread Amit Tiwari via cfe-commits


@@ -0,0 +1,72 @@
+// This test checks that #pragma omp target update to(data[0:4:3]) correctly
+// updates every third element (stride 3) from the host to the device, 
partially
+// across the array
+
+// RUN: %libomptarget-compile-run-and-check-generic
+#include 
+#include 
+
+int main() {
+  int len = 11;
+  double data[len];
+
+  // Initialize on host
+  for (int i = 0; i < len; i++)
+data[i] = i;
+
+  // Initial values
+  printf("original host array values:\n");
+  for (int i = 0; i < len; i++)
+printf("%f\n", data[i]);
+  printf("\n");
+
+  // CHECK: 0.00
+  // CHECK: 1.00
+  // CHECK: 2.00
+  // CHECK: 3.00
+  // CHECK: 4.00
+  // CHECK: 5.00
+  // CHECK: 6.00
+  // CHECK: 7.00
+  // CHECK: 8.00
+  // CHECK: 9.00
+  // CHECK: 10.00
+
+#pragma omp target data map(tofrom : data[0 : len])
+  {
+// Initialize device array to 20
+#pragma omp target
+for (int i = 0; i < len; i++)
+  data[i] = 20.0;
+
+// Modify host data for strided elements
+data[0] = 10.0;
+data[3] = 10.0;
+data[6] = 10.0;
+data[9] = 10.0;
+
+#pragma omp target update to(data[0 : 4 : 3]) // indices 0,3,6,9
+
+// Verify on device by adding 5
+#pragma omp target
+for (int i = 0; i < len; i++)
+  data[i] += 5.0;
+  }
+
+  printf("device array values after update to:\n");
+  for (int i = 0; i < len; i++)
+printf("%f\n", data[i]);
+  printf("\n");
+
+  // CHECK: 15.00
+  // CHECK: 25.00
+  // CHECK: 25.00
+  // CHECK: 15.00
+  // CHECK: 25.00
+  // CHECK: 25.00
+  // CHECK: 15.00
+  // CHECK: 25.00
+  // CHECK: 25.00
+  // CHECK: 15.00
+  // CHECK: 25.00

amitamd7 wrote:

I agree with the stride 2 point but stride 3 tests a less obvious pattern 
(non-power-of-2, doesn't evenly divide array length). Stride 2 exists Also 
consistent with the already existent "partial" tests. 

They affect different code paths in Clang - single vs. partial vs. multiple 
strides affect AST handling, descriptor construction, and mapping components 
differently. Separate approach also helps tracking issues & debugging.

https://github.com/llvm/llvm-project/pull/169623
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [Offload][Tests] Non-contiguous_update_to_tests (PR #169623)

2025-12-08 Thread Shilei Tian via cfe-commits


@@ -0,0 +1,26 @@
+// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s -Wuninitialized
+// RUN: %clang_cc1 -verify -fopenmp-simd -ferror-limit 100 %s -Wuninitialized
+
+int main(int argc, char **argv) {
+  int len = 12;
+  double data1[len], data2[len];
+
+  // Valid multiple strided array sections
+  #pragma omp target update to(data1[0:4:2], data2[0:2:5]) // OK
+  {}
+
+  // Mixed strided and regular array sections
+  #pragma omp target update to(data1[0:len], data2[0:4:2]) // OK
+  {}
+
+  // Invalid stride in one of multiple sections
+  #pragma omp target update to(data1[0:3:4], data2[0:2:0]) // expected-error 
{{section stride is evaluated to a non-positive value 0}}
+  {}
+
+  // Missing colon 
+  #pragma omp target update to(data1[0:4:2], data2[0:3 4]) // expected-error 
{{expected ']'}} expected-note {{to match this '['}}
+  {}
+
+  return 0;
+}
+

shiltian wrote:

you added two empty lines here.

https://github.com/llvm/llvm-project/pull/169623
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [Offload][Tests] Non-contiguous_update_to_tests (PR #169623)

2025-12-08 Thread Shilei Tian via cfe-commits


@@ -0,0 +1,26 @@
+// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s -Wuninitialized
+// RUN: %clang_cc1 -verify -fopenmp-simd -ferror-limit 100 %s -Wuninitialized
+// expected-no-diagnostics
+
+int main(int argc, char **argv) {
+  int len = 11;
+  double data[len];
+
+  // Valid partial strided updates
+  #pragma omp target update to(data[0:4:3]) // OK
+  {}
+
+  // Stride larger than length
+  #pragma omp target update to(data[0:2:10]) // OK
+  {}
+
+  // Valid: complex expressions
+  int offset = 1;
+
+  // Potentially invalid stride expressions depending on runtime values
+  #pragma omp target update to(data[0:4:offset-1]) // OK if offset > 1
+  {}
+
+  return 0;
+}
+

shiltian wrote:

you added two empty lines here.

https://github.com/llvm/llvm-project/pull/169623
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [Offload][Tests] Non-contiguous_update_to_tests (PR #169623)

2025-12-08 Thread Shilei Tian via cfe-commits


@@ -17,16 +16,11 @@ int main(int argc, char **argv) {
   
   // Valid: complex expressions
   int offset = 1;
-  int count = 3;
-  int stride = 2;
-  #pragma omp target update from(data[offset:count:stride]) // OK
-  {}
-  
+
   // Invalid stride expressions
   #pragma omp target update from(data[0:4:offset-1]) // OK if offset > 1
   {}
   
-  #pragma omp target update from(data[0:count:0]) // expected-error {{section 
stride is evaluated to a non-positive value 0}} expected-error {{expected at 
least one 'to' clause or 'from' clause specified to '#pragma omp target 
update'}}
-  
   return 0;
-}
\ No newline at end of file
+}
+

shiltian wrote:

you added two empty lines here.

https://github.com/llvm/llvm-project/pull/169623
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [Offload][Tests] Non-contiguous_update_to_tests (PR #169623)

2025-12-08 Thread Shilei Tian via cfe-commits


@@ -0,0 +1,72 @@
+// This test checks that "update to" clause in OpenMP is supported when the
+// elements are updated in a non-contiguous manner. This test checks that
+// #pragma omp target update to(data[0:4:2]) correctly updates only every
+// other element (stride 2) from the host to the device
+
+// RUN: %libomptarget-compile-run-and-check-generic
+#include 
+#include 
+
+int main() {
+  int len = 8;
+  double data[len];
+
+  // Initialize on host
+  for (int i = 0; i < len; i++) {
+data[i] = i;
+  }
+
+  // Initial values
+  printf("original host array values:\n");
+  for (int i = 0; i < len; i++)
+printf("%f\n", data[i]);
+  printf("\n");
+
+#pragma omp target data map(tofrom : len, data[0 : len])
+  {
+// Initialize device to 20
+#pragma omp target
+for (int i = 0; i < len; i++) {
+  data[i] = 20.0;
+}
+
+// Modify host for strided elements
+data[0] = 10.0;
+data[2] = 10.0;
+data[4] = 10.0;
+data[6] = 10.0;
+
+#pragma omp target update to(data[0 : 4 : 2])
+
+// Verify on device by adding 5
+#pragma omp target
+for (int i = 0; i < len; i++) {
+  data[i] += 5.0;
+}
+  }
+
+  // CHECK: 0.00
+  // CHECK: 1.00
+  // CHECK: 2.00
+  // CHECK: 3.00
+  // CHECK: 4.00
+  // CHECK: 5.00
+  // CHECK: 6.00
+  // CHECK: 7.00
+
+  printf("device array values after update to:\n");
+  for (int i = 0; i < len; i++)
+printf("%f\n", data[i]);
+  printf("\n");
+
+  // CHECK: 15.00
+  // CHECK: 25.00
+  // CHECK: 15.00
+  // CHECK: 25.00
+  // CHECK: 15.00
+  // CHECK: 25.00
+  // CHECK: 15.00
+  // CHECK: 25.00
+
+  return 0;
+}

shiltian wrote:

and miss one empty line here

https://github.com/llvm/llvm-project/pull/169623
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [Offload][Tests] Non-contiguous_update_to_tests (PR #169623)

2025-12-08 Thread Shilei Tian via cfe-commits


@@ -0,0 +1,72 @@
+// This test checks that #pragma omp target update to(data[0:4:3]) correctly
+// updates every third element (stride 3) from the host to the device, 
partially
+// across the array
+
+// RUN: %libomptarget-compile-run-and-check-generic
+#include 
+#include 
+
+int main() {
+  int len = 11;
+  double data[len];
+
+  // Initialize on host
+  for (int i = 0; i < len; i++)
+data[i] = i;
+
+  // Initial values
+  printf("original host array values:\n");
+  for (int i = 0; i < len; i++)
+printf("%f\n", data[i]);
+  printf("\n");
+
+  // CHECK: 0.00
+  // CHECK: 1.00
+  // CHECK: 2.00
+  // CHECK: 3.00
+  // CHECK: 4.00
+  // CHECK: 5.00
+  // CHECK: 6.00
+  // CHECK: 7.00
+  // CHECK: 8.00
+  // CHECK: 9.00
+  // CHECK: 10.00
+
+#pragma omp target data map(tofrom : data[0 : len])
+  {
+// Initialize device array to 20
+#pragma omp target
+for (int i = 0; i < len; i++)
+  data[i] = 20.0;
+
+// Modify host data for strided elements
+data[0] = 10.0;
+data[3] = 10.0;
+data[6] = 10.0;
+data[9] = 10.0;
+
+#pragma omp target update to(data[0 : 4 : 3]) // indices 0,3,6,9
+
+// Verify on device by adding 5
+#pragma omp target
+for (int i = 0; i < len; i++)
+  data[i] += 5.0;
+  }
+
+  printf("device array values after update to:\n");
+  for (int i = 0; i < len; i++)
+printf("%f\n", data[i]);
+  printf("\n");
+
+  // CHECK: 15.00
+  // CHECK: 25.00
+  // CHECK: 25.00
+  // CHECK: 15.00
+  // CHECK: 25.00
+  // CHECK: 25.00
+  // CHECK: 15.00
+  // CHECK: 25.00
+  // CHECK: 25.00
+  // CHECK: 15.00
+  // CHECK: 25.00

shiltian wrote:

This doesn't look very representative. I'd make the stride 2, such that only 0, 
2, 4, 6 should be updated, but the rest, 8, 10, are untouched. Also, there is 
no point of making this a file. Just merge the three runtime tests.

https://github.com/llvm/llvm-project/pull/169623
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [Offload][Tests] Non-contiguous_update_to_tests (PR #169623)

2025-12-01 Thread Amit Tiwari via cfe-commits

https://github.com/amitamd7 ready_for_review 
https://github.com/llvm/llvm-project/pull/169623
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [Offload][Tests] Non-contiguous_update_to_tests (PR #169623)

2025-12-01 Thread Amit Tiwari via cfe-commits

https://github.com/amitamd7 updated 
https://github.com/llvm/llvm-project/pull/169623

>From 4ee4ce40ff1f0965b181bade8810cbf282573343 Mon Sep 17 00:00:00 2001
From: amtiwari 
Date: Wed, 26 Nov 2025 03:58:44 -0500
Subject: [PATCH] non-contiguous_update_to_tests

---
 ... => target_update_strided_messages_from.c} |   8 +-
 .../target_update_strided_messages_to.c   |  34 +
 ...t_update_strided_multiple_messages_from.c} |  26 +---
 ...rget_update_strided_multiple_messages_to.c |  26 
 ...et_update_strided_partial_messages_from.c} |  14 +-
 ...arget_update_strided_partial_messages_to.c |  26 
 ...pdate.c => strided_multiple_update_from.c} |   0
 .../offloading/strided_multiple_update_to.c   | 122 ++
 ...update.c => strided_partial_update_from.c} |   0
 .../offloading/strided_partial_update_to.c|  72 +++
 ...strided_update.c => strided_update_from.c} |   0
 offload/test/offloading/strided_update_to.c   |  72 +++
 12 files changed, 360 insertions(+), 40 deletions(-)
 rename clang/test/OpenMP/{target_update_strided_messages.c => 
target_update_strided_messages_from.c} (92%)
 create mode 100644 clang/test/OpenMP/target_update_strided_messages_to.c
 rename clang/test/OpenMP/{target_update_strided_multiple_messages.c => 
target_update_strided_multiple_messages_from.c} (60%)
 create mode 100644 
clang/test/OpenMP/target_update_strided_multiple_messages_to.c
 rename clang/test/OpenMP/{target_update_strided_partial_messages.c => 
target_update_strided_partial_messages_from.c} (59%)
 create mode 100644 
clang/test/OpenMP/target_update_strided_partial_messages_to.c
 rename offload/test/offloading/{strided_multiple_update.c => 
strided_multiple_update_from.c} (100%)
 create mode 100644 offload/test/offloading/strided_multiple_update_to.c
 rename offload/test/offloading/{strided_partial_update.c => 
strided_partial_update_from.c} (100%)
 create mode 100644 offload/test/offloading/strided_partial_update_to.c
 rename offload/test/offloading/{strided_update.c => strided_update_from.c} 
(100%)
 create mode 100644 offload/test/offloading/strided_update_to.c

diff --git a/clang/test/OpenMP/target_update_strided_messages.c 
b/clang/test/OpenMP/target_update_strided_messages_from.c
similarity index 92%
rename from clang/test/OpenMP/target_update_strided_messages.c
rename to clang/test/OpenMP/target_update_strided_messages_from.c
index 1f50af4e52805..2f411abeddc7b 100644
--- a/clang/test/OpenMP/target_update_strided_messages.c
+++ b/clang/test/OpenMP/target_update_strided_messages_from.c
@@ -1,8 +1,6 @@
 // RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s -Wuninitialized
 // RUN: %clang_cc1 -verify -fopenmp-simd -ferror-limit 100 %s -Wuninitialized
 
-void foo(void) {}
-
 int main(int argc, char **argv) {
   int len = 8;
   double data[len];
@@ -11,9 +9,6 @@ int main(int argc, char **argv) {
   #pragma omp target update from(data[0:4:2]) // OK
   {}
   
-  #pragma omp target update to(data[0:len/2:2]) // OK
-  {}
-  
   #pragma omp target update from(data[1:3:2]) // OK
   {}
   
@@ -35,4 +30,5 @@ int main(int argc, char **argv) {
   {}
   
   return 0;
-}
\ No newline at end of file
+}
+
diff --git a/clang/test/OpenMP/target_update_strided_messages_to.c 
b/clang/test/OpenMP/target_update_strided_messages_to.c
new file mode 100644
index 0..2e2f0f8bb070e
--- /dev/null
+++ b/clang/test/OpenMP/target_update_strided_messages_to.c
@@ -0,0 +1,34 @@
+// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s -Wuninitialized
+// RUN: %clang_cc1 -verify -fopenmp-simd -ferror-limit 100 %s -Wuninitialized
+
+int main(int argc, char **argv) {
+  int len = 8;
+  double data[len];
+
+  // Valid strided array sections
+  #pragma omp target update to(data[0:4:2]) // OK
+  {}
+
+  #pragma omp target update to(data[1:3:2]) // OK
+  {}
+
+  // Missing stride (default = 1)
+  #pragma omp target update to(data[0:4]) // OK
+  {}
+
+  // Invalid stride expressions
+  #pragma omp target update to(data[0:4:0]) // expected-error {{section stride 
is evaluated to a non-positive value 0}} expected-error {{expected at least one 
'to' clause or 'from' clause specified to '#pragma omp target update'}}
+
+  #pragma omp target update to(data[0:4:-1]) // expected-error {{section 
stride is evaluated to a non-positive value -1}} expected-error {{expected at 
least one 'to' clause or 'from' clause specified to '#pragma omp target 
update'}}
+
+  // Missing colon 
+  #pragma omp target update to(data[0:4 2]) // expected-error {{expected ']'}} 
expected-note {{to match this '['}} expected-error {{expected at least one 'to' 
clause or 'from' clause specified to '#pragma omp target update'}}
+  {}
+
+  // Too many colons
+  #pragma omp target update to(data[0:4:2:1]) // expected-error {{expected 
']'}} expected-note {{to match this '['}} expected-error {{expected at least 
one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
+  {}
+
+  return 0;
+}
+
diff --git a/clang/test/OpenMP/ta

[clang] [llvm] [Offload][Tests] Non-contiguous_update_to_tests (PR #169623)

2025-12-01 Thread Amit Tiwari via cfe-commits

https://github.com/amitamd7 converted_to_draft 
https://github.com/llvm/llvm-project/pull/169623
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [Offload][Tests] Non-contiguous_update_to_tests (PR #169623)

2025-12-01 Thread Amit Tiwari via cfe-commits

https://github.com/amitamd7 updated 
https://github.com/llvm/llvm-project/pull/169623

>From d7408664bd5dcb1baf40f875a50f71dcf9cc993b Mon Sep 17 00:00:00 2001
From: amtiwari 
Date: Wed, 26 Nov 2025 03:58:44 -0500
Subject: [PATCH] non-contiguous_update_to_tests

---
 ... => target_update_strided_messages_from.c} |   7 +-
 .../target_update_strided_messages_to.c   |  33 +
 ...t_update_strided_multiple_messages_from.c} |  25 +---
 ...rget_update_strided_multiple_messages_to.c |  25 
 ...et_update_strided_partial_messages_from.c} |  13 +-
 ...arget_update_strided_partial_messages_to.c |  25 
 ...pdate.c => strided_multiple_update_from.c} |   0
 .../offloading/strided_multiple_update_to.c   | 122 ++
 ...update.c => strided_partial_update_from.c} |   0
 .../offloading/strided_partial_update_to.c|  72 +++
 ...strided_update.c => strided_update_from.c} |   0
 offload/test/offloading/strided_update_to.c   |  72 +++
 12 files changed, 354 insertions(+), 40 deletions(-)
 rename clang/test/OpenMP/{target_update_strided_messages.c => 
target_update_strided_messages_from.c} (92%)
 create mode 100644 clang/test/OpenMP/target_update_strided_messages_to.c
 rename clang/test/OpenMP/{target_update_strided_multiple_messages.c => 
target_update_strided_multiple_messages_from.c} (60%)
 create mode 100644 
clang/test/OpenMP/target_update_strided_multiple_messages_to.c
 rename clang/test/OpenMP/{target_update_strided_partial_messages.c => 
target_update_strided_partial_messages_from.c} (59%)
 create mode 100644 
clang/test/OpenMP/target_update_strided_partial_messages_to.c
 rename offload/test/offloading/{strided_multiple_update.c => 
strided_multiple_update_from.c} (100%)
 create mode 100644 offload/test/offloading/strided_multiple_update_to.c
 rename offload/test/offloading/{strided_partial_update.c => 
strided_partial_update_from.c} (100%)
 create mode 100644 offload/test/offloading/strided_partial_update_to.c
 rename offload/test/offloading/{strided_update.c => strided_update_from.c} 
(100%)
 create mode 100644 offload/test/offloading/strided_update_to.c

diff --git a/clang/test/OpenMP/target_update_strided_messages.c 
b/clang/test/OpenMP/target_update_strided_messages_from.c
similarity index 92%
rename from clang/test/OpenMP/target_update_strided_messages.c
rename to clang/test/OpenMP/target_update_strided_messages_from.c
index 1f50af4e52805..eea873849e000 100644
--- a/clang/test/OpenMP/target_update_strided_messages.c
+++ b/clang/test/OpenMP/target_update_strided_messages_from.c
@@ -1,8 +1,6 @@
 // RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s -Wuninitialized
 // RUN: %clang_cc1 -verify -fopenmp-simd -ferror-limit 100 %s -Wuninitialized
 
-void foo(void) {}
-
 int main(int argc, char **argv) {
   int len = 8;
   double data[len];
@@ -11,9 +9,6 @@ int main(int argc, char **argv) {
   #pragma omp target update from(data[0:4:2]) // OK
   {}
   
-  #pragma omp target update to(data[0:len/2:2]) // OK
-  {}
-  
   #pragma omp target update from(data[1:3:2]) // OK
   {}
   
@@ -35,4 +30,4 @@ int main(int argc, char **argv) {
   {}
   
   return 0;
-}
\ No newline at end of file
+}
diff --git a/clang/test/OpenMP/target_update_strided_messages_to.c 
b/clang/test/OpenMP/target_update_strided_messages_to.c
new file mode 100644
index 0..4044c94d499f9
--- /dev/null
+++ b/clang/test/OpenMP/target_update_strided_messages_to.c
@@ -0,0 +1,33 @@
+// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s -Wuninitialized
+// RUN: %clang_cc1 -verify -fopenmp-simd -ferror-limit 100 %s -Wuninitialized
+
+int main(int argc, char **argv) {
+  int len = 8;
+  double data[len];
+
+  // Valid strided array sections
+  #pragma omp target update to(data[0:4:2]) // OK
+  {}
+
+  #pragma omp target update to(data[1:3:2]) // OK
+  {}
+
+  // Missing stride (default = 1)
+  #pragma omp target update to(data[0:4]) // OK
+  {}
+
+  // Invalid stride expressions
+  #pragma omp target update to(data[0:4:0]) // expected-error {{section stride 
is evaluated to a non-positive value 0}} expected-error {{expected at least one 
'to' clause or 'from' clause specified to '#pragma omp target update'}}
+
+  #pragma omp target update to(data[0:4:-1]) // expected-error {{section 
stride is evaluated to a non-positive value -1}} expected-error {{expected at 
least one 'to' clause or 'from' clause specified to '#pragma omp target 
update'}}
+
+  // Missing colon 
+  #pragma omp target update to(data[0:4 2]) // expected-error {{expected ']'}} 
expected-note {{to match this '['}} expected-error {{expected at least one 'to' 
clause or 'from' clause specified to '#pragma omp target update'}}
+  {}
+
+  // Too many colons
+  #pragma omp target update to(data[0:4:2:1]) // expected-error {{expected 
']'}} expected-note {{to match this '['}} expected-error {{expected at least 
one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
+  {}
+
+  return 0;
+}
diff --git a/clang/test/OpenMP/target

[clang] [llvm] [Offload][Tests] Non-contiguous_update_to_tests (PR #169623)

2025-12-01 Thread Shilei Tian via cfe-commits


@@ -0,0 +1,25 @@
+// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s -Wuninitialized
+// RUN: %clang_cc1 -verify -fopenmp-simd -ferror-limit 100 %s -Wuninitialized
+// expected-no-diagnostics
+
+int main(int argc, char **argv) {
+  int len = 11;
+  double data[len];
+
+  // Valid partial strided updates
+  #pragma omp target update to(data[0:4:3]) // OK
+  {}
+
+  // Stride larger than length
+  #pragma omp target update to(data[0:2:10]) // OK
+  {}
+
+  // Valid: complex expressions
+  int offset = 1;
+
+  // Potentially invalid stride expressions depending on runtime values
+  #pragma omp target update to(data[0:4:offset-1]) // OK if offset > 1
+  {}
+
+  return 0;
+}

shiltian wrote:

all new files

https://github.com/llvm/llvm-project/pull/169623
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [Offload][Tests] Non-contiguous_update_to_tests (PR #169623)

2025-12-01 Thread Shilei Tian via cfe-commits


@@ -17,16 +16,10 @@ int main(int argc, char **argv) {
   
   // Valid: complex expressions
   int offset = 1;
-  int count = 3;
-  int stride = 2;
-  #pragma omp target update from(data[offset:count:stride]) // OK
-  {}
-  
+
   // Invalid stride expressions
   #pragma omp target update from(data[0:4:offset-1]) // OK if offset > 1
   {}
   
-  #pragma omp target update from(data[0:count:0]) // expected-error {{section 
stride is evaluated to a non-positive value 0}} expected-error {{expected at 
least one 'to' clause or 'from' clause specified to '#pragma omp target 
update'}}
-  
   return 0;
 }

shiltian wrote:

same here

https://github.com/llvm/llvm-project/pull/169623
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [Offload][Tests] Non-contiguous_update_to_tests (PR #169623)

2025-12-01 Thread Shilei Tian via cfe-commits


@@ -0,0 +1,25 @@
+// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s -Wuninitialized
+// RUN: %clang_cc1 -verify -fopenmp-simd -ferror-limit 100 %s -Wuninitialized
+
+int main(int argc, char **argv) {
+  int len = 12;
+  double data1[len], data2[len];
+
+  // Valid multiple strided array sections
+  #pragma omp target update to(data1[0:4:2], data2[0:2:5]) // OK
+  {}
+
+  // Mixed strided and regular array sections
+  #pragma omp target update to(data1[0:len], data2[0:4:2]) // OK
+  {}
+
+  // Invalid stride in one of multiple sections
+  #pragma omp target update to(data1[0:3:4], data2[0:2:0]) // expected-error 
{{section stride is evaluated to a non-positive value 0}}
+  {}
+
+  // Missing colon 
+  #pragma omp target update to(data1[0:4:2], data2[0:3 4]) // expected-error 
{{expected ']'}} expected-note {{to match this '['}}
+  {}
+
+  return 0;
+}

shiltian wrote:

here as well

https://github.com/llvm/llvm-project/pull/169623
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [Offload][Tests] Non-contiguous_update_to_tests (PR #169623)

2025-12-01 Thread Shilei Tian via cfe-commits


@@ -0,0 +1,33 @@
+// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s -Wuninitialized
+// RUN: %clang_cc1 -verify -fopenmp-simd -ferror-limit 100 %s -Wuninitialized
+
+int main(int argc, char **argv) {
+  int len = 8;
+  double data[len];
+
+  // Valid strided array sections
+  #pragma omp target update to(data[0:4:2]) // OK
+  {}
+
+  #pragma omp target update to(data[1:3:2]) // OK
+  {}
+
+  // Missing stride (default = 1)
+  #pragma omp target update to(data[0:4]) // OK
+  {}
+
+  // Invalid stride expressions
+  #pragma omp target update to(data[0:4:0]) // expected-error {{section stride 
is evaluated to a non-positive value 0}} expected-error {{expected at least one 
'to' clause or 'from' clause specified to '#pragma omp target update'}}
+
+  #pragma omp target update to(data[0:4:-1]) // expected-error {{section 
stride is evaluated to a non-positive value -1}} expected-error {{expected at 
least one 'to' clause or 'from' clause specified to '#pragma omp target 
update'}}
+
+  // Missing colon 
+  #pragma omp target update to(data[0:4 2]) // expected-error {{expected ']'}} 
expected-note {{to match this '['}} expected-error {{expected at least one 'to' 
clause or 'from' clause specified to '#pragma omp target update'}}
+  {}
+
+  // Too many colons
+  #pragma omp target update to(data[0:4:2:1]) // expected-error {{expected 
']'}} expected-note {{to match this '['}} expected-error {{expected at least 
one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
+  {}
+
+  return 0;
+}

shiltian wrote:

missing an empty file at EoF

https://github.com/llvm/llvm-project/pull/169623
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [Offload][Tests] Non-contiguous_update_to_tests (PR #169623)

2025-12-01 Thread Amit Tiwari via cfe-commits

https://github.com/amitamd7 ready_for_review 
https://github.com/llvm/llvm-project/pull/169623
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [Offload][Tests] Non-contiguous_update_to_tests (PR #169623)

2025-12-01 Thread Amit Tiwari via cfe-commits

https://github.com/amitamd7 updated 
https://github.com/llvm/llvm-project/pull/169623

>From e38e0feaf7bb13e6147eca002cd616499253c595 Mon Sep 17 00:00:00 2001
From: amtiwari 
Date: Wed, 26 Nov 2025 03:58:44 -0500
Subject: [PATCH] non-contiguous_update_to_tests

---
 ... => target_update_strided_messages_from.c} |   5 -
 .../target_update_strided_messages_to.c   |  33 +
 ...t_update_strided_multiple_messages_from.c} |  23 
 ...rget_update_strided_multiple_messages_to.c |  25 
 ...et_update_strided_partial_messages_from.c} |  11 +-
 ...arget_update_strided_partial_messages_to.c |  25 
 ...pdate.c => strided_multiple_update_from.c} |   0
 .../offloading/strided_multiple_update_to.c   | 122 ++
 ...update.c => strided_partial_update_from.c} |   0
 .../offloading/strided_partial_update_to.c|  72 +++
 ...strided_update.c => strided_update_from.c} |   0
 offload/test/offloading/strided_update_to.c   |  72 +++
 12 files changed, 351 insertions(+), 37 deletions(-)
 rename clang/test/OpenMP/{target_update_strided_messages.c => 
target_update_strided_messages_from.c} (92%)
 create mode 100644 clang/test/OpenMP/target_update_strided_messages_to.c
 rename clang/test/OpenMP/{target_update_strided_multiple_messages.c => 
target_update_strided_multiple_messages_from.c} (60%)
 create mode 100644 
clang/test/OpenMP/target_update_strided_multiple_messages_to.c
 rename clang/test/OpenMP/{target_update_strided_partial_messages.c => 
target_update_strided_partial_messages_from.c} (59%)
 create mode 100644 
clang/test/OpenMP/target_update_strided_partial_messages_to.c
 rename offload/test/offloading/{strided_multiple_update.c => 
strided_multiple_update_from.c} (100%)
 create mode 100644 offload/test/offloading/strided_multiple_update_to.c
 rename offload/test/offloading/{strided_partial_update.c => 
strided_partial_update_from.c} (100%)
 create mode 100644 offload/test/offloading/strided_partial_update_to.c
 rename offload/test/offloading/{strided_update.c => strided_update_from.c} 
(100%)
 create mode 100644 offload/test/offloading/strided_update_to.c

diff --git a/clang/test/OpenMP/target_update_strided_messages.c 
b/clang/test/OpenMP/target_update_strided_messages_from.c
similarity index 92%
rename from clang/test/OpenMP/target_update_strided_messages.c
rename to clang/test/OpenMP/target_update_strided_messages_from.c
index 1f50af4e52805..7696505cc58f1 100644
--- a/clang/test/OpenMP/target_update_strided_messages.c
+++ b/clang/test/OpenMP/target_update_strided_messages_from.c
@@ -1,8 +1,6 @@
 // RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s -Wuninitialized
 // RUN: %clang_cc1 -verify -fopenmp-simd -ferror-limit 100 %s -Wuninitialized
 
-void foo(void) {}
-
 int main(int argc, char **argv) {
   int len = 8;
   double data[len];
@@ -11,9 +9,6 @@ int main(int argc, char **argv) {
   #pragma omp target update from(data[0:4:2]) // OK
   {}
   
-  #pragma omp target update to(data[0:len/2:2]) // OK
-  {}
-  
   #pragma omp target update from(data[1:3:2]) // OK
   {}
   
diff --git a/clang/test/OpenMP/target_update_strided_messages_to.c 
b/clang/test/OpenMP/target_update_strided_messages_to.c
new file mode 100644
index 0..e765c6344d1b5
--- /dev/null
+++ b/clang/test/OpenMP/target_update_strided_messages_to.c
@@ -0,0 +1,33 @@
+// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s -Wuninitialized
+// RUN: %clang_cc1 -verify -fopenmp-simd -ferror-limit 100 %s -Wuninitialized
+
+int main(int argc, char **argv) {
+  int len = 8;
+  double data[len];
+
+  // Valid strided array sections
+  #pragma omp target update to(data[0:4:2]) // OK
+  {}
+
+  #pragma omp target update to(data[1:3:2]) // OK
+  {}
+
+  // Missing stride (default = 1)
+  #pragma omp target update to(data[0:4]) // OK
+  {}
+
+  // Invalid stride expressions
+  #pragma omp target update to(data[0:4:0]) // expected-error {{section stride 
is evaluated to a non-positive value 0}} expected-error {{expected at least one 
'to' clause or 'from' clause specified to '#pragma omp target update'}}
+
+  #pragma omp target update to(data[0:4:-1]) // expected-error {{section 
stride is evaluated to a non-positive value -1}} expected-error {{expected at 
least one 'to' clause or 'from' clause specified to '#pragma omp target 
update'}}
+
+  // Missing colon 
+  #pragma omp target update to(data[0:4 2]) // expected-error {{expected ']'}} 
expected-note {{to match this '['}} expected-error {{expected at least one 'to' 
clause or 'from' clause specified to '#pragma omp target update'}}
+  {}
+
+  // Too many colons
+  #pragma omp target update to(data[0:4:2:1]) // expected-error {{expected 
']'}} expected-note {{to match this '['}} expected-error {{expected at least 
one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
+  {}
+
+  return 0;
+}
\ No newline at end of file
diff --git a/clang/test/OpenMP/target_update_strided_multiple_messages.c 
b/clang/test/OpenMP/target_update_strided_mul