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

Prefer Array class over register arrays. #3737

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Prefer Array class over register arrays. #3737

wants to merge 1 commit into from

Conversation

csarofeen
Copy link
Collaborator

Prefer Array class over register arrays.
For example in code generation use Array<float, 2> not float[2].

@csarofeen
Copy link
Collaborator Author

!test

Copy link

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 PR contains tests
⚡ Recommended focus areas for review

Logic Change

The condition in the if statement has been modified to also check if tv->getMemoryType() == MemoryType::Local. This change may affect the behavior of the function.

if (tv &&
    (aligned_array_of_regs_.count(tv) ||
     tv->getMemoryType() == MemoryType::Local)) {
Type Change

The type of variables T1, T2, and T3 has been changed from float to Array<float, ...>. This change may affect the behavior of the function.

Array<float, 1LL, 1> T1;
Array<float, 1LL, 1> T2;

@csarofeen
Copy link
Collaborator Author

!test --pybench

@csarofeen
Copy link
Collaborator Author

csarofeen commented Jan 21, 2025

All tests passing.
Benchmarks do not appear to regress. https://nv/ei9/22766159

@naoyam
Copy link
Collaborator

naoyam commented Jan 21, 2025

Prefer Array class over register arrays. For example in code generation use Array<float, 2> not float[2].

Any specific reason?

@zasdfgbnm
Copy link
Collaborator

Prefer Array class over register arrays. For example in code generation use Array<float, 2> not float[2].

Any specific reason?

Likely because currently we are using float[2] in some cases, but Array<float, 2> in other cases, and sometimes there are compatibility issue for these two types? I remembered Liqiang fixed one such issue on vectorization.

@zasdfgbnm
Copy link
Collaborator

zasdfgbnm commented Jan 21, 2025

Possibly related: #1475

@@ -265,7 +265,9 @@ class CudaKernelGenerator : private kir::ConstIrVisitor {
} else if (v->isA<TensorView>()) {
tv = v->as<TensorView>();
}
if (tv && aligned_array_of_regs_.count(tv)) {
if (tv &&
(aligned_array_of_regs_.count(tv) ||
Copy link
Collaborator

Choose a reason for hiding this comment

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

Seems that aligned_array_of_regs_ can be removed now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants