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

Adding data copy between host and device #323

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

hochawa
Copy link

@hochawa hochawa commented Oct 4, 2020

Could you give me comments or accept the pull request?

Copy link
Contributor

@stephenchouca stephenchouca left a comment

Choose a reason for hiding this comment

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

Looks pretty good overall! I think it'd be good to add one or two test cases with input tensor(s) that are stored in a zeroless format though to make sure everything works.

}

SingletonModeFormat::SingletonModeFormat(bool isFull, bool isOrdered,
bool isUnique, long long allocSize) :
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't this constructor also be modified to take in isZeroless as an argument?

Copy link
Author

Choose a reason for hiding this comment

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

Oh, you are right. Thank you. By the way, it is wired because I modified the code as you suggested about a week ago, but the pull request does not seem to reflect it.

@@ -191,6 +191,12 @@ bool Iterator::isCompact() const {
return getMode().defined() && getMode().getModeFormat().isCompact();
}

bool Iterator::isZeroless() const {
taco_iassert(defined());
if (isDimensionIterator()) return true;
Copy link
Contributor

Choose a reason for hiding this comment

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

Should return false for dimension iterators I think?

Copy link
Author

Choose a reason for hiding this comment

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

Oh, yes. it should return false for dimension iterators. Thank you for correcting me.

Copy link
Author

Choose a reason for hiding this comment

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

I will modify that line.

@hochawa
Copy link
Author

hochawa commented Nov 19, 2020

Could you accept the feature for cudaMalloc and cudaMemcpy, or give me a comment?

@hochawa hochawa changed the title Adding the Zeroless feature Adding data copy between host and device Nov 19, 2020
@@ -1,6 +1,10 @@
#ifndef TACO_CODEGEN_H
#define TACO_CODEGEN_H

#define PRINT_FUNC 0
#define PRINT_MEM_HOST_TO_DEV 1
#define PRINT_MEM_DEV_TO_HOST 2
Copy link
Contributor

Choose a reason for hiding this comment

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

Should replace these with an enum.

Copy link
Author

Choose a reason for hiding this comment

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

Oh, I see. I will replace them with an enum.

@@ -312,7 +313,7 @@ class CodeGen_CUDA::DeviceFunctionCollector : public IRVisitor {
taco_iassert(var) << "Outputs must be vars in codegen";
taco_iassert(scopeMap.count(var) == 0) <<
"Duplicate output found in codegen";

output_tensor = var->name; // Isn't there only one output?
Copy link
Contributor

Choose a reason for hiding this comment

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

The code generator was designed with the thought that we might eventually support kernels with multiple outputs, though that's not something we've actually fully implemented. It's probably fine to assume for now that there's only one output, though you should probably add an assertion to check for that (e.g., taco_iassert(outputs.size() == 1)) .

Copy link
Author

Choose a reason for hiding this comment

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

I see. Thanks for explanation. I know understand why the code looks like that. I will add an assertion to check there is only one output.

Copy link
Author

Choose a reason for hiding this comment

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

Thanks for your time to take a look at the parts I modified!

@stephenchouca
Copy link
Contributor

I've added a couple more comments above. On the whole the changes look good though; I'll merge them into master after you've addressed those comments.

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.

None yet

2 participants