Skip to content

[SYCL][FPGA] Allowing max-concurrency attribute on functions. #3388

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 30 commits into from
Apr 1, 2021

Conversation

zahiraam
Copy link
Contributor

@zahiraam zahiraam commented Mar 21, 2021

This patch implements the support of a new FPGA function attribute ‘max_concurrency”. The attribute exists already for loops. It takes a single unsigned integer argument and has the following syntax:
[[intel::max_concurrency(n)]]

An example of it use:
[[intel::max_concurrency(n)]]
void foo() {
}
The LLVM IR representation will be function metadata:
!max_concurrency !0
!0 = !{!i32 n}

Max_concurrency applies to functions in device code. It is not be propagated to the caller.

Signed-off-by: Zahira Ammarguellat <[email protected]>
Signed-off-by: Zahira Ammarguellat <[email protected]>
Signed-off-by: Zahira Ammarguellat <[email protected]>
Signed-off-by: Zahira Ammarguellat <[email protected]>
Signed-off-by: Zahira Ammarguellat <[email protected]>
@zahiraam zahiraam changed the title Adding max-concurrency attr - Scratch PR. [SYCL][FPGA] Allowing max-concurrency attribute on functions. Mar 23, 2021
Signed-off-by: Zahira Ammarguellat <[email protected]>
Signed-off-by: Zahira Ammarguellat <[email protected]>
@zahiraam zahiraam requested a review from erichkeane March 24, 2021 22:08
@zahiraam zahiraam requested a review from smanna12 March 29, 2021 12:41
AaronBallman
AaronBallman previously approved these changes Mar 29, 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!

@smanna12
Copy link
Contributor

@zahiraam, could you please update summary since we are not naming this attribute to component_max_concurrency?

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

LGTM, but the review is still marked as a draft.

@zahiraam
Copy link
Contributor Author

LGTM, but the review is still marked as a draft.

So that's my next challenge. Not sure how to make it a "real" PR.

@erichkeane erichkeane marked this pull request as ready for review March 31, 2021 17:30
@erichkeane
Copy link
Contributor

@zahiraam
Copy link
Contributor Author

@zahiraam : https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/changing-the-stage-of-a-pull-request

I did it for you :)

Wow! That was fast. I was still reading the doc. Thanks.

AaronBallman
AaronBallman previously approved these changes Mar 31, 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 more officially now. :-D

smanna12
smanna12 previously approved these changes Mar 31, 2021
be applied multiple times to the same loop.
This attribute applies to a loop or a function. Indicates that the loop/function
should allow no more than N threads or iterations to execute it simultaneously.
N must be a non negative integer. '0' indicates the max_concurrency case to b
Copy link
Contributor

Choose a reason for hiding this comment

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

typo: 'be'

E = Res.get();

// This attribute requires a strictly positive value.
if (ArgVal <= 0) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be ArgVal < 0, I think (or the document is wrong). 0 indicates unbounded concurrency.


// expected-error@+1 {{'max_concurrency' attribute takes one argument}}
[[intel::max_concurrency(3, 3)]] void goo() {}

Copy link
Contributor

Choose a reason for hiding this comment

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

Please add a test for '0'.

@zahiraam zahiraam dismissed stale reviews from smanna12 and AaronBallman via 47f0c4a March 31, 2021 19:35
return;
E = Res.get();

// This attribute requires a strictly positive value.
Copy link
Contributor

Choose a reason for hiding this comment

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

Very minor: comment is incorrect. We need a non-negative value.

But otherwise looks good to me.

Copy link
Contributor

@premanandrao premanandrao left a comment

Choose a reason for hiding this comment

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

LGTM

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