-
Notifications
You must be signed in to change notification settings - Fork 8
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
Use the RoCM/HIP device to accelerate certain DPLASMA kernels #57
Open
abouteiller
wants to merge
49
commits into
ICLDisco:master
Choose a base branch
from
abouteiller:feature/hip
base: master
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
49 commits
Select commit
Hold shift + click to select a range
a9edd90
configure: Add the --with-hip option
abouteiller 99290a9
hip: Configury
abouteiller 1555488
hip: kernel typedefs
abouteiller 170e8a6
hip: update for hip-enabled parsec
abouteiller 8e4f817
hip: detect hipblas and rocsolvers
abouteiller 820da6f
hip: precision generator rules
abouteiller 47f1564
hip: cleanup unused dyld hipblas functions
abouteiller bc27596
hip: Update lapack stagein
abouteiller 58cb109
Update for feature/common_gpu parsec branch changes
abouteiller 133e5e0
Some conflicting updates between hip and common_gpu need more resolution
abouteiller e05589e
hip: stream info registration
abouteiller 454bcbf
hip: potrf on AMD
abouteiller 94d05df
hip:po: Some errors introduced when merging
abouteiller 54508b6
Add HIP to the lookahead gpu gemm
abouteiller 899a246
Add HIP to zgemm_summa
abouteiller 2804bc6
hip: rework of PO and workspaces
abouteiller 725ab3c
hip: remove unecessary hiblas init calls
abouteiller 4a51b5d
hip:po:errors in ldam asserts
abouteiller 87b73e6
hip:po: some of the changes had broken cusolver
abouteiller f8b5ed9
fix printlogcuda/hip
abouteiller e5817a7
Auto-generate hip stage-in/out functions
abouteiller 8d8aa7f
hip:zgemm_gpu: don't use hipComplex
abouteiller 63bb167
Return the proper PARSEC_HOOK_RETURN_ERROR in GPU error cases
abouteiller 92dd7d4
Update for the new device mask for incarnations
abouteiller 8609500
So far only NN gemm can run with HIP
abouteiller d893034
Use the correct DPLASMA_HAVE_HIP
abouteiller e63d3e7
Remove weight properties from HIP bodies
abouteiller 7015aa6
Reorder and uniformize cuda and hip bodies
abouteiller ba39cb7
A PARSEC_HAVE_HIP was still present
abouteiller f89a541
Rework zpotrf_U
abouteiller 9558c09
Merge branch 'master' into feature/hip
abouteiller fe6ac01
hip: add NT/TN/TT cases to gemm_summa
abouteiller b2316c2
Update parsec to a version that works with GPUs
abouteiller a590a55
zpotrf_wrapper: uid and handles don't exist when not using a GPU device
abouteiller d250d61
Merge branch 'master' into feature/hip
abouteiller 4d32bbd
Merge branch 'master' into feature/hip
abouteiller e545100
Merge branch 'master' into feature/hip
abouteiller d9adbba
Merge branch 'master' into feature/hip
abouteiller 3266498
Merge branch 'master' into feature/hip
abouteiller 430e83a
Merge branch 'master' into feature/hip
abouteiller 94b4eeb
Update dtd for hip/cuda specializations for the dtd workspaces
abouteiller 16d30cb
Merge branch 'master' into feature/hip
abouteiller b07a569
Make all gemm_summa the same between hip/cuda
abouteiller 379228e
Use the same controls as parsec for GPU_WITH_CUDA/HIP
abouteiller ab621ad
hip: merge error: the device count must be updated in both hip and cuda
abouteiller 67c241b
hip: printlog hipblascomplex not compatible with creal
abouteiller d224ae7
hip: final cleanup
abouteiller 778b7a9
Merge branch 'master' into feature/hip
abouteiller 81e56dc
hip: rework compile-time guards for cuda and hip inclusion
abouteiller 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
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
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 |
---|---|---|
@@ -1,8 +1,9 @@ | ||
[cu*_alloc_failed] | ||
There was not enough memory available on a CUDA device | ||
[gpu_alloc_failed] | ||
There was not enough memory available on a GPU device | ||
while trying to allocate a %s handle to manage tasks on | ||
this device, or another CUDA device on the node. The | ||
this device, or another GPU device on the node. The | ||
PaRSEC runtime system may be configured to reserve too | ||
much memory on CUDA devices. Try reducing the amount of | ||
much memory on GPU devices. Try reducing the amount of | ||
reserved memory by setting the PaRSEC MCA parameter | ||
'device_cuda_memory_use' to a lower value. | ||
'device_cuda_memory_use' (or similar for the type of | ||
device) to a lower value. | ||
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
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
This directory contains files that are automatically converted from CUDA to HIP using Hipify. | ||
If your file is not automatically convertible, put it somewhere else. | ||
|
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 |
---|---|---|
@@ -0,0 +1,165 @@ | ||
/* | ||
* Copyright (c) 2020-2024 The University of Tennessee and The University | ||
* of Tennessee Research Foundation. All rights | ||
* reserved. | ||
* | ||
* $COPYRIGHT | ||
* | ||
*/ | ||
|
||
#include "dplasma.h" | ||
#include "dplasmajdf_lapack_dtt.h" | ||
|
||
#if defined(DPLASMA_HAVE_CUDA) | ||
#include <cuda.h> | ||
#include <parsec/mca/device/cuda/device_cuda.h> | ||
|
||
/* Use cudaMemcpy2DAsync or loop with cudaMemcpyAsync for data transfers to device */ | ||
#define USE_COPY_2D | ||
|
||
int | ||
dplasma_cuda_lapack_stage_in(parsec_gpu_task_t *gtask, | ||
uint32_t flow_mask, | ||
parsec_gpu_exec_stream_t *gpu_stream) | ||
{ | ||
cudaError_t ret; | ||
parsec_data_copy_t * copy_in; | ||
parsec_data_copy_t * copy_out; | ||
parsec_device_gpu_module_t *in_elem_dev; | ||
parsec_cuda_exec_stream_t *cuda_stream = (parsec_cuda_exec_stream_t*)gpu_stream; | ||
dplasma_data_collection_t * ddc; | ||
parsec_task_t *task = gtask->ec; | ||
int elem_sz; | ||
int i; | ||
for(i = 0; i < task->task_class->nb_flows; i++){ | ||
if(flow_mask & (1U << i)){ | ||
copy_in = task->data[i].data_in; | ||
copy_out = task->data[i].data_out; | ||
ddc = (dplasma_data_collection_t*)gtask->flow_dc[i]; | ||
assert(ddc != NULL); | ||
elem_sz = parsec_datadist_getsizeoftype(ddc->dc_original->mtype); | ||
in_elem_dev = (parsec_device_gpu_module_t*)parsec_mca_device_get( copy_in->device_index); | ||
if( (in_elem_dev->super.type == PARSEC_DEV_CUDA) || (ddc->dc_original->storage != PARSEC_MATRIX_LAPACK)){ | ||
ret = (cudaError_t)cudaMemcpyAsync( copy_out->device_private, | ||
copy_in->device_private, | ||
gtask->flow_nb_elts[i], | ||
(in_elem_dev->super.type != PARSEC_DEV_CUDA)? | ||
cudaMemcpyHostToDevice : cudaMemcpyDeviceToDevice, | ||
cuda_stream->cuda_stream); | ||
PARSEC_CUDA_CHECK_ERROR( "cudaMemcpyAsync ", ret, { return PARSEC_ERROR; } ); | ||
}else{ | ||
|
||
#ifdef USE_COPY_2D | ||
int ldd, nrows, ncols; | ||
ADTT_INFO_internal(copy_in, ddc, &ldd, &nrows, &ncols); | ||
size_t dpitch = ddc->dc_original->mb * elem_sz; | ||
size_t spitch = ldd * elem_sz; | ||
size_t width = nrows * elem_sz; | ||
size_t height = ncols; | ||
/* copy width bytes heigth times, skipping pitch - width bytes every time */ | ||
ret = (cudaError_t)cudaMemcpy2DAsync( copy_out->device_private, | ||
dpitch, /*dst pitch bytes*/ | ||
copy_in->device_private, | ||
spitch, /*src pitch bytes*/ | ||
width, height, | ||
cudaMemcpyHostToDevice, | ||
cuda_stream->cuda_stream ); | ||
PARSEC_CUDA_CHECK_ERROR( "cudaMemcpy2DAsync ", ret, { return PARSEC_ERROR; } ); | ||
|
||
|
||
#else | ||
|
||
int ldd, nrows, ncols; | ||
ADTT_INFO_internal(copy_in, ddc, &ldd, &nrows, &ncols); | ||
|
||
int j; | ||
for(j=0; j<ncols; j++) { | ||
char*src = ((char*)copy_in->device_private) + j * ldd * elem_sz; | ||
char*dst = ((char*)copy_out->device_private) + j * ddc->dc_original->mb * elem_sz; | ||
ret = cudaMemcpyAsync(dst, | ||
src, | ||
nrows * elem_sz, | ||
cudaMemcpyHostToDevice, | ||
cuda_stream->cuda_stream ); | ||
PARSEC_CUDA_CHECK_ERROR( "cudaMemcpyAsync ", ret, { return PARSEC_ERROR; } ); | ||
|
||
} | ||
#endif | ||
|
||
|
||
} | ||
} | ||
} | ||
return PARSEC_SUCCESS; | ||
} | ||
|
||
int | ||
dplasma_cuda_lapack_stage_out(parsec_gpu_task_t *gtask, | ||
uint32_t flow_mask, | ||
parsec_gpu_exec_stream_t *gpu_stream) | ||
{ | ||
cudaError_t ret; | ||
parsec_data_copy_t * copy_in; | ||
parsec_data_copy_t * copy_out; | ||
parsec_device_gpu_module_t *out_elem_dev; | ||
parsec_cuda_exec_stream_t *cuda_stream = (parsec_cuda_exec_stream_t*)gpu_stream; | ||
parsec_task_t *task = gtask->ec; | ||
dplasma_data_collection_t * ddc; | ||
int elem_sz; | ||
int i; | ||
for(i = 0; i < task->task_class->nb_flows; i++){ | ||
if(flow_mask & (1U << i)){ | ||
copy_in = task->data[i].data_out; | ||
copy_out = copy_in->original->device_copies[0]; | ||
ddc = (dplasma_data_collection_t*)gtask->flow_dc[i]; | ||
assert(ddc != NULL); | ||
elem_sz = parsec_datadist_getsizeoftype(ddc->dc_original->mtype); | ||
out_elem_dev = (parsec_device_gpu_module_t*)parsec_mca_device_get( copy_out->device_index); | ||
|
||
if( (out_elem_dev->super.type == PARSEC_DEV_CUDA) || (ddc->dc_original->storage != PARSEC_MATRIX_LAPACK)){ | ||
ret = (cudaError_t)cudaMemcpyAsync( copy_out->device_private, | ||
copy_in->device_private, | ||
gtask->flow_nb_elts[i], | ||
out_elem_dev->super.type != PARSEC_DEV_CUDA ? | ||
cudaMemcpyDeviceToHost : cudaMemcpyDeviceToDevice, | ||
cuda_stream->cuda_stream); | ||
PARSEC_CUDA_CHECK_ERROR( "cudaMemcpyAsync ", ret, { return PARSEC_ERROR; } ); | ||
}else{ | ||
|
||
#ifdef USE_COPY_2D | ||
int ldd, nrows, ncols; | ||
ADTT_INFO_internal(copy_out, ddc, &ldd, &nrows, &ncols); | ||
size_t dpitch = ldd * elem_sz; | ||
size_t spitch = ddc->dc_original->mb * elem_sz; | ||
size_t width = nrows * elem_sz; | ||
size_t height = ncols; | ||
/* copy width bytes heigth times, skipping pitch - width bytes every time */ | ||
ret = (cudaError_t)cudaMemcpy2DAsync( copy_out->device_private, | ||
dpitch, /*dst pitch bytes*/ | ||
copy_in->device_private, | ||
spitch, /*src pitch bytes*/ | ||
width, height, | ||
cudaMemcpyDeviceToHost, | ||
cuda_stream->cuda_stream); | ||
PARSEC_CUDA_CHECK_ERROR( "cudaMemcpy2DAsync ", ret, { return PARSEC_ERROR; } ); | ||
#else | ||
int ldd, nrows, ncols; | ||
ADTT_INFO_internal(copy_out, ddc, &ldd, &nrows, &ncols); | ||
int j; | ||
for(j=0; j<ncols; j++) { | ||
char*src = ((char*)copy_in->device_private) + j * ddc->dc_original->mb * elem_sz; | ||
char*dst = ((char*)copy_out->device_private) + j * ldd * elem_sz; | ||
ret = cudaMemcpyAsync(dst, | ||
src, | ||
nrows * elem_sz, | ||
cudaMemcpyDeviceToHost, | ||
cuda_stream->cuda_stream); | ||
PARSEC_CUDA_CHECK_ERROR( "cudaMemcpyAsync ", ret, { return PARSEC_ERROR; } ); | ||
} | ||
#endif | ||
} | ||
} | ||
} | ||
return PARSEC_SUCCESS; | ||
} | ||
#endif /* defined(DPLASMA_HAVE_CUDA) */ |
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
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.
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.
Should we mention
device_hip_memory_use
here? (if that's the right name?)