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

Allow 0-stride dimensions for cublas input/output #400

Merged
merged 2 commits into from
Mar 31, 2023

Conversation

tbensonatl
Copy link
Collaborator

Currently, if a tensor contains 0-stride dimensions in one of the last two dimensions, then that tensor will not be used directly as input/output to cublas matmul and a copy will be made transparently. This generates copies during matvec operations because matvec clones a tensor and delegates to matmul, which then copies the tensor because the clone creates a 0-stride dimension. This change allows 0-stride dimensions if the dimension size is 1 (and thus no index will stride in that dimension) and thus eliminates allocations/frees and copies when calling matvec.

Currently, if a tensor contains 0-stride dimensions in one of the
last two dimensions, then that tensor will not be used directly as
input/output to cublas and a copy will be made transparently. This
generates copies during matvec operations because matvec clones a
tensor and delegates to matmul, which then copies the tensor because
the clone creates a 0-stride dimension. This change allows 0-stride
dimensions if the dimension size is 1 (and thus no index will stride
in that dimension) and thus eliminates allocations/frees and copies
when calling matvec.
@cliffburdick
Copy link
Collaborator

/blossom-ci

@cliffburdick
Copy link
Collaborator

thanks for adding all the tests!

@cliffburdick
Copy link
Collaborator

/blossom-ci

2 similar comments
@cliffburdick
Copy link
Collaborator

/blossom-ci

@cliffburdick
Copy link
Collaborator

/blossom-ci

@cliffburdick
Copy link
Collaborator

/blossom-ci

4 similar comments
@cliffburdick
Copy link
Collaborator

/blossom-ci

@cliffburdick
Copy link
Collaborator

/blossom-ci

@cliffburdick
Copy link
Collaborator

/blossom-ci

@cliffburdick
Copy link
Collaborator

/blossom-ci

@cliffburdick cliffburdick merged commit 8ace894 into main Mar 31, 2023
@cliffburdick cliffburdick deleted the allow_zero_stride_matmul_inputs branch March 31, 2023 23:55
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.

4 participants