Skip to content

Check if device support heterogeneous memory #88

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 3 commits into from
Mar 4, 2022

Conversation

sherry-yuan
Copy link
Contributor

Currently sycl runtime is trying to distinguish whether buffer location is supported on the target device using lower level runtime getDeviceInfo call to determine it. However current runtime get device info does not yet support accepting the buffer location property yet, this change addes it.

The referenced sycl runtime PR: intel/llvm#5604

This change is only needed if sycl runtime cannot come up with an workaround.

@sherry-yuan sherry-yuan self-assigned this Mar 2, 2022
@sherry-yuan sherry-yuan added the enhancement New feature or request label Mar 2, 2022
@sherry-yuan sherry-yuan added this to the 2022.3 milestone Mar 2, 2022
@sherry-yuan sherry-yuan force-pushed the buffer_location_support branch from 124a805 to 42ac055 Compare March 2, 2022 17:13
@sherry-yuan

This comment was marked as resolved.

@sherry-yuan sherry-yuan force-pushed the buffer_location_support branch from 42ac055 to e98f4e2 Compare March 3, 2022 20:14
@sherry-yuan sherry-yuan requested a review from pcolberg March 3, 2022 20:14
Copy link
Contributor

@pcolberg pcolberg left a comment

Choose a reason for hiding this comment

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

Thanks @sherry-yuan 🙂

Maybe title the commit Add buffer location to supported extensions since it is always supported?

@sherry-yuan sherry-yuan force-pushed the buffer_location_support branch 2 times, most recently from 4030428 to 6e3281f Compare March 4, 2022 17:30
@sherry-yuan
Copy link
Contributor Author

I think something is wrong with the windows machine, ninja got uninstalled?

https://github.com/intel/fpga-runtime-for-opencl/runs/5426146169?check_suite_focus=true

     | The term 'ninja' is not recognized as a name of a cmdlet, function, script file, or executable
     | program. Check the spelling of the name, or if a path was included, verify that the path is correct
     | and try again.

@pcolberg
Copy link
Contributor

pcolberg commented Mar 4, 2022

I think something is wrong with the windows machine, ninja got uninstalled?

https://github.com/intel/fpga-runtime-for-opencl/runs/5426146169?check_suite_focus=true

     | The term 'ninja' is not recognized as a name of a cmdlet, function, script file, or executable
     | program. Check the spelling of the name, or if a path was included, verify that the path is correct
     | and try again.

No worries, this looks like a temporary failure, maybe related to actions/cache. The previous run failed on Windows 2022 with a similar error of aoc missing from PATH.

------------------------------------------------------------------------

The query for CL_DEVICE_EXTENSIONS will have nonzero return size, the checks can now be removed to check there are positive number of extensions.
---------------------------------------------------------------------------

The string literall returned is statically allocated so that it is safe to return one from a function.

The reason why std::string was not used. once modified, the c_cstr() pointer may no longer be valid. Futher tsan reported a heap use after free error if the acl_platform_extensions return std::string instead.
--------------------------------------------------------------------------

For sycl runtime to check whether a lower runtime library support a specific extension, they use clGetDeviceInfo with CL_DEVICE_EXTENSIONS as query parameter. If the extension of interest appears in the string then the runtime will use the extension accordingly. Otherwise the extension will have no effect.
@pcolberg pcolberg force-pushed the buffer_location_support branch from 6e3281f to 382297d Compare March 4, 2022 20:17
Copy link
Contributor

@pcolberg pcolberg left a comment

Choose a reason for hiding this comment

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

Thanks Sherry! I have revised the commit series slightly while keeping the contents the same.

When committing a change, think of it like a story where each commit contains a different aspect of your change. Rather than a chronological series, try to organise your commits into a logical series, where each commit is as self-contained as possible.

Taking this change as an example, you have three self-contained changes.

  1. Checking for size_ret > 0 in all cases. This is independent of the other changes, so you can make this change anywhere in the series; usually I prefer to get these out of the way first so the reviewer can focus on the actual change thereafter.
  2. Factoring out and testing the extensions string. Since you want to proof that your desired change, adding the buffer_location extension, does not break the test, this commit should come before the next commit.
  3. Now you can add the new extension. Not only have you proven that your change does not break the test, you have also shown that the test does not require any modification to test your new extension string, which was the point of factoring out the extension string.

A fine-grained commit series makes sense when the maintainers value their code history, i.e., merge or rebase pull-request branches as is. Fine-grained commits can be immensely valuable for later reading and comprehension, or easy cherry-picking to release branches, to give only two of many examples. On the other hand, when pull-request branches are merged by squashing down to a single commit, the effort is unfortunately in vain.

@sherry-yuan
Copy link
Contributor Author

Thanks @pcolberg for the guide!

In this case we would prefer a PR to contain multiple commits where each is a self-contained change rather than squashing all to one commit?

@pcolberg
Copy link
Contributor

pcolberg commented Mar 4, 2022

In this case we would prefer a PR to contain multiple commits where each is a self-contained change rather than squashing all to one commit?

Yes, because in this PR each commit introduces a new aspect of your change, multiple commits are justified.

On the other hand, consider another example of one commit making a small change and the next commit applying clang-format. In this case, the two commits should be squashed, since the clang-format is nothing but noise to a reviewer, it does not add anything new to their understanding of the change.

If in doubt, I would always tend to more commits rather than fewer; commits can always be squashed if desired, but unsquashing a commit requires more work.

@pcolberg pcolberg merged commit d7ab9be into intel:main Mar 4, 2022
@sherry-yuan
Copy link
Contributor Author

I see, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants