-
Notifications
You must be signed in to change notification settings - Fork 12.2k
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
[clang] Add support for new loop attribute [[clang::code_align()]] #70762
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please be sure to add a reasonable description to the patch summary so that reviewers know more about what's going on, but thank you for already having written docs (that helps give context).
The changes should come with a release note as well.
✅ With the latest revision this PR passed the C/C++ code formatter. |
Thank you @erichkeane and @AaronBallman for reviews and feedbacks.
I have added description to the patch summary.
I have added release note. |
… Loops. This patch added backend consumption on a new loop metadata: !1 = !{!"llvm.loop.align", i32 64} which is generated from clang's new loop attribute: [[clang::code_align()]] clang patch: llvm#70762
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the link to the LLVM side of things, that helps!
@AaronBallman, @erichkeane I have addressed comments in the PR, could you please revisit this PR? Thank you! |
Thank you @erichkeane for reviews! |
This patch disables parts of clang/test/Sema/code_align.c that need __int128_t to be defined. This will fix failures on Arm v7 buildbots due to #70762 Following bots are failing: https://lab.llvm.org/buildbot/#/builders/245 https://lab.llvm.org/buildbot/#/builders/178 https://lab.llvm.org/buildbot/#/builders/182 https://lab.llvm.org/buildbot/#/builders/186 https://lab.llvm.org/buildbot/#/builders/187
Lit test generates different outputs for usage of __int128_t in clang-armv8-quick environment. This patch adds triple to fix the lit failure. ``` Step 5 (ninja check 1) failure: 1 unexpected failures 38623 expected passes 71 expected failures 36752 unsupported tests (failure) ******************** TEST 'Clang :: Sema/code_align.c' FAILED ******************** Exit Code: 1 Command Output (stderr): -- RUN: at line 1: /home/tcwg-buildbot/worker/clang-armv8-quick/stage1/bin/clang -cc1 -internal-isystem /home/tcwg-buildbot/worker/clang-armv8-quick/stage1/lib/clang/18/include -nostdsysteminc -fsyntax-only -verify=expected,c-local -x c /home/tcwg-buildbot/worker/clang-armv8-quick/llvm/clang/test/Sema/code_align.c + /home/tcwg-buildbot/worker/clang-armv8-quick/stage1/bin/clang -cc1 + -internal-isystem + /home/tcwg-buildbot/worker/clang-armv8-quick/stage1/lib/clang/18/inclu + de -nostdsysteminc -fsyntax-only -verify=expected,c-local -x c + /home/tcwg-buildbot/worker/clang-armv8-quick/llvm/clang/test/Sema/code + _align.c error: 'c-local-error' diagnostics expected but not seen: File /home/tcwg-buildbot/worker/clang-armv8-quick/llvm/clang/test/Sema/code_align.c Line 79 (directive at /home/tcwg-buildbot/worker/clang-armv8-quick/llvm/clang/test/Sema/code_align.c:78): 'code_align' attribute requires an integer argument which is a constant power of two between 1 and 4096 inclusive; provided argument was (__int128_t)1311768467294899680ULL << 64 File /home/tcwg-buildbot/worker/clang-armv8-quick/llvm/clang/test/Sema/code_align.c Line 89 (directive at /home/tcwg-buildbot/worker/clang-armv8-quick/llvm/clang/test/Sema/code_align.c:88): 'code_align' attribute requires an integer argument which is a constant power of two between 1 and 4096 inclusive; provided argument was -(__int128_t)1311768467294899680ULL << 64 error: 'c-local-error' diagnostics seen but not expected: File /home/tcwg-buildbot/worker/clang-armv8-quick/llvm/clang/test/Sema/code_align.c Line 79: use of undeclared identifier '__int128_t' File /home/tcwg-buildbot/worker/clang-armv8-quick/llvm/clang/test/Sema/code_align.c Line 89: use of undeclared identifier '__int128_t' 4 errors generated. ```
…e way we handle conflicting vs duplicate values This patch diagnose non-identical duplicates as a 'conflicting' loop attributes and suppress duplicate errors in cases where the two match for FPGA SYCL attributes: 'SYCLIntelMaxInterleavingAttr', 'SYCLIntelSpeculatedIterationsAttr', and 'SYCLIntelMaxReinvocationDelayAttr' to align with clang community change (Ref: llvm/llvm-project#70762). Signed-off-by: Soumi Manna <soumi.manna@intel.com>
…e way we handle conflicting vs duplicate values (#12243) This patch diagnose non-identical duplicates as a 'conflicting' loop attributes and suppress duplicate errors in cases where the two match for FPGA SYCL attributes: 'SYCLIntelMaxInterleavingAttr', 'SYCLIntelSpeculatedIterationsAttr', and 'SYCLIntelMaxReinvocationDelayAttr' to align with clang community change (Ref: llvm/llvm-project#70762). --------- Signed-off-by: Soumi Manna <soumi.manna@intel.com>
(came here from #80765) |
…e way we handle conflicting vs duplicate values This patch updates ExprArgument<> to use same routine CheckForDuplicateAttrs() that was added on intel#12243 to diagnose non-identical duplicates as a 'conflicting' loop attributes and suppresse duplicate errors in cases where the two match for FPGA SYCL attributes: [[intel::max_concurrency()]] and [[intel::initiation_interval()]] to align with clang community change (Ref: llvm/llvm-project#70762). Signed-off-by: Soumi Manna <soumi.manna@intel.com>
…e way we handle conflicting vs duplicate values (#13146) This patch updates ExprArgument<> to use same routine CheckForDuplicateAttrs() that was added on #12243 to diagnose non-identical duplicates as a 'conflicting' loop attributes and suppresse duplicate errors in cases where the two match for FPGA SYCL attributes: [[intel::max_concurrency()]] and [[intel::initiation_interval()]] to align with clang community change (Ref: llvm/llvm-project#70762). --------- Signed-off-by: Soumi Manna <soumi.manna@intel.com>
…h loop attribute 'code_align' llvm#70762 added support for new loop attribute [[clang::code_align()]]. This patch fixes bug for the test case below that misses diagnostic due to discontinue to loop while checking duplicate vs conflicting code_align attribute values. [[clang::code_align(4)]] [[clang::code_align(4)]] [[clang::code_align(8)]] for(int I=0; I<128; ++I) { bar(I); }
…th loop attribute 'code_align' (#87372) #70762 added support for new loop attribute [[clang::code_align()]]. This patch fixes bugs for the test cases below that misses diagnostics due to discontinue to while loop during checking duplicate vs conflicting code_align attribute values in routine CheckForDuplicateLoopAttrs(). [[clang::code_align(4)]] [[clang::code_align(4)]] [[clang::code_align(8)]] for(int I=0; I<128; ++I) { bar(I); } [[clang::code_align(4)]] [[clang::code_align(4)]] [[clang::code_align(8)]] [[clang::code_align(32)]] for(int I=0; I<128; ++I) { bar(I); }
This patch adds support for new loop attribute: [[clang::code_align(N)]].
This attribute applies to a loop and specifies the byte alignment for a loop.
The attribute accepts a positive integer constant initialization expression
indicating the number of bytes for the minimum alignment boundary.
Its value must be a power of 2, between 1 and 4096 (inclusive).