Skip to content

[SYCL-WEB][SYCL] Update function-attrs for sycl branch #11569

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
Oct 17, 2023
Merged

[SYCL-WEB][SYCL] Update function-attrs for sycl branch #11569

merged 1 commit into from
Oct 17, 2023

Conversation

jsji
Copy link
Contributor

@jsji jsji commented Oct 17, 2023

2dc6579 updated the function-attrs test using script using llorg driver.
This is update it using sycl driver.

@jsji jsji requested a review from a team as a code owner October 17, 2023 17:39
@jsji jsji self-assigned this Oct 17, 2023
//.
// CHECK: !0 = !{i32 1, !"wchar_size", i32 4}
// CHECK: !1 = !{i32 1, i32 2}
// CHECK: !2 = !{i32 4, i32 100000}
// CHECK: !3 = !{i32 {{.*}}}
Copy link
Contributor Author

@jsji jsji Oct 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These looks something need to be follow up? The value generated by script is NOT the same as running in command line. Also the number are not the real source line number?

!3 = !{i32 1302}
!4 = !{}
!5 = !{i32 747}
!6 = !{i32 1088}

Copy link
Contributor

@zahiraam zahiraam Oct 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jsji
This is passing.
diff --git a/clang/test/CodeGenSYCL/function-attrs.cpp b/clang/test/CodeGenSYCL/function-attrs.cpp
index 557b3c8bd3f7..71bd00b014a1 100644
--- a/clang/test/CodeGenSYCL/function-attrs.cpp
+++ b/clang/test/CodeGenSYCL/function-attrs.cpp
@@ -1,15 +1,14 @@
-// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --check-globals --version 3
// RUN: %clang_cc1 -fsycl-is-device -emit-llvm -disable-llvm-passes
// RUN: -triple spir64 -fexceptions -emit-llvm -fno-ident %s -o - | FileCheck %s

int foo();

-// CHECK-LABEL: define {{.}}spir_func void @_Z3barv(
-// CHECK-SAME: ) #[[ATTR0:[0-9]+]] {
+// CHECK-LABEL: define dso_local spir_func void @_Z3barv(
+// CHECK-SAME: ) #[[ATTR2:[0-9]+]] !srcloc !5 {
// CHECK-NEXT: entry:
// CHECK-NEXT: [[A:%.
]] = alloca i32, align 4
// CHECK-NEXT: [[A_ASCAST:%.]] = addrspacecast ptr [[A]] to ptr addrspace(4)
-// CHECK-NEXT: [[CALL:%.
]] = call spir_func noundef i32 @_Z3foov() #[[ATTR1:[0-9]+]]
+// CHECK-NEXT: [[CALL:%.*]] = call spir_func noundef i32 @_Z3foov() #[[ATTR3:[0-9]+]]
// CHECK-NEXT: store i32 [[CALL]], ptr addrspace(4) [[A_ASCAST]], align 4
// CHECK-NEXT: ret void
//
@@ -17,8 +16,8 @@ void bar() {
int a = foo();
}

-// CHECK-LABEL: define {{.}}spir_func noundef i32 @_Z3foov(
-// CHECK-SAME: ) #[[ATTR0]] {
+// CHECK-LABEL: define dso_local spir_func noundef i32 @_Z3foov(
+// CHECK-SAME: ) #[[ATTR2]] !srcloc !6 {
// CHECK-NEXT: entry:
// CHECK-NEXT: [[RETVAL:%.
]] = alloca i32, align 4
// CHECK-NEXT: [[RETVAL_ASCAST:%.*]] = addrspacecast ptr [[RETVAL]] to ptr addrspace(4)
@@ -33,24 +32,12 @@ attribute((sycl_kernel)) void kernel_single_task(const Func &kernelFunc) {
kernelFunc();
}

-// CHECK-LABEL: define dso_local noundef i32 @main(
-// CHECK-SAME: ) #[[ATTR0]] {
-// CHECK-NEXT: entry:
-// CHECK-NEXT: [[RETVAL:%.]] = alloca i32, align 4
-// CHECK-NEXT: [[REF_TMP:%.
]] = alloca [[CLASS_ANON:%.]], align 1
-// CHECK-NEXT: [[RETVAL_ASCAST:%.
]] = addrspacecast ptr [[RETVAL]] to ptr addrspace(4)
-// CHECK-NEXT: [[REF_TMP_ASCAST:%.*]] = addrspacecast ptr [[REF_TMP]] to ptr addrspace(4)
-// CHECK-NEXT: store i32 0, ptr addrspace(4) [[RETVAL_ASCAST]], align 4
-// CHECK-NEXT: call spir_func void @Z18kernel_single_taskIZ4mainE11fake_kernelZ4mainEUlvE_EvRKT0(ptr addrspace(4) noundef align 1 dereferenceable(1) [[REF_TMP_ASCAST]]) #[[ATTR1]]
-// CHECK-NEXT: ret i32 0
-//
int main() {
kernel_single_task([] { bar(); });
return 0;
}
//.
-// CHECK: attributes #0 = { convergent mustprogress noinline norecurse nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" }
-// CHECK: attributes #1 = { convergent nounwind }
-//.
-// CHECK: !0 = !{i32 1, !"wchar_size", i32 4}
-//.
+// CHECK: attributes #0 = { convergent mustprogress noinline norecurse nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "sycl-module-id"="clang/test/CodeGenSYCL/function-attrs.cpp" "uniform-work-group-size"="true" }
+// CHECK: attributes #1 = { alwaysinline convergent mustprogress norecurse nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" }
+// CHECK: attributes #2 = { convergent mustprogress noinline norecurse nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" }
+// CHECK: attributes #3 = { convergent nounwind }

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jsji This is passing. diff --git a/clang/test/CodeGenSYCL/function-attrs.cpp b/clang/test/CodeGenSYCL/function-

Thanks. Yes, I know removing the CHECKs will let it pass. But I think the line number are wrong to me? So we should follow up to fix the line numbers for debugging purpose.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about with these at the end:
/.
// CHECK: !0 = !{i32 1, !"wchar_size", i32 4}
// CHECK: !1 = !{i32 1, i32 2}
// CHECK: !2 = !{i32 4, i32 100000}
// CHECK: !3 = !{i32 1180}
// CHECK: !4 = !{}
// CHECK: !5 = !{i32 628}
// CHECK: !6 = !{i32 966}
//.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jsji I see the issue now. I think that the source location shouldn't change from machine to machine. How about if you push this but you open another jira to track the source location issue?
Thanks.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#11573 open to track.

@jsji jsji merged commit 8e393d1 into intel:sycl-web Oct 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants