Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[OpenCL] Add test for __kernel_exec macro #138287

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 5, 2025
Merged

Conversation

svenvh
Copy link
Member

@svenvh svenvh commented May 2, 2025

The __kernel_exec macro is mandated by the OpenCL C specification and supplied by opencl-c-base.h, but it was not covered in any tests.

The `__kernel_exec` macro is mandated by the OpenCL C specification
and supplied by `opencl-c-base.h`, but it was not covered in any
tests.
@svenvh svenvh added the OpenCL label May 2, 2025
@llvmbot llvmbot added the clang Clang issues not falling into any other category label May 2, 2025
@llvmbot
Copy link
Member

llvmbot commented May 2, 2025

@llvm/pr-subscribers-clang

Author: Sven van Haastregt (svenvh)

Changes

The __kernel_exec macro is mandated by the OpenCL C specification and supplied by opencl-c-base.h, but it was not covered in any tests.


Full diff: https://github.com/llvm/llvm-project/pull/138287.diff

1 Files Affected:

  • (modified) clang/test/CodeGenOpenCL/kernel-attributes.cl (+6-1)
diff --git a/clang/test/CodeGenOpenCL/kernel-attributes.cl b/clang/test/CodeGenOpenCL/kernel-attributes.cl
index 3625138f96330..d3d033349768f 100644
--- a/clang/test/CodeGenOpenCL/kernel-attributes.cl
+++ b/clang/test/CodeGenOpenCL/kernel-attributes.cl
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -fdeclare-opencl-builtins -finclude-default-header -emit-llvm -o - %s | FileCheck %s
 
 typedef unsigned int uint4 __attribute__((ext_vector_type(4)));
 
@@ -11,8 +11,13 @@ kernel __attribute__((vec_type_hint(uint4))) __attribute__((work_group_size_hint
 kernel __attribute__((intel_reqd_sub_group_size(8))) void kernel3(int a) {}
 // CHECK: define {{(dso_local )?}}spir_kernel void @kernel3(i32 {{[^%]*}}%a) {{[^{]+}} !intel_reqd_sub_group_size ![[MD5:[0-9]+]]
 
+__kernel_exec(32, float) void kernel_from_exec(int a) {}
+// CHECK: define {{(dso_local )?}}spir_kernel void @kernel_from_exec(i32 {{[^%]*}}%a) {{[^{]+}} !vec_type_hint ![[MD6:[0-9]+]] !work_group_size_hint ![[MD7:[0-9]+]]
+
 // CHECK: [[MD1]] = !{i32 poison, i32 1}
 // CHECK: [[MD2]] = !{i32 1, i32 2, i32 4}
 // CHECK: [[MD3]] = !{<4 x i32> poison, i32 0}
 // CHECK: [[MD4]] = !{i32 8, i32 16, i32 32}
 // CHECK: [[MD5]] = !{i32 8}
+// CHECK: [[MD6]] = !{float poison, i32 0}
+// CHECK: [[MD7]] = !{i32 32, i32 1, i32 1}

@svenvh svenvh merged commit 0f6b671 into llvm:main May 5, 2025
14 checks passed
@svenvh svenvh deleted the kernel-exec-test branch May 5, 2025 07:53
@llvm-ci
Copy link
Collaborator

llvm-ci commented May 5, 2025

LLVM Buildbot has detected a new failure on builder llvm-clang-x86_64-gcc-ubuntu running on sie-linux-worker3 while building clang at step 6 "test-build-unified-tree-check-all".

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

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'AddressSanitizer-x86_64-linux-dynamic :: TestCases/asan_lsan_deadlock.cpp' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
/home/buildbot/buildbot-root/llvm-clang-x86_64-gcc-ubuntu/build/./bin/clang  --driver-mode=g++ -fsanitize=address -mno-omit-leaf-frame-pointer -fno-omit-frame-pointer -fno-optimize-sibling-calls -gline-tables-only  -m64  -shared-libasan -O0 /home/buildbot/buildbot-root/llvm-clang-x86_64-gcc-ubuntu/llvm-project/compiler-rt/test/asan/TestCases/asan_lsan_deadlock.cpp -o /home/buildbot/buildbot-root/llvm-clang-x86_64-gcc-ubuntu/build/runtimes/runtimes-bins/compiler-rt/test/asan/X86_64LinuxDynamicConfig/TestCases/Output/asan_lsan_deadlock.cpp.tmp # RUN: at line 4
+ /home/buildbot/buildbot-root/llvm-clang-x86_64-gcc-ubuntu/build/./bin/clang --driver-mode=g++ -fsanitize=address -mno-omit-leaf-frame-pointer -fno-omit-frame-pointer -fno-optimize-sibling-calls -gline-tables-only -m64 -shared-libasan -O0 /home/buildbot/buildbot-root/llvm-clang-x86_64-gcc-ubuntu/llvm-project/compiler-rt/test/asan/TestCases/asan_lsan_deadlock.cpp -o /home/buildbot/buildbot-root/llvm-clang-x86_64-gcc-ubuntu/build/runtimes/runtimes-bins/compiler-rt/test/asan/X86_64LinuxDynamicConfig/TestCases/Output/asan_lsan_deadlock.cpp.tmp
env ASAN_OPTIONS=detect_leaks=1 not  /home/buildbot/buildbot-root/llvm-clang-x86_64-gcc-ubuntu/build/runtimes/runtimes-bins/compiler-rt/test/asan/X86_64LinuxDynamicConfig/TestCases/Output/asan_lsan_deadlock.cpp.tmp 2>&1 | FileCheck /home/buildbot/buildbot-root/llvm-clang-x86_64-gcc-ubuntu/llvm-project/compiler-rt/test/asan/TestCases/asan_lsan_deadlock.cpp # RUN: at line 5
+ FileCheck /home/buildbot/buildbot-root/llvm-clang-x86_64-gcc-ubuntu/llvm-project/compiler-rt/test/asan/TestCases/asan_lsan_deadlock.cpp
+ env ASAN_OPTIONS=detect_leaks=1 not /home/buildbot/buildbot-root/llvm-clang-x86_64-gcc-ubuntu/build/runtimes/runtimes-bins/compiler-rt/test/asan/X86_64LinuxDynamicConfig/TestCases/Output/asan_lsan_deadlock.cpp.tmp
�[1m/home/buildbot/buildbot-root/llvm-clang-x86_64-gcc-ubuntu/llvm-project/compiler-rt/test/asan/TestCases/asan_lsan_deadlock.cpp:58:12: �[0m�[0;1;31merror: �[0m�[1mCHECK: expected string not found in input
�[0m // CHECK: SUMMARY: AddressSanitizer: stack-buffer-overflow
�[0;1;32m           ^
�[0m�[1m<stdin>:1:1: �[0m�[0;1;30mnote: �[0m�[1mscanning from here
�[0m=================================================================
�[0;1;32m^
�[0m�[1m<stdin>:2:10: �[0m�[0;1;30mnote: �[0m�[1mpossible intended match here
�[0m==2182668==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7b4c46dde034 at pc 0x55f3b519e220 bp 0x7b4c44ffdce0 sp 0x7b4c44ffdcd8
�[0;1;32m         ^
�[0m
Input file: <stdin>
Check file: /home/buildbot/buildbot-root/llvm-clang-x86_64-gcc-ubuntu/llvm-project/compiler-rt/test/asan/TestCases/asan_lsan_deadlock.cpp

-dump-input=help explains the following input dump.

Input was:
<<<<<<
�[1m�[0m�[0;1;30m            1: �[0m�[1m�[0;1;46m================================================================= �[0m
�[0;1;31mcheck:58'0     X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
�[0m�[0;1;30m            2: �[0m�[1m�[0;1;46m==2182668==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7b4c46dde034 at pc 0x55f3b519e220 bp 0x7b4c44ffdce0 sp 0x7b4c44ffdcd8 �[0m
�[0;1;31mcheck:58'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
�[0m�[0;1;35mcheck:58'1              ?                                                                                                                                    possible intended match
�[0m�[0;1;30m            3: �[0m�[1m�[0;1;46mWRITE of size 4 at 0x7b4c46dde034 thread T2 �[0m
�[0;1;31mcheck:58'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
�[0m>>>>>>

--

********************


IanWood1 pushed a commit to IanWood1/llvm-project that referenced this pull request May 6, 2025
The `__kernel_exec` macro is mandated by the OpenCL C specification and
supplied by `opencl-c-base.h`, but it was not covered in any tests.
IanWood1 pushed a commit to IanWood1/llvm-project that referenced this pull request May 6, 2025
The `__kernel_exec` macro is mandated by the OpenCL C specification and
supplied by `opencl-c-base.h`, but it was not covered in any tests.
IanWood1 pushed a commit to IanWood1/llvm-project that referenced this pull request May 6, 2025
The `__kernel_exec` macro is mandated by the OpenCL C specification and
supplied by `opencl-c-base.h`, but it was not covered in any tests.
GeorgeARM pushed a commit to GeorgeARM/llvm-project that referenced this pull request May 7, 2025
The `__kernel_exec` macro is mandated by the OpenCL C specification and
supplied by `opencl-c-base.h`, but it was not covered in any tests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang Clang issues not falling into any other category OpenCL
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants