Skip to content

[SYCL][FPGA] Refactor of statement attributes #4136

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 25 commits into from
Jul 25, 2021

Conversation

smanna12
Copy link
Contributor

@smanna12 smanna12 commented Jul 19, 2021

This patch

  1. refactors six statement attributes to align with upstream:

    SYCLIntelFPGALoopCountAttr
    SYCLIntelFPGAInitiationIntervalAttr
    SYCLIntelFPGAMaxConcurrencyAttr
    SYCLIntelFPGAMaxInterleavingAttr
    SYCLIntelFPGASpeculatedIterationsAttr
    SYCLIntelFPGALoopCoalesceAttr

  2. stores expression as ConstantExpr in Semantic Attributes

  3. removes generic function "BuildSYCLIntelFPGALoopAttr"

  4. updates codegen codes to use single variable for loop metadata and value.

Signed-off-by: Soumi Manna [email protected]

Signed-off-by: Soumi Manna <[email protected]>
@smanna12 smanna12 changed the title Refactor of loop attributes [WIP]Refactor of loop attributes Jul 19, 2021
smanna12 added 10 commits July 19, 2021 05:59
Signed-off-by: Soumi Manna <[email protected]>
Signed-off-by: Soumi Manna <[email protected]>
Signed-off-by: Soumi Manna <[email protected]>
Signed-off-by: Soumi Manna <[email protected]>
Signed-off-by: Soumi Manna <[email protected]>
Signed-off-by: Soumi Manna <[email protected]>
Signed-off-by: Soumi Manna <[email protected]>
Signed-off-by: Soumi Manna <[email protected]>
Signed-off-by: Soumi Manna <[email protected]>
@smanna12 smanna12 changed the title [WIP]Refactor of loop attributes [SYCL][FPGA] Refactor of statement attributes Jul 20, 2021
@smanna12 smanna12 marked this pull request as ready for review July 20, 2021 10:01
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.

Thanks for the refactoring, it looks like it's heading in a good direction! Should you also add more template instantiation test coverage for the improvements in SemaStmtAttr.cpp as well?

@smanna12
Copy link
Contributor Author

smanna12 commented Jul 22, 2021

Should you also add more template instantiation test coverage for the improvements in SemaStmtAttr.cpp as well?

Thanks @AaronBallman for the reviews. Do you mean to add AST tests? Are test cases below sufficient here?

void x() {
  // Test that checks expression is not a constant expression.
  // expected-note@+1{{declared here}}
  int a[10];
  int foo;
  // expected-error@+2{{expression is not an integral constant expression}}
  // expected-note@+1{{read of non-const variable 'foo' is not allowed in a constant expression}}
  [[intel::max_concurrency(foo + 1)]] for (int i = 0; i != 10; ++i)
       a[i] = 0;

 // Test that checks expression is a constant expression.
  constexpr int bar = 0;
  [[intel::max_concurrency(bar + 2)]] for (int i = 0; i != 10; ++i) // OK
      a[i] = 0;
}

// Test that checks wrong function template instantiation and ensures that the type
// is checked properly when instantiating from the template definition.
struct S {};
template <typename Ty>
void R() {
  int a[10];
  // expected-error@+2 {{integral constant expression must have integral or unscoped enumeration type, not 'S'}}
  // expected-error@+1 {{integral constant expression must have integral or unscoped enumeration type, not 'float'}}
  [[intel::max_concurrency(Ty{})]] for (int i = 0; i != 10; ++i)
      a[i] = 0;
}

int main() {
     R<S>(); //expected-note {{in instantiation of function template specialization 'R<S>' requested here}}
     R<float>(); // expected-note {{in instantiation of function template specialization 'R<float>' requested here}}
}

}

Signed-off-by: Soumi Manna <[email protected]>
@AaronBallman
Copy link
Contributor

Should you also add more template instantiation test coverage for the improvements in SemaStmtAttr.cpp as well?

Thanks @AaronBallman for the reviews. Do you mean to add AST tests? Are test cases below sufficient here?

Sema tests ("AST tests" mean -ast-dump tests to me). But yes, the test cases you posted are the kinds I'm hoping to add for these attributes since you're making changes to support them for template instantiations now. One other test to add to round things out is:

template <int N>
void R() {
  int a[10];
  [[intel::max_concurrency(N)]] for (int i = 0; i != 10; ++i)
      a[i] = 0;
}

int main() {
  R<1>();
  R<0>();
  R<-1>();
}

@smanna12
Copy link
Contributor Author

Should you also add more template instantiation test coverage for the improvements in SemaStmtAttr.cpp as well?

Thanks @AaronBallman for the reviews. Do you mean to add AST tests? Are test cases below sufficient here?

Sema tests ("AST tests" mean -ast-dump tests to me). But yes, the test cases you posted are the kinds I'm hoping to add for these attributes since you're making changes to support them for template instantiations now. One other test to add to round things out is:

template <int N>
void R() {
  int a[10];
  [[intel::max_concurrency(N)]] for (int i = 0; i != 10; ++i)
      a[i] = 0;
}

int main() {
  R<1>();
  R<0>();
  R<-1>();
}

Thanks @AaronBallman. I will add and push new patch here.

@smanna12 smanna12 requested a review from AaronBallman July 22, 2021 17:05
Signed-off-by: Soumi Manna <[email protected]>
Signed-off-by: Soumi Manna <[email protected]>
smanna12 added 3 commits July 22, 2021 13:50
Signed-off-by: Soumi Manna <[email protected]>
Signed-off-by: Soumi Manna <[email protected]>
Signed-off-by: Soumi Manna <[email protected]>
@smanna12 smanna12 requested a review from AaronBallman July 22, 2021 21:11
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.

Just style nits, but mostly LG.

smanna12 added 2 commits July 23, 2021 04:32
Signed-off-by: Soumi Manna <[email protected]>
Signed-off-by: Soumi Manna <[email protected]>
AaronBallman
AaronBallman previously approved these changes Jul 23, 2021
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, thank you for the cleanup!

@smanna12
Copy link
Contributor Author

Thank you for the reviews.

Signed-off-by: Soumi Manna <[email protected]>
@smanna12
Copy link
Contributor Author

Thank you for the reviews.

@bader bader merged commit 6ac26ad into intel:sycl Jul 25, 2021
alexbatashev added a commit to alexbatashev/llvm that referenced this pull request Jul 27, 2021
…ackend_plugin

* upstream/sycl: (755 commits)
  [SYCL] Add operator= to atomic_ref specializations (intel#4183)
  [SYCL] Make spelling of Debug value for CMAKE_BUILD_TYPE variable case insensitive (intel#4069)
  [SYCL][LIBCLC] Add atan and cbrt for amdgcn-amdhsa (intel#4180)
  [SYCL][CUDA] Correctly free managed memory (intel#4181)
  [SYCL] Revert barrier deprecation note (intel#4162)
  [SYCL][FPGA] Refactor of statement attributes (intel#4136)
  [Driver][SYCL] Enable way to emit int-footer source to a specific dir (intel#4167)
  [Driver] Fix default MSVC version setting for -fms-compatibilty-version (intel#4165)
  [BuildBot] Add llvm-enable-projects flag to configure.py (intel#4169)
  [Driver][SYCL][FPGA] Improve aocx archive processing for FPGA (intel#4160)
  [SYCL] Correct int-header emission with type aliases
  [SYCL] Fix name collisions in SYCL enums (intel#4154)
  [SYCL] Return the correct status info for host_task event (intel#4161)
  [ESIMD][NFC] Added tests for simd class type traits (intel#4146)
  [SYCL][ROCm] Fix missing parameter in ROCm plugin (intel#4166)
  [SYCL][L0] Add temporary option to allow user to use copy engine for device to device copy (intel#4127)
  Remove check for AMD HIP to fix Driver/cuda-arch-translation.cu
  Reapply after conflict resolution 418a6d6 "Fix nvptx_target_teams_distribute_parallel_for_simd_codegen failure"
  Revert "[SYCL] Removes redefinitions of macros in libclc (intel#3505)"
  [PGO] Change test-run line to check NewPM pass behavior
  ...
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.

4 participants