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

[SYCL][USM] Fix USM malloc_shared and free to handle zero byte #1273

Merged
merged 31 commits into from
Mar 17, 2020
Merged

[SYCL][USM] Fix USM malloc_shared and free to handle zero byte #1273

merged 31 commits into from
Mar 17, 2020

Conversation

bso-intel
Copy link
Contributor

This patch fixes the issue of user requests USM malloc_shared of zero byte.
It should not choke for freeing nullptr, too.
I also added a regression test usm_malloc_shared.cpp to handle in various device types.

bso-intel and others added 25 commits February 24, 2020 22:18
[CORC-7433]

Enum variables were too commonly used by users.
This kind of conflicts cannot be avoided 100%, but
we can minimize the chance by using the prefix SYCL_

Signed-off-by: Byoungro So <byoungro.so@intel.com>
Signed-off-by: Byoungro So <byoungro.so@intel.com>
Signed-off-by: Byoungro So <byoungro.so@intel.com>
Signed-off-by: Byoungro So <byoungro.so@intel.com>
Signed-off-by: Byoungro So <byoungro.so@intel.com>
Signed-off-by : Byoungro So <byoungro.so@intel.com>
Co-Authored-By: Alexey Bader <alexey.bader@intel.com>
Signed-off-by: Byoungro So <byoungro.so@intel.com>
Signed-off-by: Byoungro So <byoungro.so@intel.com>
Signed-off-by: Byoungro So <byoungro.so@intel.com>
Co-Authored-By: Alexey Bader <alexey.bader@intel.com>
Signed-off-by: Byoungro So <byoungro.so@intel.com>
Signed-off-by: Byoungro So <byoungro.so@intel.com>
Signed-off-by: Byoungro So <byoungro.so@intel.com>
Signed-off-by: Byoungro So <byoungro.so@intel.com>
Signed-off-by: Byoungro So <byoungro.so@intel.com>
Signed-off-by: Byoungro So <byoungro.so@intel.com>
Signed-off-by: Byoungro So <byoungro.so@intel.com>
Signed-off-by: Byoungro So <byoungro.so@intel.com>
Signed-off-by: Byoungro So <byoungro.so@intel.com>
Signed-off-by: Byoungro So <byoungro.so@intel.com>
Signed-off-by: Byoungro So <byoungro.so@intel.com>
@bader bader requested review from romanovvlad and jbrodman March 7, 2020 19:01
@bader bader changed the title [SYCL][USM] fixed USM malloc_shared and free to handle zero byte [SYCL][USM] Fix USM malloc_shared and free to handle zero byte Mar 7, 2020
jbrodman
jbrodman previously approved these changes Mar 9, 2020
Copy link
Contributor

@jbrodman jbrodman left a comment

Choose a reason for hiding this comment

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

LGTM

sycl/test/regression/usm_malloc_shared.cpp Outdated Show resolved Hide resolved
sycl/test/regression/usm_malloc_shared.cpp Outdated Show resolved Hide resolved
Signed-off-by: Byoungro So <byoungro.so@intel.com>

Co-Authored-By: Alexey Bader <alexey.bader@intel.com>
Signed-off-by: Byoungro So <byoungro.so@intel.com>
@bso-intel bso-intel requested a review from bader March 9, 2020 18:24
bader
bader previously approved these changes Mar 9, 2020
Copy link
Contributor

@bader bader left a comment

Choose a reason for hiding this comment

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

Do I get it correctly that allocations of "0" or negative # of bytes will return nullptr and free functions are able to handle nullptr?

@bso-intel
Copy link
Contributor Author

Do I get it correctly that allocations of "0" or negative # of bytes will return nullptr and free functions are able to handle nullptr?

Yes, that is right.

Signed-off-by: Byoungro So <byoungro.so@intel.com>
Signed-off-by: Byoungro So <byoungro.so@intel.com>
Signed-off-by: Byoungro So <byoungro.so@intel.com>
@bso-intel
Copy link
Contributor Author

@romanovvlad Could you review the changes you asked? Thanks.

@bader bader requested a review from romanovvlad March 15, 2020 15:38
@bader bader merged commit d596593 into intel:sycl Mar 17, 2020
alexbatashev pushed a commit to alexbatashev/llvm that referenced this pull request Mar 20, 2020
* sycl: (1209 commits)
  [SYCL] Check exit status get_device_count_by_type
  [SYCL][Doc] Update sub-group extension docs (intel#1330)
  [SYCL][Doc] Add leader to GroupAlgorithms (intel#1297)
  [SYCL] Add SYCL headers search path to default compilation options (intel#1347)
  [SYCL][PI] Add interoperability with generic handles to device and program classes (intel#1244)
  Move SPIR devicelib to top level (intel#1276)
  [SYCL][Driver] Improve fat static library support (intel#1319)
  [SYCL] Remove image_api LIT (intel#1349)
  [SYCL] Fix headers location for check-sycl-deploy target
  [SYCL] Allow gcc asm statements in kernel code (intel#1341)
  [SYCL] Add Intel FPGA force_pow2_depth attribute (intel#1284)
  [SPIR-V][NFC] Fix for building llvm-spirv with -DLLVM_LINK_LLVM_DYLIB=ON (intel#1323)
  [SYCL][NFC] Fix execution graph dump (intel#1331)
  [SYCL][Doc] Release SYCL_INTEL_enqueue_barrier extension document (intel#1199)
  [SYCL][USM] Fix USM malloc_shared and free to handle zero byte (intel#1273)
  [SYCL] Fix undefined symbols in async_work_group_copy (intel#1243)
  [SYCL] Mark calls to barrier and work-item functions as convergent
  [SYCL][CUDA] Fix CUDA plug-in build with enabled assertions (intel#1325)
  [SYCL][Test] Add OpenCL requirement to test/ordered_queue/prop.cpp (intel#1335)
  [SYCL][CUDA] Improve CUDA backend documentation (intel#1293)
  ...
@bso-intel bso-intel deleted the shared_malloc branch June 11, 2020 15:30
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.

4 participants