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

Avoid stack allocation for test_requires_unified_shared_memory_heap* #632

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

tob2
Copy link
Collaborator

@tob2 tob2 commented Oct 24, 2022

Some (pseuo)USM implementations allocate memory in a special memory section that permits either direct memory access (DMA) from the device or on-access migration. In that case, stack and static memory may or may not be accessible.

This pull request changes the test_requires_unified_shared_memory_heap{,_map,_is_device_ptr}.{c,F90} testcases such that only heap memory is used on the device. The existing test_unified_shared_memory*.* testcases handle the other variants.

@nolanbaker31 @spophale @jrreap @krishols @mjcarr458 – please review

This is a consistency fix – permitting a partial pass with pseudo USM. For full USM, kernel + hardware support is required to access all memory. I some (but not all) post-Pascal Nvidia cards permit to access all memory and, if I understood it correctly (big “if”), AMD cards since VEGA support accessing all memory in principle, but effectively, only gfx90a (MI 200 series) permits fast access and has proper.

tob2 added 2 commits October 24, 2022 12:52
Some (pseuo)USM implementations allocate memory in a special memory
section that permits either direct memory access (DMA) from the device
or on-access migration. In that case, stack and static memory may or may
not be accessible.

Change the test_requires_unified_shared_memory_heap{,_map,_is_device_ptr}.{c,F90}
testcases such that only heap memory is used on the device. The
test_unified_shared_memory*.* testcases handle the other variants.
Variant of test_requires_unified_shared_memory_heap_{,map_}.{F90,C};
one test only works with heap memory - the other variant uses stack
allocated memory but with an explicit 'map' clause.
@tob2
Copy link
Collaborator Author

tob2 commented Oct 24, 2022

A colleague commented that having a stack memory (as before) but with an explicit map would work as well with (a certain) (pseudo)USM implementation.

I believe that this is an implementation choice, but I have now added as additional testcase that variant as well. Thus:

  • original tests now only use heap memory
  • new tests which are same as 4 original testcases, i.e. use a stack-allocated anArrayCopy, – except that they now use an explicit 'map(anArrayCopy)' for the checking array.

@spophale
Copy link
Collaborator

spophale commented Nov 4, 2022

@tob2 I am not in favor of changing existing tests to use heap because spec 5.0 clearly states
".. memory in the device data environment of any device visible to OpenMP, including but not limited to the host, is considered part of the device data environment of all devices accessible through OpenMP ..."

But I am in favor of adding new tests or modify test to check for complete vs pseudo USM support. From the msg it should be clear that there is some degree of support for USM but not comprehensive support.

IMO adding map to target completely kills the intent of testing USM. I know the optimizing implications but nevertheless functionality should not depend on explicit maps when requires USM is specified.

@spophale spophale added 5.0 Related to spec version 5.0 enhancement New feature or request under discussion PR is on hold pending further discussion labels Nov 5, 2022
@seyonglee
Copy link
Collaborator

IMO adding map to target completely kills the intent of testing USM. I know the optimizing implications but nevertheless functionality should not depend on explicit maps when requires USM is specified.

Using explicit map on a system with USM is still valid, and testing it has some values (even though not much, especially when tested alone).
Therefore, having multiple variants to test full USM and pseudo USM can be useful, even though not required by the standard.

@spophale spophale self-assigned this Oct 19, 2023
@spophale
Copy link
Collaborator

@spophale will create new tests based on the changes suggested by Tobias and add them.

@spophale spophale added in progress PR created, we are working on it and removed enhancement New feature or request under discussion PR is on hold pending further discussion labels Oct 19, 2023
@spophale
Copy link
Collaborator

@tob2 , I am creating a new PR for the first five test edits. I am adding them as new tests. Can you please delete those from your commit ?

@spophale
Copy link
Collaborator

@tob2 , can you take a look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
5.0 Related to spec version 5.0 in progress PR created, we are working on it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants