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

Half factorization #1712

Open
wants to merge 9 commits into
base: half_solver
Choose a base branch
from
Open

Half factorization #1712

wants to merge 9 commits into from

Conversation

yhmtsai
Copy link
Member

@yhmtsai yhmtsai commented Oct 25, 2024

this pr adds the factorization with half support.

Hip does not support atomic on the 16bits type currently

TODO:

  • add the fix of tri solve with half

@yhmtsai yhmtsai added the 1:ST:WIP This PR is a work in progress. Not ready for review. label Oct 25, 2024
@yhmtsai yhmtsai self-assigned this Oct 25, 2024
@ginkgo-bot ginkgo-bot added reg:testing This is related to testing. type:solver This is related to the solvers type:factorization This is related to the Factorizations reg:helper-scripts This issue/PR is related to the helper scripts mainly concerned with development of Ginkgo. mod:all This touches all Ginkgo modules. labels Oct 25, 2024
@yhmtsai yhmtsai mentioned this pull request Oct 30, 2024
12 tasks
@yhmtsai yhmtsai added this to the Ginkgo 1.9.0 milestone Oct 30, 2024
@yhmtsai yhmtsai added 1:ST:ready-for-review This PR is ready for review and removed 1:ST:WIP This PR is a work in progress. Not ready for review. labels Nov 5, 2024
@yhmtsai yhmtsai force-pushed the half_solver branch 2 times, most recently from 50ae4c1 to bba40e0 Compare November 7, 2024 14:40
@MarcelKoch MarcelKoch self-requested a review November 11, 2024 11:25
Copy link
Member

@MarcelKoch MarcelKoch left a comment

Choose a reason for hiding this comment

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

Generally LGTM. I have a question regarding atomics and hip. The latest ROCm shows support for fp16 atomic operations: https://rocm.docs.amd.com/en/latest/reference/precision-support.html#atomic-operations-support, but TBH I can't figure out what operations exactly they mean with that. Did you try anything in that regard?

PairTypenameNameGenerator);


TYPED_TEST(ParIlut, KernelThresholdSelectIsEquivalentToRef)
{
using value_type = typename TestFixture::value_type;
Copy link
Member

Choose a reason for hiding this comment

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

Many of the tests here are missing SKIP_HALF if compiling for HIP.

Copy link
Member Author

Choose a reason for hiding this comment

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

we do not support compute_l_u_factors in hip, but the others still works with half precision in HIP

Copy link
Member Author

Choose a reason for hiding this comment

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

I got your meaning now

@@ -212,13 +212,15 @@ struct CudaSolveStruct : gko::solver::SolveStruct {

size_type work_size{};

// TODO: In nullptr is considered nullptr_t not casted to const
// it does not work in cuda110/100 images
Copy link
Member

Choose a reason for hiding this comment

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

nit:

Suggested change
// it does not work in cuda110/100 images
// Explicitly cast `nullptr` to `const ValueType*` to prevent compiler issues with cuda 10/11

Copy link
Member Author

Choose a reason for hiding this comment

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

I think it is more on the host compiler side because it goes through our binding first with specfic type

cuda/solver/common_trs_kernels.cuh Outdated Show resolved Hide resolved
cuda/solver/common_trs_kernels.cuh Outdated Show resolved Hide resolved
cuda/solver/common_trs_kernels.cuh Outdated Show resolved Hide resolved
cuda/solver/common_trs_kernels.cuh Outdated Show resolved Hide resolved
cuda/solver/common_trs_kernels.cuh Outdated Show resolved Hide resolved
hip/components/memory.hip.hpp Outdated Show resolved Hide resolved
reference/factorization/par_ilut_kernels.cpp Outdated Show resolved Hide resolved
test/factorization/lu_kernels.cpp Show resolved Hide resolved
Comment on lines 595 to 600
using shared_value_type = std::conditional_t<
std::is_same<remove_complex<ValueType>, gko::half>::value, float,
ValueType>;
sptrsv_naive_caching_kernel<is_upper, device_type<shared_value_type>>
Copy link
Member

Choose a reason for hiding this comment

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

now this will also be float when using std::complex<gko::half>. That doesn't seem correct. You will loose any imaginary part that might be in the matrix or vectors.

Copy link
Member Author

Choose a reason for hiding this comment

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

you are right.
Sorry, I do not pay enough attention when changing it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1:ST:ready-for-review This PR is ready for review mod:all This touches all Ginkgo modules. reg:helper-scripts This issue/PR is related to the helper scripts mainly concerned with development of Ginkgo. reg:testing This is related to testing. type:factorization This is related to the Factorizations type:solver This is related to the solvers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants