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] remove cinn_pod_value_t(part1) #70503

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from

Conversation

phlrain
Copy link
Collaborator

@phlrain phlrain commented Dec 26, 2024

PR Category

PR Types

Description

为了清理nvrtc编译的头文件个数,需要清理下cinn pod value,这个pr是cinn jit kernel中,不再使用 cinn pod value

本来计划直接使用 void* 进行传递,但是会产生cuda 700 error,引入了一个新的数据结构

Copy link

paddle-bot bot commented Dec 26, 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.

@phlrain phlrain changed the title test using void * [CINN] remove cinn_pod_value_t(part1) Dec 27, 2024
Comment on lines 81 to 84
int64_t cinn_get_value_in_cuda_kernel_args(void *v_args, int idx) {
cinn_pod_value_t *args = static_cast<cinn_pod_value_t *>(v_args);
return args[idx].operator int64_t();
KernelArgsNode *args = static_cast<KernelArgsNode *>(v_args);
return args[idx].symbol_val;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

这里后续是否可以加上type的检查以便定位arg不一致问题

Comment on lines +105 to +106
func_args_[i] = KernelArgsNode{
kernel_tensor_args[i]->data(), -1, KernelArgsType::void_p_args_type};
Copy link
Contributor

Choose a reason for hiding this comment

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

优化一下构造函数写法?

Comment on lines +49 to +51
unk_args_type = -1, //! Unknown type
void_p_args_type = 0, //! void*
int64_args_type = 1, //! int64_t
Copy link
Contributor

Choose a reason for hiding this comment

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

image 变量命名格式需要调整下

Comment on lines +55 to +56
void* data_ptr{nullptr};
int64_t symbol_val{-1};
Copy link
Contributor

Choose a reason for hiding this comment

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

symbol_val的含义是什么,感觉需要一点注释说明?

if (args[idx].type_code() == ::cinn_type_code<cinn_buffer_t *>()) {
kernel_args.emplace_back(
&((cinn_buffer_t *)(args[idx]))->memory); // NOLINT
// kernel_args.emplace_back( &(args[idx])); // NOLINT
Copy link
Contributor

Choose a reason for hiding this comment

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

无用注释?

if (args[idx].args_type == KernelArgsType::void_p_args_type) {
kernel_args.emplace_back(&(args[idx].data_ptr)); // NOLINT
} else if (args[idx].args_type == KernelArgsType::int64_args_type) {
kernel_args.emplace_back(&(args[idx].symbol_val)); // NOLINT
Copy link
Contributor

Choose a reason for hiding this comment

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

这里对int取地址会不会有风险?

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.

3 participants