-
Notifications
You must be signed in to change notification settings - Fork 189
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
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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) : |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
src/lower/iterator.cpp
Outdated
@@ -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; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
Could you accept the feature for cudaMalloc and cudaMemcpy, or give me a comment? |
src/codegen/codegen.h
Outdated
@@ -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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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? |
There was a problem hiding this comment.
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)
) .
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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!
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. |
Could you give me comments or accept the pull request?