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

UCP: Add prot parameter to UCP API. #5309

Merged
merged 1 commit into from
Jul 15, 2020
Merged

Conversation

leibin2014
Copy link
Contributor

@leibin2014 leibin2014 commented Jun 21, 2020

What

Add prot READ/WRITE to prot parameters of UCP API.

Why ?

Currently prot READ|WRITE is hard code in UCX, we need configure them through UCP API.

How ?

Add prot READ/WRITE relative macros in the prot parameter of UCP API.

@leibin2014
Copy link
Contributor Author

@yosefe Fixed according to our last talk.

@leibin2014
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link

Commenter does not have sufficient privileges for PR 5309 in repo openucx/ucx

src/ucp/api/ucp.h Outdated Show resolved Hide resolved
* ucp_mem_map() function.
*/
enum {
UCP_MEM_MAP_WRITE = UCS_BIT(1), /**< Enable write access. */
Copy link
Contributor

Choose a reason for hiding this comment

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

UCP_MEM_MAP_PROT_READ = UCS_BIT(0)
UCP_MEM_MAP_PROT_WRITE = UCS_BIT(1)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@yosefe Done

@@ -699,15 +699,21 @@ enum uct_md_mem_flags {
UCT_MD_MEM_ACCESS_REMOTE_PUT = UCS_BIT(5), /**< enable remote put access */
UCT_MD_MEM_ACCESS_REMOTE_GET = UCS_BIT(6), /**< enable remote get access */
UCT_MD_MEM_ACCESS_REMOTE_ATOMIC = UCS_BIT(7), /**< enable remote atomic access */
UCT_MD_MEM_ACCESS_LOCAL_WRITE = UCS_BIT(8), /**< enable local write access */
Copy link
Contributor

Choose a reason for hiding this comment

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

pls remove UCT part from this PR (add in another PR)

@yosefe
Copy link
Contributor

yosefe commented Jul 1, 2020

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@leibin2014
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@leibin2014 leibin2014 changed the title UCP/UCT: Add prot READ/WRITE to flag parameters of UCP and UCT API. UCP/UCT: Add prot READ/WRITE to parameters of UCP API. Jul 1, 2020
@leibin2014 leibin2014 changed the title UCP/UCT: Add prot READ/WRITE to parameters of UCP API. UCP: Add prot READ/WRITE to parameters of UCP API. Jul 1, 2020
*
* The enumeration list describes the memory mapping protections supported by @ref
* ucp_mem_map() function.
*/
enum {
UCP_MEM_MAP_WRITE = UCS_BIT(1), /**< Enable write access. */
UCP_MEM_MAP_READ = UCS_BIT(2) /**< Enable read access. */
UCP_MEM_MAP_PROT_READ = UCS_BIT(0), /**< Enable read access. */
Copy link
Contributor

Choose a reason for hiding this comment

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

pls remove space after 'read'

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. Thanks!

@leibin2014
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).


/* always acquire context lock */
UCP_THREAD_CS_ENTER(&context->mt_lock);

mem_params = *params;
status = ucp_mem_map_check_and_adjust_params(&mem_params);
Copy link
Contributor

Choose a reason for hiding this comment

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

shall we delete ucp_mem_map_check_and_adjust_params() function?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@yosefe Deleted. Thanks!

goto out;
}

if (((params->field_mask & UCP_MEM_MAP_PARAM_FIELD_FLAGS) &&
Copy link
Contributor

Choose a reason for hiding this comment

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

unsigned flags;
...
flags = UCP_PARAM_VALUE(MEM_MAP, params, flags, FLAGS, 0);
then, can use 'flags' local var without checking the field every time

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@yosefe Fixed.

Comment on lines 463 to 467
if (!(params->field_mask & UCP_MEM_MAP_PARAM_FIELD_ADDRESS)) {
address = NULL;
} else {
address = params->address;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

use UCP_PARAM_VALUE macro

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

@leibin2014
Copy link
Contributor Author

retest with bot:pipe:retest

@leibin2014
Copy link
Contributor Author

bot:pipe:retest

3 similar comments
@leibin2014
Copy link
Contributor Author

bot:pipe:retest

@leibin2014
Copy link
Contributor Author

bot:pipe:retest

@leibin2014
Copy link
Contributor Author

bot:pipe:retest

Copy link
Contributor

@yosefe yosefe left a comment

Choose a reason for hiding this comment

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

@evgeny-leksikov can you pls take a look as well?

* | result | err if | alloc/reg | err | reg | err | alloc/reg | err | alloc/reg |
* | | len >0 | | | | | (hint) | | (fixed) |
* |--------------------------------------------------------------------------------|
*/
Copy link
Contributor

Choose a reason for hiding this comment

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

👍 for keeping the documentation

@yosefe yosefe added the API label Jul 4, 2020
@leibin2014 leibin2014 changed the title UCP: Add prot READ/WRITE to parameters of UCP API. UCP: Add prot parameter to UCP API. Jul 4, 2020
@yosefe
Copy link
Contributor

yosefe commented Jul 6, 2020

@shamisp @tonycurtis can you pls take a look?

Copy link
Contributor

@tonycurtis tonycurtis left a comment

Choose a reason for hiding this comment

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

ucp.h:447 would add "the" after "by"

otherwise fine.

@shamisp
Copy link
Contributor

shamisp commented Jul 6, 2020

👍

@shamisp
Copy link
Contributor

shamisp commented Jul 6, 2020

squash please

* ucp_mem_map() function.
*/
enum {
UCP_MEM_MAP_PROT_READ = UCS_BIT(0), /**< Enable read access. */
Copy link
Contributor

Choose a reason for hiding this comment

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

I would like to withdraw my approval based on UCT patch review :) Let's add LOCAL to both - enum name and description. @yosefe Maybe you want to use this opportunity to add remote read/write ?

Copy link
Contributor

Choose a reason for hiding this comment

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

UCT patch #5348

Copy link
Contributor

Choose a reason for hiding this comment

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

@shamisp do you mean the flags we need are: UCP_MAM_MAP_PROT_[LOCAL|REMOTE]_[READ|WRITE] ?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think so. Even if you want to define only local for now, I would explicitly name it _local_.

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, to some extend this might be a hint, since some transports may not have permissions for read/write, etc.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@shamisp @yosefe Fixed. One more look pls. Just one more thing to confirm, we are using REMOTE_GET and REMOTE_PUT in UCT, we can use REMOTE_READ and REMOTE_WRITE in UCP. Right?

Copy link
Contributor

Choose a reason for hiding this comment

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

@yosefe I don't understand what is the value of pre-defined UCP_MEM_MAP_PROT_READ = UCP_MEM_MAP_PROT_LOCAL_READ| UCP_MEM_MAP_PROT_REMOTE_READ

Copy link
Contributor

Choose a reason for hiding this comment

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

syntax sugar

Copy link
Contributor

Choose a reason for hiding this comment

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

IMHO, it looks completely out of place in UCP.H. Extra enum to document and manage with no additional value.

Copy link
Contributor Author

@leibin2014 leibin2014 Jul 9, 2020

Choose a reason for hiding this comment

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

@shamisp @yosefe I removed UCP_MEM_MAP_PROT_READ/UCP_MEM_MAP_PROT_WRITE.

@leibin2014
Copy link
Contributor Author

leibin2014 commented Jul 7, 2020

ucp.h:447 would add "the" after "by"

otherwise fine.

Fixed. Thanks!

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@leibin2014
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@leibin2014
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@leibin2014
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@leibin2014
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@yosefe
Copy link
Contributor

yosefe commented Jul 11, 2020

@leibin2014 can you pls squash?

@leibin2014
Copy link
Contributor Author

@leibin2014 can you pls squash?

@yosefe It was squashed before the last /azp run. Thanks!

@yosefe
Copy link
Contributor

yosefe commented Jul 13, 2020

@yosefe It was squashed before the last /azp run. Thanks!

@leibin2014 there are 6 commits in the PR, it should be 1 only

@leibin2014
Copy link
Contributor Author

@yosefe It was squashed before the last /azp run. Thanks!

@leibin2014 there are 6 commits in the PR, it should be 1 only

OK, thought it didn't matter having "Merge pull request #8 from openucx/master" this kind of commits. Done now. Thanks!

@leibin2014
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@leibin2014
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@leibin2014
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@leibin2014 leibin2014 force-pushed the master branch 3 times, most recently from 6a8edc2 to ec8da5b Compare July 14, 2020 04:44
@leibin2014
Copy link
Contributor Author

bot:pipe:retest

@yosefe
Copy link
Contributor

yosefe commented Jul 14, 2020

bot:pipe:retest

@yosefe yosefe merged commit 9afdce2 into openucx:master Jul 15, 2020
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.

5 participants