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

[CINN][New Hardware Update] extend SplitCudaAndHostModule #64345

Merged

Conversation

DongBaiYue
Copy link
Contributor

@DongBaiYue DongBaiYue commented May 16, 2024

PR Category

CINN

PR Types

Improvements

Description

扩展SplitCudaAndHostModule为SplitDeviceAndHostModule,以复用在其他device后端上。
DefaultNVGPUTarget -> DefaultDeviceTarget,后者是前者的超集。

pcard-79890

* rename SplitCudaAndHostModule to SplitDeviceAndHostModule
Copy link

paddle-bot bot commented May 16, 2024

你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

@paddle-bot paddle-bot bot added the contributor External developers label May 16, 2024
@DongBaiYue DongBaiYue changed the title [CINN][New Hardware Update] rename SplitCudaAndHostModule [CINN][New Hardware Update] extend SplitCudaAndHostModule May 16, 2024
@@ -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;
Copy link
Contributor

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;

Copy link
Contributor Author

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;
Copy link
Contributor

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()) {}
Copy link
Contributor

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吗?

Copy link
Contributor Author

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(
Copy link
Contributor

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目录下呢?

@tc20042008 tc20042008 merged commit 2188b4a into PaddlePaddle:develop May 17, 2024
31 checks passed
@DongBaiYue DongBaiYue deleted the renameSplitCudaAndHostModule branch May 17, 2024 06:47
co63oc pushed a commit to co63oc/Paddle that referenced this pull request May 18, 2024
…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
co63oc pushed a commit to co63oc/Paddle that referenced this pull request May 19, 2024
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor External developers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants