Skip to content
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

[oneDPL] Transform_if APIs #547

Merged

Conversation

danhoeflinger
Copy link
Contributor

Proposing oneapi::dpl::transform_if specification for oneDPL.

@danhoeflinger danhoeflinger changed the title oneDPL transform_if [oneDPL] Transform_if APIs Jun 17, 2024
@akukanov akukanov added the DPL label Aug 12, 2024
source/elements/oneDPL/source/parallel_api.rst Outdated Show resolved Hide resolved
source/elements/oneDPL/source/parallel_api.rst Outdated Show resolved Hide resolved
source/elements/oneDPL/source/parallel_api.rst Outdated Show resolved Hide resolved
Copy link
Contributor

@dcbenito dcbenito left a comment

Choose a reason for hiding this comment

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

Minor changes, but the general text LGTM.

@@ -688,5 +688,37 @@ than an element in the range being searched.

The elements e of [start, end) must be partitioned with respect to the comparator used.
Copy link
Contributor

Choose a reason for hiding this comment

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

Should e be in quotes? Should the brackets be the same? Right now, it is mixed with squares/parentheses.

Copy link
Contributor

@akukanov akukanov Aug 16, 2024

Choose a reason for hiding this comment

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

This e thing should be removed, but it's better done in a separate patch.
The brackets are intentionally different, it is the mathematical notation for so-called half-intervals.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thank you! I did not know that about the brackets and will keep that in mind for future reviews.

Copy link
Contributor

Choose a reason for hiding this comment

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

This e thing should be removed, but it's better done in a separate patch.

Also added to #565.

transform_if(Policy&& policy, InputIt1 start1, InputIt1 end1, InputIt2 start2, OutputIt result,
BinaryOp op, BinaryPredicate pred); // (2)

:code:`oneapi::dpl::transform_if` applies a given function to the elements of the input sequence(s) that
Copy link
Contributor

@dcbenito dcbenito Aug 16, 2024

Choose a reason for hiding this comment

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

Why are we using :code:'' in this file and "" in other files? I think that we should standardize this and am partial to "".

Please add a colon after "...the algorithm"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

for :code: vs , I don't have a good explanation other than staying consistent with the other cases in this file. If we want to make a formatting change on this topic, I'd suggest we do it for the whole oneDPL spec, and in a separate PR from this.

Copy link
Contributor

Choose a reason for hiding this comment

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

After a quick look around, I think that this file is the only one using :code: (for docs anyway). I would prefer that we stay consistent. I think that a new PR for this issue would be good to fix before the next release.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

To be clear, this is the oneDPL specification within the oneAPI specification in UXL, rather than docs which would be tied to an intel release.
I see a few other instances of :code: in sycl_kernels_api.rst and common.rst, but most are here in this file. However, I agree it would be good to update with a PR prior to the specification freeze.

Copy link
Contributor

Choose a reason for hiding this comment

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

That is good to keep in mind!

Would you like me to create a PR? I can have that done by EOD.

Copy link
Contributor

@akukanov akukanov Aug 16, 2024

Choose a reason for hiding this comment

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

At the HTML level, this is the output for backquotes:

<code class="docutils literal notranslate">
<span class="pre">using</span> <span class="pre">scalar_type</span> <span class="pre">=</span> <span class="pre">result_type;</span>
</code>

and this is the output for :code:

<code class="code docutils literal notranslate">
<span class="pre">namespace</span> <span class="pre">oneapi::dpl::execution</span>
</code>

(the examples use different strings - I have not found the same or similar strings for both styles.)

The difference seems to be only in the extra "code" class name in attributes.. I guess it technically allows to set different formatting in CSS or JavaScript, but I do not know if it is used in the oneAPI specification. Visually both styles look the same.

Copy link
Contributor

Choose a reason for hiding this comment

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

I looked through the other products in this repo and we are the only ones using the :code:'value' (single quote)and only in some spots. Most of the instances are "value"(no :code: and with double quotes). We should stick to one.

I have created a PR, but do not have approval/access to push it. Can someone on this thread give me write access for this repo?

Copy link
Contributor

Choose a reason for hiding this comment

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

As far as I can tell, contributions/PRs to this repo are done from forks, not from repo branches.
If you do not want to fork it in your own GitHub account, I can create a PR from my fork.

Copy link
Contributor

Choose a reason for hiding this comment

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

I have followed up via email. Thank you @akukanov

Copy link
Contributor

Choose a reason for hiding this comment

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

:code:`oneapi::dpl::transform_if` applies a given function to the elements of the input sequence(s) that
satisfy a given predicate, and stores the result to the output. Depending on the arguments, the algorithm

1. evaluates the unary predicate :code:`pred` for each position :code:`i` of the sequence
Copy link
Contributor

Choose a reason for hiding this comment

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

Please capitalize evaluates in steps 1 and 2.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

both are continuing a sentence started prior to the enumerated list, should we still capitalize them? Or do you think we should reformat the structure to avoid that?

Copy link
Contributor

@dcbenito dcbenito Aug 16, 2024

Choose a reason for hiding this comment

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

This is a weird one where normal grammar rules don't really apply. Per our and IDZ's style guide we format the text using sentence case, this is why the capital for "evaluates". We also use a sentence or snippet to introduce the list, so "Depending on the arguments, the algorithm:" is the intro and why we want a colon after "algorithm".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

alright I've applied that pair of changes.

Signed-off-by: Dan Hoeflinger <[email protected]>
Signed-off-by: Dan Hoeflinger <[email protected]>
Signed-off-by: Dan Hoeflinger <[email protected]>
Signed-off-by: Dan Hoeflinger <[email protected]>
Signed-off-by: Dan Hoeflinger <[email protected]>
Signed-off-by: Dan Hoeflinger <[email protected]>
Signed-off-by: Dan Hoeflinger <[email protected]>
Signed-off-by: Dan Hoeflinger <[email protected]>
@danhoeflinger danhoeflinger force-pushed the dev/dhoeflin/oneDPL_transform_if branch from b808ab6 to fdd74ff Compare August 20, 2024 18:28
Copy link
Contributor

@timmiesmith timmiesmith left a comment

Choose a reason for hiding this comment

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

The description looks good to me. I'll follow the changes in #565 to continue the discussion.

@danhoeflinger danhoeflinger merged commit eeac4e8 into uxlfoundation:main Aug 23, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants