-
Notifications
You must be signed in to change notification settings - Fork 93
[SYCLomatic] Migrate cudaMallocAsync and cudaFreeAsync #2843
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
Open
zhiweij1
wants to merge
10
commits into
oneapi-src:SYCLomatic
Choose a base branch
from
zhiweij1:async_alloc
base: SYCLomatic
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
6d31113
[SYCLomatic] Migrate cudaMallocAsync and cudaFreeAsync
zhiweij1 4596d63
Fix lit
zhiweij1 f1a56df
Update
zhiweij1 79887e2
Fix lit
zhiweij1 ec0f591
Update
zhiweij1 ce36a78
Fix test
zhiweij1 55caba5
Merge remote-tracking branch 'origin/SYCLomatic' into async_alloc
zhiweij1 fab0fdf
Merge remote-tracking branch 'origin/SYCLomatic' into async_alloc
zhiweij1 41ec4b7
Merge remote-tracking branch 'origin/SYCLomatic' into async_alloc
zhiweij1 ec591c8
Fix
zhiweij1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// UNSUPPORTED: cuda-8.0, cuda-9.0, cuda-9.1, cuda-9.2, cuda-10.0, cuda-10.1, cuda-10.2, cuda-11.0, cuda-11.1 | ||
// UNSUPPORTED: v8.0, v9.0, v9.1, v9.2, v10.0, v10.1, v10.2, v11.0, v11.1 | ||
// RUN: dpct --format-range=none --out-root %T/async_alloc %s --cuda-include-path="%cuda-path/include" --use-experimental-features=async_alloc | ||
// RUN: FileCheck --match-full-lines --input-file %T/async_alloc/async_alloc.dp.cpp %s | ||
// RUN: %if build_lit %{icpx -c -fsycl -DNO_BUILD_TEST %T/async_alloc/async_alloc.dp.cpp -o %T/async_alloc/async_alloc.dp.o %} | ||
|
||
// CHECK: #include <sycl/ext/oneapi/experimental/async_alloc/async_alloc.hpp> | ||
|
||
void foo_1(float *f, cudaStream_t hStream) { | ||
// CHECK: cudaMemPool_t memPool; | ||
// CHECK-NEXT: /* | ||
// CHECK-NEXT: DPCT1007:{{[0-9]+}}: Migration of cudaMallocAsync is not supported. | ||
// CHECK-NEXT: */ | ||
// CHECK-NEXT: cudaMallocAsync(&f, 1024, memPool, hStream); | ||
// CHECK: f = sycl::ext::oneapi::experimental::async_malloc(*hStream, sycl::usm::alloc::device, 1024); | ||
// CHECK-NEXT: sycl::ext::oneapi::experimental::async_free(*hStream, f); | ||
#ifndef NO_BUILD_TEST | ||
cudaMemPool_t memPool; | ||
cudaMallocAsync(&f, 1024, memPool, hStream); | ||
#endif | ||
cudaMallocAsync(&f, 1024, hStream); | ||
cudaFreeAsync(f, hStream); | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// UNSUPPORTED: cuda-8.0, cuda-9.0, cuda-9.1, cuda-9.2, cuda-10.0, cuda-10.1, cuda-10.2, cuda-11.0, cuda-11.1 | ||
// UNSUPPORTED: v8.0, v9.0, v9.1, v9.2, v10.0, v10.1, v10.2, v11.0, v11.1 | ||
// RUN: dpct --format-range=none --out-root %T/async_alloc_no_ext %s --cuda-include-path="%cuda-path/include" | ||
// RUN: FileCheck --match-full-lines --input-file %T/async_alloc_no_ext/async_alloc_no_ext.dp.cpp %s | ||
// RUN: %if build_lit %{icpx -c -fsycl -DNO_BUILD_TEST %T/async_alloc_no_ext/async_alloc_no_ext.dp.cpp -o %T/async_alloc_no_ext/async_alloc_no_ext.dp.o %} | ||
|
||
void foo_1(float *f, cudaStream_t hStream) { | ||
// CHECK: cudaMemPool_t memPool; | ||
// CHECK-NEXT: /* | ||
// CHECK-NEXT: DPCT1007:{{[0-9]+}}: Migration of cudaMallocAsync is not supported. | ||
// CHECK-NEXT: */ | ||
// CHECK-NEXT: cudaMallocAsync(&f, 1024, memPool, hStream); | ||
// CHECK-NEXT: /* | ||
// CHECK-NEXT: DPCT1119:{{[0-9]+}}: Migration of cudaMallocAsync is not supported, please try to remigrate with option: --use-experimental-features=async_alloc. | ||
// CHECK-NEXT: */ | ||
// CHECK-NEXT: cudaMallocAsync(&f, 1024, hStream); | ||
// CHECK-NEXT: /* | ||
// CHECK-NEXT: DPCT1119:{{[0-9]+}}: Migration of cudaFreeAsync is not supported, please try to remigrate with option: --use-experimental-features=async_alloc. | ||
// CHECK-NEXT: */ | ||
// CHECK-NEXT: cudaFreeAsync(f, hStream); | ||
#ifndef NO_BUILD_TEST | ||
cudaMemPool_t memPool; | ||
cudaMallocAsync(&f, 1024, memPool, hStream); | ||
cudaMallocAsync(&f, 1024, hStream); | ||
cudaFreeAsync(f, hStream); | ||
#endif | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.