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

Modify trig initialization on device to remove dependency on lda. #1543

Merged
merged 1 commit into from
Jan 28, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions clients/common/hipblaslt_init_device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
*
* MIT License
*
* Copyright (C) 2024 Advanced Micro Devices, Inc.
* Copyright (C) 2024-2025 Advanced Micro Devices, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -150,13 +150,20 @@ void hipblaslt_init_device(ABC abc,
}
break;
case hipblaslt_initialization::trig_float:
stride = std::max(lda * N, stride);
if(abc == ABC::A || abc == ABC::C)
fill_batch(A, M, N, lda, stride, batch_count, [](size_t idx) -> T {
return T(sin(double(idx)));
fill_batch(A, M, N, lda, stride, batch_count, [M, N, stride, lda](size_t idx) -> T {
auto b = idx / stride;
auto j = (idx - b * stride) / lda;
auto i = (idx - b * stride) - j * lda;
return T(sin(double(i + j*M + b*M*N)));
});
else if(abc == ABC::B)
fill_batch(A, M, N, lda, stride, batch_count, [](size_t idx) -> T {
return T(cos(double(idx)));
fill_batch(A, M, N, lda, stride, batch_count, [M, N, stride, lda](size_t idx) -> T {
auto b = idx / stride;
auto j = (idx - b * stride) / lda;
auto i = (idx - b * stride) - j * lda;
return T(cos(double(i + j*M + b*M*N)));
});
break;
case hipblaslt_initialization::hpl:
Expand Down