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

Paddlebox #26

Merged
merged 4 commits into from
Nov 23, 2023
Merged

Paddlebox #26

merged 4 commits into from
Nov 23, 2023

Conversation

HuangShiqing
Copy link
Collaborator

PR types

PR changes

Describe

if(flags.empty()) {
offset += outputs[i]->dims()[0];
} else {
if(is_expand_slot_small==true){
Copy link
Collaborator

Choose a reason for hiding this comment

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

后面的==true可以删掉

std::vector<int> slot_inner_offset(total_length);
int out_count = 0;
for(int i=0;i<slot_num;i++) {
for(int j=0;j<slot_lengths[i];j++) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

这里的slot_length[i]是int64的值,用int j去迭代循环存在死循环风险

push_offset, total_length, slot_vector, slot_lens, slot_num,
hidden_size, batch_size, total_dims, skip_offset, key2slot);
void *d_slot_inner_offset = nullptr;
xpu_malloc((void **)&d_slot_inner_offset, total_length * sizeof(int));
Copy link
Collaborator

Choose a reason for hiding this comment

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

建议用Paddle封装的Alloc

std::vector<int> slot_inner_offset(total_length);
int out_count = 0;
for(int i=0;i<slot_num;i++) {
for(int j=0;j<slot_lengths[i];j++) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

< * 这些双目运算符的两边空格,后面建议都修改以下

if(outputs[embedx_offset]->numel()==0) {
outputs[embedx_offset]->set_layout(paddle::framework::DataLayout::UNDEFINED);
} else {
int offset = slot_dims0_offset[i]*dims1* sizeof(T);
Copy link
Collaborator

Choose a reason for hiding this comment

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

这里的offset类型建议用size_t, 后面set_offset传进去的就是size_t类型。
相应的,slot_dims0_offset也建议改成size_t类型

@HuangShiqing HuangShiqing merged commit 8d071ee into jack603047588:paddlebox Nov 23, 2023
@@ -3,6 +3,7 @@
#include "xpu/kernel/xtdk.h"
// #include "xpu/kernel/debug.h"
#include "xpu/kernel/xtdk_math.h"
#include "xpu/kernel/xtdk_io.h"
Copy link
Owner

Choose a reason for hiding this comment

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

这个不用的话,注意注释下

@@ -2114,8 +2114,11 @@ void PadBoxSlotDataset::PreLoadIntoDisk(const std::string& path,
}
CHECK(slot_pool_ != nullptr) << "slotrecord pool nullptr";
read_ins_ref_ = thread_num_;
if (disable_shuffle_) {
read_ins_ref_ = 1;
}
Copy link
Owner

Choose a reason for hiding this comment

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

此处会有问题,参考PadBoxSlotDataset::PreLoadIntoMemory()中修改方式

@@ -30,6 +30,9 @@ limitations under the License. */
#include "xpu/kernel/xtdk_simd.h"

#ifdef TRACE_PROFILE
#include "xpu/kernel/xtdk_io.h"
Copy link
Owner

Choose a reason for hiding this comment

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

这个是否有打开的必要

Copy link
Owner

@jack603047588 jack603047588 left a comment

Choose a reason for hiding this comment

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

参考下代码中部分comment修改下

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