-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
[CINN][New Hardware Update] extend SplitCudaAndHostModule #64345
[CINN][New Hardware Update] extend SplitCudaAndHostModule #64345
Conversation
* rename SplitCudaAndHostModule to SplitDeviceAndHostModule
你的PR提交成功,感谢你对开源项目的贡献! |
@@ -121,9 +133,19 @@ struct CollectHostFunctionVisitor : public ir::IRMutator<> { | |||
<< func->cuda_axis_info.block_dim(1) << ", " | |||
<< func->cuda_axis_info.block_dim(2) << "), " | |||
<< "shared_mem: " << shared_mem_bytes; | |||
|
|||
const char* call_kernel; |
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.
const char* call_kernel = nullptr;
基本数据类型总是需要默认值。
或者更加现代c++的感觉:
std::optional<const char*> call_kernel;
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.
done
@@ -91,7 +91,16 @@ void detail::CollectBucketStrategyHostFunctionVisitor::ProcessLoweredFunc( | |||
ir::Var kernel_ptr(GenDeviceKernelName(func_node->name, predicate), | |||
type_of<std::string>()); | |||
|
|||
Expr shared_mem_bytes = CalculateSharedMemory(func); | |||
Expr shared_mem_bytes; |
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.
std::optional shared_mem_bytes;
cinn::common::DefaultNVGPUTarget()) {} | ||
device_module_builder( | ||
module_name + "_gpu_device", | ||
cinn::runtime::CurrentTarget::GetCurrentTarget()) {} |
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.
这些改动没有遵守平迁原则。cinn::common::DefaultNVGPUTarget
和cinn::runtime::CurrentTarget::GetCurrentTarget
是啥关系呢?如果是替换,那应该在别的pr里完成。
就算要同时迁移这里的逻辑,与旧版cinn::common::DefaultNVGPUTarget
对应的名字难道不是cinn::common::DefaultDeviceTarget
吗?
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.
done
@@ -101,9 +110,17 @@ void detail::CollectBucketStrategyHostFunctionVisitor::ProcessLoweredFunc( | |||
<< func_node->cuda_axis_info.block_dim(1) << ", " | |||
<< func_node->cuda_axis_info.block_dim(2) << "), " | |||
<< "shared_mem: " << shared_mem_bytes; | |||
const char *call_kernel; | |||
cinn::runtime::CurrentTarget::GetCurrentTarget().arch.Match( |
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.
cinn::runtime::CurrentTarget::GetCurrentTarget这个名字非常拧巴。原本的命名空间是cinn::common::,为啥不继续写在common目录下呢?
…le#64345) * [CINN][New Hardware Update] rename SplitCudaAndHostModule * rename SplitCudaAndHostModule to SplitDeviceAndHostModule * [CINN][New Hardware Update] fix CMakeLists * [CINN][New Hardware Update] extend SplitDeviceAndHostModule * fix review
…le#64345) * [CINN][New Hardware Update] rename SplitCudaAndHostModule * rename SplitCudaAndHostModule to SplitDeviceAndHostModule * [CINN][New Hardware Update] fix CMakeLists * [CINN][New Hardware Update] extend SplitDeviceAndHostModule * fix review
PR Category
CINN
PR Types
Improvements
Description
扩展SplitCudaAndHostModule为SplitDeviceAndHostModule,以复用在其他device后端上。
DefaultNVGPUTarget -> DefaultDeviceTarget,后者是前者的超集。
pcard-79890