-
Notifications
You must be signed in to change notification settings - Fork 159
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
Move lapack_info_check
inside of onemkl_cusolver_host_task
#238
Open
JackAKirk
wants to merge
12
commits into
oneapi-src:develop
Choose a base branch
from
JackAKirk:info_check_rebased
base: develop
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 10 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
9208387
Move dev_info check to host_task
c515f25
Asynchronously free ipiv 32-bit memory
e12107b
User helper for depends on events
654e5f5
Remove unncessary reinterpret_cast for ipiv32
39d8f65
Wait on scratchpad_size host task
ac4f639
Pass queue by reference to cusolver host task
87b4900
Update for includes for removed CL namespace
1880bf9
Merge branch 'develop' into infocheck
0d057c3
Resolved conflict in cusolver_helper.hpp
cf2a7dd
Update cusolver_batch cases.
JackAKirk 0d02373
Applied Aidan's suggestions.
JackAKirk 91bbde4
Merge branch 'develop' into info_check_rebased
JackAKirk 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 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 |
---|---|---|
|
@@ -184,26 +184,25 @@ inline void getrf_batch(const char *func_name, Func func, sycl::queue &queue, st | |
// Create new buffer with 32-bit ints then copy over results | ||
std::uint64_t ipiv_size = stride_ipiv * batch_size; | ||
sycl::buffer<int> ipiv32(sycl::range<1>{ ipiv_size }); | ||
sycl::buffer<int> devInfo{ batch_size }; | ||
|
||
queue.submit([&](sycl::handler &cgh) { | ||
auto a_acc = a.template get_access<sycl::access::mode::read_write>(cgh); | ||
auto ipiv32_acc = ipiv32.template get_access<sycl::access::mode::write>(cgh); | ||
auto devInfo_acc = devInfo.template get_access<sycl::access::mode::write>(cgh); | ||
auto scratch_acc = scratchpad.template get_access<sycl::access::mode::write>(cgh); | ||
onemkl_cusolver_host_task(cgh, queue, [=](CusolverScopedContextHandler &sc) { | ||
auto handle = sc.get_handle(queue); | ||
auto a_ = sc.get_mem<cuDataType *>(a_acc); | ||
auto ipiv_ = sc.get_mem<int *>(ipiv32_acc); | ||
auto devInfo_ = sc.get_mem<int *>(devInfo_acc); | ||
auto scratch_ = sc.get_mem<cuDataType *>(scratch_acc); | ||
cusolverStatus_t err; | ||
int *dev_info_d = create_dev_info(batch_size); | ||
|
||
// Uses scratch so sync between each cuSolver call | ||
for (std::int64_t i = 0; i < batch_size; ++i) { | ||
CUSOLVER_ERROR_FUNC_T_SYNC(func_name, func, err, handle, m, n, a_ + stride_a * i, | ||
lda, scratch_, ipiv_ + stride_ipiv * i, devInfo_ + i); | ||
lda, scratch_, ipiv_ + stride_ipiv * i, dev_info_d + i); | ||
} | ||
lapack_info_check_and_free(dev_info_d, __func__, func_name, batch_size); | ||
}); | ||
}); | ||
|
||
|
@@ -215,7 +214,6 @@ inline void getrf_batch(const char *func_name, Func func, sycl::queue &queue, st | |
[=](sycl::id<1> index) { ipiv_acc[index] = ipiv32_acc[index]; }); | ||
}); | ||
|
||
lapack_info_check(queue, devInfo, __func__, func_name, batch_size); | ||
} | ||
|
||
#define GETRF_STRIDED_BATCH_LAUNCHER(TYPE, CUSOLVER_ROUTINE) \ | ||
|
@@ -571,7 +569,6 @@ inline sycl::event getrf_batch(const char *func_name, Func func, sycl::queue &qu | |
// Allocate memory with 32-bit ints then copy over results | ||
std::uint64_t ipiv_size = stride_ipiv * batch_size; | ||
int *ipiv32 = (int *)malloc_device(sizeof(int) * ipiv_size, queue); | ||
int *devInfo = (int *)malloc_device(sizeof(int) * batch_size, queue); | ||
|
||
auto done = queue.submit([&](sycl::handler &cgh) { | ||
int64_t num_events = dependencies.size(); | ||
|
@@ -581,16 +578,17 @@ inline sycl::event getrf_batch(const char *func_name, Func func, sycl::queue &qu | |
onemkl_cusolver_host_task(cgh, queue, [=](CusolverScopedContextHandler &sc) { | ||
auto handle = sc.get_handle(queue); | ||
auto a_ = reinterpret_cast<cuDataType *>(a); | ||
auto devInfo_ = reinterpret_cast<int *>(devInfo); | ||
auto scratchpad_ = reinterpret_cast<cuDataType *>(scratchpad); | ||
auto ipiv_ = reinterpret_cast<int *>(ipiv32); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can also remove this unnecessary reinterpret cast as |
||
cusolverStatus_t err; | ||
int *dev_info_d = create_dev_info(batch_size); | ||
|
||
// Uses scratch so sync between each cuSolver call | ||
for (int64_t i = 0; i < batch_size; ++i) { | ||
CUSOLVER_ERROR_FUNC_T_SYNC(func_name, func, err, handle, m, n, a_ + stride_a * i, | ||
lda, scratchpad_, ipiv_ + stride_ipiv * i, devInfo_ + i); | ||
lda, scratchpad_, ipiv_ + stride_ipiv * i, dev_info_d + i); | ||
} | ||
lapack_info_check_and_free(dev_info_d, __func__, func_name, batch_size); | ||
}); | ||
}); | ||
|
||
|
@@ -607,10 +605,6 @@ inline sycl::event getrf_batch(const char *func_name, Func func, sycl::queue &qu | |
cgh.host_task([=](sycl::interop_handle ih) { sycl::free(ipiv32, queue); }); | ||
}); | ||
|
||
// lapack_info_check calls queue.wait() | ||
lapack_info_check(queue, devInfo, __func__, func_name, batch_size); | ||
sycl::free(devInfo, queue); | ||
|
||
return done_casting; | ||
} | ||
|
||
|
@@ -656,7 +650,6 @@ inline sycl::event getrf_batch(const char *func_name, Func func, sycl::queue &qu | |
for (int64_t group_id = 0; group_id < group_count; ++group_id) | ||
for (int64_t local_id = 0; local_id < group_sizes[group_id]; ++local_id, ++global_id) | ||
ipiv32[global_id] = (int *)malloc_device(sizeof(int) * n[group_id], queue); | ||
int *devInfo = (int *)malloc_device(sizeof(int) * batch_size, queue); | ||
|
||
auto done = queue.submit([&](sycl::handler &cgh) { | ||
int64_t num_events = dependencies.size(); | ||
|
@@ -669,16 +662,18 @@ inline sycl::event getrf_batch(const char *func_name, Func func, sycl::queue &qu | |
auto scratch_ = reinterpret_cast<cuDataType *>(scratchpad); | ||
int64_t global_id = 0; | ||
cusolverStatus_t err; | ||
int *dev_info_d = create_dev_info(batch_size); | ||
|
||
// Uses scratch so sync between each cuSolver call | ||
for (int64_t group_id = 0; group_id < group_count; ++group_id) { | ||
for (int64_t local_id = 0; local_id < group_sizes[group_id]; | ||
++local_id, ++global_id) { | ||
CUSOLVER_ERROR_FUNC_T_SYNC(func_name, func, err, handle, m[group_id], | ||
n[group_id], a_[global_id], lda[group_id], scratch_, | ||
ipiv32[global_id], devInfo + global_id); | ||
ipiv32[global_id], dev_info_d + global_id); | ||
} | ||
} | ||
lapack_info_check_and_free(dev_info_d, __func__, func_name, batch_size); | ||
}); | ||
}); | ||
|
||
|
@@ -712,10 +707,6 @@ inline sycl::event getrf_batch(const char *func_name, Func func, sycl::queue &qu | |
}); | ||
}); | ||
|
||
// lapack_info_check calls queue.wait() | ||
lapack_info_check(queue, devInfo, __func__, func_name, batch_size); | ||
sycl::free(devInfo, queue); | ||
|
||
return done_freeing; | ||
} | ||
|
||
|
This file contains 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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The dependencies loop can be simplified in the batch with
depends_on_events(cgh, dependencies);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice one. I've made these changes.