-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
[XPU][Phi Kernel] nonzero kernel support simulator XPUSIM_SKIP_RUN mode #60224
[XPU][Phi Kernel] nonzero kernel support simulator XPUSIM_SKIP_RUN mode #60224
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
3f1e56b
to
ad55026
Compare
@@ -40,6 +42,13 @@ void NonZeroKernel(const Context& dev_ctx, | |||
dev_ctx.GetPlace(), | |||
static_cast<void*>(true_num), | |||
sizeof(int32_t)); | |||
if (std::getenv("XPU_SIMULATOR_MODE") && std::getenv("XPUSIM_SKIP_RUN") && |
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::getenv("XPU_SIMULATOR_MODE")
,模拟器将XPUSIM_SKIP_RUN
的值转成bool来进行判断。
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.
lgtm
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.
代码看起来没问题。但是缺个单测。
不知道好不好写?如果在单测里面刷环境变量,但是CI环境下面又没有模拟器,可能导致一些奇怪的情况出现。
加了几个单测,由于CI环境里面要测到新增代码里面分支,因此要把 |
161be2f
to
dd77073
Compare
…de (PaddlePaddle#60224) * [XPU][Phi Kernel] nonzero kernel support simulator XPUSIM_SKIP_RUN mode * [XPU][Phi Kernel] add unittest for nonzero simulator skip_run mode
PR types
New features
PR changes
OPs
Description
nonzero kernel support simulator XPUSIM_SKIP_RUN mode.
In the simulator mode, the variable
true_num_cpu
stores an uninitialized value. To avoid allocating a memory of random size, we assignnumel
to it.