8000 [SYCL] [FPGA] Disable swapping dimension values of WorkGroupAttr arguments for semantic checks by smanna12 · Pull Request #2962 · intel/llvm · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[SYCL] [FPGA] Disable swapping dimension values of WorkGroupAttr arguments for semantic checks #2962

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 2 commits into from
Dec 29, 2020

Conversation

smanna12
Copy link
Contributor
@smanna12 smanna12 commented Dec 28, 2020

This is a followup comments on #2906 (comment)
and #2906 (comment).

Currently for a SYCLDevice, first and third argument of WorkGroupAttr
are reversed in doing semantic checks as wells as code generation.

There are few problems with this approach (swapping order in AST):

  1. A user who writes the order as X, Y, Z in their source will get Z, Y, X when
    they pretty print the AST.
  2. The same will happen when dumping the AST to text or JSON or
    generating diagnostic messages since the fist and third arguments of
    WorkGroupAttr are reversed.
  3. This is very confusing for user to see different order than the original
    source codes for Semantic checks.

max_work_group_size() follows same rules as reqd_work_group_size() in Sema and LLVM IR generation.

This patch keeps the arguments in the same order as they were parsed in doing semantic checks,
and when performing code generation, we would change the argument order when lowering to
LLVM IR and not when creating the semantic attribute.

Signed-off-by: Soumi Manna soumi.manna@intel.com

…or semantic checks

This is a followup comments on intel#2906 (comment)
and intel#2906 (comment).

Currently
For a SYCLDevice WorkGroupAttr arguments are reversed.
  if (S.getLangOpts().SYCLIsDevice)
    std::swap(XDimExpr, ZDimExpr);

There are few problems with this approach (swapping order in AST):
1. A user who writes the order as X, Y, Z in their source will get Z, Y, X when
   they pretty print the AST.
2. The same will happen when dumping the AST to text or JSON or
   generating diagnostic messages since the fist and third arguments of
   WorkGroupAttr are reversed.
3. This is very confusing to see the different order than the oroginal
   source codes.

max_work_group_size() follows same rules as reqd_work_group_size() in Sema and LLVM IR generation.

This patch keeps the arguments in the same order as they were parsed in doing semantic checks,
and when performing code generation, we would change the argument order when lowering to
LLVM IR and not when creating the semantic attribute.

Signed-off-by: Soumi Manna <soumi.manna@intel.com>
@smanna12 smanna12 changed the title [SYCL] Disable swapping dimension values of WorkGroupAttr arguments f… [SYCL] Disable swapping dimension values of WorkGroupAttr arguments for semantic checks Dec 28, 2020
@smanna12 smanna12 marked this pull request as ready for review December 28, 2020 17:35
@smanna12 smanna12 changed the title [SYCL] Disable swapping dimension values of WorkGroupAttr arguments for semantic checks [SYCL] [FPGA]Disable swapping dimension values of WorkGroupAttr arguments for semantic checks Dec 29, 2020
@smanna12 smanna12 changed the title [SYCL] [FPGA]Disable swapping dimension values of WorkGroupAttr arguments for semantic checks [SYCL] [FPGA] Disable swapping dimension values of WorkGroupAttr arguments for semantic checks Dec 29, 2020
@smanna12
Copy link
Contributor Author

could you please review @Fznamznon? Thanks

Fznamznon
Fznamznon previously approved these changes Dec 29, 2020
Copy link
Contributor
@Fznamznon Fznamznon left a comment

Choose a reason for hiding this comment

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

It would be great to hear from @AaronBallman here as well, but for me it looks fine.

@smanna12
Copy link
Contributor Author

It would be great to hear from @AaronBallman here as well, but for me it looks fine.

Thanks Mariya.

AaronBallman
AaronBallman previously approved these changes Dec 29, 2020
Copy link
Contributor
@AaronBallman AaronBallman left a comment

Choose a reason for hiding this comment

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

LGTM aside from a very minor nit that can be fixed in one of the tests.

@@ -94,13 +94,13 @@ int main() {
h.single_task<class test_kernel5>(TRIFuncObjGood2());
// CHECK-LABEL: FunctionDecl {{.*}}test_kernel5
// CHECK: ReqdWorkGroupSizeAttr {{.*}}
// // CHECK-NEXT: IntegerLiteral{{.*}}1{{$}}
// // CHECK-NEXT: IntegerLiteral{{.*}}4{{$}}
Copy link
Contributor

Choose a reason for hiding this comment

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

You can remove the duplicate // comment token. Same below.

Copy link
Contributor Author
@smanna12 smanna12 Dec 29, 2020

Choose a reason for hiding this comment

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

Done. Sorry for the duplicate comments. Thanks @AaronBallman.

Signed-off-by: Soumi Manna <soumi.manna@intel.com>
@smanna12
Copy link
Contributor Author

Thank you everyone for the reviews.

@romanovvlad romanovvlad merged commit 7ef84b6 into intel:sycl Dec 29, 2020
smanna12 added a commit to smanna12/llvm that referenced this pull request Feb 1, 2021
…work_group_size attributes

This patch
  1. fixes typo
  2. removes redundant comments (we have disabled swapping dimension values of WorkGroupAttr
     arguments for semantic checks on  intel#2962)
  3. Hoist the logic from the second if into the above if (AttrValue == 0)

Signed-off-by: Soumi Manna <soumi.manna@intel.com>
bader pushed a commit that referenced this pull request Feb 2, 2021
…tributes (#3128)

This patch
  1. fixes typo
  2. removes redundant comments (we have disabled swapping dimension values of WorkGroupAttr
     arguments for semantic checks on  #2962)
  3. Hoist the logic from the second if into the above if (AttrValue == 0)

Signed-off-by: Soumi Manna <soumi.manna@intel.com>
jsji pushed a commit that referenced this pull request Jan 26, 2025
Update for llvm-project commit abba01a ("[ADT] Deprecate
PointerUnion::{is,get} (NFC) (#122623)", 2025-01-13).

Original commit:
KhronosGroup/SPIRV-LLVM-Translator@c8e8867efd44034
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.

6 participants
0