-
Notifications
You must be signed in to change notification settings - Fork 141
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
Feature: Optimize dngvd_op with CPU/GPU Branching Based on nstart #5919
Conversation
please fix the compiling error |
// copied from ../cuda/dngvd_op.cu, "dngvd_op" | ||
assert(nstart == ldh); | ||
|
||
if (nstart > N_DCU){ |
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.
please add notes for this kernel has intersection point of the performance curves between CPU and DCU.
// copied from ../cuda/dngvd_op.cu, "dngvd_op" | ||
assert(nstart == ldh); | ||
|
||
if (nstart > N_DCU){ |
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.
please add notes for this kernel has intersection point of the performance curves between CPU and DCU.
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.
to be honest, N_DCU is tested only for "complex" kernel, but maybe not good intersection point for "double" and "complex" kernel.
Currently,
dngvd_op
inmodule_hsolver/kernels/rocm/dngvd_op.hip.cu
uses the ROCm implementation for all input sizes (nstart). Performance analysis shows that the CPU implementation (dngvd_op.cpp
) is faster for smaller nstart values.This PR proposes adding a conditional branch within the
dngvd_op<double, base_device::DEVICE_GPU>::operator()
function to select the optimal implementation based onnstart
:If nstart > 234
, use the existing ROCm implementation.If nstart <= 234
, call the CPU implementation (dngvd_op<double, base_device::DEVICE_CPU>
).This change requires:
Adding an
if (nstart > 234) { ... } else { ... }
block within the GPU operator().Inside the else block, calling the CPU implementation with appropriate type casts.
This optimization is expected to improve performance, especially for bigger matrix sizes.